From 2f77fc1e40bc7aa1220f544e079b1d6c135fdfdc Mon Sep 17 00:00:00 2001 From: nitind Date: Thu, 27 Jan 2011 02:17:02 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'v201101270219'. --- .../org.eclipse.wst.jsdt_tests.feature/.cvsignore | 1 - .../org.eclipse.wst.jsdt_tests.feature/.project | 17 - .../.settings/org.eclipse.core.resources.prefs | 3 - .../build.properties | 5 - .../eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../epl-v10.html | 328 - .../feature.properties | 168 - .../org.eclipse.wst.jsdt_tests.feature/feature.xml | 62 - .../license.html | 107 - .../.classpath | 7 - .../.cvsignore | 2 - .../org.eclipse.wst.jsdt.core.tests.model/.project | 28 - .../.settings/org.eclipse.core.resources.prefs | 4 - .../.settings/org.eclipse.jdt.core.prefs | 7 - .../META-INF/MANIFEST.MF | 25 - .../META-INF/eclipse.inf | 6 - .../about.html | 28 - .../build.properties | 18 - .../plugin.properties | 19 - .../plugin.xml | 67 - .../wst/jsdt/core/tests/RunCompilerTests.java | 59 - .../eclipse/wst/jsdt/core/tests/RunDOMTests.java | 32 - .../wst/jsdt/core/tests/RunFormatterTests.java | 61 - .../wst/jsdt/core/tests/RunJSDTCoreTests.java | 35 - .../eclipse/wst/jsdt/core/tests/RunModelTests.java | 32 - .../jsdt/core/tests/dom/ASTConverterAST3Test.java | 9467 ------------- .../core/tests/dom/ASTConverterBindingsTest.java | 506 - .../core/tests/dom/ASTConverterJavadocTest.java | 3405 ----- .../core/tests/dom/ASTConverterRecoveryTest.java | 923 -- .../wst/jsdt/core/tests/dom/ASTConverterTest.java | 8795 ------------ .../wst/jsdt/core/tests/dom/ASTConverterTest2.java | 5418 -------- .../core/tests/dom/ASTConverterTestAST3_2.java | 8652 ------------ .../wst/jsdt/core/tests/dom/ASTMatcherTest.java | 1112 -- .../jsdt/core/tests/dom/ASTModelBridgeTests.java | 1419 -- .../core/tests/dom/ASTNodesCollectorVisitor.java | 260 - .../wst/jsdt/core/tests/dom/ASTParserTest.java | 116 - .../wst/jsdt/core/tests/dom/ASTPositionsTest.java | 144 - .../core/tests/dom/ASTStructuralPropertyTest.java | 348 - .../eclipse/wst/jsdt/core/tests/dom/ASTTest.java | 7191 ---------- .../wst/jsdt/core/tests/dom/ASTVisitorTest.java | 1951 --- .../wst/jsdt/core/tests/dom/AbstractASTTests.java | 548 - .../jsdt/core/tests/dom/BatchASTCreationTests.java | 1670 --- .../core/tests/dom/BindingsCollectorVisitor.java | 429 - .../core/tests/dom/CompatibilityRulesTests.java | 787 -- .../jsdt/core/tests/dom/ConverterTestSetup.java | 564 - .../wst/jsdt/core/tests/dom/GetKeyVisitor.java | 29 - .../core/tests/dom/ProfilingASTConvertionTest.java | 350 - .../wst/jsdt/core/tests/dom/RunAllTests.java | 69 - .../wst/jsdt/core/tests/dom/RunConverterTests.java | 66 - .../wst/jsdt/core/tests/dom/SampleASTs.java | 276 - .../formatter/DecodeCodeFormatterPreferences.java | 154 - .../tests/formatter/FormatterRegressionTests.java | 9245 ------------- .../formatter/comment/CommentFormatterUtil.java | 193 - .../tests/formatter/comment/CommentTestCase.java | 114 - .../tests/formatter/comment/CommentsTestSuite.java | 31 - .../tests/formatter/comment/JavaDocTestCase.java | 703 - .../tests/formatter/comment/MultiLineTestCase.java | 204 - .../formatter/comment/SingleLineTestCase.java | 197 - .../model/AbstractJavaModelCompletionTests.java | 167 - .../core/tests/model/AbstractJavaModelTests.java | 2261 --- .../core/tests/model/AbstractJavaSearchTests.java | 607 - .../model/AbstractJavadocCompletionModelTest.java | 500 - .../core/tests/model/AccessRestrictionsTests.java | 1023 -- .../jsdt/core/tests/model/AttachSourceTests.java | 1141 -- .../core/tests/model/AttachedJavadocTests.java | 509 - .../wst/jsdt/core/tests/model/BindingKeyTests.java | 227 - .../wst/jsdt/core/tests/model/BufferTests.java | 424 - .../wst/jsdt/core/tests/model/CancelCounter.java | 31 - .../wst/jsdt/core/tests/model/Canceler.java | 34 - .../wst/jsdt/core/tests/model/ClassFileTests.java | 824 -- .../wst/jsdt/core/tests/model/ClassNameTests.java | 1169 -- .../tests/model/ClasspathInitializerTests.java | 1306 -- .../wst/jsdt/core/tests/model/ClasspathTests.java | 3032 ---- .../jsdt/core/tests/model/CodeCorrectionTests.java | 731 - .../tests/model/CodeCorrectionTestsRequestor.java | 118 - .../tests/model/CodeSnippetParsingUtilTests.java | 125 - .../core/tests/model/CompilationUnitTests.java | 1422 -- .../core/tests/model/CompletionContextTests.java | 3385 ----- .../wst/jsdt/core/tests/model/CompletionTests.java | 13665 ------------------- .../jsdt/core/tests/model/CompletionTests2.java | 2416 ---- .../core/tests/model/CompletionTestsRequestor.java | 193 - .../tests/model/CompletionTestsRequestor2.java | 446 - .../model/CompletionWithMissingTypesTests.java | 1415 -- .../model/CompletionWithMissingTypesTests2.java | 249 - .../model/CompletionWithMissingTypesTests_1_5.java | 569 - .../core/tests/model/ContainerInitializer.java | 48 - .../core/tests/model/CopyMoveElementsTests.java | 2743 ---- .../core/tests/model/CopyMoveResourcesTests.java | 933 -- .../wst/jsdt/core/tests/model/CopyMoveTests.java | 307 - .../tests/model/CreateCompilationUnitTests.java | 341 - .../jsdt/core/tests/model/CreateMembersTests.java | 144 - .../jsdt/core/tests/model/CreatePackageTests.java | 133 - .../tests/model/DefaultJavaElementComparator.java | 295 - .../wst/jsdt/core/tests/model/DeleteTests.java | 1009 -- .../wst/jsdt/core/tests/model/EncodingTests.java | 918 -- .../core/tests/model/ExclusionPatternsTests.java | 895 -- .../wst/jsdt/core/tests/model/ExistenceTests.java | 507 - .../core/tests/model/ExternalJarDeltaTests.java | 541 - .../wst/jsdt/core/tests/model/FactoryTests.java | 232 - .../wst/jsdt/core/tests/model/GetSourceTests.java | 246 - .../tests/model/HierarchyOnWorkingCopiesTests.java | 102 - .../core/tests/model/InclusionPatternsTests.java | 1049 -- .../wst/jsdt/core/tests/model/JSDTModelTests.java | 244 - .../jsdt/core/tests/model/JavaConventionTests.java | 402 - .../core/tests/model/JavaElementDeltaTests.java | 2056 --- .../wst/jsdt/core/tests/model/JavaModelTests.java | 564 - .../jsdt/core/tests/model/JavaProjectTests.java | 1133 -- .../tests/model/JavaScriptLikeExtensionsTests.java | 106 - .../jsdt/core/tests/model/JavaSearchBugsTests.java | 7560 ---------- .../core/tests/model/JavaSearchJavadocTests.java | 926 -- .../model/JavaSearchMultipleProjectsTests.java | 919 -- .../core/tests/model/JavaSearchScopeTests.java | 966 -- .../wst/jsdt/core/tests/model/JavaSearchTests.java | 3616 ----- .../model/JavadocBugsCompletionModelTest.java | 1061 -- .../tests/model/JavadocCompletionContextTests.java | 1587 --- .../model/JavadocFieldCompletionModelTest.java | 519 - .../model/JavadocMethodCompletionModelTest.java | 2584 ---- .../model/JavadocPackageCompletionModelTest.java | 523 - .../model/JavadocTextCompletionModelTest.java | 1240 -- .../model/JavadocTypeCompletionModelTest.java | 1343 -- .../jsdt/core/tests/model/LocalElementTests.java | 580 - .../wst/jsdt/core/tests/model/MementoTests.java | 678 - .../core/tests/model/ModifyingResourceTests.java | 347 - .../jsdt/core/tests/model/NameLookupTests2.java | 253 - .../core/tests/model/NamingConventionTests.java | 729 - .../wst/jsdt/core/tests/model/OptionTests.java | 632 - .../core/tests/model/OverflowingCacheTests.java | 692 - .../model/ReconcilerStatementsRecoveryTests.java | 346 - .../wst/jsdt/core/tests/model/ReconcilerTests.java | 3413 ----- .../wst/jsdt/core/tests/model/RenameTests.java | 875 -- .../wst/jsdt/core/tests/model/ResolveTests.java | 2113 --- .../core/tests/model/RootManipulationsTests.java | 1226 -- .../core/tests/model/RunCompletionModelTests.java | 100 - .../jsdt/core/tests/model/RunJavaSearchTests.java | 78 - .../core/tests/model/SearchParticipantTests.java | 310 - .../wst/jsdt/core/tests/model/SearchTests.java | 1014 -- .../tests/model/SelectionJavadocModelTests.java | 1019 -- .../wst/jsdt/core/tests/model/Semaphore.java | 65 - .../wst/jsdt/core/tests/model/SignatureTests.java | 1024 -- .../tests/model/SnippetCompletionContextTests.java | 187 - .../core/tests/model/SnippetCompletionTests.java | 326 - .../tests/model/SnippetCompletionTests_1_5.java | 67 - .../model/SortCompilationUnitElementsTests.java | 2080 --- .../jsdt/core/tests/model/SuiteOfTestCases.java | 122 - .../wst/jsdt/core/tests/model/TestBuffer.java | 191 - .../core/tests/model/TestPessimisticProvider.java | 95 - .../jsdt/core/tests/model/TestProgressMonitor.java | 69 - .../tests/model/TestvalidationParticipant.java | 28 - .../jsdt/core/tests/model/ThreadSafetyTests.java | 117 - .../model/TypeHierarchyNotificationTests.java | 1218 -- .../model/TypeHierarchySerializationTests.java | 143 - .../jsdt/core/tests/model/TypeHierarchyTests.java | 1707 --- .../jsdt/core/tests/model/TypeResolveTests.java | 233 - .../core/tests/model/VariablesInitializer.java | 48 - .../model/WorkingCopyNotInClasspathTests.java | 468 - .../core/tests/model/WorkingCopyOwnerTests.java | 1331 -- .../core/tests/model/WorkingCopySearchTests.java | 436 - .../jsdt/core/tests/model/WorkingCopyTests.java | 701 - .../describing/ASTRewritingExpressionsTest.java | 1229 -- .../describing/ASTRewritingGroupNodeTest.java | 139 - .../describing/ASTRewritingInsertBoundTest.java | 1525 --- .../describing/ASTRewritingJavadocTest.java | 1062 -- .../describing/ASTRewritingMethodDeclTest.java | 2180 --- .../describing/ASTRewritingMoveCodeTest.java | 1892 --- .../describing/ASTRewritingStatementsTest.java | 3132 ----- .../tests/rewrite/describing/ASTRewritingTest.java | 229 - .../describing/ASTRewritingTrackingTest.java | 524 - .../describing/ASTRewritingTypeDeclTest.java | 1084 -- .../rewrite/describing/LineCommentOffsetsTest.java | 466 - .../rewrite/describing/SourceModifierTest.java | 149 - .../tests/rewrite/describing/StringAsserts.java | 153 - .../modifying/ASTRewritingModifyingCopyTest.java | 438 - .../modifying/ASTRewritingModifyingInsertTest.java | 365 - .../modifying/ASTRewritingModifyingMoveTest.java | 488 - .../modifying/ASTRewritingModifyingOtherTest.java | 122 - .../modifying/ASTRewritingModifyingRemoveTest.java | 409 - .../ASTRewritingModifyingReplaceTest.java | 108 - .../modifying/ASTRewritingModifyingTest.java | 208 - .../jsdt/core/tests/utils/SequenceReaderTests.java | 84 - .../org.eclipse.wst.jsdt.core.tests.model/test.xml | 119 - .../workspace/AttachSourceTests/.classpath | 16 - .../workspace/AttachSourceTests/.project | 17 - .../workspace/AttachSourceTests/attach.jar | Bin 953 -> 0 bytes .../workspace/AttachSourceTests/attach2.jar | Bin 1051 -> 0 bytes .../workspace/AttachSourceTests/attach2src.zip | Bin 22 -> 0 bytes .../workspace/AttachSourceTests/attachsrc.new.zip | Bin 374 -> 0 bytes .../workspace/AttachSourceTests/attachsrc.zip | Bin 198 -> 0 bytes .../workspace/AttachSourceTests/b153133.jar | Bin 1774 -> 0 bytes .../workspace/AttachSourceTests/full.jar | Bin 1096 -> 0 bytes .../workspace/AttachSourceTests/fullsrc.zip | Bin 797 -> 0 bytes .../workspace/AttachSourceTests/src.zip | Bin 559 -> 0 bytes .../workspace/AttachSourceTests/src/A.js | 2 - .../workspace/AttachSourceTests/srcLib/p/X.js | 5 - .../workspace/AttachSourceTests/test.jar | Bin 502 -> 0 bytes .../workspace/AttachSourceTests/test2.jar | Bin 1134 -> 0 bytes .../workspace/AttachSourceTests/test4.jar | Bin 1055 -> 0 bytes .../workspace/AttachSourceTests/test4_src.zip | Bin 609 -> 0 bytes .../workspace/AttachSourceTests/test5.jar | Bin 1513 -> 0 bytes .../workspace/AttachSourceTests/test6.jar | Bin 1748 -> 0 bytes .../workspace/AttachSourceTests/test6src.zip | Bin 556 -> 0 bytes .../workspace/AttachSourceTests/update.jar | Bin 783 -> 0 bytes .../workspace/AttachedJavadocProject/.classpath | 7 - .../workspace/AttachedJavadocProject/.project | 17 - .../workspace/AttachedJavadocProject/doc.zip | Bin 78240 -> 0 bytes .../doc/allclasses-frame.html | 52 - .../doc/allclasses-noframe.html | 52 - .../doc/constant-values.html | 142 - .../doc/deprecated-list.html | 142 - .../AttachedJavadocProject/doc/help-doc.html | 219 - .../doc/index-files/index-1.html | 141 - .../doc/index-files/index-10.html | 144 - .../doc/index-files/index-11.html | 145 - .../doc/index-files/index-12.html | 150 - .../doc/index-files/index-13.html | 141 - .../doc/index-files/index-14.html | 141 - .../doc/index-files/index-15.html | 141 - .../doc/index-files/index-2.html | 156 - .../doc/index-files/index-3.html | 138 - .../doc/index-files/index-4.html | 144 - .../doc/index-files/index-5.html | 141 - .../doc/index-files/index-6.html | 171 - .../doc/index-files/index-7.html | 147 - .../doc/index-files/index-8.html | 141 - .../doc/index-files/index-9.html | 138 - .../AttachedJavadocProject/doc/index.html | 37 - .../AttachedJavadocProject/doc/overview-frame.html | 46 - .../doc/overview-summary.html | 156 - .../AttachedJavadocProject/doc/overview-tree.html | 172 - .../AttachedJavadocProject/doc/p1/p2/Annot.D.html | 224 - .../AttachedJavadocProject/doc/p1/p2/Annot.html | 235 - .../AttachedJavadocProject/doc/p1/p2/Annot2.html | 198 - .../AttachedJavadocProject/doc/p1/p2/E.html | 362 - .../doc/p1/p2/TestClass.html | 221 - .../AttachedJavadocProject/doc/p1/p2/X.A.html | 230 - .../AttachedJavadocProject/doc/p1/p2/X.B.html | 224 - .../AttachedJavadocProject/doc/p1/p2/X.html | 440 - .../AttachedJavadocProject/doc/p1/p2/Z.html | 258 - .../doc/p1/p2/class-use/Annot.D.html | 140 - .../doc/p1/p2/class-use/Annot.html | 140 - .../doc/p1/p2/class-use/Annot2.html | 140 - .../doc/p1/p2/class-use/E.html | 185 - .../doc/p1/p2/class-use/TestClass.html | 140 - .../doc/p1/p2/class-use/X.A.html | 140 - .../doc/p1/p2/class-use/X.B.html | 140 - .../doc/p1/p2/class-use/X.html | 140 - .../doc/p1/p2/class-use/Z.html | 140 - .../AttachedJavadocProject/doc/p1/p2/p3/C.html | 442 - .../AttachedJavadocProject/doc/p1/p2/p3/D.html | 221 - .../doc/p1/p2/p3/class-use/C.html | 140 - .../doc/p1/p2/p3/class-use/D.html | 201 - .../doc/p1/p2/p3/package-frame.html | 43 - .../doc/p1/p2/p3/package-summary.html | 168 - .../doc/p1/p2/p3/package-tree.html | 154 - .../doc/p1/p2/p3/package-use.html | 166 - .../doc/p1/p2/package-frame.html | 62 - .../doc/p1/p2/package-summary.html | 198 - .../doc/p1/p2/package-tree.html | 166 - .../doc/p1/p2/package-use.html | 166 - .../workspace/AttachedJavadocProject/doc/p2/X.html | 254 - .../workspace/AttachedJavadocProject/doc/p2/Y.html | 256 - .../workspace/AttachedJavadocProject/doc/p2/Z.html | 221 - .../AttachedJavadocProject/doc/p2/class-use/X.html | 176 - .../AttachedJavadocProject/doc/p2/class-use/Y.html | 140 - .../AttachedJavadocProject/doc/p2/class-use/Z.html | 184 - .../doc/p2/package-frame.html | 36 - .../doc/p2/package-summary.html | 162 - .../doc/p2/package-tree.html | 151 - .../AttachedJavadocProject/doc/p2/package-use.html | 172 - .../AttachedJavadocProject/doc/package-list | 3 - .../doc/resources/inherit.gif | Bin 57 -> 0 bytes .../AttachedJavadocProject/doc/stylesheet.css | 29 - .../workspace/AttachedJavadocProject/lib/test6.jar | Bin 7538 -> 0 bytes .../AttachedJavadocProject/lib/test6src.zip | Bin 3083 -> 0 bytes .../AttachedJavadocProject/src/p1/p2/X.js | 68 - .../AttachedJavadocProject/src/p1/p2/Y.js | 8 - .../workspace/CodeCorrection/.project | 17 - .../workspace/CodeCorrection/.settings/.jsdtscope | 7 - .../workspace/CodeCorrection/lib.jar | Bin 2435 -> 0 bytes .../workspace/CodeCorrection/libSrc.zip | Bin 1573 -> 0 bytes .../CodeCorrection/src/CorrectArgument1.js | 5 - .../CodeCorrection/src/CorrectException1.js | 5 - .../CodeCorrection/src/CorrectException2.js | 5 - .../workspace/CodeCorrection/src/CorrectField1.js | 6 - .../workspace/CodeCorrection/src/CorrectField2.js | 7 - .../CodeCorrection/src/CorrectFieldType1.js | 3 - .../CodeCorrection/src/CorrectFieldType2.js | 3 - .../CodeCorrection/src/CorrectFieldType3.js | 5 - .../workspace/CodeCorrection/src/CorrectImport1.js | 5 - .../workspace/CodeCorrection/src/CorrectImport2.js | 5 - .../workspace/CodeCorrection/src/CorrectImport3.js | 5 - .../CodeCorrection/src/CorrectLocalVariable1.js | 6 - .../src/CorrectLocalVariableType1.js | 5 - .../src/CorrectLocalVariableType2.js | 5 - .../workspace/CodeCorrection/src/CorrectMethod1.js | 9 - .../workspace/CodeCorrection/src/CorrectMethod2.js | 10 - .../CodeCorrection/src/CorrectReturnType1.js | 5 - .../CodeCorrection/src/CorrectReturnType2.js | 5 - .../CodeCorrection/src/CorrectSuperClass1.js | 3 - .../CodeCorrection/src/CorrectSuperClass2.js | 3 - .../CodeCorrection/src/CorrectSuperInterface1.js | 3 - .../CodeCorrection/src/CorrectSuperInterface2.js | 3 - .../workspace/Compiler/.project | 17 - .../workspace/Compiler/.settings/.jsdtscope | 6 - .../src/org/eclipse/jdt/core/compiler/package.html | 17 - .../jdt/internal/compiler/parser/parser1.rsc | Bin 23054 -> 0 bytes .../jdt/internal/compiler/parser/parser10.rsc | Bin 252 -> 0 bytes .../jdt/internal/compiler/parser/parser11.rsc | Bin 252 -> 0 bytes .../jdt/internal/compiler/parser/parser12.rsc | Bin 252 -> 0 bytes .../jdt/internal/compiler/parser/parser13.rsc | Bin 252 -> 0 bytes .../jdt/internal/compiler/parser/parser14.rsc | Bin 1204 -> 0 bytes .../jdt/internal/compiler/parser/parser15.rsc | Bin 890 -> 0 bytes .../jdt/internal/compiler/parser/parser16.rsc | Bin 1866 -> 0 bytes .../jdt/internal/compiler/parser/parser17.rsc | Bin 671 -> 0 bytes .../jdt/internal/compiler/parser/parser18.rsc | Bin 7979 -> 0 bytes .../jdt/internal/compiler/parser/parser19.rsc | 2 - .../jdt/internal/compiler/parser/parser2.rsc | Bin 21712 -> 0 bytes .../jdt/internal/compiler/parser/parser20.rsc | Bin 12598 -> 0 bytes .../jdt/internal/compiler/parser/parser21.rsc | Bin 5368 -> 0 bytes .../jdt/internal/compiler/parser/parser3.rsc | Bin 1866 -> 0 bytes .../jdt/internal/compiler/parser/parser4.rsc | Bin 3126 -> 0 bytes .../jdt/internal/compiler/parser/parser5.rsc | Bin 1866 -> 0 bytes .../jdt/internal/compiler/parser/parser6.rsc | Bin 866 -> 0 bytes .../jdt/internal/compiler/parser/parser7.rsc | Bin 218 -> 0 bytes .../jdt/internal/compiler/parser/parser8.rsc | Bin 598 -> 0 bytes .../jdt/internal/compiler/parser/parser9.rsc | Bin 15800 -> 0 bytes .../compiler/parser/readableNames.properties | 306 - .../internal/compiler/problem/messages.properties | 465 - .../jdt/internal/compiler/util/messages.properties | 66 - .../eclipse/jsdt/core/compiler/CharOperation.js | 2747 ---- .../src/org/eclipse/jsdt/core/compiler/IProblem.js | 983 -- .../jsdt/core/compiler/InvalidInputException.js | 34 - .../org/eclipse/jsdt/core/compiler/package.html | 17 - .../eclipse/jsdt/internal/compiler/ASTVisitor.js | 924 -- .../eclipse/jsdt/internal/compiler/ClassFile.js | 3040 ----- .../jsdt/internal/compiler/CompilationResult.js | 433 - .../org/eclipse/jsdt/internal/compiler/Compiler.js | 610 - .../jsdt/internal/compiler/ConfigurableOption.js | 227 - .../compiler/DefaultErrorHandlingPolicies.js | 75 - .../jsdt/internal/compiler/ICompilerRequestor.js | 22 - .../jsdt/internal/compiler/IDebugRequestor.js | 42 - .../jsdt/internal/compiler/IErrorHandlingPolicy.js | 28 - .../jsdt/internal/compiler/IProblemFactory.js | 41 - .../internal/compiler/ast/AND_AND_Expression.js | 269 - .../eclipse/jsdt/internal/compiler/ast/ASTNode.js | 298 - .../compiler/ast/AbstractMethodDeclaration.js | 421 - .../compiler/ast/AbstractVariableDeclaration.js | 97 - .../internal/compiler/ast/AllocationExpression.js | 317 - .../jsdt/internal/compiler/ast/Annotation.js | 38 - .../compiler/ast/AnnotationTypeDeclaration.js | 283 - .../ast/AnnotationTypeMemberDeclaration.js | 158 - .../eclipse/jsdt/internal/compiler/ast/Argument.js | 132 - .../compiler/ast/ArrayAllocationExpression.js | 191 - .../jsdt/internal/compiler/ast/ArrayInitializer.js | 209 - .../compiler/ast/ArrayQualifiedTypeReference.js | 86 - .../jsdt/internal/compiler/ast/ArrayReference.js | 213 - .../internal/compiler/ast/ArrayTypeReference.js | 83 - .../jsdt/internal/compiler/ast/AssertStatement.js | 198 - .../jsdt/internal/compiler/ast/Assignment.js | 204 - .../jsdt/internal/compiler/ast/BinaryExpression.js | 1764 --- .../eclipse/jsdt/internal/compiler/ast/Block.js | 142 - .../jsdt/internal/compiler/ast/BranchStatement.js | 62 - .../jsdt/internal/compiler/ast/BreakStatement.js | 95 - .../jsdt/internal/compiler/ast/CaseStatement.js | 114 - .../jsdt/internal/compiler/ast/CastExpression.js | 420 - .../jsdt/internal/compiler/ast/CharLiteral.js | 101 - .../internal/compiler/ast/ClassLiteralAccess.js | 105 - .../eclipse/jsdt/internal/compiler/ast/Clinit.js | 248 - .../compiler/ast/CompilationUnitDeclaration.js | 323 - .../internal/compiler/ast/CompoundAssignment.js | 158 - .../internal/compiler/ast/ConditionalExpression.js | 416 - .../compiler/ast/ConstructorDeclaration.js | 467 - .../internal/compiler/ast/ContinueStatement.js | 100 - .../jsdt/internal/compiler/ast/DoStatement.js | 173 - .../jsdt/internal/compiler/ast/DoubleLiteral.js | 115 - .../jsdt/internal/compiler/ast/EmptyStatement.js | 64 - .../jsdt/internal/compiler/ast/EnumConstant.js | 208 - .../jsdt/internal/compiler/ast/EnumDeclaration.js | 242 - .../jsdt/internal/compiler/ast/EqualExpression.js | 454 - .../compiler/ast/ExplicitConstructorCall.js | 366 - .../jsdt/internal/compiler/ast/Expression.js | 757 - .../internal/compiler/ast/ExtendedStringLiteral.js | 79 - .../jsdt/internal/compiler/ast/FalseLiteral.js | 67 - .../jsdt/internal/compiler/ast/FieldDeclaration.js | 242 - .../jsdt/internal/compiler/ast/FieldReference.js | 545 - .../jsdt/internal/compiler/ast/FloatLiteral.js | 117 - .../jsdt/internal/compiler/ast/ForStatement.js | 325 - .../jsdt/internal/compiler/ast/ForeachStatement.js | 393 - .../jsdt/internal/compiler/ast/IfStatement.js | 242 - .../compiler/ast/ImplicitDocTypeReference.js | 73 - .../jsdt/internal/compiler/ast/ImportReference.js | 82 - .../jsdt/internal/compiler/ast/Initializer.js | 120 - .../internal/compiler/ast/InstanceOfExpression.js | 105 - .../jsdt/internal/compiler/ast/IntLiteral.js | 150 - .../internal/compiler/ast/IntLiteralMinValue.js | 27 - .../eclipse/jsdt/internal/compiler/ast/Javadoc.js | 495 - .../compiler/ast/JavadocAllocationExpression.js | 113 - .../compiler/ast/JavadocArgumentExpression.js | 98 - .../ast/JavadocArrayQualifiedTypeReference.js | 48 - .../ast/JavadocArraySingleTypeReference.js | 46 - .../internal/compiler/ast/JavadocFieldReference.js | 143 - .../compiler/ast/JavadocImportReference.js | 32 - .../internal/compiler/ast/JavadocMessageSend.js | 170 - .../compiler/ast/JavadocQualifiedTypeReference.js | 94 - .../compiler/ast/JavadocReturnStatement.js | 51 - .../compiler/ast/JavadocSingleNameReference.js | 58 - .../compiler/ast/JavadocSingleTypeReference.js | 94 - .../jsdt/internal/compiler/ast/LabeledStatement.js | 129 - .../eclipse/jsdt/internal/compiler/ast/Literal.js | 57 - .../jsdt/internal/compiler/ast/LocalDeclaration.js | 226 - .../jsdt/internal/compiler/ast/LongLiteral.js | 141 - .../internal/compiler/ast/LongLiteralMinValue.js | 27 - .../jsdt/internal/compiler/ast/MagicLiteral.js | 29 - .../jsdt/internal/compiler/ast/MarkerAnnotation.js | 42 - .../jsdt/internal/compiler/ast/MemberValuePair.js | 67 - .../jsdt/internal/compiler/ast/MessageSend.js | 399 - .../internal/compiler/ast/MethodDeclaration.js | 181 - .../jsdt/internal/compiler/ast/NameReference.js | 64 - .../jsdt/internal/compiler/ast/NormalAnnotation.js | 84 - .../jsdt/internal/compiler/ast/NullLiteral.js | 59 - .../jsdt/internal/compiler/ast/NumberLiteral.js | 36 - .../jsdt/internal/compiler/ast/OR_OR_Expression.js | 272 - .../internal/compiler/ast/OperatorExpression.js | 1564 --- .../jsdt/internal/compiler/ast/OperatorIds.js | 43 - .../ast/ParameterizedQualifiedTypeReference.js | 287 - .../ast/ParameterizedSingleTypeReference.js | 217 - .../internal/compiler/ast/PostfixExpression.js | 77 - .../jsdt/internal/compiler/ast/PrefixExpression.js | 60 - .../compiler/ast/QualifiedAllocationExpression.js | 359 - .../compiler/ast/QualifiedNameReference.js | 877 -- .../compiler/ast/QualifiedSuperReference.js | 63 - .../compiler/ast/QualifiedThisReference.js | 120 - .../compiler/ast/QualifiedTypeReference.js | 115 - .../jsdt/internal/compiler/ast/Reference.js | 70 - .../jsdt/internal/compiler/ast/ReturnStatement.js | 244 - .../compiler/ast/SingleMemberAnnotation.js | 69 - .../internal/compiler/ast/SingleNameReference.js | 689 - .../internal/compiler/ast/SingleTypeReference.js | 77 - .../jsdt/internal/compiler/ast/Statement.js | 79 - .../jsdt/internal/compiler/ast/StringLiteral.js | 120 - .../compiler/ast/StringLiteralConcatenation.js | 79 - .../internal/compiler/ast/SubRoutineStatement.js | 67 - .../jsdt/internal/compiler/ast/SuperReference.js | 68 - .../jsdt/internal/compiler/ast/SwitchStatement.js | 320 - .../internal/compiler/ast/SynchronizedStatement.js | 194 - .../jsdt/internal/compiler/ast/ThisReference.js | 120 - .../jsdt/internal/compiler/ast/ThrowStatement.js | 79 - .../jsdt/internal/compiler/ast/TrueLiteral.js | 70 - .../jsdt/internal/compiler/ast/TryStatement.js | 562 - .../jsdt/internal/compiler/ast/TypeDeclaration.js | 1202 -- .../jsdt/internal/compiler/ast/TypeParameter.js | 79 - .../jsdt/internal/compiler/ast/TypeReference.js | 164 - .../jsdt/internal/compiler/ast/UnaryExpression.js | 301 - .../jsdt/internal/compiler/ast/WhileStatement.js | 234 - .../eclipse/jsdt/internal/compiler/ast/Wildcard.js | 112 - .../compiler/classfmt/ClassFileConstants.js | 72 - .../internal/compiler/classfmt/ClassFileReader.js | 827 -- .../internal/compiler/classfmt/ClassFileStruct.js | 188 - .../compiler/classfmt/ClassFormatException.js | 131 - .../jsdt/internal/compiler/classfmt/FieldInfo.js | 318 - .../internal/compiler/classfmt/InnerClassInfo.js | 142 - .../jsdt/internal/compiler/classfmt/MethodInfo.js | 251 - .../compiler/codegen/AttributeNamesConstants.js | 25 - .../jsdt/internal/compiler/codegen/CaseLabel.js | 81 - .../internal/compiler/codegen/CharArrayCache.js | 184 - .../jsdt/internal/compiler/codegen/CodeStream.js | 5479 -------- .../jsdt/internal/compiler/codegen/ConstantPool.js | 3609 ----- .../jsdt/internal/compiler/codegen/DoubleCache.js | 138 - .../internal/compiler/codegen/ExceptionLabel.js | 49 - .../compiler/codegen/FieldNameAndTypeCache.js | 161 - .../jsdt/internal/compiler/codegen/FloatCache.js | 138 - .../jsdt/internal/compiler/codegen/IntegerCache.js | 155 - .../jsdt/internal/compiler/codegen/Label.js | 262 - .../jsdt/internal/compiler/codegen/LongCache.js | 155 - .../compiler/codegen/MethodNameAndTypeCache.js | 162 - .../jsdt/internal/compiler/codegen/ObjectCache.js | 152 - .../jsdt/internal/compiler/codegen/Opcodes.js | 216 - .../compiler/codegen/QualifiedNamesConstants.js | 107 - .../jsdt/internal/compiler/env/IBinaryField.js | 39 - .../jsdt/internal/compiler/env/IBinaryMethod.js | 50 - .../internal/compiler/env/IBinaryNestedType.js | 38 - .../jsdt/internal/compiler/env/IBinaryType.js | 114 - .../jsdt/internal/compiler/env/ICompilationUnit.js | 36 - .../jsdt/internal/compiler/env/IConstants.js | 48 - .../jsdt/internal/compiler/env/IDependent.js | 44 - .../jsdt/internal/compiler/env/IGenericField.js | 27 - .../jsdt/internal/compiler/env/IGenericMethod.js | 36 - .../jsdt/internal/compiler/env/IGenericType.js | 32 - .../jsdt/internal/compiler/env/INameEnvironment.js | 71 - .../jsdt/internal/compiler/env/ISourceField.js | 47 - .../jsdt/internal/compiler/env/ISourceImport.js | 45 - .../jsdt/internal/compiler/env/ISourceMethod.js | 72 - .../jsdt/internal/compiler/env/ISourceType.js | 108 - .../internal/compiler/env/NameEnvironmentAnswer.js | 79 - .../internal/compiler/flow/ConditionalFlowInfo.js | 178 - .../compiler/flow/ExceptionHandlingFlowContext.js | 219 - .../internal/compiler/flow/FinallyFlowContext.js | 122 - .../jsdt/internal/compiler/flow/FlowContext.js | 493 - .../jsdt/internal/compiler/flow/FlowInfo.js | 144 - .../compiler/flow/InitializationFlowContext.js | 97 - .../compiler/flow/InsideSubRoutineFlowContext.js | 59 - .../internal/compiler/flow/LabelFlowContext.js | 61 - .../internal/compiler/flow/LoopingFlowContext.js | 153 - .../internal/compiler/flow/SwitchFlowContext.js | 54 - .../compiler/flow/UnconditionalFlowInfo.js | 558 - .../jsdt/internal/compiler/impl/BooleanConstant.js | 41 - .../jsdt/internal/compiler/impl/ByteConstant.js | 52 - .../jsdt/internal/compiler/impl/CharConstant.js | 55 - .../jsdt/internal/compiler/impl/CompilerOptions.js | 725 - .../jsdt/internal/compiler/impl/Constant.js | 1611 --- .../jsdt/internal/compiler/impl/DoubleConstant.js | 64 - .../jsdt/internal/compiler/impl/FloatConstant.js | 62 - .../jsdt/internal/compiler/impl/ITypeRequestor.js | 37 - .../jsdt/internal/compiler/impl/IntConstant.js | 63 - .../jsdt/internal/compiler/impl/LongConstant.js | 52 - .../internal/compiler/impl/ReferenceContext.js | 26 - .../jsdt/internal/compiler/impl/ShortConstant.js | 52 - .../jsdt/internal/compiler/impl/StringConstant.js | 48 - .../jsdt/internal/compiler/lookup/ArrayBinding.js | 219 - .../internal/compiler/lookup/BaseTypeBinding.js | 186 - .../jsdt/internal/compiler/lookup/BaseTypes.js | 24 - .../internal/compiler/lookup/BinaryTypeBinding.js | 819 -- .../jsdt/internal/compiler/lookup/Binding.js | 45 - .../jsdt/internal/compiler/lookup/BindingIds.js | 21 - .../jsdt/internal/compiler/lookup/BlockScope.js | 825 -- .../jsdt/internal/compiler/lookup/ClassScope.js | 995 -- .../compiler/lookup/CompilationUnitScope.js | 633 - .../internal/compiler/lookup/CompilerModifiers.js | 42 - .../jsdt/internal/compiler/lookup/FieldBinding.js | 228 - .../jsdt/internal/compiler/lookup/ImportBinding.js | 45 - .../compiler/lookup/InnerEmulationDependency.js | 22 - .../internal/compiler/lookup/InvocationSite.js | 28 - .../internal/compiler/lookup/LocalTypeBinding.js | 177 - .../compiler/lookup/LocalVariableBinding.js | 110 - .../internal/compiler/lookup/LookupEnvironment.js | 815 -- .../internal/compiler/lookup/MemberTypeBinding.js | 39 - .../jsdt/internal/compiler/lookup/MethodBinding.js | 635 - .../jsdt/internal/compiler/lookup/MethodScope.js | 502 - .../internal/compiler/lookup/MethodVerifier.js | 544 - .../internal/compiler/lookup/MethodVerifier15.js | 161 - .../internal/compiler/lookup/NestedTypeBinding.js | 217 - .../internal/compiler/lookup/PackageBinding.js | 197 - .../compiler/lookup/ParameterizedFieldBinding.js | 59 - .../lookup/ParameterizedGenericMethodBinding.js | 232 - .../compiler/lookup/ParameterizedMethodBinding.js | 91 - .../compiler/lookup/ParameterizedTypeBinding.js | 787 -- .../internal/compiler/lookup/ProblemBinding.js | 55 - .../compiler/lookup/ProblemFieldBinding.js | 41 - .../compiler/lookup/ProblemMethodBinding.js | 42 - .../compiler/lookup/ProblemPackageBinding.js | 32 - .../internal/compiler/lookup/ProblemReasons.js | 28 - .../compiler/lookup/ProblemReferenceBinding.js | 50 - .../internal/compiler/lookup/RawTypeBinding.js | 170 - .../internal/compiler/lookup/ReferenceBinding.js | 742 - .../eclipse/jsdt/internal/compiler/lookup/Scope.js | 2887 ---- .../internal/compiler/lookup/SignatureWrapper.js | 68 - .../internal/compiler/lookup/SourceTypeBinding.js | 1162 -- .../jsdt/internal/compiler/lookup/Substitution.js | 23 - .../lookup/SyntheticAccessMethodBinding.js | 307 - .../compiler/lookup/SyntheticArgumentBinding.js | 61 - .../compiler/lookup/SyntheticFieldBinding.js | 21 - .../jsdt/internal/compiler/lookup/TagBits.js | 61 - .../jsdt/internal/compiler/lookup/TypeBinding.js | 289 - .../jsdt/internal/compiler/lookup/TypeConstants.js | 89 - .../jsdt/internal/compiler/lookup/TypeIds.js | 138 - .../compiler/lookup/TypeVariableBinding.js | 210 - .../compiler/lookup/UnresolvedReferenceBinding.js | 70 - .../compiler/lookup/UpdatedMethodBinding.js | 25 - .../internal/compiler/lookup/VariableBinding.js | 59 - .../internal/compiler/lookup/WildcardBinding.js | 325 - .../compiler/parser/AbstractCommentParser.js | 1234 -- .../jsdt/internal/compiler/parser/JavadocParser.js | 632 - .../jsdt/internal/compiler/parser/NLSLine.js | 65 - .../jsdt/internal/compiler/parser/Parser.js | 9112 ------------- .../compiler/parser/ParserBasicInformation.js | 35 - .../internal/compiler/parser/RecoveredBlock.js | 330 - .../internal/compiler/parser/RecoveredElement.js | 308 - .../internal/compiler/parser/RecoveredField.js | 169 - .../internal/compiler/parser/RecoveredImport.js | 57 - .../compiler/parser/RecoveredInitializer.js | 237 - .../compiler/parser/RecoveredLocalVariable.js | 108 - .../internal/compiler/parser/RecoveredMethod.js | 447 - .../internal/compiler/parser/RecoveredStatement.js | 54 - .../jsdt/internal/compiler/parser/RecoveredType.js | 511 - .../jsdt/internal/compiler/parser/RecoveredUnit.js | 217 - .../jsdt/internal/compiler/parser/Scanner.js | 3587 ----- .../internal/compiler/parser/TerminalTokens.js | 144 - .../compiler/parser/diagnose/DiagnoseParser.js | 2295 ---- .../internal/compiler/parser/diagnose/LexStream.js | 270 - .../internal/compiler/parser/diagnose/RangeUtil.js | 200 - .../jsdt/internal/compiler/parser/parser1.rsc | Bin 23054 -> 0 bytes .../jsdt/internal/compiler/parser/parser10.rsc | Bin 252 -> 0 bytes .../jsdt/internal/compiler/parser/parser11.rsc | Bin 252 -> 0 bytes .../jsdt/internal/compiler/parser/parser12.rsc | Bin 252 -> 0 bytes .../jsdt/internal/compiler/parser/parser13.rsc | Bin 252 -> 0 bytes .../jsdt/internal/compiler/parser/parser14.rsc | Bin 1204 -> 0 bytes .../jsdt/internal/compiler/parser/parser15.rsc | Bin 890 -> 0 bytes .../jsdt/internal/compiler/parser/parser16.rsc | Bin 1866 -> 0 bytes .../jsdt/internal/compiler/parser/parser17.rsc | Bin 671 -> 0 bytes .../jsdt/internal/compiler/parser/parser18.rsc | Bin 7979 -> 0 bytes .../jsdt/internal/compiler/parser/parser19.rsc | 2 - .../jsdt/internal/compiler/parser/parser2.rsc | Bin 21712 -> 0 bytes .../jsdt/internal/compiler/parser/parser20.rsc | Bin 12598 -> 0 bytes .../jsdt/internal/compiler/parser/parser21.rsc | Bin 5368 -> 0 bytes .../jsdt/internal/compiler/parser/parser3.rsc | Bin 1866 -> 0 bytes .../jsdt/internal/compiler/parser/parser4.rsc | Bin 3126 -> 0 bytes .../jsdt/internal/compiler/parser/parser5.rsc | Bin 1866 -> 0 bytes .../jsdt/internal/compiler/parser/parser6.rsc | Bin 866 -> 0 bytes .../jsdt/internal/compiler/parser/parser7.rsc | Bin 218 -> 0 bytes .../jsdt/internal/compiler/parser/parser8.rsc | Bin 598 -> 0 bytes .../jsdt/internal/compiler/parser/parser9.rsc | Bin 15800 -> 0 bytes .../compiler/parser/readableNames.properties | 90 - .../internal/compiler/problem/AbortCompilation.js | 75 - .../compiler/problem/AbortCompilationUnit.js | 29 - .../jsdt/internal/compiler/problem/AbortMethod.js | 29 - .../jsdt/internal/compiler/problem/AbortType.js | 29 - .../internal/compiler/problem/DefaultProblem.js | 227 - .../compiler/problem/DefaultProblemFactory.js | 197 - .../internal/compiler/problem/ProblemHandler.js | 183 - .../internal/compiler/problem/ProblemReporter.js | 4731 ------- .../internal/compiler/problem/ProblemSeverities.js | 25 - .../compiler/problem/ShouldNotImplement.js | 24 - .../internal/compiler/problem/messages.properties | 465 - .../internal/compiler/util/CompoundNameVector.js | 71 - .../jsdt/internal/compiler/util/FloatUtil.js | 421 - .../jsdt/internal/compiler/util/HashtableOfInt.js | 92 - .../internal/compiler/util/HashtableOfIntValues.js | 148 - .../jsdt/internal/compiler/util/HashtableOfLong.js | 92 - .../internal/compiler/util/HashtableOfObject.js | 146 - .../internal/compiler/util/HashtableOfPackage.js | 96 - .../jsdt/internal/compiler/util/HashtableOfType.js | 96 - .../jsdt/internal/compiler/util/ObjectVector.js | 132 - .../internal/compiler/util/SimpleLookupTable.js | 156 - .../internal/compiler/util/SimpleNameVector.js | 96 - .../jsdt/internal/compiler/util/SuffixConstants.js | 43 - .../eclipse/jsdt/internal/compiler/util/Util.js | 523 - .../jsdt/internal/compiler/util/WeakHashSet.js | 206 - .../internal/compiler/util/messages.properties | 66 - .../workspace/Completion/.project | 17 - .../workspace/Completion/.settings/.jsdtscope | 15 - .../workspace/Completion/ZZZ.js | 5 - .../workspace/Completion/constructors.jar | Bin 1456 -> 0 bytes .../workspace/Completion/constructorssrc.zip | Bin 615 -> 0 bytes .../workspace/Completion/generics.jar | Bin 695 -> 0 bytes .../workspace/Completion/genericssrc.zip | Bin 265 -> 0 bytes .../workspace/Completion/lib.jar | Bin 392 -> 0 bytes .../workspace/Completion/pack.jar | Bin 1303 -> 0 bytes .../workspace/Completion/same.jar | Bin 535 -> 0 bytes .../workspace/Completion/src/A.js | 7 - .../workspace/Completion/src/B.js | 4 - .../Completion/src/CUWithSecondaryType.js | 6 - .../Completion/src/ClassWithComplexName.js | 2 - .../src/Completion2InterfacesWithSameMethod.js | 13 - .../Completion/src/CompletionAfterCase1.js | 8 - .../Completion/src/CompletionAfterCase2.js | 9 - .../Completion/src/CompletionAfterSupercall1.js | 14 - .../Completion/src/CompletionAfterSwitch.js | 14 - .../src/CompletionAllocationExpressionIsParent1.js | 14 - .../src/CompletionAllocationExpressionIsParent4.js | 14 - .../src/CompletionAllocationExpressionIsParent5.js | 13 - .../Completion/src/CompletionAmbiguousFieldName.js | 6 - .../src/CompletionAmbiguousFieldName3.js | 12 - .../src/CompletionAmbiguousFieldName4.js | 12 - .../Completion/src/CompletionAmbiguousType.js | 6 - .../Completion/src/CompletionAmbiguousType2.js | 6 - .../Completion/src/CompletionArgumentName.js | 7 - .../Completion/src/CompletionArrayAccess1.js | 8 - .../Completion/src/CompletionArraysCloneMethod.js | 5 - .../src/CompletionAssignmentInMethod1.js | 12 - .../src/CompletionAssignmentInMethod2.js | 12 - .../src/CompletionAssignmentInMethod3.js | 6 - .../src/CompletionAssignmentInMethod4.js | 6 - .../Completion/src/CompletionBasicField1.js | 6 - .../Completion/src/CompletionBasicKeyword1.js | 5 - .../src/CompletionBasicLocalVariable1.js | 6 - .../Completion/src/CompletionBasicMethod1.js | 5 - .../src/CompletionBasicMethodDeclaration1.js | 3 - .../Completion/src/CompletionBasicPackage1.js | 3 - .../CompletionBasicPotentialMethodDeclaration1.js | 3 - .../Completion/src/CompletionBasicType1.js | 5 - .../Completion/src/CompletionBinaryOperator1.js | 10 - .../Completion/src/CompletionBinaryOperator2.js | 9 - .../Completion/src/CompletionBinaryOperator3.js | 9 - .../Completion/src/CompletionCaseInsensitive.js | 6 - .../src/CompletionCaseInsensitivePackage.js | 5 - .../Completion/src/CompletionCastIsParent1.js | 27 - .../Completion/src/CompletionCastIsParent2.js | 5 - .../Completion/src/CompletionCatchArgumentName2.js | 7 - .../CompletionClassLiteralAfterAnonymousType1.js | 13 - .../src/CompletionConditionalExpression1.js | 12 - .../src/CompletionConditionalExpression2.js | 12 - .../src/CompletionConditionalExpression3.js | 12 - .../src/CompletionConstructorForAnonymousType.js | 5 - .../Completion/src/CompletionDefaultPackage.js | 5 - .../Completion/src/CompletionEmptyToken1.js | 6 - .../Completion/src/CompletionEmptyTypeName2.js | 5 - .../Completion/src/CompletionEmptyTypeName3.js | 8 - .../src/CompletionEndOfCompilationUnit.js | 5 - .../src/CompletionExactNameCaseInsensitive.js | 6 - .../src/CompletionExpectedTypeIsNotValid.js | 5 - .../Completion/src/CompletionFieldInitializer1.js | 9 - .../Completion/src/CompletionFieldInitializer2.js | 9 - .../Completion/src/CompletionFieldInitializer3.js | 3 - .../Completion/src/CompletionFieldInitializer4.js | 3 - .../Completion/src/CompletionFieldName.js | 4 - .../Completion/src/CompletionFindClass2.js | 5 - .../Completion/src/CompletionFindException1.js | 7 - .../Completion/src/CompletionFindException2.js | 4 - .../Completion/src/CompletionFindField1.js | 8 - .../Completion/src/CompletionFindField2.js | 8 - .../Completion/src/CompletionFindField3.js | 13 - .../Completion/src/CompletionFindLocalVariable.js | 8 - .../Completion/src/CompletionFindMethod1.js | 6 - .../Completion/src/CompletionFindMethod2.js | 5 - .../src/CompletionFindMethodInProcess.js | 7 - .../Completion/src/CompletionFindMethodInThis.js | 7 - .../Completion/src/CompletionFindSecondaryType1.js | 6 - .../Completion/src/CompletionFindThisDotField.js | 7 - .../Completion/src/CompletionInsideStaticMethod.js | 10 - .../src/CompletionInstanceofOperator1.js | 21 - .../Completion/src/CompletionLocalName.js | 6 - .../src/CompletionMessageSendIsParent1.js | 14 - .../src/CompletionMessageSendIsParent2.js | 16 - .../src/CompletionMessageSendIsParent3.js | 16 - .../src/CompletionMessageSendIsParent4.js | 14 - .../src/CompletionMessageSendIsParent5.js | 13 - .../src/CompletionMessageSendIsParent6.js | 13 - .../Completion/src/CompletionMethodDeclaration.js | 9 - .../src/CompletionMethodDeclaration10.js | 4 - .../Completion/src/CompletionMethodDeclaration6.js | 10 - .../Completion/src/CompletionMethodDeclaration7.js | 3 - .../Completion/src/CompletionMethodDeclaration8.js | 4 - .../Completion/src/CompletionMethodDeclaration9.js | 4 - .../Completion/src/CompletionMethodThrowsClause.js | 3 - .../src/CompletionMethodThrowsClause2.js | 3 - .../Completion/src/CompletionNonEmptyToken1.js | 6 - .../src/CompletionNonStaticFieldRelevance.js | 11 - .../Completion/src/CompletionNullRequestor.js | 3 - ...CompletionObjectsMethodWithInterfaceReceiver.js | 16 - .../Completion/src/CompletionOnStaticMember1.js | 7 - .../Completion/src/CompletionOnStaticMember2.js | 7 - .../Completion/src/CompletionOutOfBounds.js | 3 - .../Completion/src/CompletionRepeatedType.js | 9 - .../src/CompletionReturnInInitializer.js | 5 - .../src/CompletionReturnStatementIsParent1.js | 27 - .../src/CompletionReturnStatementIsParent2.js | 5 - .../Completion/src/CompletionSameClass.js | 3 - .../Completion/src/CompletionThrowStatement.js | 5 - .../workspace/Completion/src/CompletionType1.js | 7 - .../Completion/src/CompletionUnaryOperator1.js | 9 - .../Completion/src/CompletionUnaryOperator2.js | 9 - .../src/CompletionUnresolvedEnclosingType.js | 5 - .../src/CompletionUnresolvedFieldType.js | 5 - .../src/CompletionUnresolvedParameterType.js | 5 - .../src/CompletionUnresolvedReturnType.js | 5 - .../CompletionVariableInitializerInInitializer1.js | 11 - .../CompletionVariableInitializerInInitializer2.js | 11 - .../CompletionVariableInitializerInInitializer3.js | 5 - .../CompletionVariableInitializerInInitializer4.js | 5 - .../src/CompletionVariableInitializerInMethod1.js | 11 - .../src/CompletionVariableInitializerInMethod2.js | 11 - .../src/CompletionVariableInitializerInMethod3.js | 5 - .../src/CompletionVariableInitializerInMethod4.js | 5 - .../Completion/src/CompletionVariableName1.js | 5 - .../Completion/src/CompletionVariableName2.js | 5 - .../Completion/src/CompletionVariableName3.js | 6 - .../src/CompletionVariableNameUnresolvedType.js | 3 - .../Completion/src/CompletionVisibilityCheck.js | 12 - .../Completion/src/CompletionVoidMethod.js | 8 - .../Completion/src/CompletionWithBinaryFolder.js | 5 - .../workspace/Completion/src/Default.js | 3 - .../workspace/Completion/src/SuperClass.js | 2 - .../workspace/Completion/src/SuperInterface.js | 2 - .../workspace/Completion/src/TEST_FOO_MyClass.js | 3 - .../workspace/Completion/src/Test_Bar_MyClass.js | 3 - .../Completion/src/TypeWithConstructor.js | 4 - .../workspace/Completion/src/XX00.js | 11 - .../workspace/Completion/src/XX01.js | 11 - .../workspace/Completion/src/XX02.js | 11 - .../workspace/Completion/src/XX10.js | 11 - .../workspace/Completion/src/XX11.js | 11 - .../workspace/Completion/src/XX12.js | 11 - .../workspace/Completion/src/XX20.js | 11 - .../workspace/Completion/src/XX21.js | 11 - .../workspace/Completion/src/XX22.js | 11 - .../Completion/src/deprecation/Bug127628Type1.js | 6 - .../Completion/src/deprecation/Bug127628Type2.js | 9 - .../eclipse/jsdt/core/tests/BasicTestReferences.js | 6 - .../workspace/Completion/src/p1/ABC.js | 5 - .../workspace/Completion/src/p2/ABC.js | 5 - .../Completion/src/p3/CompletionToplevelType1.js | 4 - .../workspace/Completion/src/pack1/PX.js | 4 - .../workspace/Completion/src/pack1/pack3/PX.js | 4 - .../workspace/Completion/src/pack2/PX.js | 4 - .../workspace/Completion/src/q1/CT1.js | 4 - .../workspace/Completion/src/q2/CT1.js | 4 - .../workspace/Completion/src/z1/z2/Qla1.js | 5 - .../workspace/Completion/src/z1/z2/qla0/Qla3.js | 7 - .../workspace/Completion/src/z1/z2/qla0/Qla4.js | 5 - .../workspace/Completion/src/z1/z2/qla0/Wla.js | 7 - .../workspace/Completion/src/z1/z2/qla2.js | 5 - .../Completion/src2/CompletionKeywordAbstract1.js | 1 - .../Completion/src2/CompletionKeywordAbstract10.js | 2 - .../Completion/src2/CompletionKeywordAbstract11.js | 2 - .../Completion/src2/CompletionKeywordAbstract12.js | 2 - .../Completion/src2/CompletionKeywordAbstract13.js | 4 - .../Completion/src2/CompletionKeywordAbstract14.js | 4 - .../Completion/src2/CompletionKeywordAbstract15.js | 4 - .../Completion/src2/CompletionKeywordAbstract16.js | 4 - .../Completion/src2/CompletionKeywordAbstract2.js | 1 - .../Completion/src2/CompletionKeywordAbstract3.js | 1 - .../Completion/src2/CompletionKeywordAbstract4.js | 1 - .../Completion/src2/CompletionKeywordAbstract5.js | 3 - .../Completion/src2/CompletionKeywordAbstract6.js | 3 - .../Completion/src2/CompletionKeywordAbstract7.js | 3 - .../Completion/src2/CompletionKeywordAbstract8.js | 3 - .../Completion/src2/CompletionKeywordAbstract9.js | 2 - .../Completion/src2/CompletionKeywordAssert1.js | 5 - .../Completion/src2/CompletionKeywordAssert2.js | 5 - .../Completion/src2/CompletionKeywordAssert3.js | 3 - .../Completion/src2/CompletionKeywordAssert4.js | 6 - .../Completion/src2/CompletionKeywordAssert5.js | 6 - .../Completion/src2/CompletionKeywordAssert6.js | 4 - .../Completion/src2/CompletionKeywordBreak1.js | 7 - .../Completion/src2/CompletionKeywordBreak2.js | 6 - .../Completion/src2/CompletionKeywordBreak3.js | 8 - .../Completion/src2/CompletionKeywordBreak4.js | 8 - .../Completion/src2/CompletionKeywordBreak5.js | 7 - .../Completion/src2/CompletionKeywordBreak6.js | 9 - .../Completion/src2/CompletionKeywordCase1.js | 7 - .../Completion/src2/CompletionKeywordCase10.js | 6 - .../Completion/src2/CompletionKeywordCase2.js | 8 - .../Completion/src2/CompletionKeywordCase3.js | 8 - .../Completion/src2/CompletionKeywordCase4.js | 9 - .../Completion/src2/CompletionKeywordCase5.js | 5 - .../Completion/src2/CompletionKeywordCase6.js | 8 - .../Completion/src2/CompletionKeywordCase7.js | 9 - .../Completion/src2/CompletionKeywordCase8.js | 9 - .../Completion/src2/CompletionKeywordCase9.js | 10 - .../Completion/src2/CompletionKeywordCatch1.js | 8 - .../Completion/src2/CompletionKeywordCatch10.js | 10 - .../Completion/src2/CompletionKeywordCatch2.js | 5 - .../Completion/src2/CompletionKeywordCatch3.js | 3 - .../Completion/src2/CompletionKeywordCatch4.js | 5 - .../Completion/src2/CompletionKeywordCatch5.js | 9 - .../Completion/src2/CompletionKeywordCatch6.js | 9 - .../Completion/src2/CompletionKeywordCatch7.js | 6 - .../Completion/src2/CompletionKeywordCatch8.js | 4 - .../Completion/src2/CompletionKeywordCatch9.js | 6 - .../Completion/src2/CompletionKeywordClass1.js | 1 - .../Completion/src2/CompletionKeywordClass10.js | 5 - .../Completion/src2/CompletionKeywordClass11.js | 5 - .../Completion/src2/CompletionKeywordClass12.js | 5 - .../Completion/src2/CompletionKeywordClass13.js | 2 - .../Completion/src2/CompletionKeywordClass14.js | 6 - .../Completion/src2/CompletionKeywordClass15.js | 6 - .../Completion/src2/CompletionKeywordClass16.js | 6 - .../Completion/src2/CompletionKeywordClass17.js | 5 - .../Completion/src2/CompletionKeywordClass18.js | 2 - .../Completion/src2/CompletionKeywordClass19.js | 2 - .../Completion/src2/CompletionKeywordClass2.js | 4 - .../Completion/src2/CompletionKeywordClass20.js | 2 - .../Completion/src2/CompletionKeywordClass21.js | 4 - .../Completion/src2/CompletionKeywordClass22.js | 4 - .../Completion/src2/CompletionKeywordClass23.js | 4 - .../Completion/src2/CompletionKeywordClass24.js | 4 - .../Completion/src2/CompletionKeywordClass3.js | 1 - .../Completion/src2/CompletionKeywordClass4.js | 1 - .../Completion/src2/CompletionKeywordClass5.js | 1 - .../Completion/src2/CompletionKeywordClass6.js | 3 - .../Completion/src2/CompletionKeywordClass7.js | 3 - .../Completion/src2/CompletionKeywordClass8.js | 3 - .../Completion/src2/CompletionKeywordClass9.js | 3 - .../Completion/src2/CompletionKeywordContinue1.js | 7 - .../Completion/src2/CompletionKeywordContinue2.js | 6 - .../Completion/src2/CompletionKeywordContinue3.js | 8 - .../Completion/src2/CompletionKeywordContinue4.js | 7 - .../Completion/src2/CompletionKeywordDefault1.js | 7 - .../Completion/src2/CompletionKeywordDefault10.js | 9 - .../Completion/src2/CompletionKeywordDefault2.js | 8 - .../Completion/src2/CompletionKeywordDefault3.js | 9 - .../Completion/src2/CompletionKeywordDefault4.js | 5 - .../Completion/src2/CompletionKeywordDefault5.js | 8 - .../Completion/src2/CompletionKeywordDefault6.js | 8 - .../Completion/src2/CompletionKeywordDefault7.js | 9 - .../Completion/src2/CompletionKeywordDefault8.js | 10 - .../Completion/src2/CompletionKeywordDefault9.js | 6 - .../Completion/src2/CompletionKeywordDo1.js | 5 - .../Completion/src2/CompletionKeywordDo2.js | 5 - .../Completion/src2/CompletionKeywordDo3.js | 3 - .../Completion/src2/CompletionKeywordDo4.js | 6 - .../Completion/src2/CompletionKeywordDo5.js | 6 - .../Completion/src2/CompletionKeywordDo6.js | 4 - .../Completion/src2/CompletionKeywordElse1.js | 7 - .../Completion/src2/CompletionKeywordElse2.js | 5 - .../Completion/src2/CompletionKeywordElse3.js | 3 - .../Completion/src2/CompletionKeywordElse4.js | 5 - .../Completion/src2/CompletionKeywordElse5.js | 8 - .../Completion/src2/CompletionKeywordElse6.js | 6 - .../Completion/src2/CompletionKeywordElse7.js | 4 - .../Completion/src2/CompletionKeywordElse8.js | 6 - .../Completion/src2/CompletionKeywordExtends1.js | 3 - .../Completion/src2/CompletionKeywordExtends10.js | 4 - .../Completion/src2/CompletionKeywordExtends2.js | 3 - .../Completion/src2/CompletionKeywordExtends3.js | 3 - .../Completion/src2/CompletionKeywordExtends4.js | 3 - .../Completion/src2/CompletionKeywordExtends5.js | 3 - .../Completion/src2/CompletionKeywordExtends6.js | 4 - .../Completion/src2/CompletionKeywordExtends7.js | 4 - .../Completion/src2/CompletionKeywordExtends8.js | 4 - .../Completion/src2/CompletionKeywordExtends9.js | 4 - .../Completion/src2/CompletionKeywordFalse1.js | 5 - .../Completion/src2/CompletionKeywordFalse2.js | 5 - .../Completion/src2/CompletionKeywordFalse3.js | 6 - .../Completion/src2/CompletionKeywordFalse4.js | 6 - .../Completion/src2/CompletionKeywordFinal1.js | 1 - .../Completion/src2/CompletionKeywordFinal10.js | 2 - .../Completion/src2/CompletionKeywordFinal11.js | 2 - .../Completion/src2/CompletionKeywordFinal12.js | 2 - .../Completion/src2/CompletionKeywordFinal13.js | 2 - .../Completion/src2/CompletionKeywordFinal14.js | 4 - .../Completion/src2/CompletionKeywordFinal15.js | 4 - .../Completion/src2/CompletionKeywordFinal16.js | 4 - .../Completion/src2/CompletionKeywordFinal17.js | 4 - .../Completion/src2/CompletionKeywordFinal18.js | 6 - .../Completion/src2/CompletionKeywordFinal2.js | 1 - .../Completion/src2/CompletionKeywordFinal3.js | 1 - .../Completion/src2/CompletionKeywordFinal4.js | 1 - .../Completion/src2/CompletionKeywordFinal5.js | 3 - .../Completion/src2/CompletionKeywordFinal6.js | 3 - .../Completion/src2/CompletionKeywordFinal7.js | 3 - .../Completion/src2/CompletionKeywordFinal8.js | 3 - .../Completion/src2/CompletionKeywordFinal9.js | 5 - .../Completion/src2/CompletionKeywordFinally1.js | 8 - .../Completion/src2/CompletionKeywordFinally10.js | 4 - .../Completion/src2/CompletionKeywordFinally11.js | 6 - .../Completion/src2/CompletionKeywordFinally12.js | 10 - .../Completion/src2/CompletionKeywordFinally13.js | 10 - .../Completion/src2/CompletionKeywordFinally14.js | 10 - .../Completion/src2/CompletionKeywordFinally2.js | 5 - .../Completion/src2/CompletionKeywordFinally3.js | 3 - .../Completion/src2/CompletionKeywordFinally4.js | 5 - .../Completion/src2/CompletionKeywordFinally5.js | 9 - .../Completion/src2/CompletionKeywordFinally6.js | 9 - .../Completion/src2/CompletionKeywordFinally7.js | 9 - .../Completion/src2/CompletionKeywordFinally8.js | 9 - .../Completion/src2/CompletionKeywordFinally9.js | 6 - .../Completion/src2/CompletionKeywordFor1.js | 5 - .../Completion/src2/CompletionKeywordFor2.js | 5 - .../Completion/src2/CompletionKeywordFor3.js | 3 - .../Completion/src2/CompletionKeywordFor4.js | 6 - .../Completion/src2/CompletionKeywordFor5.js | 6 - .../Completion/src2/CompletionKeywordFor6.js | 4 - .../Completion/src2/CompletionKeywordIf1.js | 5 - .../Completion/src2/CompletionKeywordIf2.js | 5 - .../Completion/src2/CompletionKeywordIf3.js | 3 - .../Completion/src2/CompletionKeywordIf4.js | 6 - .../Completion/src2/CompletionKeywordIf5.js | 6 - .../Completion/src2/CompletionKeywordIf6.js | 4 - .../src2/CompletionKeywordImplements1.js | 3 - .../src2/CompletionKeywordImplements2.js | 3 - .../src2/CompletionKeywordImplements3.js | 3 - .../src2/CompletionKeywordImplements4.js | 4 - .../src2/CompletionKeywordImplements5.js | 4 - .../src2/CompletionKeywordImplements6.js | 4 - .../Completion/src2/CompletionKeywordImport1.js | 5 - .../Completion/src2/CompletionKeywordImport3.js | 5 - .../Completion/src2/CompletionKeywordImport4.js | 4 - .../Completion/src2/CompletionKeywordImport5.js | 5 - .../Completion/src2/CompletionKeywordImport6.js | 5 - .../Completion/src2/CompletionKeywordImport7.js | 7 - .../src2/CompletionKeywordInstanceof1.js | 5 - .../src2/CompletionKeywordInstanceof2.js | 5 - .../src2/CompletionKeywordInstanceof3.js | 5 - .../src2/CompletionKeywordInstanceof4.js | 6 - .../src2/CompletionKeywordInstanceof5.js | 6 - .../src2/CompletionKeywordInstanceof6.js | 6 - .../Completion/src2/CompletionKeywordInterface1.js | 1 - .../src2/CompletionKeywordInterface10.js | 2 - .../src2/CompletionKeywordInterface11.js | 4 - .../src2/CompletionKeywordInterface12.js | 2 - .../src2/CompletionKeywordInterface13.js | 2 - .../src2/CompletionKeywordInterface14.js | 2 - .../src2/CompletionKeywordInterface15.js | 4 - .../src2/CompletionKeywordInterface16.js | 4 - .../src2/CompletionKeywordInterface17.js | 4 - .../src2/CompletionKeywordInterface18.js | 4 - .../Completion/src2/CompletionKeywordInterface2.js | 3 - .../Completion/src2/CompletionKeywordInterface3.js | 1 - .../Completion/src2/CompletionKeywordInterface4.js | 1 - .../Completion/src2/CompletionKeywordInterface5.js | 1 - .../Completion/src2/CompletionKeywordInterface6.js | 3 - .../Completion/src2/CompletionKeywordInterface7.js | 3 - .../Completion/src2/CompletionKeywordInterface8.js | 3 - .../Completion/src2/CompletionKeywordInterface9.js | 3 - .../Completion/src2/CompletionKeywordNative1.js | 3 - .../Completion/src2/CompletionKeywordNative2.js | 3 - .../Completion/src2/CompletionKeywordNative3.js | 3 - .../Completion/src2/CompletionKeywordNative4.js | 3 - .../Completion/src2/CompletionKeywordNative5.js | 4 - .../Completion/src2/CompletionKeywordNative6.js | 4 - .../Completion/src2/CompletionKeywordNative7.js | 4 - .../Completion/src2/CompletionKeywordNative8.js | 4 - .../Completion/src2/CompletionKeywordNew1.js | 5 - .../Completion/src2/CompletionKeywordNew10.js | 6 - .../Completion/src2/CompletionKeywordNew11.js | 6 - .../Completion/src2/CompletionKeywordNew12.js | 6 - .../Completion/src2/CompletionKeywordNew13.js | 7 - .../Completion/src2/CompletionKeywordNew14.js | 7 - .../Completion/src2/CompletionKeywordNew15.js | 7 - .../Completion/src2/CompletionKeywordNew16.js | 7 - .../Completion/src2/CompletionKeywordNew2.js | 5 - .../Completion/src2/CompletionKeywordNew3.js | 5 - .../Completion/src2/CompletionKeywordNew4.js | 5 - .../Completion/src2/CompletionKeywordNew5.js | 6 - .../Completion/src2/CompletionKeywordNew6.js | 6 - .../Completion/src2/CompletionKeywordNew7.js | 6 - .../Completion/src2/CompletionKeywordNew8.js | 6 - .../Completion/src2/CompletionKeywordNew9.js | 6 - .../Completion/src2/CompletionKeywordNull1.js | 5 - .../Completion/src2/CompletionKeywordNull2.js | 5 - .../Completion/src2/CompletionKeywordNull3.js | 6 - .../Completion/src2/CompletionKeywordNull4.js | 6 - .../Completion/src2/CompletionKeywordPackage1.js | 5 - .../Completion/src2/CompletionKeywordPackage3.js | 6 - .../Completion/src2/CompletionKeywordPackage4.js | 4 - .../Completion/src2/CompletionKeywordPackage5.js | 7 - .../Completion/src2/CompletionKeywordPackage6.js | 5 - .../Completion/src2/CompletionKeywordPackage7.js | 7 - .../Completion/src2/CompletionKeywordPrivate1.js | 3 - .../Completion/src2/CompletionKeywordPrivate10.js | 4 - .../Completion/src2/CompletionKeywordPrivate2.js | 3 - .../Completion/src2/CompletionKeywordPrivate3.js | 3 - .../Completion/src2/CompletionKeywordPrivate4.js | 3 - .../Completion/src2/CompletionKeywordPrivate5.js | 3 - .../Completion/src2/CompletionKeywordPrivate6.js | 4 - .../Completion/src2/CompletionKeywordPrivate7.js | 4 - .../Completion/src2/CompletionKeywordPrivate8.js | 4 - .../Completion/src2/CompletionKeywordPrivate9.js | 4 - .../Completion/src2/CompletionKeywordProtected1.js | 3 - .../src2/CompletionKeywordProtected10.js | 4 - .../Completion/src2/CompletionKeywordProtected2.js | 3 - .../Completion/src2/CompletionKeywordProtected3.js | 3 - .../Completion/src2/CompletionKeywordProtected4.js | 3 - .../Completion/src2/CompletionKeywordProtected5.js | 3 - .../Completion/src2/CompletionKeywordProtected6.js | 4 - .../Completion/src2/CompletionKeywordProtected7.js | 4 - .../Completion/src2/CompletionKeywordProtected8.js | 4 - .../Completion/src2/CompletionKeywordProtected9.js | 4 - .../Completion/src2/CompletionKeywordPublic1.js | 1 - .../Completion/src2/CompletionKeywordPublic10.js | 3 - .../Completion/src2/CompletionKeywordPublic11.js | 2 - .../Completion/src2/CompletionKeywordPublic12.js | 4 - .../Completion/src2/CompletionKeywordPublic13.js | 4 - .../Completion/src2/CompletionKeywordPublic14.js | 2 - .../Completion/src2/CompletionKeywordPublic15.js | 2 - .../Completion/src2/CompletionKeywordPublic16.js | 5 - .../Completion/src2/CompletionKeywordPublic17.js | 4 - .../Completion/src2/CompletionKeywordPublic18.js | 4 - .../Completion/src2/CompletionKeywordPublic19.js | 4 - .../Completion/src2/CompletionKeywordPublic2.js | 3 - .../Completion/src2/CompletionKeywordPublic20.js | 4 - .../Completion/src2/CompletionKeywordPublic3.js | 1 - .../Completion/src2/CompletionKeywordPublic4.js | 1 - .../Completion/src2/CompletionKeywordPublic5.js | 4 - .../Completion/src2/CompletionKeywordPublic6.js | 3 - .../Completion/src2/CompletionKeywordPublic7.js | 3 - .../Completion/src2/CompletionKeywordPublic8.js | 3 - .../Completion/src2/CompletionKeywordPublic9.js | 3 - .../Completion/src2/CompletionKeywordReturn1.js | 5 - .../Completion/src2/CompletionKeywordReturn2.js | 5 - .../Completion/src2/CompletionKeywordReturn3.js | 3 - .../Completion/src2/CompletionKeywordReturn4.js | 6 - .../Completion/src2/CompletionKeywordReturn5.js | 6 - .../Completion/src2/CompletionKeywordReturn6.js | 4 - .../Completion/src2/CompletionKeywordStatic1.js | 3 - .../Completion/src2/CompletionKeywordStatic10.js | 4 - .../Completion/src2/CompletionKeywordStatic2.js | 3 - .../Completion/src2/CompletionKeywordStatic3.js | 3 - .../Completion/src2/CompletionKeywordStatic4.js | 3 - .../Completion/src2/CompletionKeywordStatic5.js | 3 - .../Completion/src2/CompletionKeywordStatic6.js | 4 - .../Completion/src2/CompletionKeywordStatic7.js | 4 - .../Completion/src2/CompletionKeywordStatic8.js | 4 - .../Completion/src2/CompletionKeywordStatic9.js | 4 - .../Completion/src2/CompletionKeywordStrictfp1.js | 3 - .../Completion/src2/CompletionKeywordStrictfp2.js | 3 - .../Completion/src2/CompletionKeywordStrictfp3.js | 3 - .../Completion/src2/CompletionKeywordStrictfp4.js | 3 - .../Completion/src2/CompletionKeywordStrictfp5.js | 4 - .../Completion/src2/CompletionKeywordStrictfp6.js | 4 - .../Completion/src2/CompletionKeywordStrictfp7.js | 4 - .../Completion/src2/CompletionKeywordStrictfp8.js | 4 - .../Completion/src2/CompletionKeywordSuper1.js | 5 - .../Completion/src2/CompletionKeywordSuper10.js | 6 - .../Completion/src2/CompletionKeywordSuper11.js | 6 - .../Completion/src2/CompletionKeywordSuper2.js | 5 - .../Completion/src2/CompletionKeywordSuper3.js | 3 - .../Completion/src2/CompletionKeywordSuper4.js | 5 - .../Completion/src2/CompletionKeywordSuper5.js | 5 - .../Completion/src2/CompletionKeywordSuper7.js | 6 - .../Completion/src2/CompletionKeywordSuper8.js | 6 - .../Completion/src2/CompletionKeywordSuper9.js | 4 - .../Completion/src2/CompletionKeywordSwitch1.js | 5 - .../Completion/src2/CompletionKeywordSwitch2.js | 5 - .../Completion/src2/CompletionKeywordSwitch3.js | 3 - .../Completion/src2/CompletionKeywordSwitch4.js | 6 - .../Completion/src2/CompletionKeywordSwitch5.js | 6 - .../Completion/src2/CompletionKeywordSwitch6.js | 4 - .../src2/CompletionKeywordSynchronized1.js | 3 - .../src2/CompletionKeywordSynchronized10.js | 4 - .../src2/CompletionKeywordSynchronized11.js | 6 - .../src2/CompletionKeywordSynchronized12.js | 6 - .../src2/CompletionKeywordSynchronized2.js | 3 - .../src2/CompletionKeywordSynchronized3.js | 3 - .../src2/CompletionKeywordSynchronized4.js | 3 - .../src2/CompletionKeywordSynchronized5.js | 5 - .../src2/CompletionKeywordSynchronized6.js | 5 - .../src2/CompletionKeywordSynchronized7.js | 4 - .../src2/CompletionKeywordSynchronized8.js | 4 - .../src2/CompletionKeywordSynchronized9.js | 4 - .../Completion/src2/CompletionKeywordThis1.js | 5 - .../Completion/src2/CompletionKeywordThis10.js | 4 - .../Completion/src2/CompletionKeywordThis11.js | 6 - .../Completion/src2/CompletionKeywordThis12.js | 6 - .../Completion/src2/CompletionKeywordThis13.js | 6 - .../Completion/src2/CompletionKeywordThis14.js | 6 - .../Completion/src2/CompletionKeywordThis2.js | 5 - .../Completion/src2/CompletionKeywordThis3.js | 3 - .../Completion/src2/CompletionKeywordThis4.js | 5 - .../Completion/src2/CompletionKeywordThis5.js | 5 - .../Completion/src2/CompletionKeywordThis6.js | 5 - .../Completion/src2/CompletionKeywordThis7.js | 5 - .../Completion/src2/CompletionKeywordThis8.js | 6 - .../Completion/src2/CompletionKeywordThis9.js | 6 - .../Completion/src2/CompletionKeywordThrow1.js | 5 - .../Completion/src2/CompletionKeywordThrow2.js | 5 - .../Completion/src2/CompletionKeywordThrow3.js | 3 - .../Completion/src2/CompletionKeywordThrow4.js | 6 - .../Completion/src2/CompletionKeywordThrow5.js | 6 - .../Completion/src2/CompletionKeywordThrow6.js | 4 - .../Completion/src2/CompletionKeywordThrows1.js | 4 - .../Completion/src2/CompletionKeywordThrows2.js | 4 - .../Completion/src2/CompletionKeywordThrows3.js | 4 - .../Completion/src2/CompletionKeywordThrows4.js | 4 - .../Completion/src2/CompletionKeywordThrows5.js | 5 - .../Completion/src2/CompletionKeywordThrows6.js | 5 - .../Completion/src2/CompletionKeywordThrows7.js | 5 - .../Completion/src2/CompletionKeywordThrows8.js | 5 - .../Completion/src2/CompletionKeywordTransient1.js | 3 - .../Completion/src2/CompletionKeywordTransient2.js | 3 - .../Completion/src2/CompletionKeywordTransient3.js | 3 - .../Completion/src2/CompletionKeywordTransient4.js | 3 - .../Completion/src2/CompletionKeywordTransient5.js | 4 - .../Completion/src2/CompletionKeywordTransient6.js | 4 - .../Completion/src2/CompletionKeywordTransient7.js | 4 - .../Completion/src2/CompletionKeywordTransient8.js | 4 - .../Completion/src2/CompletionKeywordTrue1.js | 5 - .../Completion/src2/CompletionKeywordTrue2.js | 5 - .../Completion/src2/CompletionKeywordTrue3.js | 6 - .../Completion/src2/CompletionKeywordTrue4.js | 6 - .../Completion/src2/CompletionKeywordTry1.js | 5 - .../Completion/src2/CompletionKeywordTry2.js | 5 - .../Completion/src2/CompletionKeywordTry3.js | 3 - .../Completion/src2/CompletionKeywordTry4.js | 6 - .../Completion/src2/CompletionKeywordTry5.js | 6 - .../Completion/src2/CompletionKeywordTry6.js | 4 - .../Completion/src2/CompletionKeywordVolatile1.js | 3 - .../Completion/src2/CompletionKeywordVolatile2.js | 3 - .../Completion/src2/CompletionKeywordVolatile3.js | 3 - .../Completion/src2/CompletionKeywordVolatile4.js | 3 - .../Completion/src2/CompletionKeywordVolatile5.js | 4 - .../Completion/src2/CompletionKeywordVolatile6.js | 4 - .../Completion/src2/CompletionKeywordVolatile7.js | 4 - .../Completion/src2/CompletionKeywordVolatile8.js | 4 - .../Completion/src2/CompletionKeywordWhile1.js | 5 - .../Completion/src2/CompletionKeywordWhile10.js | 8 - .../Completion/src2/CompletionKeywordWhile2.js | 5 - .../Completion/src2/CompletionKeywordWhile3.js | 3 - .../Completion/src2/CompletionKeywordWhile4.js | 6 - .../Completion/src2/CompletionKeywordWhile5.js | 7 - .../Completion/src2/CompletionKeywordWhile6.js | 6 - .../Completion/src2/CompletionKeywordWhile7.js | 6 - .../Completion/src2/CompletionKeywordWhile8.js | 4 - .../Completion/src2/CompletionKeywordWhile9.js | 7 - .../Completion/src2/p/CompletionKeywordImport2.js | 6 - .../Completion/src2/p/CompletionKeywordImport8.js | 7 - .../Completion/src2/p/CompletionKeywordPackage2.js | 5 - .../Completion/src2/p/CompletionKeywordPackage8.js | 6 - .../workspace/Completion/src3/test0001/Test.js | 11 - .../workspace/Completion/src3/test0002/Test.js | 11 - .../workspace/Completion/src3/test0003/Test.js | 11 - .../workspace/Completion/src3/test0004/Test.js | 17 - .../workspace/Completion/src3/test0009/Test.js | 5 - .../workspace/Completion/src3/test0010/Test.js | 7 - .../workspace/Completion/src3/test0023/Test.js | 12 - .../workspace/Completion/src3/test0024/Test.js | 8 - .../workspace/Completion/src3/test0025/Test.js | 9 - .../workspace/Completion/src3/test0028/Test.js | 12 - .../workspace/Completion/src3/test0030/Test.js | 8 - .../workspace/Completion/src3/test0032/Test.js | 6 - .../workspace/Completion/src3/test0033/Test.js | 8 - .../workspace/Completion/src3/test0034/Test.js | 6 - .../workspace/Completion/src3/test0035/Test.js | 8 - .../workspace/Completion/src3/test0036/Test.js | 6 - .../workspace/Completion/src3/test0037/Test.js | 8 - .../workspace/Completion/src3/test0038/Test.js | 6 - .../workspace/Completion/src3/test0039/Test.js | 8 - .../workspace/Completion/src3/test0048/Test.js | 11 - .../workspace/Completion/src3/test0049/Test.js | 9 - .../workspace/Completion/src3/test0050/Test.js | 17 - .../workspace/Completion/src3/test0057/Test.js | 7 - .../workspace/Completion/src3/test0060/Test.js | 7 - .../workspace/Completion/src3/test0064/Test.js | 7 - .../workspace/Completion/src3/test0067/Test.js | 7 - .../workspace/Completion/src3/test0068/Test.js | 7 - .../workspace/Completion/src3/test0069/Test.js | 11 - .../workspace/Completion/src3/test0070/Test.js | 7 - .../workspace/Completion/src3/test0072/Test.js | 7 - .../workspace/Completion/src3/test0073/Test.js | 7 - .../workspace/Completion/src3/test0074/Test.js | 7 - .../workspace/Completion/test0049.jar | Bin 453 -> 0 bytes .../workspace/Completion/test0049src.zip | Bin 209 -> 0 bytes .../workspace/Completion/tmpDoc.jar | Bin 550 -> 0 bytes .../workspace/Completion/tmpDocDoc.zip | Bin 20791 -> 0 bytes .../workspace/Completion/tmpDocsrc.zip | Bin 221 -> 0 bytes .../workspace/Completion/zzz.jar | Bin 842 -> 0 bytes .../workspace/Completion/zzzsrc.zip | Bin 528 -> 0 bytes .../workspace/Converter/.project | 17 - .../workspace/Converter/.settings/.jsdtscope | 7 - .../workspace/Converter/src/Hello.js | 23 - .../workspace/Converter/src/NO_WORKING.js | 4 - .../workspace/Converter/src/Test0157.js | 3 - .../workspace/Converter/src/Test0158.js | 1 - .../workspace/Converter/src/Test0170.js | 3 - .../workspace/Converter/src/Test462.js | 2 - .../workspace/Converter/src/X.js | 0 .../Converter/src/codeManipulation/bug.js | 14 - .../src/examples.oneofeach/ASTPosterChild.js | 188 - .../Converter/src/javadoc/test000/Test.js | 36 - .../Converter/src/javadoc/test001/Test.js | 13 - .../Converter/src/javadoc/test002/Test.js | 10 - .../Converter/src/javadoc/test003/Test.js | 8 - .../Converter/src/javadoc/test004/Test.js | 12 - .../Converter/src/javadoc/test005/Test.js | 8 - .../Converter/src/javadoc/test006/Test.js | 11 - .../Converter/src/javadoc/test007/Test.js | 9 - .../Converter/src/javadoc/test008/Test.js | 15 - .../Converter/src/javadoc/test009/Test.js | 15 - .../Converter/src/javadoc/test010/Test.js | 10 - .../Converter/src/javadoc/test011/Test.js | 5 - .../Converter/src/javadoc/test012/Test.js | 8 - .../Converter/src/javadoc/test013/Test.js | 16 - .../workspace/Converter/src/javadoc/test014/X.js | 11 - .../Converter/src/javadoc/test015/Test.js | 14 - .../Converter/src/javadoc/test100/TestB1.js | 11 - .../Converter/src/javadoc/test100/TestB2.js | 11 - .../Converter/src/javadoc/test100/TestD1.js | 11 - .../Converter/src/javadoc/test100/TestD2.js | 11 - .../Converter/src/javadoc/test101/Test.js | 11 - .../Converter/src/javadoc/test102/TestB1.js | 14 - .../Converter/src/javadoc/test102/TestB2.js | 14 - .../Converter/src/javadoc/test102/TestD1.js | 14 - .../Converter/src/javadoc/test102/TestD2.js | 14 - .../Converter/src/javadoc/test103/Test.js | 14 - .../Converter/src/javadoc/test104/TestD1.js | 13 - .../Converter/src/javadoc/test104/TestD2.js | 13 - .../Converter/src/javadoc/test105/TestB1.js | 13 - .../Converter/src/javadoc/test105/TestB2.js | 13 - .../Converter/src/javadoc/test106/Test.js | 13 - .../Converter/src/javadoc/test107/TestB1.js | 14 - .../Converter/src/javadoc/test107/TestB2.js | 14 - .../Converter/src/javadoc/test107/TestD1.js | 14 - .../Converter/src/javadoc/test107/TestD2.js | 14 - .../Converter/src/javadoc/test108/Test.js | 14 - .../Converter/src/javadoc/testBug48489/TestA.js | 11 - .../Converter/src/javadoc/testBug48489/TestB.js | 8 - .../Converter/src/javadoc/testBug48489/TestC.js | 11 - .../Converter/src/javadoc/testBug48489/TestD.js | 10 - .../Converter/src/javadoc/testBug48489/TestE.js | 10 - .../Converter/src/javadoc/testBug50898/G.js | 4 - .../Converter/src/javadoc/testBug50898/Test.js | 8 - .../Converter/src/javadoc/testBug51226/X1.js | 6 - .../Converter/src/javadoc/testBug51226/X2.js | 6 - .../Converter/src/javadoc/testBug51226/X3.js | 6 - .../Converter/src/javadoc/testBug51226/X4.js | 6 - .../Converter/src/javadoc/testBug51226/X5.js | 6 - .../Converter/src/javadoc/testBug51226/X6.js | 6 - .../Converter/src/javadoc/testBug51241/X.js | 20 - .../Converter/src/javadoc/testBug51363/Test.js | 4 - .../Converter/src/javadoc/testBug51476/X1.js | 7 - .../Converter/src/javadoc/testBug51476/X2.js | 6 - .../Converter/src/javadoc/testBug51476/X3.js | 6 - .../Converter/src/javadoc/testBug51478/X1.js | 7 - .../Converter/src/javadoc/testBug51478/X2.js | 6 - .../Converter/src/javadoc/testBug51478/X3.js | 6 - .../Converter/src/javadoc/testBug51508/X.js | 7 - .../Converter/src/javadoc/testBug51600/Test.js | 17 - .../Converter/src/javadoc/testBug51617/Test.js | 10 - .../Converter/src/javadoc/testBug51650/X.js | 9 - .../Converter/src/javadoc/testBug51660/Test.js | 37 - .../Converter/src/javadoc/testBug51770/X.js | 6 - .../src/javadoc/testBug51911/TestInvalid.js | 8 - .../src/javadoc/testBug51911/TestValid1.js | 8 - .../src/javadoc/testBug51911/TestValid2.js | 7 - .../src/javadoc/testBug51911/TestValid3.js | 9 - .../Converter/src/javadoc/testBug52908/X.js | 47 - .../Converter/src/javadoc/testBug52908/Y.js | 14 - .../Converter/src/javadoc/testBug52908a/Test.js | 15 - .../Converter/src/javadoc/testBug52908unicode/X.js | 47 - .../Converter/src/javadoc/testBug52908unicode/Y.js | 14 - .../Converter/src/javadoc/testBug53075/X.js | 9 - .../Converter/src/javadoc/testBug53276/TestA.js | 15 - .../Converter/src/javadoc/testBug53276/TestB.js | 23 - .../Converter/src/javadoc/testBug53276/TestC.js | 12 - .../Converter/src/javadoc/testBug53757/Test.js | 55 - .../Converter/src/javadoc/testBug54424/Test.js | 25 - .../Converter/src/javadoc/testBug54776/Test.js | 9 - .../Converter/src/javadoc/testBug55221/a/Test.js | 18 - .../Converter/src/javadoc/testBug55221/b/Test.js | 17 - .../Converter/src/javadoc/testBug55221/c/Test.js | 16 - .../Converter/src/javadoc/testBug55221/d/Test.js | 7 - .../Converter/src/javadoc/testBug55223/TestA.js | 6 - .../Converter/src/javadoc/testBug55223/TestB.js | 10 - .../Converter/src/javadoc/testBug63044/Test.js | 11 - .../Converter/src/javadoc/testBug65174/Test.js | 39 - .../Converter/src/javadoc/testBug65253/Test.js | 15 - .../Converter/src/javadoc/testBug65253/TestD.js | 21 - .../Converter/src/javadoc/testBug65288/Test.js | 7 - .../src/javadoc/testBug68017/TestInvalid.js | 13 - .../src/javadoc/testBug68017/TestValid.js | 9 - .../src/javadoc/testBug68017/TestWarn1.js | 8 - .../src/javadoc/testBug68017/TestWarn2.js | 7 - .../Converter/src/javadoc/testBug68025/TestA.js | 12 - .../Converter/src/javadoc/testBug68025/TestB.js | 17 - .../javadoc/testBug68726/TestBug68726conform1.js | 9 - .../javadoc/testBug68726/TestBug68726conform2.js | 20 - .../javadoc/testBug68726/TestBug68726negative1.js | 21 - .../javadoc/testBug68726/TestBug68726negative2.js | 20 - .../src/javadoc/testBug69272/TestClassInvalid.js | 10 - .../src/javadoc/testBug69272/TestClassValid.js | 14 - .../src/javadoc/testBug69272/TestFieldInvalid.js | 11 - .../src/javadoc/testBug69272/TestFieldValid.js | 15 - .../src/javadoc/testBug69272/TestMethInvalid.js | 10 - .../src/javadoc/testBug69272/TestMethValid.js | 14 - .../Converter/src/javadoc/testBug69275/TestA.js | 14 - .../Converter/src/javadoc/testBug69275/TestB.js | 10 - .../src/javadoc/testBug69302/TestInvalid.js | 7 - .../src/javadoc/testBug69302/TestValid1.js | 12 - .../src/javadoc/testBug69302/TestValid2.js | 11 - .../src/javadoc/testBug70892/TestInvalid1.js | 12 - .../src/javadoc/testBug70892/TestInvalid2.js | 12 - .../src/javadoc/testBug70892/TestValid.js | 9 - .../src/javadoc/testBug73348/TestInvalid.js | 14 - .../src/javadoc/testBug73348/TestValid.js | 14 - .../Converter/src/javadoc/testBug77644/A.js | 7 - .../Converter/src/javadoc/testBug77644/B.js | 13 - .../Converter/src/javadoc/testBug77644/C.js | 16 - .../Converter/src/junit/awtui/AboutDialog.js | 67 - .../workspace/Converter/src/junit/awtui/Logo.js | 53 - .../Converter/src/junit/awtui/ProgressBar.js | 84 - .../Converter/src/junit/awtui/TestRunner.js | 539 - .../src/junit/extensions/ActiveTestSuite.js | 64 - .../src/junit/extensions/ExceptionTestCase.js | 46 - .../Converter/src/junit/extensions/RepeatedTest.js | 31 - .../src/junit/extensions/TestDecorator.js | 38 - .../Converter/src/junit/extensions/TestSetup.js | 37 - .../Converter/src/junit/framework/Assert.js | 291 - .../src/junit/framework/AssertionFailedError.js | 13 - .../src/junit/framework/ComparisonFailure.js | 68 - .../Converter/src/junit/framework/Protectable.js | 14 - .../Converter/src/junit/framework/Test.js | 17 - .../Converter/src/junit/framework/TestCase.js | 197 - .../Converter/src/junit/framework/TestFailure.js | 57 - .../Converter/src/junit/framework/TestListener.js | 23 - .../Converter/src/junit/framework/TestResult.js | 166 - .../Converter/src/junit/framework/TestSuite.js | 267 - .../Converter/src/junit/runner/BaseTestRunner.js | 323 - .../src/junit/runner/ClassPathTestCollector.js | 80 - .../src/junit/runner/FailureDetailView.js | 23 - .../src/junit/runner/LoadingTestCollector.js | 69 - .../src/junit/runner/ReloadingTestSuiteLoader.js | 19 - .../src/junit/runner/SimpleTestCollector.js | 20 - .../workspace/Converter/src/junit/runner/Sorter.js | 38 - .../src/junit/runner/StandardTestSuiteLoader.js | 19 - .../src/junit/runner/TestCaseClassLoader.js | 224 - .../Converter/src/junit/runner/TestCollector.js | 16 - .../Converter/src/junit/runner/TestRunListener.js | 19 - .../Converter/src/junit/runner/TestSuiteLoader.js | 9 - .../Converter/src/junit/runner/Version.js | 14 - .../Converter/src/junit/swingui/AboutDialog.js | 81 - .../Converter/src/junit/swingui/CounterPanel.js | 110 - .../src/junit/swingui/DefaultFailureDetailView.js | 94 - .../Converter/src/junit/swingui/FailureRunView.js | 110 - .../Converter/src/junit/swingui/ProgressBar.js | 42 - .../Converter/src/junit/swingui/StatusLine.js | 42 - .../src/junit/swingui/TestHierarchyRunView.js | 72 - .../Converter/src/junit/swingui/TestRunContext.js | 21 - .../Converter/src/junit/swingui/TestRunView.js | 37 - .../Converter/src/junit/swingui/TestRunner.js | 774 -- .../Converter/src/junit/swingui/TestSelector.js | 258 - .../Converter/src/junit/swingui/TestSuitePanel.js | 159 - .../Converter/src/junit/swingui/TestTreeModel.js | 184 - .../Converter/src/junit/textui/ResultPrinter.js | 138 - .../Converter/src/junit/textui/TestRunner.js | 189 - .../workspace/Converter/src/p1/A.js | 7 - .../workspace/Converter/src/p2/A.js | 6 - .../workspace/Converter/src/p3/B.js | 13 - .../workspace/Converter/src/test0001/Test.js | 3 - .../workspace/Converter/src/test0002/Test.js | 3 - .../workspace/Converter/src/test0003/Test.js | 3 - .../workspace/Converter/src/test0004/Test.js | 3 - .../workspace/Converter/src/test0005/Test.js | 3 - .../workspace/Converter/src/test0006/Test.js | 3 - .../workspace/Converter/src/test0007/Test.js | 6 - .../workspace/Converter/src/test0008/Test.js | 3 - .../workspace/Converter/src/test0009/Test.js | 3 - .../workspace/Converter/src/test0010/Test.js | 4 - .../workspace/Converter/src/test0011/Test.js | 8 - .../workspace/Converter/src/test0012/Test.js | 8 - .../workspace/Converter/src/test0013/Test.js | 3 - .../workspace/Converter/src/test0014/Test.js | 3 - .../workspace/Converter/src/test0015/Test.js | 4 - .../workspace/Converter/src/test0016/Test.js | 4 - .../workspace/Converter/src/test0017/Test.js | 5 - .../workspace/Converter/src/test0018/Test.js | 4 - .../workspace/Converter/src/test0019/Test.js | 4 - .../workspace/Converter/src/test0020/Test.js | 4 - .../workspace/Converter/src/test0021/Test.js | 4 - .../workspace/Converter/src/test0022/Test.js | 4 - .../workspace/Converter/src/test0023/Test.js | 4 - .../workspace/Converter/src/test0024/Test.js | 4 - .../workspace/Converter/src/test0025/Test.js | 4 - .../workspace/Converter/src/test0026/Test.js | 4 - .../workspace/Converter/src/test0027/Test.js | 4 - .../workspace/Converter/src/test0028/Test.js | 4 - .../workspace/Converter/src/test0029/Test.js | 4 - .../workspace/Converter/src/test0030/Test.js | 4 - .../workspace/Converter/src/test0031/Test.js | 4 - .../workspace/Converter/src/test0032/Test.js | 4 - .../workspace/Converter/src/test0033/Test.js | 4 - .../workspace/Converter/src/test0034/Test.js | 4 - .../workspace/Converter/src/test0035/Test.js | 6 - .../workspace/Converter/src/test0036/Test.js | 4 - .../workspace/Converter/src/test0037/Test.js | 4 - .../workspace/Converter/src/test0038/Test.js | 3 - .../workspace/Converter/src/test0039/Test.js | 3 - .../workspace/Converter/src/test0040/Test.js | 3 - .../workspace/Converter/src/test0041/Test.js | 3 - .../workspace/Converter/src/test0042/Test.js | 3 - .../workspace/Converter/src/test0043/Test.js | 3 - .../workspace/Converter/src/test0044/Test.js | 3 - .../workspace/Converter/src/test0045/Test.js | 4 - .../workspace/Converter/src/test0046/Test.js | 4 - .../workspace/Converter/src/test0047/Test.js | 3 - .../workspace/Converter/src/test0048/Test.js | 4 - .../workspace/Converter/src/test0049/Test.js | 5 - .../workspace/Converter/src/test0050/Test.js | 5 - .../workspace/Converter/src/test0051/Test.js | 5 - .../workspace/Converter/src/test0052/Test.js | 5 - .../workspace/Converter/src/test0053/Test.js | 5 - .../workspace/Converter/src/test0054/Test.js | 5 - .../workspace/Converter/src/test0055/Test.js | 6 - .../workspace/Converter/src/test0056/Test.js | 5 - .../workspace/Converter/src/test0057/Test.js | 6 - .../workspace/Converter/src/test0058/Test.js | 7 - .../workspace/Converter/src/test0059/Test.js | 5 - .../workspace/Converter/src/test0060/Test.js | 5 - .../workspace/Converter/src/test0061/Test.js | 5 - .../workspace/Converter/src/test0062/Test.js | 7 - .../workspace/Converter/src/test0063/Test.js | 6 - .../workspace/Converter/src/test0064/Test.js | 6 - .../workspace/Converter/src/test0065/Test.js | 6 - .../workspace/Converter/src/test0066/Test.js | 6 - .../workspace/Converter/src/test0067/Test.js | 5 - .../workspace/Converter/src/test0068/Test.js | 5 - .../workspace/Converter/src/test0069/Test.js | 5 - .../workspace/Converter/src/test0070/Test.js | 4 - .../workspace/Converter/src/test0071/Test.js | 4 - .../workspace/Converter/src/test0072/Test.js | 4 - .../workspace/Converter/src/test0073/Test.js | 4 - .../workspace/Converter/src/test0074/Test.js | 3 - .../workspace/Converter/src/test0075/Test.js | 3 - .../workspace/Converter/src/test0076/Test.js | 4 - .../workspace/Converter/src/test0077/Test.js | 5 - .../workspace/Converter/src/test0078/Test.js | 3 - .../workspace/Converter/src/test0079/Test.js | 3 - .../workspace/Converter/src/test0080/Test.js | 3 - .../workspace/Converter/src/test0081/Test.js | 4 - .../workspace/Converter/src/test0082/Test.js | 4 - .../workspace/Converter/src/test0083/Test.js | 4 - .../workspace/Converter/src/test0084/Test.js | 4 - .../workspace/Converter/src/test0085/Test.js | 4 - .../workspace/Converter/src/test0086/Test.js | 3 - .../workspace/Converter/src/test0087/Test.js | 4 - .../workspace/Converter/src/test0088/Test.js | 4 - .../workspace/Converter/src/test0089/Test.js | 8 - .../workspace/Converter/src/test0090/Test.js | 4 - .../workspace/Converter/src/test0091/Test.js | 3 - .../workspace/Converter/src/test0092/Test.js | 7 - .../workspace/Converter/src/test0093/Test.js | 6 - .../workspace/Converter/src/test0094/Test.js | 7 - .../workspace/Converter/src/test0095/Test.js | 6 - .../workspace/Converter/src/test0096/Test.js | 5 - .../workspace/Converter/src/test0097/Test.js | 11 - .../workspace/Converter/src/test0098/Test.js | 4 - .../workspace/Converter/src/test0099/Test.js | 5 - .../workspace/Converter/src/test0100/Test.js | 4 - .../workspace/Converter/src/test0101/Test.js | 4 - .../workspace/Converter/src/test0102/Test.js | 4 - .../workspace/Converter/src/test0103/Test.js | 4 - .../workspace/Converter/src/test0104/Test.js | 4 - .../workspace/Converter/src/test0105/Test.js | 4 - .../workspace/Converter/src/test0106/Test.js | 4 - .../workspace/Converter/src/test0107/Test.js | 5 - .../workspace/Converter/src/test0108/Test.js | 4 - .../workspace/Converter/src/test0109/Test.js | 4 - .../workspace/Converter/src/test0110/Test.js | 4 - .../workspace/Converter/src/test0111/Test.js | 5 - .../workspace/Converter/src/test0112/Test.js | 9 - .../workspace/Converter/src/test0113/Test.js | 7 - .../workspace/Converter/src/test0114/Test.js | 7 - .../workspace/Converter/src/test0115/Test.js | 8 - .../workspace/Converter/src/test0116/Test.js | 3 - .../workspace/Converter/src/test0117/Test.js | 4 - .../workspace/Converter/src/test0118/Test.js | 3 - .../workspace/Converter/src/test0119/Test.js | 5 - .../workspace/Converter/src/test0120/Test.js | 6 - .../workspace/Converter/src/test0121/Test.js | 6 - .../workspace/Converter/src/test0122/Test.js | 4 - .../workspace/Converter/src/test0123/Test.js | 5 - .../workspace/Converter/src/test0124/Test.js | 3 - .../workspace/Converter/src/test0125/Test.js | 8 - .../workspace/Converter/src/test0126/Test.js | 8 - .../workspace/Converter/src/test0127/Test.js | 8 - .../workspace/Converter/src/test0128/Test.js | 4 - .../workspace/Converter/src/test0129/Test.js | 1 - .../workspace/Converter/src/test0130/Test.js | 1 - .../workspace/Converter/src/test0131/Test.js | 6 - .../workspace/Converter/src/test0132/Test.js | 3 - .../workspace/Converter/src/test0133/Test.js | 4 - .../workspace/Converter/src/test0134/Test.js | 3 - .../workspace/Converter/src/test0135/Test.js | 3 - .../workspace/Converter/src/test0136/Test.js | 4 - .../workspace/Converter/src/test0137/Test.js | 3 - .../workspace/Converter/src/test0138/Test.js | 6 - .../workspace/Converter/src/test0139/Test.js | 7 - .../workspace/Converter/src/test0140/Test.js | 6 - .../workspace/Converter/src/test0141/Test.js | 6 - .../workspace/Converter/src/test0142/Test.js | 8 - .../workspace/Converter/src/test0143/Test.js | 7 - .../workspace/Converter/src/test0144/Test.js | 5 - .../workspace/Converter/src/test0145/Test.js | 5 - .../workspace/Converter/src/test0146/Test.js | 6 - .../workspace/Converter/src/test0147/Test.js | 7 - .../workspace/Converter/src/test0148/Test.js | 7 - .../workspace/Converter/src/test0149/Test.js | 8 - .../workspace/Converter/src/test0150/Test.js | 1 - .../workspace/Converter/src/test0151/Test.js | 4 - .../workspace/Converter/src/test0152/Test.js | 2 - .../workspace/Converter/src/test0153/Test.js | 4 - .../workspace/Converter/src/test0154/Test.js | 7 - .../workspace/Converter/src/test0155/Test.js | 1 - .../workspace/Converter/src/test0156/Test.js | 5 - .../workspace/Converter/src/test0159/Test.js | 14 - .../workspace/Converter/src/test0160/Test.js | 3 - .../workspace/Converter/src/test0161/Test.js | 5 - .../workspace/Converter/src/test0162/Test.js | 5 - .../workspace/Converter/src/test0163/Test.js | 7 - .../workspace/Converter/src/test0164/Test.js | 5 - .../workspace/Converter/src/test0165/Test.js | 8 - .../workspace/Converter/src/test0166/Test.js | 4 - .../workspace/Converter/src/test0167/Test.js | 3 - .../workspace/Converter/src/test0168/test1/Test.js | 4 - .../workspace/Converter/src/test0169/Test.js | 4 - .../workspace/Converter/src/test0171/Test.js | 8 - .../workspace/Converter/src/test0172/Test.js | 9 - .../workspace/Converter/src/test0173/Test.js | 5 - .../workspace/Converter/src/test0174/Test.js | 5 - .../workspace/Converter/src/test0175/Test.js | 1 - .../workspace/Converter/src/test0176/Test.js | 4 - .../workspace/Converter/src/test0177/Test.js | 10 - .../workspace/Converter/src/test0178/Test.js | 12 - .../workspace/Converter/src/test0179/Test.js | 10 - .../workspace/Converter/src/test0180/Test.js | 8 - .../workspace/Converter/src/test0181/Test.js | 8 - .../workspace/Converter/src/test0182/Test.js | 5 - .../workspace/Converter/src/test0183/Test.js | 5 - .../workspace/Converter/src/test0184/Test.js | 5 - .../workspace/Converter/src/test0185/Test.js | 5 - .../workspace/Converter/src/test0186/Test.js | 5 - .../workspace/Converter/src/test0187/Test.js | 6 - .../workspace/Converter/src/test0188/Test.js | 7 - .../workspace/Converter/src/test0189/Test.js | 4 - .../workspace/Converter/src/test0190/Test.js | 23 - .../workspace/Converter/src/test0191/Test.js | 4 - .../workspace/Converter/src/test0192/Test.js | 3 - .../workspace/Converter/src/test0193/Test.js | 9 - .../workspace/Converter/src/test0194/Test.js | 9 - .../workspace/Converter/src/test0195/Test.js | 18 - .../workspace/Converter/src/test0196/Test.js | 11 - .../workspace/Converter/src/test0197/Test.js | 16 - .../workspace/Converter/src/test0198/Test.js | 3 - .../workspace/Converter/src/test0199/Test.js | 3 - .../workspace/Converter/src/test0200/Test.js | 17 - .../workspace/Converter/src/test0201/Test.js | 6 - .../workspace/Converter/src/test0202/Test.js | 1 - .../workspace/Converter/src/test0203/Test.js | 1 - .../workspace/Converter/src/test0204/Test.js | 1 - .../workspace/Converter/src/test0205/Test.js | 3 - .../workspace/Converter/src/test0206/Test.js | 9 - .../workspace/Converter/src/test0207/Test.js | 3 - .../workspace/Converter/src/test0208/Test.js | 4 - .../workspace/Converter/src/test0209/Test.js | 3 - .../workspace/Converter/src/test0210/Test.js | 5 - .../workspace/Converter/src/test0211/Test.js | 6 - .../workspace/Converter/src/test0212/Test.js | 5 - .../workspace/Converter/src/test0213/Test.js | 3 - .../workspace/Converter/src/test0214/Test.js | 7 - .../workspace/Converter/src/test0215/Test.js | 6 - .../workspace/Converter/src/test0216/Test.js | 6 - .../workspace/Converter/src/test0217/Test.js | 8 - .../workspace/Converter/src/test0218/Test.js | 7 - .../workspace/Converter/src/test0219/Test.js | 5 - .../workspace/Converter/src/test0220/Test.js | 5 - .../workspace/Converter/src/test0221/Test.js | 6 - .../workspace/Converter/src/test0222/Test.js | 7 - .../workspace/Converter/src/test0223/Test.js | 7 - .../workspace/Converter/src/test0224/Test.js | 8 - .../workspace/Converter/src/test0225/Test.js | 6 - .../workspace/Converter/src/test0226/Test.js | 5 - .../workspace/Converter/src/test0227/Test.js | 19 - .../workspace/Converter/src/test0228/Test.js | 11 - .../workspace/Converter/src/test0229/Test.js | 6 - .../workspace/Converter/src/test0230/Test.js | 8 - .../workspace/Converter/src/test0231/Test.js | 7 - .../workspace/Converter/src/test0232/Test.js | 5 - .../workspace/Converter/src/test0233/Test.js | 5 - .../workspace/Converter/src/test0234/Test.js | 4 - .../workspace/Converter/src/test0235/Test.js | 6 - .../workspace/Converter/src/test0236/Test.js | 1 - .../workspace/Converter/src/test0238/Test.js | 17 - .../workspace/Converter/src/test0239/Test.js | 23 - .../workspace/Converter/src/test0240/Test.js | 14 - .../workspace/Converter/src/test0241/Test.js | 27 - .../workspace/Converter/src/test0242/Test.js | 16 - .../workspace/Converter/src/test0243/Test.js | 5 - .../workspace/Converter/src/test0244/Test.js | 5 - .../workspace/Converter/src/test0245/Test.js | 5 - .../workspace/Converter/src/test0246/Test.js | 8 - .../workspace/Converter/src/test0247/Test.js | 5 - .../workspace/Converter/src/test0248/Test.js | 3 - .../workspace/Converter/src/test0249/Test.js | 12 - .../workspace/Converter/src/test0250/Test.js | 5 - .../workspace/Converter/src/test0251/Test.js | 7 - .../workspace/Converter/src/test0252/Test.js | 14 - .../workspace/Converter/src/test0253/Test.js | 4 - .../workspace/Converter/src/test0254/Test.js | 11 - .../workspace/Converter/src/test0255/Test.js | 13 - .../workspace/Converter/src/test0256/Test.js | 14 - .../workspace/Converter/src/test0257/Test.js | 13 - .../workspace/Converter/src/test0258/Test.js | 14 - .../workspace/Converter/src/test0259/Test.js | 5 - .../workspace/Converter/src/test0260/Test.js | 5 - .../workspace/Converter/src/test0261/Test.js | 4 - .../workspace/Converter/src/test0262/Test.js | 4 - .../workspace/Converter/src/test0263/Test.js | 4 - .../workspace/Converter/src/test0264/Test.js | 11 - .../workspace/Converter/src/test0265/Test.js | 4 - .../workspace/Converter/src/test0266/Test.js | 8 - .../workspace/Converter/src/test0267/Test.js | 8 - .../workspace/Converter/src/test0268/Test.js | 8 - .../workspace/Converter/src/test0269/Test.js | 8 - .../workspace/Converter/src/test0270/Test.js | 8 - .../workspace/Converter/src/test0271/Test.js | 8 - .../workspace/Converter/src/test0272/Test.js | 4 - .../workspace/Converter/src/test0273/Test.js | 3 - .../workspace/Converter/src/test0274/Test.js | 4 - .../workspace/Converter/src/test0275/Test.js | 4 - .../workspace/Converter/src/test0276/Test.js | 4 - .../workspace/Converter/src/test0277/Test.js | 3 - .../workspace/Converter/src/test0278/Test.js | 5 - .../workspace/Converter/src/test0279/Test.js | 7 - .../workspace/Converter/src/test0280/Test.js | 5 - .../workspace/Converter/src/test0281/Test.js | 2 - .../workspace/Converter/src/test0282/Test.js | 2 - .../workspace/Converter/src/test0283/Test.js | 2 - .../workspace/Converter/src/test0284/Test.js | 2 - .../workspace/Converter/src/test0285/Test.js | 5 - .../workspace/Converter/src/test0286/Test.js | 2 - .../workspace/Converter/src/test0287/Test.js | 2 - .../workspace/Converter/src/test0288/Test.js | 2 - .../workspace/Converter/src/test0289/Test.js | 3 - .../workspace/Converter/src/test0290/Test.js | 5 - .../workspace/Converter/src/test0291/Test.js | 5 - .../workspace/Converter/src/test0292/Test.js | 5 - .../workspace/Converter/src/test0293/Test.js | 11 - .../workspace/Converter/src/test0294/Test.js | 7 - .../workspace/Converter/src/test0295/Test.js | 6 - .../workspace/Converter/src/test0296/Test.js | 7 - .../workspace/Converter/src/test0297/Test.js | 10 - .../workspace/Converter/src/test0298/Test.js | 7 - .../workspace/Converter/src/test0299/Test.js | 1 - .../workspace/Converter/src/test0300/Test.js | 1 - .../workspace/Converter/src/test0301/Test.js | 1 - .../workspace/Converter/src/test0302/Test.js | 6 - .../workspace/Converter/src/test0303/Test.js | 5 - .../workspace/Converter/src/test0304/Test.js | 2 - .../workspace/Converter/src/test0307/Test.js | 16 - .../workspace/Converter/src/test0308/Test.js | 16 - .../workspace/Converter/src/test0309/Test.js | 4 - .../workspace/Converter/src/test0310/Test.js | 10 - .../workspace/Converter/src/test0311/Test.js | 12 - .../workspace/Converter/src/test0312/Test.js | 12 - .../workspace/Converter/src/test0313/Test.js | 4 - .../workspace/Converter/src/test0314/Test.js | 1 - .../workspace/Converter/src/test0315/Test.js | 4 - .../workspace/Converter/src/test0317/Test.js | 3 - .../workspace/Converter/src/test0318/Test.js | 4 - .../workspace/Converter/src/test0319/Test.js | 4 - .../workspace/Converter/src/test0320/Test.js | 4 - .../workspace/Converter/src/test0321/Test.js | 7 - .../workspace/Converter/src/test0322/Test.js | 1 - .../workspace/Converter/src/test0323/Test.js | 5 - .../workspace/Converter/src/test0324/Test.js | 8 - .../workspace/Converter/src/test0325/Test.js | 8 - .../workspace/Converter/src/test0326/A.js | 7 - .../workspace/Converter/src/test0327/Test.js | 9 - .../workspace/Converter/src/test0328/Test.js | 7 - .../workspace/Converter/src/test0329/Test.js | 7 - .../workspace/Converter/src/test0330/Test.js | 13 - .../workspace/Converter/src/test0331/Test.js | 5 - .../src/test0332/LocalSelectionTransfer.js | 88 - .../workspace/Converter/src/test0333/Test.js | 7 - .../workspace/Converter/src/test0334/Test.js | 7 - .../src/test0335/ExceptionTestCaseTest.js | 8 - .../workspace/Converter/src/test0336/SorterTest.js | 11 - .../workspace/Converter/src/test0337/Test.js | 9 - .../workspace/Converter/src/test0338/Test.js | 8 - .../workspace/Converter/src/test0339/Test.js | 6 - .../workspace/Converter/src/test0341/A.js | 29 - .../workspace/Converter/src/test0342/Test.js | 19 - .../workspace/Converter/src/test0343/Test.js | 13 - .../workspace/Converter/src/test0344/Test.js | 14 - .../workspace/Converter/src/test0345/A.js | 14 - .../workspace/Converter/src/test0346/Test2.js | 9 - .../workspace/Converter/src/test0347/Test2.js | 9 - .../workspace/Converter/src/test0348/Test2.js | 9 - .../workspace/Converter/src/test0349/Test2.js | 7 - .../workspace/Converter/src/test0350/Test2.js | 7 - .../workspace/Converter/src/test0351/Test2.js | 6 - .../workspace/Converter/src/test0352/Test2.js | 6 - .../workspace/Converter/src/test0353/Test.js | 10 - .../workspace/Converter/src/test0354/Test.js | 12 - .../workspace/Converter/src/test0355/Foo.js | 10 - .../workspace/Converter/src/test0356/A.js | 8 - .../workspace/Converter/src/test0356/X.js | 7 - .../workspace/Converter/src/test0357/A.js | 3 - .../workspace/Converter/src/test0358/A.js | 6 - .../workspace/Converter/src/test0359/A.js | 6 - .../workspace/Converter/src/test0360/X.js | 9 - .../workspace/Converter/src/test0361/X.js | 9 - .../workspace/Converter/src/test0362/Test.js | 4 - .../workspace/Converter/src/test0363/A.js | 8 - .../workspace/Converter/src/test0364/A.js | 9 - .../workspace/Converter/src/test0365/A.js | 9 - .../workspace/Converter/src/test0366/A.js | 9 - .../workspace/Converter/src/test0367/A.js | 9 - .../workspace/Converter/src/test0368/A.js | 9 - .../workspace/Converter/src/test0369/A.js | 3 - .../workspace/Converter/src/test0370/Test.js | 4 - .../workspace/Converter/src/test0371/A.js | 9 - .../workspace/Converter/src/test0372/A.js | 9 - .../workspace/Converter/src/test0373/A.js | 11 - .../workspace/Converter/src/test0374/A.js | 11 - .../workspace/Converter/src/test0375/A.js | 8 - .../workspace/Converter/src/test0376/A.js | 7 - .../workspace/Converter/src/test0377/A.js | 7 - .../workspace/Converter/src/test0378/A.js | 8 - .../workspace/Converter/src/test0379/Test.js | 7 - .../workspace/Converter/src/test0380/A.js | 7 - .../workspace/Converter/src/test0381/A.js | 7 - .../workspace/Converter/src/test0382/A.js | 4 - .../workspace/Converter/src/test0383/A.js | 8 - .../workspace/Converter/src/test0384/A.js | 8 - .../workspace/Converter/src/test0385/A.js | 8 - .../workspace/Converter/src/test0386/A.js | 14 - .../workspace/Converter/src/test0387/A.js | 7 - .../workspace/Converter/src/test0388/A.js | 4 - .../workspace/Converter/src/test0389/A.js | 6 - .../workspace/Converter/src/test0390/A.js | 7 - .../workspace/Converter/src/test0391/A.js | 7 - .../workspace/Converter/src/test0392/A.js | 7 - .../workspace/Converter/src/test0393/A.js | 7 - .../workspace/Converter/src/test0394/A.js | 7 - .../workspace/Converter/src/test0395/A.js | 7 - .../workspace/Converter/src/test0396/A.js | 7 - .../workspace/Converter/src/test0397/A.js | 7 - .../workspace/Converter/src/test0398/A.js | 7 - .../workspace/Converter/src/test0399/A.js | 8 - .../workspace/Converter/src/test0400/A.js | 10 - .../workspace/Converter/src/test0401/A.js | 7 - .../workspace/Converter/src/test0402/A.js | 14 - .../workspace/Converter/src/test0403/A.js | 12 - .../workspace/Converter/src/test0404/A.js | 8 - .../workspace/Converter/src/test0405/A.js | 13 - .../workspace/Converter/src/test0406/A.js | 10 - .../workspace/Converter/src/test0406_a/A.js | 6 - .../workspace/Converter/src/test0407/A.js | 9 - .../workspace/Converter/src/test0408/A.js | 7 - .../workspace/Converter/src/test0409/A.js | 102 - .../workspace/Converter/src/test0410/A.js | 7 - .../workspace/Converter/src/test0411/A.js | 12 - .../workspace/Converter/src/test0412/A.js | 5 - .../workspace/Converter/src/test0413/A.js | 8 - .../workspace/Converter/src/test0414/A.js | 11 - .../workspace/Converter/src/test0414/B.js | 4 - .../workspace/Converter/src/test0415/A.js | 13 - .../workspace/Converter/src/test0416/A.js | 11 - .../workspace/Converter/src/test0417/A.js | 7 - .../workspace/Converter/src/test0418/A.js | 10 - .../workspace/Converter/src/test0419/A.js | 14 - .../workspace/Converter/src/test0420/A.js | 7 - .../workspace/Converter/src/test0421/A.js | 7 - .../workspace/Converter/src/test0422/A.js | 7 - .../workspace/Converter/src/test0423/A.js | 7 - .../workspace/Converter/src/test0424/A.js | 7 - .../workspace/Converter/src/test0425/A.js | 7 - .../workspace/Converter/src/test0426/A.js | 12 - .../workspace/Converter/src/test0427/A.js | 13 - .../workspace/Converter/src/test0428/A.js | 12 - .../workspace/Converter/src/test0429/A.js | 11 - .../workspace/Converter/src/test0430/A.js | 14 - .../workspace/Converter/src/test0431/A.js | 12 - .../workspace/Converter/src/test0432/A.js | 11 - .../workspace/Converter/src/test0433/A.js | 11 - .../workspace/Converter/src/test0434/A.js | 11 - .../workspace/Converter/src/test0435/A.js | 11 - .../workspace/Converter/src/test0436/A.js | 12 - .../workspace/Converter/src/test0437/A.js | 12 - .../workspace/Converter/src/test0438/D.js | 6 - .../workspace/Converter/src/test0438_a/W.js | 4 - .../workspace/Converter/src/test0439/C.js | 6 - .../workspace/Converter/src/test0439/E.js | 7 - .../workspace/Converter/src/test0440/A.js | 7 - .../workspace/Converter/src/test0441/A.js | 7 - .../workspace/Converter/src/test0442/A.js | 7 - .../workspace/Converter/src/test0443/A.js | 7 - .../workspace/Converter/src/test0444/A.js | 11 - .../workspace/Converter/src/test0445/A.js | 11 - .../workspace/Converter/src/test0446/A.js | 7 - .../workspace/Converter/src/test0447/A.js | 12 - .../workspace/Converter/src/test0448/A.js | 6 - .../workspace/Converter/src/test0449/A.js | 7 - .../workspace/Converter/src/test0450/A.js | 22 - .../workspace/Converter/src/test0451/A.js | 6 - .../workspace/Converter/src/test0453/A.js | 7 - .../workspace/Converter/src/test0454/A.js | 10 - .../workspace/Converter/src/test0455/A.js | 10 - .../workspace/Converter/src/test0456/A.js | 17 - .../workspace/Converter/src/test0457/A.js | 10 - .../workspace/Converter/src/test0458/A.js | 10 - .../workspace/Converter/src/test0459/A.js | 10 - .../workspace/Converter/src/test0460/A.js | 9 - .../workspace/Converter/src/test0461/A.js | 7 - .../workspace/Converter/src/test0463/A.js | 7 - .../workspace/Converter/src/test0464/A.js | 9 - .../workspace/Converter/src/test0465/A.js | 11 - .../workspace/Converter/src/test0466/Assert.js | 15 - .../workspace/Converter/src/test0467/Assert.js | 16 - .../workspace/Converter/src/test0468/A.js | 14 - .../workspace/Converter/src/test0470/A.js | 13 - .../workspace/Converter/src/test0471/A.js | 15 - .../workspace/Converter/src/test0473/A.js | 10 - .../workspace/Converter/src/test0474/A.js | 14 - .../workspace/Converter/src/test0475/A.js | 14 - .../workspace/Converter/src/test0476/A.js | 14 - .../workspace/Converter/src/test0477/A.js | 19 - .../workspace/Converter/src/test0478/A.js | 13 - .../workspace/Converter/src/test0479/A.js | 13 - .../workspace/Converter/src/test0480/A.js | 11 - .../workspace/Converter/src/test0481/A.js | 11 - .../workspace/Converter/src/test0482/A.js | 13 - .../workspace/Converter/src/test0483/A.js | 16 - .../workspace/Converter/src/test0484/A.js | 13 - .../workspace/Converter/src/test0485/A.js | 17 - .../workspace/Converter/src/test0486/A.js | 14 - .../workspace/Converter/src/test0487/A.js | 27 - .../workspace/Converter/src/test0488/A.js | 27 - .../workspace/Converter/src/test0489/A.js | 13 - .../workspace/Converter/src/test0490/A.js | 11 - .../workspace/Converter/src/test0490/B.js | 6 - .../workspace/Converter/src/test0491/A.js | 8 - .../workspace/Converter/src/test0492/A.js | 8 - .../workspace/Converter/src/test0493/A.js | 5 - .../workspace/Converter/src/test0494/A.js | 5 - .../workspace/Converter/src/test0495/A.js | 5 - .../workspace/Converter/src/test0496/A.js | 5 - .../workspace/Converter/src/test0497/A.js | 5 - .../workspace/Converter/src/test0498/A.js | 12 - .../workspace/Converter/src/test0499/A.js | 6 - .../workspace/Converter/src/test0500/A.js | 13 - .../workspace/Converter/src/test0501/JavaEditor.js | 3243 ----- .../workspace/Converter/src/test0502/A.js | 28 - .../workspace/Converter/src/test0503/A.js | 27 - .../workspace/Converter/src/test0504/A.js | 14 - .../workspace/Converter/src/test0505/A.js | 14 - .../workspace/Converter/src/test0506/A.js | 7 - .../workspace/Converter/src/test0507/A.js | 7 - .../workspace/Converter/src/test0507/B.js | 4 - .../workspace/Converter/src/test0508/A.js | 9 - .../workspace/Converter/src/test0509/A.js | 7 - .../workspace/Converter/src/test0509/B.js | 6 - .../workspace/Converter/src/test0510/A.js | 7 - .../workspace/Converter/src/test0511/A.js | 7 - .../workspace/Converter/src/test0512/A.js | 5 - .../workspace/Converter/src/test0513/A.js | 6 - .../workspace/Converter/src/test0514/A.js | 7 - .../workspace/Converter/src/test0515/A.js | 12 - .../workspace/Converter/src/test0516/A.js | 11 - .../workspace/Converter/src/test0517/A.js | 8 - .../workspace/Converter/src/test0518/A.js | 11 - .../workspace/Converter/src/test0519/A.js | 10 - .../workspace/Converter/src/test0520/A.js | 10 - .../workspace/Converter/src/test0521/A.js | 6 - .../workspace/Converter/src/test0522/A.js | 13 - .../workspace/Converter/src/test0523/A.js | 13 - .../workspace/Converter/src/test0524/A.js | 11 - .../workspace/Converter/src/test0525/A.js | 11 - .../workspace/Converter/src/test0526/A.js | 13 - .../workspace/Converter/src/test0527/A.js | 16 - .../workspace/Converter/src/test0528/A.js | 13 - .../workspace/Converter/src/test0529/A.js | 17 - .../workspace/Converter/src/test0530/A.js | 14 - .../workspace/Converter/src/test0531/A.js | 27 - .../workspace/Converter/src/test0532/A.js | 27 - .../workspace/Converter/src/test0533/A.js | 7 - .../workspace/Converter/src/test0534/A.js | 5 - .../workspace/Converter/src/test0535/A.js | 7 - .../workspace/Converter/src/test0536/A.js | 505 - .../workspace/Converter/src/test0537/A.js | 4 - .../workspace/Converter/src/test0537/B.js | 4 - .../workspace/Converter/src/test0537/C.js | 4 - .../workspace/Converter/src/test0538/A.js | 3 - .../workspace/Converter/src/test0539/A.js | 7 - .../workspace/Converter/src/test0541/A.js | 11 - .../workspace/Converter/src/test0541/B.js | 21 - .../workspace/Converter/src/test0542/A.js | 14 - .../workspace/Converter/src/test0543/A.js | 8 - .../workspace/Converter/src/test0544/A.js | 7 - .../workspace/Converter/src/test0545/First.js | 12 - .../workspace/Converter/src/test0545/Second.js | 11 - .../workspace/Converter/src/test0545/Test.js | 6 - .../workspace/Converter/src/test0545/Third.js | 9 - .../workspace/Converter/src/test0546/A.js | 10 - .../workspace/Converter/src/test0547/A.js | 12 - .../Converter/src/test0548/PaletteStackEditPart.js | 16 - .../workspace/Converter/src/test0549/A.js | 8 - .../workspace/Converter/src/test0550/A.js | 6 - .../workspace/Converter/src/test0551/A.js | 7 - .../workspace/Converter/src/test0552/Test.js | 7 - .../workspace/Converter/src/test0553/A.js | 8 - .../workspace/Converter/src/test0554/A.js | 8 - .../workspace/Converter/src/test0554/B.js | 9 - .../workspace/Converter/src/test0555/A.js | 8 - .../workspace/Converter/src/test0555/B.js | 9 - .../workspace/Converter/src/test0556/A.js | 13 - .../workspace/Converter/src/test0557/A.js | 18 - .../workspace/Converter/src/test0559/A.js | 8 - .../workspace/Converter/src/test0560/A.js | 8 - .../workspace/Converter/src/test0561/A.js | 8 - .../workspace/Converter/src/test0562/A.js | 8 - .../workspace/Converter/src/test0563/A.js | 8 - .../workspace/Converter/src/test0564/A.js | 8 - .../workspace/Converter/src/test0565/A.js | 8 - .../workspace/Converter/src/test0566/A.js | 6 - .../workspace/Converter/src/test0567/A.js | 7 - .../workspace/Converter/src/test0568/A.js | 8 - .../workspace/Converter/src/test0569/A.js | 19 - .../workspace/Converter/src/test0570/A.js | 9 - .../workspace/Converter/src/test0573/X.js | 6 - .../workspace/Converter/src/test0573/Y.js | 6 - .../workspace/Converter/src/test0573/Z.js | 12 - .../workspace/Converter/src/test0574/X.js | 17 - .../workspace/Converter/src/test0575/X.js | 17 - .../workspace/Converter/src/test0578/X.js | 51 - .../workspace/Converter/src/test0579/ParserTask.js | 91 - .../src/test0580/DiamondSquareTerrainGenerator.js | 123 - .../workspace/Converter/src/test0582/X.js | 6 - .../workspace/Converter/src/test0595/X.js | 9 - .../workspace/Converter/src/test0595a/A.js | 6 - .../workspace/Converter/src/test0597/X.js | 10 - .../workspace/Converter/src/test0599/X.js | 7 - .../workspace/Converter/src/test0600/C.js | 7 - .../workspace/Converter/src/test0600/Try.js | 7 - .../workspace/Converter/src/test0602/X.js | 2890 ---- .../workspace/Converter/src/test0603/X.js | 15 - .../workspace/Converter/src/test0604/X.js | 15 - .../workspace/Converter/src/test0605/X.js | 16 - .../workspace/Converter/src/test0606/X.js | 7 - .../workspace/Converter/src/test0610/Test.js | 5 - .../workspace/Converter/src/test0610/X.js | 5 - .../workspace/Converter/src/test0619/A.js | 6 - .../workspace/Converter/src/test0629/X.js | 5 - .../workspace/Converter/src/test0630/X.js | 7 - .../workspace/Converter/src/test0631/X.js | 5 - .../workspace/Converter/src/test0653/A.js | 9 - .../workspace/Converter/src/test0653/X.js | 22 - .../workspace/Converter/src/test0657/A.js | 3 - .../workspace/Converter/src/test0657/X.js | 4 - .../workspace/CreateMembers/.project | 17 - .../workspace/CreateMembers/.settings/.jsdtscope | 6 - .../workspace/CreateMembers/src/A.js | 1 - .../workspace/CreateMembers/src/A2.js | 1 - .../workspace/CreateMembers/src/Annot.js | 3 - .../workspace/CreateMembers/src/E.js | 4 - .../workspace/CreateMembers/src/E2.js | 3 - .../workspace/CreateMembers/src/E3.js | 3 - .../workspace/Encoding/.classpath | 8 - .../workspace/Encoding/.project | 17 - .../workspace/Encoding/src/testBug110576/Test.js | 10 - .../workspace/Encoding/src/testBug66898/Test.js | 22 - .../workspace/Encoding/src/testBug66898b/Test.js | 22 - .../workspace/Encoding/src/testUTF8/Test.js | 22 - .../workspace/Encoding/src/testUTF8BOM/Test.js | 22 - .../workspace/Encoding/testUTF8.jar | Bin 1737 -> 0 bytes .../workspace/Encoding/testUTF8.zip | Bin 1038 -> 0 bytes .../workspace/Formatter/.project | 17 - .../workspace/Formatter/.settings/.jsdtscope | 6 - .../workspace/Formatter/test001/A_in.js | 5 - .../workspace/Formatter/test001/A_out.js | 4 - .../workspace/Formatter/test002/A_in.js | 4 - .../workspace/Formatter/test002/A_out.js | 4 - .../workspace/Formatter/test003/A_in.js | 8 - .../workspace/Formatter/test003/A_out.js | 10 - .../workspace/Formatter/test004/A_in.js | 8 - .../workspace/Formatter/test004/A_out.js | 6 - .../workspace/Formatter/test005/A_in.js | 8 - .../workspace/Formatter/test005/A_out.js | 8 - .../workspace/Formatter/test006/A_in.js | 10 - .../workspace/Formatter/test006/A_out.js | 12 - .../workspace/Formatter/test007/A_in.js | 14 - .../workspace/Formatter/test007/A_out.js | 16 - .../workspace/Formatter/test008/A_in.js | 6 - .../workspace/Formatter/test008/A_out.js | 15 - .../workspace/Formatter/test009/A_in.js | 4 - .../workspace/Formatter/test009/A_out.js | 4 - .../workspace/Formatter/test010/A_in.js | 1 - .../workspace/Formatter/test010/A_out.js | 3 - .../workspace/Formatter/test011/A_in.js | 7 - .../workspace/Formatter/test011/A_out.js | 16 - .../workspace/Formatter/test012/A_in.js | 2 - .../workspace/Formatter/test012/A_out.js | 8 - .../workspace/Formatter/test013/A_in.js | 4 - .../workspace/Formatter/test013/A_out.js | 10 - .../workspace/Formatter/test014/A_in.js | 6 - .../workspace/Formatter/test014/A_out.js | 11 - .../workspace/Formatter/test015/A_in.js | 8 - .../workspace/Formatter/test015/A_out.js | 8 - .../workspace/Formatter/test016/A_in.js | 5 - .../workspace/Formatter/test016/A_out.js | 12 - .../workspace/Formatter/test017/A_in.js | 7 - .../workspace/Formatter/test017/A_out.js | 9 - .../workspace/Formatter/test018/A_in.js | 5 - .../workspace/Formatter/test018/A_out.js | 5 - .../workspace/Formatter/test019/A_1_in.js | 5 - .../workspace/Formatter/test019/A_1_out.js | 12 - .../workspace/Formatter/test019/A_2_in.js | 4 - .../workspace/Formatter/test019/A_2_out.js | 12 - .../workspace/Formatter/test020/A_in.js | 5 - .../workspace/Formatter/test020/A_out.js | 7 - .../workspace/Formatter/test021/A_in.js | 4 - .../workspace/Formatter/test021/A_out.js | 6 - .../workspace/Formatter/test022/A_in.js | 6 - .../workspace/Formatter/test022/A_out.js | 6 - .../workspace/Formatter/test023/A_in.js | 14 - .../workspace/Formatter/test023/A_out.js | 14 - .../workspace/Formatter/test024/A_in.js | 8 - .../workspace/Formatter/test024/A_out.js | 11 - .../workspace/Formatter/test025/A_in.js | 6 - .../workspace/Formatter/test025/A_out.js | 6 - .../workspace/Formatter/test026/A_in.js | 8 - .../workspace/Formatter/test026/A_out.js | 17 - .../workspace/Formatter/test027/A_in.js | 5 - .../workspace/Formatter/test027/A_out.js | 9 - .../workspace/Formatter/test028/A_in.js | 5 - .../workspace/Formatter/test028/A_out.js | 6 - .../workspace/Formatter/test029/A_in.js | 8 - .../workspace/Formatter/test029/A_out.js | 19 - .../workspace/Formatter/test030/A_in.js | 13 - .../workspace/Formatter/test030/A_out.js | 19 - .../workspace/Formatter/test031/A_in.js | 8 - .../workspace/Formatter/test031/A_out.js | 21 - .../workspace/Formatter/test032/A_in.js | 3 - .../workspace/Formatter/test032/A_out.js | 8 - .../workspace/Formatter/test033/A_in.js | 4 - .../workspace/Formatter/test033/A_out.js | 6 - .../workspace/Formatter/test034/A_in.js | 3 - .../workspace/Formatter/test034/A_out.js | 9 - .../workspace/Formatter/test035/A_in.js | 3 - .../workspace/Formatter/test035/A_out.js | 8 - .../workspace/Formatter/test036/A_in.js | 3 - .../workspace/Formatter/test036/A_out.js | 8 - .../workspace/Formatter/test037/A_in.js | 10 - .../workspace/Formatter/test037/A_out.js | 10 - .../workspace/Formatter/test038/A_in.js | 6 - .../workspace/Formatter/test038/A_out.js | 9 - .../workspace/Formatter/test039/A_in.js | 5 - .../workspace/Formatter/test039/A_out.js | 9 - .../workspace/Formatter/test040/A_in.js | 3 - .../workspace/Formatter/test040/A_out.js | 6 - .../workspace/Formatter/test041/A_in.js | 2 - .../workspace/Formatter/test041/A_out.js | 1 - .../workspace/Formatter/test042/A_in.js | 10 - .../workspace/Formatter/test042/A_out.js | 14 - .../workspace/Formatter/test043/A_in.js | 8 - .../workspace/Formatter/test043/A_out.js | 7 - .../workspace/Formatter/test044/A_in.js | 1 - .../workspace/Formatter/test044/A_out.js | 3 - .../workspace/Formatter/test045/A_in.js | 8 - .../workspace/Formatter/test045/A_out.js | 8 - .../workspace/Formatter/test046/A_in.js | 1 - .../workspace/Formatter/test046/A_out.js | 1 - .../workspace/Formatter/test047/A_in.js | 2 - .../workspace/Formatter/test047/A_out.js | 1 - .../workspace/Formatter/test048/A_in.js | 1 - .../workspace/Formatter/test048/A_out.js | 5 - .../workspace/Formatter/test049/A_in.js | 1 - .../workspace/Formatter/test049/A_out.js | 14 - .../workspace/Formatter/test050/A_in.js | 1 - .../workspace/Formatter/test050/A_out.js | 1 - .../workspace/Formatter/test051/A_in.js | 1 - .../workspace/Formatter/test051/A_out.js | 14 - .../workspace/Formatter/test052/A_in.js | 8 - .../workspace/Formatter/test052/A_out.js | 10 - .../workspace/Formatter/test053/A_in.js | 15 - .../workspace/Formatter/test053/A_out.js | 17 - .../workspace/Formatter/test054/A_in.js | 15 - .../workspace/Formatter/test054/A_out.js | 17 - .../workspace/Formatter/test055/A_in.js | 31 - .../workspace/Formatter/test055/A_out.js | 32 - .../workspace/Formatter/test056/A_in.js | 1 - .../workspace/Formatter/test056/A_out.js | 2 - .../workspace/Formatter/test057/A_in.js | 293 - .../workspace/Formatter/test057/A_out.js | 289 - .../workspace/Formatter/test058/A_in.js | 135 - .../workspace/Formatter/test058/A_out.js | 117 - .../workspace/Formatter/test059/Parser_in.js | 293 - .../workspace/Formatter/test059/Parser_out.js | 289 - .../workspace/Formatter/test060/Parser_in.js | 135 - .../workspace/Formatter/test060/Parser_out.js | 117 - .../workspace/Formatter/test061/Parser_in.js | 135 - .../workspace/Formatter/test061/Parser_out.js | 117 - .../workspace/Formatter/test062/A_in.js | 1 - .../workspace/Formatter/test062/A_out.js | 5 - .../workspace/Formatter/test063/A_in.js | 5 - .../workspace/Formatter/test063/A_out.js | 7 - .../workspace/Formatter/test064/A_in.js | 10 - .../workspace/Formatter/test064/A_out.js | 11 - .../workspace/Formatter/test065/A_in.js | 14 - .../workspace/Formatter/test065/A_out.js | 16 - .../workspace/Formatter/test066/A_in.js | 14 - .../workspace/Formatter/test066/A_out.js | 11 - .../workspace/Formatter/test067/A_in.js | 14 - .../workspace/Formatter/test067/A_out.js | 15 - .../workspace/Formatter/test068/A_in.js | 23 - .../workspace/Formatter/test068/A_out.js | 21 - .../workspace/Formatter/test069/A_in.js | 6 - .../workspace/Formatter/test069/A_out.js | 9 - .../workspace/Formatter/test070/A_in.js | 2 - .../workspace/Formatter/test070/A_out.js | 2 - .../workspace/Formatter/test071/A_in.js | 5 - .../workspace/Formatter/test071/A_out.js | 5 - .../workspace/Formatter/test072/A_in.js | 3 - .../workspace/Formatter/test072/A_out.js | 4 - .../workspace/Formatter/test073/A_in.js | 38 - .../workspace/Formatter/test073/A_out.js | 31 - .../workspace/Formatter/test074/A_in.js | 8 - .../workspace/Formatter/test074/A_out.js | 12 - .../workspace/Formatter/test075/A_in.js | 4 - .../workspace/Formatter/test075/A_out.js | 7 - .../workspace/Formatter/test076/A_in.js | 7 - .../workspace/Formatter/test076/A_out.js | 4 - .../workspace/Formatter/test077/A_in.js | 15 - .../workspace/Formatter/test077/A_out.js | 11 - .../workspace/Formatter/test078/A_in.js | 1 - .../workspace/Formatter/test078/A_out.js | 6 - .../workspace/Formatter/test079/A_in.js | 8 - .../workspace/Formatter/test079/A_out.js | 2 - .../workspace/Formatter/test080/A_in.js | 1 - .../workspace/Formatter/test080/A_out.js | 3 - .../workspace/Formatter/test081/A_in.js | 1 - .../workspace/Formatter/test081/A_out.js | 5 - .../workspace/Formatter/test082/A_in.js | 13 - .../workspace/Formatter/test082/A_out.js | 11 - .../workspace/Formatter/test083/A_in.js | 28 - .../workspace/Formatter/test083/A_out.js | 26 - .../workspace/Formatter/test084/A_in.js | 9 - .../workspace/Formatter/test084/A_out.js | 9 - .../workspace/Formatter/test085/A_in.js | 9 - .../workspace/Formatter/test085/A_out.js | 9 - .../workspace/Formatter/test086/A_in.js | 9 - .../workspace/Formatter/test086/A_out.js | 15 - .../workspace/Formatter/test087/A_in.js | 3 - .../workspace/Formatter/test087/A_out.js | 3 - .../workspace/Formatter/test088/A_in.js | 3 - .../workspace/Formatter/test088/A_out.js | 5 - .../workspace/Formatter/test089/A_in.js | 1 - .../workspace/Formatter/test089/A_out.js | 1 - .../workspace/Formatter/test090/A_in.js | 1 - .../workspace/Formatter/test090/A_out.js | 1 - .../workspace/Formatter/test091/A_in.js | 1 - .../workspace/Formatter/test091/A_out.js | 1 - .../workspace/Formatter/test092/A_in.js | 1 - .../workspace/Formatter/test092/A_out.js | 2 - .../workspace/Formatter/test093/A_in.js | 2 - .../workspace/Formatter/test093/A_out.js | 1 - .../workspace/Formatter/test094/A_in.js | 1 - .../workspace/Formatter/test094/A_out.js | 1 - .../workspace/Formatter/test095/A_in.js | 1 - .../workspace/Formatter/test095/A_out.js | 4 - .../workspace/Formatter/test096/A_in.js | 5 - .../workspace/Formatter/test096/A_out.js | 6 - .../workspace/Formatter/test097/A_in.js | 11 - .../workspace/Formatter/test097/A_out.js | 4 - .../workspace/Formatter/test098/A_in.js | 6 - .../workspace/Formatter/test098/A_out.js | 10 - .../workspace/Formatter/test099/A_in.js | 3 - .../workspace/Formatter/test099/A_out.js | 3 - .../workspace/Formatter/test100/B_in.js | 3 - .../workspace/Formatter/test100/B_out.js | 3 - .../workspace/Formatter/test100/C_in.js | 3 - .../workspace/Formatter/test100/C_out.js | 3 - .../workspace/Formatter/test100/D_in.js | 3 - .../workspace/Formatter/test100/D_out.js | 3 - .../workspace/Formatter/test100/E_in.js | 3 - .../workspace/Formatter/test100/E_out.js | 3 - .../workspace/Formatter/test100/F_in.js | 3 - .../workspace/Formatter/test100/F_out.js | 3 - .../workspace/Formatter/test100/G_in.js | 3 - .../workspace/Formatter/test100/G_out.js | 3 - .../workspace/Formatter/test101/A_in.js | 6 - .../workspace/Formatter/test101/A_out.js | 9 - .../workspace/Formatter/test102/A_in.js | 6 - .../workspace/Formatter/test102/A_out.js | 5 - .../workspace/Formatter/test103/A_in.js | 5 - .../workspace/Formatter/test103/A_out.js | 4 - .../workspace/Formatter/test104/A_in.js | 1 - .../workspace/Formatter/test104/A_out.js | 6 - .../workspace/Formatter/test105/A_in.js | 7 - .../workspace/Formatter/test105/A_out.js | 10 - .../workspace/Formatter/test106/A_in.js | 1 - .../workspace/Formatter/test106/A_out.js | 2 - .../workspace/Formatter/test107/A_in.js | 6 - .../workspace/Formatter/test107/A_out.js | 6 - .../workspace/Formatter/test108/A_in.js | 10 - .../workspace/Formatter/test108/A_out.js | 10 - .../workspace/Formatter/test109/A_in.js | 2 - .../workspace/Formatter/test109/A_out.js | 5 - .../workspace/Formatter/test110/A_in.js | 2 - .../workspace/Formatter/test110/A_out.js | 4 - .../workspace/Formatter/test111/A_in.js | 4 - .../workspace/Formatter/test111/A_out.js | 7 - .../workspace/Formatter/test112/A_in.js | 4 - .../workspace/Formatter/test112/A_out.js | 7 - .../workspace/Formatter/test113/A_in.js | 5 - .../workspace/Formatter/test113/A_out.js | 12 - .../workspace/Formatter/test114/A_in.js | 4 - .../workspace/Formatter/test114/A_out.js | 7 - .../workspace/Formatter/test115/A_in.js | 4 - .../workspace/Formatter/test115/A_out.js | 7 - .../workspace/Formatter/test116/A_in.js | 4 - .../workspace/Formatter/test116/A_out.js | 7 - .../workspace/Formatter/test117/A_in.js | 5 - .../workspace/Formatter/test117/A_out.js | 8 - .../workspace/Formatter/test118/A_in.js | 5 - .../workspace/Formatter/test118/A_out.js | 8 - .../workspace/Formatter/test119/A_in.js | 1 - .../workspace/Formatter/test119/A_out.js | 6 - .../workspace/Formatter/test120/A_in.js | 22 - .../workspace/Formatter/test120/A_out.js | 20 - .../workspace/Formatter/test121/A_in.js | 3 - .../workspace/Formatter/test121/A_out.js | 5 - .../workspace/Formatter/test122/A_in.js | 3 - .../workspace/Formatter/test122/A_out.js | 5 - .../workspace/Formatter/test123/A_in.js | 5 - .../workspace/Formatter/test123/A_out.js | 8 - .../workspace/Formatter/test124/A_in.js | 4 - .../workspace/Formatter/test124/A_out.js | 7 - .../workspace/Formatter/test125/A_in.js | 1 - .../workspace/Formatter/test125/A_out.js | 1 - .../workspace/Formatter/test126/A_in.js | 5 - .../workspace/Formatter/test126/A_out.js | 8 - .../workspace/Formatter/test127/A_in.js | 5 - .../workspace/Formatter/test127/A_out.js | 8 - .../workspace/Formatter/test128/A_in.js | 5 - .../workspace/Formatter/test128/A_out.js | 5 - .../workspace/Formatter/test129/A_in.js | 4 - .../workspace/Formatter/test129/A_out.js | 4 - .../workspace/Formatter/test130/A_in.js | 19 - .../workspace/Formatter/test130/A_out.js | 20 - .../workspace/Formatter/test131/A_in.js | 16 - .../workspace/Formatter/test131/A_out.js | 17 - .../workspace/Formatter/test132/A_in.js | 94 - .../workspace/Formatter/test132/A_out.js | 94 - .../workspace/Formatter/test133/A_in.js | 156 - .../workspace/Formatter/test133/A_out.js | 144 - .../workspace/Formatter/test134/A_in.js | 142 - .../workspace/Formatter/test134/A_out.js | 144 - .../workspace/Formatter/test135/A_in.js | 5 - .../workspace/Formatter/test135/A_out.js | 7 - .../workspace/Formatter/test136/A_in.js | 8 - .../workspace/Formatter/test136/A_out.js | 10 - .../workspace/Formatter/test137/A_in.js | 129 - .../workspace/Formatter/test137/A_out.js | 119 - .../workspace/Formatter/test138/A_in.js | 1 - .../workspace/Formatter/test138/A_out.js | 4 - .../workspace/Formatter/test139/A_in.js | 1 - .../workspace/Formatter/test139/A_out.js | 1 - .../workspace/Formatter/test140/A_in.js | 9 - .../workspace/Formatter/test140/A_out.js | 10 - .../workspace/Formatter/test141/A_in.js | 10 - .../workspace/Formatter/test141/A_out.js | 10 - .../workspace/Formatter/test142/A_in.js | 4 - .../workspace/Formatter/test142/A_out.js | 6 - .../workspace/Formatter/test143/A_in.js | 4 - .../workspace/Formatter/test143/A_out.js | 6 - .../workspace/Formatter/test144/A_in.js | 5 - .../workspace/Formatter/test144/A_out.js | 5 - .../workspace/Formatter/test145/A_in.js | 4 - .../workspace/Formatter/test145/A_out.js | 4 - .../workspace/Formatter/test146/A_in.js | 12 - .../workspace/Formatter/test146/A_out.js | 6 - .../workspace/Formatter/test147/A_in.js | 40 - .../workspace/Formatter/test147/A_out.js | 37 - .../workspace/Formatter/test148/A_in.js | 2 - .../workspace/Formatter/test148/A_out.js | 2 - .../workspace/Formatter/test149/A_in.js | 5 - .../workspace/Formatter/test149/A_out.js | 6 - .../workspace/Formatter/test150/A_in.js | 4 - .../workspace/Formatter/test150/A_out.js | 5 - .../workspace/Formatter/test151/A_in.js | 13 - .../workspace/Formatter/test151/A_out.js | 12 - .../workspace/Formatter/test152/A_in.js | 5 - .../workspace/Formatter/test152/A_out.js | 6 - .../workspace/Formatter/test153/A_in.js | 6 - .../workspace/Formatter/test153/A_out.js | 6 - .../workspace/Formatter/test154/A_in.js | 19 - .../workspace/Formatter/test154/A_out.js | 19 - .../workspace/Formatter/test155/A_in.js | 9 - .../workspace/Formatter/test155/A_out.js | 2 - .../workspace/Formatter/test156/A_in.js | 2 - .../workspace/Formatter/test156/A_out.js | 3 - .../workspace/Formatter/test157/A_in.js | 1 - .../workspace/Formatter/test157/A_out.js | 2 - .../workspace/Formatter/test158/A_in.js | 1 - .../workspace/Formatter/test158/A_out.js | 3 - .../workspace/Formatter/test159/A_in.js | 44 - .../workspace/Formatter/test159/A_out.js | 44 - .../workspace/Formatter/test160/A_in.js | 15 - .../workspace/Formatter/test160/A_out.js | 13 - .../workspace/Formatter/test161/A_in.js | 15 - .../workspace/Formatter/test161/A_out.js | 14 - .../workspace/Formatter/test162/A_in.js | 15 - .../workspace/Formatter/test162/A_out.js | 17 - .../workspace/Formatter/test163/A_in.js | 15 - .../workspace/Formatter/test163/A_out.js | 16 - .../workspace/Formatter/test164/A_in.js | 4 - .../workspace/Formatter/test164/A_out.js | 5 - .../workspace/Formatter/test165/A_in.js | 10 - .../workspace/Formatter/test165/A_out.js | 10 - .../workspace/Formatter/test166/A_in.js | 17 - .../workspace/Formatter/test166/A_out.js | 18 - .../workspace/Formatter/test167/A_in.js | 14 - .../workspace/Formatter/test167/A_out.js | 11 - .../workspace/Formatter/test168/A_in.js | 7 - .../workspace/Formatter/test168/A_out.js | 7 - .../workspace/Formatter/test169/A_in.js | 7 - .../workspace/Formatter/test169/A_out.js | 8 - .../workspace/Formatter/test170/A_in.js | 7 - .../workspace/Formatter/test170/A_out.js | 8 - .../workspace/Formatter/test171/A_in.js | 15 - .../workspace/Formatter/test171/A_out.js | 17 - .../workspace/Formatter/test172/A_in.js | 14 - .../workspace/Formatter/test172/A_out.js | 17 - .../workspace/Formatter/test173/A_in.js | 8 - .../workspace/Formatter/test173/A_out.js | 6 - .../workspace/Formatter/test174/A_in.js | 2 - .../workspace/Formatter/test174/A_out.js | 1 - .../workspace/Formatter/test175/A_in.js | 8 - .../workspace/Formatter/test175/A_out.js | 7 - .../workspace/Formatter/test176/A_in.js | 1 - .../workspace/Formatter/test176/A_out.js | 2 - .../workspace/Formatter/test177/A_in.js | 2 - .../workspace/Formatter/test177/A_out.js | 1 - .../workspace/Formatter/test178/A_in.js | 1 - .../workspace/Formatter/test178/A_out.js | 2 - .../workspace/Formatter/test179/A_in.js | 5 - .../workspace/Formatter/test179/A_out.js | 6 - .../workspace/Formatter/test180/A_in.js | 4 - .../workspace/Formatter/test180/A_out.js | 5 - .../workspace/Formatter/test181/A_in.js | 7 - .../workspace/Formatter/test181/A_out.js | 6 - .../workspace/Formatter/test182/A_in.js | 7 - .../workspace/Formatter/test182/A_out.js | 7 - .../workspace/Formatter/test183/A_in.js | 17 - .../workspace/Formatter/test183/A_out.js | 29 - .../workspace/Formatter/test184/A_in.js | 9 - .../workspace/Formatter/test184/A_out.js | 14 - .../workspace/Formatter/test185/A_in.js | 31 - .../workspace/Formatter/test185/A_out.js | 31 - .../workspace/Formatter/test186/A_in.js | 14 - .../workspace/Formatter/test186/A_out.js | 11 - .../workspace/Formatter/test187/A_in.js | 380 - .../workspace/Formatter/test187/A_out.js | 308 - .../workspace/Formatter/test188/A_in.js | 11 - .../workspace/Formatter/test188/A_out.js | 9 - .../workspace/Formatter/test189/A_in.js | 11 - .../workspace/Formatter/test189/A_out.js | 9 - .../workspace/Formatter/test190/A_in.js | 50 - .../workspace/Formatter/test190/A_out.js | 52 - .../workspace/Formatter/test191/A_in.js | 44 - .../workspace/Formatter/test191/A_out.js | 43 - .../workspace/Formatter/test192/A_in.js | 6 - .../workspace/Formatter/test192/A_out.js | 5 - .../workspace/Formatter/test193/A_in.js | 5 - .../workspace/Formatter/test193/A_out.js | 5 - .../workspace/Formatter/test194/A_in.js | 6 - .../workspace/Formatter/test194/A_out.js | 8 - .../workspace/Formatter/test195/A_in.js | 6 - .../workspace/Formatter/test195/A_out.js | 7 - .../workspace/Formatter/test196/A_in.js | 1 - .../workspace/Formatter/test196/A_out.js | 8 - .../workspace/Formatter/test197/A_in.js | 1 - .../workspace/Formatter/test197/A_out.js | 7 - .../workspace/Formatter/test198/A_in.js | 13 - .../workspace/Formatter/test198/A_out.js | 17 - .../workspace/Formatter/test199/A_in.js | 13 - .../workspace/Formatter/test199/A_out.js | 22 - .../workspace/Formatter/test200/A_in.js | 7 - .../workspace/Formatter/test200/A_out.js | 8 - .../workspace/Formatter/test201/A_in.js | 7 - .../workspace/Formatter/test201/A_out.js | 7 - .../workspace/Formatter/test202/A_in.js | 6 - .../workspace/Formatter/test202/A_out.js | 3 - .../workspace/Formatter/test203/A_in.js | 6 - .../workspace/Formatter/test203/A_out.js | 6 - .../workspace/Formatter/test204/A_in.js | 7 - .../workspace/Formatter/test204/A_out.js | 3 - .../workspace/Formatter/test205/A_in.js | 8 - .../workspace/Formatter/test205/A_out.js | 9 - .../workspace/Formatter/test206/A_in.js | 1 - .../workspace/Formatter/test206/A_out.js | 8 - .../workspace/Formatter/test207/A_in.js | 1 - .../workspace/Formatter/test207/A_out.js | 5 - .../workspace/Formatter/test208/A_in.js | 4 - .../workspace/Formatter/test208/A_out.js | 4 - .../workspace/Formatter/test209/A_in.js | 9 - .../workspace/Formatter/test209/A_out.js | 9 - .../workspace/Formatter/test210/A_in.js | 8 - .../workspace/Formatter/test210/A_out.js | 10 - .../workspace/Formatter/test211/A_in.js | 8 - .../workspace/Formatter/test211/A_out.js | 10 - .../workspace/Formatter/test212/A_in.js | 8 - .../workspace/Formatter/test212/A_out.js | 9 - .../workspace/Formatter/test213/A_in.js | 8 - .../workspace/Formatter/test213/A_out.js | 8 - .../workspace/Formatter/test214/A_in.js | 5 - .../workspace/Formatter/test214/A_out.js | 5 - .../workspace/Formatter/test215/A_in.js | 7 - .../workspace/Formatter/test215/A_out.js | 14 - .../workspace/Formatter/test216/A_in.js | 7 - .../workspace/Formatter/test216/A_out.js | 21 - .../workspace/Formatter/test217/A_in.js | 3 - .../workspace/Formatter/test217/A_out.js | 9 - .../workspace/Formatter/test218/A_in.js | 3 - .../workspace/Formatter/test218/A_out.js | 7 - .../workspace/Formatter/test219/A_in.js | 3 - .../workspace/Formatter/test219/A_out.js | 7 - .../workspace/Formatter/test220/A_in.js | 3 - .../workspace/Formatter/test220/A_out.js | 9 - .../workspace/Formatter/test221/A_in.js | 17 - .../workspace/Formatter/test221/A_out.js | 17 - .../workspace/Formatter/test222/A_in.js | 17 - .../workspace/Formatter/test222/A_out.js | 13 - .../workspace/Formatter/test223/A_in.js | 1 - .../workspace/Formatter/test223/A_out.js | 5 - .../workspace/Formatter/test224/A_in.js | 1 - .../workspace/Formatter/test224/A_out.js | 7 - .../workspace/Formatter/test225/A_in.js | 1 - .../workspace/Formatter/test225/A_out.js | 7 - .../workspace/Formatter/test226/A_in.js | 1 - .../workspace/Formatter/test226/A_out.js | 9 - .../workspace/Formatter/test227/A_in.js | 1 - .../workspace/Formatter/test227/A_out.js | 10 - .../workspace/Formatter/test228/A_in.js | 1 - .../workspace/Formatter/test228/A_out.js | 15 - .../workspace/Formatter/test229/A_in.js | 1 - .../workspace/Formatter/test229/A_out.js | 10 - .../workspace/Formatter/test230/A_in.js | 1 - .../workspace/Formatter/test230/A_out.js | 15 - .../workspace/Formatter/test231/A_in.js | 1 - .../workspace/Formatter/test231/A_out.js | 5 - .../workspace/Formatter/test232/A_in.js | 1 - .../workspace/Formatter/test232/A_out.js | 4 - .../workspace/Formatter/test233/A_in.js | 1 - .../workspace/Formatter/test233/A_out.js | 4 - .../workspace/Formatter/test234/A_in.js | 4 - .../workspace/Formatter/test234/A_out.js | 4 - .../workspace/Formatter/test235/A_in.js | 4 - .../workspace/Formatter/test235/A_out.js | 5 - .../workspace/Formatter/test236/A_in.js | 8 - .../workspace/Formatter/test236/A_out.js | 8 - .../workspace/Formatter/test237/A_in.js | 8 - .../workspace/Formatter/test237/A_out.js | 10 - .../workspace/Formatter/test238/A_in.js | 7 - .../workspace/Formatter/test238/A_out.js | 8 - .../workspace/Formatter/test239/A_in.js | 7 - .../workspace/Formatter/test239/A_out.js | 12 - .../workspace/Formatter/test240/A_in.js | 4 - .../workspace/Formatter/test240/A_out.js | 4 - .../workspace/Formatter/test241/A_in.js | 4 - .../workspace/Formatter/test241/A_out.js | 4 - .../workspace/Formatter/test242/A_in.js | 4 - .../workspace/Formatter/test242/A_out.js | 4 - .../workspace/Formatter/test243/A_in.js | 4 - .../workspace/Formatter/test243/A_out.js | 4 - .../workspace/Formatter/test244/A_in.js | 8 - .../workspace/Formatter/test244/A_out.js | 8 - .../workspace/Formatter/test245/A_in.js | 8 - .../workspace/Formatter/test245/A_out.js | 8 - .../workspace/Formatter/test246/A_in.js | 8 - .../workspace/Formatter/test246/A_out.js | 8 - .../workspace/Formatter/test247/A_in.js | 8 - .../workspace/Formatter/test247/A_out.js | 8 - .../workspace/Formatter/test248/A_in.js | 8 - .../workspace/Formatter/test248/A_out.js | 8 - .../workspace/Formatter/test249/A_in.js | 8 - .../workspace/Formatter/test249/A_out.js | 8 - .../workspace/Formatter/test250/A_in.js | 8 - .../workspace/Formatter/test250/A_out.js | 8 - .../workspace/Formatter/test251/A_in.js | 8 - .../workspace/Formatter/test251/A_out.js | 8 - .../workspace/Formatter/test252/A_in.js | 6 - .../workspace/Formatter/test252/A_out.js | 7 - .../workspace/Formatter/test253/A_in.js | 6 - .../workspace/Formatter/test253/A_out.js | 8 - .../workspace/Formatter/test254/A_in.js | 6 - .../workspace/Formatter/test254/A_out.js | 7 - .../workspace/Formatter/test255/A_in.js | 6 - .../workspace/Formatter/test255/A_out.js | 8 - .../workspace/Formatter/test256/A_in.js | 1 - .../workspace/Formatter/test256/A_out.js | 3 - .../workspace/Formatter/test257/A_in.js | 1 - .../workspace/Formatter/test257/A_out.js | 5 - .../workspace/Formatter/test258/A_in.js | 1 - .../workspace/Formatter/test258/A_out.js | 12 - .../workspace/Formatter/test259/A_in.js | 1 - .../workspace/Formatter/test259/A_out.js | 17 - .../workspace/Formatter/test260/A_in.js | 1 - .../workspace/Formatter/test260/A_out.js | 12 - .../workspace/Formatter/test261/A_in.js | 1 - .../workspace/Formatter/test261/A_out.js | 17 - .../workspace/Formatter/test262/A_in.js | 1 - .../workspace/Formatter/test262/A_out.js | 10 - .../workspace/Formatter/test263/A_in.js | 1 - .../workspace/Formatter/test263/A_out.js | 13 - .../workspace/Formatter/test264/A_in.js | 1 - .../workspace/Formatter/test264/A_out.js | 8 - .../workspace/Formatter/test265/A_in.js | 1 - .../workspace/Formatter/test265/A_out.js | 10 - .../workspace/Formatter/test266/A_in.js | 1 - .../workspace/Formatter/test266/A_out.js | 4 - .../workspace/Formatter/test267/A_in.js | 1 - .../workspace/Formatter/test267/A_out.js | 4 - .../workspace/Formatter/test268/A_in.js | 1 - .../workspace/Formatter/test268/A_out.js | 9 - .../workspace/Formatter/test269/A_in.js | 1 - .../workspace/Formatter/test269/A_out.js | 12 - .../workspace/Formatter/test270/A_in.js | 23 - .../workspace/Formatter/test270/A_out.js | 23 - .../workspace/Formatter/test271/A_in.js | 23 - .../workspace/Formatter/test271/A_out.js | 31 - .../workspace/Formatter/test272/A_in.js | 1 - .../workspace/Formatter/test272/A_out.js | 35 - .../workspace/Formatter/test273/A_in.js | 1 - .../workspace/Formatter/test273/A_out.js | 44 - .../workspace/Formatter/test274/A_in.js | 1 - .../workspace/Formatter/test274/A_out.js | 5 - .../workspace/Formatter/test275/A_in.js | 1 - .../workspace/Formatter/test275/A_out.js | 7 - .../workspace/Formatter/test276/A_in.js | 1 - .../workspace/Formatter/test276/A_out.js | 4 - .../workspace/Formatter/test277/A_in.js | 1 - .../workspace/Formatter/test277/A_out.js | 4 - .../workspace/Formatter/test278/A_in.js | 1 - .../workspace/Formatter/test278/A_out.js | 3 - .../workspace/Formatter/test279/A_in.js | 1 - .../workspace/Formatter/test279/A_out.js | 7 - .../workspace/Formatter/test280/A_in.js | 1 - .../workspace/Formatter/test280/A_out.js | 27 - .../workspace/Formatter/test281/A_in.js | 1 - .../workspace/Formatter/test281/A_out.js | 18 - .../workspace/Formatter/test282/A_in.js | 13 - .../workspace/Formatter/test282/A_out.js | 13 - .../workspace/Formatter/test283/A_in.js | 16 - .../workspace/Formatter/test283/A_out.js | 16 - .../workspace/Formatter/test284/A_in.js | 16 - .../workspace/Formatter/test284/A_out.js | 19 - .../workspace/Formatter/test285/A_in.js | 1 - .../workspace/Formatter/test285/A_out.js | 22 - .../workspace/Formatter/test286/A_in.js | 1 - .../workspace/Formatter/test286/A_out.js | 15 - .../workspace/Formatter/test287/A_in.js | 1 - .../workspace/Formatter/test287/A_out.js | 8 - .../workspace/Formatter/test288/A_in.js | 1 - .../workspace/Formatter/test288/A_out.js | 8 - .../workspace/Formatter/test289/A_in.js | 10 - .../workspace/Formatter/test289/A_out.js | 10 - .../workspace/Formatter/test290/A_in.js | 5 - .../workspace/Formatter/test290/A_out.js | 7 - .../workspace/Formatter/test291/A_in.js | 1 - .../workspace/Formatter/test291/A_out.js | 5 - .../workspace/Formatter/test292/A_in.js | 1 - .../workspace/Formatter/test292/A_out.js | 2 - .../workspace/Formatter/test293/A_in.js | 4 - .../workspace/Formatter/test293/A_out.js | 5 - .../workspace/Formatter/test294/A_in.js | 3 - .../workspace/Formatter/test294/A_out.js | 4 - .../workspace/Formatter/test295/A_in.js | 3 - .../workspace/Formatter/test295/A_out.js | 3 - .../workspace/Formatter/test296/A_in.js | 6 - .../workspace/Formatter/test296/A_out.js | 15 - .../workspace/Formatter/test297/A_in.js | 14 - .../workspace/Formatter/test297/A_out.js | 20 - .../workspace/Formatter/test298/A_in.js | 4 - .../workspace/Formatter/test298/A_out.js | 5 - .../workspace/Formatter/test299/A_in.js | 4 - .../workspace/Formatter/test299/A_out.js | 6 - .../workspace/Formatter/test300/A_in.js | 1 - .../workspace/Formatter/test300/A_out.js | 1 - .../workspace/Formatter/test301/A_in.js | 1 - .../workspace/Formatter/test301/A_out.js | 1 - .../workspace/Formatter/test302/A_in.js | 14 - .../workspace/Formatter/test302/A_out.js | 12 - .../workspace/Formatter/test303/A_in.js | 14 - .../workspace/Formatter/test303/A_out.js | 12 - .../workspace/Formatter/test304/A_in.js | 14 - .../workspace/Formatter/test304/A_out.js | 12 - .../workspace/Formatter/test305/A_in.js | 15 - .../workspace/Formatter/test305/A_out.js | 13 - .../workspace/Formatter/test306/A_in.js | 13 - .../workspace/Formatter/test306/A_out.js | 12 - .../workspace/Formatter/test307/A_in.js | 5 - .../workspace/Formatter/test307/A_out.js | 5 - .../workspace/Formatter/test308/A_in.js | 14 - .../workspace/Formatter/test308/A_out.js | 12 - .../workspace/Formatter/test309/A_in.js | 15 - .../workspace/Formatter/test309/A_out.js | 13 - .../workspace/Formatter/test310/A_in.js | 9 - .../workspace/Formatter/test310/A_out.js | 7 - .../workspace/Formatter/test311/A_in.js | 5 - .../workspace/Formatter/test311/A_out.js | 6 - .../workspace/Formatter/test312/A_in.js | 9 - .../workspace/Formatter/test312/A_out.js | 7 - .../workspace/Formatter/test313/A_in.js | 6 - .../workspace/Formatter/test313/A_out.js | 9 - .../workspace/Formatter/test314/A_in.js | 1 - .../workspace/Formatter/test314/A_out.js | 4 - .../workspace/Formatter/test319/A_in.js | 9 - .../workspace/Formatter/test319/A_out.js | 8 - .../workspace/Formatter/test320/A_in.js | 9 - .../workspace/Formatter/test320/A_out.js | 8 - .../workspace/Formatter/test321/A_in.js | 8 - .../workspace/Formatter/test321/A_out.js | 7 - .../workspace/Formatter/test322/A_in.js | 9 - .../workspace/Formatter/test322/A_out.js | 8 - .../workspace/Formatter/test323/A_in.js | 7 - .../workspace/Formatter/test323/A_out.js | 6 - .../workspace/Formatter/test324/A_in.js | 25 - .../workspace/Formatter/test324/A_out.js | 19 - .../workspace/Formatter/test325/A_in.js | 25 - .../workspace/Formatter/test325/A_out.js | 23 - .../workspace/Formatter/test326/A_in.js | 18 - .../workspace/Formatter/test326/A_out.js | 18 - .../workspace/Formatter/test327/A_in.js | 10 - .../workspace/Formatter/test327/A_out.js | 11 - .../workspace/Formatter/test328/A_in.js | 12 - .../workspace/Formatter/test328/A_out.js | 17 - .../workspace/Formatter/test329/A_in.js | 7 - .../workspace/Formatter/test329/A_out.js | 10 - .../workspace/Formatter/test330/A_in.js | 5 - .../workspace/Formatter/test330/A_out.js | 5 - .../workspace/Formatter/test331/A_in.js | 3 - .../workspace/Formatter/test331/A_out.js | 3 - .../workspace/Formatter/test332/A_in.js | 2 - .../workspace/Formatter/test332/A_out.js | 3 - .../workspace/Formatter/test333/A_in.js | 53 - .../workspace/Formatter/test333/A_out.js | 55 - .../workspace/Formatter/test334/A_in.js | 3 - .../workspace/Formatter/test334/A_out.js | 3 - .../workspace/Formatter/test335/A_in.js | 18 - .../workspace/Formatter/test335/A_out.js | 16 - .../workspace/Formatter/test336/A_in.js | 31 - .../workspace/Formatter/test336/A_out.js | 30 - .../workspace/Formatter/test337/A_in.js | 339 - .../workspace/Formatter/test337/A_out.js | 346 - .../workspace/Formatter/test338/A_in.js | 20 - .../workspace/Formatter/test338/A_out.js | 20 - .../workspace/Formatter/test339/A_in.js | 19 - .../workspace/Formatter/test339/A_out.js | 19 - .../workspace/Formatter/test340/A_in.js | 18 - .../workspace/Formatter/test340/A_out.js | 18 - .../workspace/Formatter/test341/A_in.js | 7 - .../workspace/Formatter/test341/A_out.js | 7 - .../workspace/Formatter/test342/A_in.js | 6 - .../workspace/Formatter/test342/A_out.js | 6 - .../workspace/Formatter/test343/A_in.js | 4 - .../workspace/Formatter/test343/A_out.js | 4 - .../workspace/Formatter/test344/A_in.js | 4 - .../workspace/Formatter/test344/A_out.js | 4 - .../workspace/Formatter/test345/A_in.js | 6 - .../workspace/Formatter/test345/A_out.js | 6 - .../workspace/Formatter/test346/A_in.js | 15 - .../workspace/Formatter/test346/A_out.js | 20 - .../workspace/Formatter/test347/A_in.js | 4 - .../workspace/Formatter/test347/A_out.js | 6 - .../workspace/Formatter/test348/A_in.js | 4 - .../workspace/Formatter/test348/A_out.js | 5 - .../workspace/Formatter/test349/A_in.js | 4 - .../workspace/Formatter/test349/A_out.js | 6 - .../workspace/Formatter/test350/A_in.js | 13 - .../workspace/Formatter/test350/A_out.js | 23 - .../workspace/Formatter/test351/A_in.js | 4 - .../workspace/Formatter/test351/A_out.js | 8 - .../workspace/Formatter/test352/A_in.js | 4 - .../workspace/Formatter/test352/A_out.js | 8 - .../workspace/Formatter/test353/A_in.js | 1 - .../workspace/Formatter/test353/A_out.js | 3 - .../workspace/Formatter/test354/A_in.js | 3 - .../workspace/Formatter/test354/A_out.js | 5 - .../workspace/Formatter/test355/A_in.js | 3 - .../workspace/Formatter/test355/A_out.js | 7 - .../workspace/Formatter/test356/A_in.js | 5 - .../workspace/Formatter/test356/A_out.js | 6 - .../workspace/Formatter/test357/A_in.js | 1 - .../workspace/Formatter/test357/A_out.js | 1 - .../workspace/Formatter/test358/A_in.js | 1 - .../workspace/Formatter/test358/A_out.js | 1 - .../workspace/Formatter/test359/A_in.js | 2 - .../workspace/Formatter/test359/A_out.js | 4 - .../workspace/Formatter/test360/A_in.js | 4 - .../workspace/Formatter/test360/A_out.js | 6 - .../workspace/Formatter/test361/A_in.js | 4 - .../workspace/Formatter/test361/A_out.js | 5 - .../workspace/Formatter/test362/A_in.js | 4 - .../workspace/Formatter/test362/A_out.js | 7 - .../workspace/Formatter/test363/A_in.js | 3 - .../workspace/Formatter/test363/A_out.js | 4 - .../workspace/Formatter/test364/A_in.js | 4 - .../workspace/Formatter/test364/A_out.js | 6 - .../workspace/Formatter/test365/A_in.js | 5 - .../workspace/Formatter/test365/A_out.js | 8 - .../workspace/Formatter/test366/A_in.js | 4 - .../workspace/Formatter/test366/A_out.js | 6 - .../workspace/Formatter/test367/A_in.js | 5 - .../workspace/Formatter/test367/A_out.js | 7 - .../workspace/Formatter/test368/A_in.js | 7 - .../workspace/Formatter/test368/A_out.js | 10 - .../workspace/Formatter/test369/A_in.js | 7 - .../workspace/Formatter/test369/A_out.js | 12 - .../workspace/Formatter/test370/A_in.js | 7 - .../workspace/Formatter/test370/A_out.js | 12 - .../workspace/Formatter/test371/A_in.js | 8 - .../workspace/Formatter/test371/A_out.js | 11 - .../workspace/Formatter/test372/A_in.js | 9 - .../workspace/Formatter/test372/A_out.js | 11 - .../workspace/Formatter/test373/A_in.js | 9 - .../workspace/Formatter/test373/A_out.js | 12 - .../workspace/Formatter/test374/A_in.js | 6 - .../workspace/Formatter/test374/A_out.js | 10 - .../workspace/Formatter/test375/A_in.js | 6 - .../workspace/Formatter/test375/A_out.js | 9 - .../workspace/Formatter/test376/A_in.js | 6 - .../workspace/Formatter/test376/A_out.js | 7 - .../workspace/Formatter/test377/A_in.js | 6 - .../workspace/Formatter/test377/A_out.js | 8 - .../workspace/Formatter/test378/A_in.js | 6 - .../workspace/Formatter/test378/A_out.js | 9 - .../workspace/Formatter/test379/A_in.js | 6 - .../workspace/Formatter/test379/A_out.js | 10 - .../workspace/Formatter/test380/A_in.js | 14 - .../workspace/Formatter/test380/A_out.js | 21 - .../workspace/Formatter/test381/A_in.js | 7 - .../workspace/Formatter/test381/A_out.js | 10 - .../workspace/Formatter/test382/A_in.js | 80 - .../workspace/Formatter/test382/A_out.js | 82 - .../workspace/Formatter/test383/A_in.js | 5 - .../workspace/Formatter/test383/A_out.js | 5 - .../workspace/Formatter/test384/A_in.js | 7 - .../workspace/Formatter/test384/A_out.js | 6 - .../workspace/Formatter/test385/A_in.js | 7 - .../workspace/Formatter/test385/A_out.js | 7 - .../workspace/Formatter/test386/A_in.js | 7 - .../workspace/Formatter/test386/A_out.js | 7 - .../workspace/Formatter/test387/A_in.js | 8 - .../workspace/Formatter/test387/A_out.js | 8 - .../workspace/Formatter/test388/A_in.js | 3 - .../workspace/Formatter/test388/A_out.js | 17 - .../workspace/Formatter/test389/A_in.js | 3 - .../workspace/Formatter/test389/A_out.js | 17 - .../workspace/Formatter/test390/A_in.js | 3 - .../workspace/Formatter/test390/A_out.js | 7 - .../workspace/Formatter/test391/A_in.js | 3 - .../workspace/Formatter/test391/A_out.js | 7 - .../workspace/Formatter/test392/A_in.js | 3 - .../workspace/Formatter/test392/A_out.js | 7 - .../workspace/Formatter/test393/A_in.js | 3 - .../workspace/Formatter/test393/A_out.js | 7 - .../workspace/Formatter/test394/A_in.js | 7 - .../workspace/Formatter/test394/A_out.js | 6 - .../workspace/Formatter/test395/A_in.js | 4 - .../workspace/Formatter/test395/A_out.js | 4 - .../workspace/Formatter/test396/A_in.js | 6 - .../workspace/Formatter/test396/A_out.js | 6 - .../workspace/Formatter/test397/A_in.js | 3 - .../workspace/Formatter/test397/A_out.js | 5 - .../workspace/Formatter/test398/A_in.js | 3 - .../workspace/Formatter/test398/A_out.js | 3 - .../workspace/Formatter/test399/A_in.js | 3 - .../workspace/Formatter/test399/A_out.js | 5 - .../workspace/Formatter/test400/A_in.js | 3 - .../workspace/Formatter/test400/A_out.js | 7 - .../workspace/Formatter/test401/A_in.js | 4 - .../workspace/Formatter/test401/A_out.js | 4 - .../workspace/Formatter/test402/A_in.js | 4 - .../workspace/Formatter/test402/A_out.js | 4 - .../workspace/Formatter/test403/A_in.js | 6 - .../workspace/Formatter/test403/A_out.js | 6 - .../workspace/Formatter/test404/A_in.js | 6 - .../workspace/Formatter/test404/A_out.js | 6 - .../workspace/Formatter/test405/A_in.js | 1 - .../workspace/Formatter/test405/A_out.js | 14 - .../workspace/Formatter/test406/A_in.js | 8 - .../workspace/Formatter/test406/A_out.js | 8 - .../workspace/Formatter/test407/A_in.js | 6 - .../workspace/Formatter/test407/A_out.js | 6 - .../workspace/Formatter/test408/A_in.js | 7 - .../workspace/Formatter/test408/A_out.js | 7 - .../workspace/Formatter/test409/A_in.js | 12 - .../workspace/Formatter/test409/A_out.js | 15 - .../workspace/Formatter/test410/A_in.js | 4 - .../workspace/Formatter/test410/A_out.js | 5 - .../workspace/Formatter/test411/A_in.js | 4 - .../workspace/Formatter/test411/A_out.js | 6 - .../workspace/Formatter/test412/A_in.js | 5 - .../workspace/Formatter/test412/A_out.js | 4 - .../workspace/Formatter/test413/A_in.js | 6 - .../workspace/Formatter/test413/A_out.js | 7 - .../workspace/Formatter/test414/A_in.js | 5 - .../workspace/Formatter/test414/A_out.js | 4 - .../workspace/Formatter/test415/A_in.js | 6 - .../workspace/Formatter/test415/A_out.js | 7 - .../workspace/Formatter/test416/A_in.js | 6 - .../workspace/Formatter/test416/A_out.js | 7 - .../workspace/Formatter/test417/A_in.js | 6 - .../workspace/Formatter/test417/A_out.js | 6 - .../workspace/Formatter/test418/A_in.js | 6 - .../workspace/Formatter/test418/A_out.js | 6 - .../workspace/Formatter/test419/A_in.js | 11 - .../workspace/Formatter/test419/A_out.js | 11 - .../workspace/Formatter/test420/A_in.js | 5 - .../workspace/Formatter/test420/A_out.js | 4 - .../workspace/Formatter/test421/A_in.js | 6 - .../workspace/Formatter/test421/A_out.js | 6 - .../workspace/Formatter/test422/A_in.js | 6 - .../workspace/Formatter/test422/A_out.js | 7 - .../workspace/Formatter/test423/A_in.js | 2 - .../workspace/Formatter/test423/A_out.js | 6 - .../workspace/Formatter/test424/A_in.js | 2 - .../workspace/Formatter/test424/A_out.js | 7 - .../workspace/Formatter/test425/A_in.js | 7 - .../workspace/Formatter/test425/A_out.js | 7 - .../workspace/Formatter/test426/A_in.js | 5 - .../workspace/Formatter/test426/A_out.js | 6 - .../workspace/Formatter/test427/A_in.js | 5 - .../workspace/Formatter/test427/A_out.js | 6 - .../workspace/Formatter/test428/A_in.js | 9 - .../workspace/Formatter/test428/A_out.js | 8 - .../workspace/Formatter/test429/A_in.js | 12 - .../workspace/Formatter/test429/A_out.js | 13 - .../workspace/Formatter/test430/A_in.js | 13 - .../workspace/Formatter/test430/A_out.js | 12 - .../workspace/Formatter/test431/A_in.js | 6 - .../workspace/Formatter/test431/A_out.js | 5 - .../workspace/Formatter/test432/A_in.js | 838 -- .../workspace/Formatter/test432/A_out.js | 839 -- .../workspace/Formatter/test432/formatter.xml | 159 - .../workspace/Formatter/test433/A_in.js | 8 - .../workspace/Formatter/test433/A_out.js | 8 - .../workspace/Formatter/test434/A_in.js | 5 - .../workspace/Formatter/test434/A_out.js | 10 - .../workspace/Formatter/test435/A_in.js | 21 - .../workspace/Formatter/test435/A_out.js | 23 - .../workspace/Formatter/test436/A_in.js | 33 - .../workspace/Formatter/test436/A_out.js | 34 - .../workspace/Formatter/test437/A_in.js | 5 - .../workspace/Formatter/test437/A_out.js | 12 - .../workspace/Formatter/test437/formatter.xml | 163 - .../workspace/Formatter/test438/A_in.js | 5 - .../workspace/Formatter/test438/A_out.js | 12 - .../workspace/Formatter/test438/formatter.xml | 163 - .../workspace/Formatter/test439/A_in.js | 15 - .../workspace/Formatter/test439/A_out.js | 21 - .../workspace/Formatter/test439/formatter.xml | 162 - .../workspace/Formatter/test440/A_in.js | 5 - .../workspace/Formatter/test440/A_out.js | 5 - .../workspace/Formatter/test441/A_in.js | 5 - .../workspace/Formatter/test441/A_out.js | 5 - .../workspace/Formatter/test442/A_in.js | 6 - .../workspace/Formatter/test442/A_out.js | 5 - .../workspace/Formatter/test443/A_in.js | 6 - .../workspace/Formatter/test443/A_out.js | 6 - .../workspace/Formatter/test444/A_in.js | 5 - .../workspace/Formatter/test444/A_out.js | 5 - .../workspace/Formatter/test445/A_in.js | 5 - .../workspace/Formatter/test445/A_out.js | 5 - .../workspace/Formatter/test446/A_in.js | 11 - .../workspace/Formatter/test446/A_out.js | 8 - .../workspace/Formatter/test447/test447.zip | Bin 1852 -> 0 bytes .../workspace/Formatter/test448/A_in.js | 6 - .../workspace/Formatter/test448/A_out.js | 5 - .../workspace/Formatter/test449/A_in.js | 6 - .../workspace/Formatter/test449/A_out.js | 5 - .../workspace/Formatter/test450/A_in.js | 0 .../workspace/Formatter/test450/A_out.js | 0 .../workspace/Formatter/test451/test451.zip | Bin 2024 -> 0 bytes .../workspace/Formatter/test452/A_in.js | 6 - .../workspace/Formatter/test452/A_out.js | 11 - .../workspace/Formatter/test453/A_in.js | 7 - .../workspace/Formatter/test453/A_out.js | 8 - .../workspace/Formatter/test454/test454.zip | Bin 1774 -> 0 bytes .../workspace/Formatter/test455/A_in.js | 49 - .../workspace/Formatter/test455/A_out.js | 51 - .../workspace/Formatter/test456/test456.zip | Bin 1760 -> 0 bytes .../workspace/Formatter/test457/A_in.js | 5 - .../workspace/Formatter/test457/A_out.js | 5 - .../workspace/Formatter/test458/A_in.js | 1 - .../workspace/Formatter/test458/A_out.js | 4 - .../workspace/Formatter/test459/A_in.js | 15 - .../workspace/Formatter/test459/A_out.js | 15 - .../workspace/Formatter/test460/A_in.js | 31 - .../workspace/Formatter/test460/A_out.js | 8 - .../workspace/Formatter/test461/A_in.js | 9 - .../workspace/Formatter/test461/A_out.js | 9 - .../workspace/Formatter/test462/A_in.js | 15 - .../workspace/Formatter/test462/A_out.js | 15 - .../workspace/Formatter/test462/formatter.xml | 182 - .../workspace/Formatter/test463/A_in.js | 10 - .../workspace/Formatter/test463/A_out.js | 16 - .../workspace/Formatter/test464/A_in.js | 5 - .../workspace/Formatter/test464/A_out.js | 7 - .../workspace/Formatter/test465/A_in.js | 4 - .../workspace/Formatter/test465/A_out.js | 4 - .../workspace/Formatter/test466/A_in.js | 5 - .../workspace/Formatter/test466/A_out.js | 6 - .../workspace/Formatter/test467/A_in.js | 1 - .../workspace/Formatter/test467/A_out.js | 2 - .../workspace/Formatter/test468/A_in.js | 13 - .../workspace/Formatter/test468/A_out.js | 18 - .../workspace/Formatter/test469/A_in.js | 6 - .../workspace/Formatter/test469/A_out.js | 6 - .../workspace/Formatter/test470/A_in.js | 6 - .../workspace/Formatter/test470/A_out.js | 6 - .../workspace/Formatter/test471/A_in.js | 6 - .../workspace/Formatter/test471/A_out.js | 6 - .../workspace/Formatter/test472/A_in.js | 6 - .../workspace/Formatter/test472/A_out.js | 6 - .../workspace/Formatter/test473/A_in.js | 6 - .../workspace/Formatter/test473/A_out.js | 6 - .../workspace/Formatter/test474/A_in.js | 6 - .../workspace/Formatter/test474/A_out.js | 6 - .../workspace/Formatter/test475/A_in.js | 6 - .../workspace/Formatter/test475/A_out.js | 7 - .../workspace/Formatter/test476/A_in.js | 30 - .../workspace/Formatter/test476/A_out.js | 30 - .../workspace/Formatter/test478/A_in.js | 5 - .../workspace/Formatter/test478/A_out.js | 6 - .../workspace/Formatter/test479/A_in.js | 6 - .../workspace/Formatter/test479/A_out.js | 6 - .../workspace/Formatter/test480/A_in.js | 12 - .../workspace/Formatter/test480/A_out.js | 10 - .../workspace/Formatter/test481/A_in.js | 7 - .../workspace/Formatter/test481/A_out.js | 8 - .../workspace/Formatter/test482/A_in.js | 8 - .../workspace/Formatter/test482/A_out.js | 8 - .../workspace/Formatter/test483/A_in.js | 9 - .../workspace/Formatter/test483/A_out.js | 9 - .../workspace/Formatter/test484/A_in.js | 4 - .../workspace/Formatter/test484/A_out.js | 12 - .../workspace/Formatter/test485/A_in.js | 3 - .../workspace/Formatter/test485/A_out.js | 14 - .../workspace/Formatter/test486/A_in.js | 6 - .../workspace/Formatter/test486/A_out.js | 8 - .../workspace/Formatter/test487/A_in.js | 21 - .../workspace/Formatter/test487/A_out.js | 19 - .../workspace/Formatter/test488/A_in.js | 21 - .../workspace/Formatter/test488/A_out.js | 19 - .../workspace/Formatter/test489/A_in.js | 8 - .../workspace/Formatter/test489/A_out.js | 8 - .../workspace/Formatter/test490/A_in.js | 3 - .../workspace/Formatter/test490/A_out.js | 3 - .../workspace/Formatter/test491/BundleChain_in.js | 3 - .../workspace/Formatter/test491/BundleChain_out.js | 4 - .../workspace/Formatter/test491/formatter.xml | 181 - .../workspace/Formatter/test492/Main_in.js | 1574 --- .../workspace/Formatter/test492/Main_out.js | 1574 --- .../Formatter/test492/core_formatting.xml | 181 - .../workspace/Formatter/test493/MyClass_in.js | 6 - .../workspace/Formatter/test493/MyClass_out.js | 7 - .../workspace/Formatter/test494/A_in.js | 26 - .../workspace/Formatter/test494/A_out.js | 25 - .../workspace/Formatter/test494/format.xml | 180 - .../workspace/Formatter/test495/A_in.js | 8 - .../workspace/Formatter/test495/A_out.js | 9 - .../workspace/Formatter/test496/A_in.js | 8 - .../workspace/Formatter/test496/A_out.js | 8 - .../workspace/Formatter/test497/A_in.js | 11 - .../workspace/Formatter/test497/A_out.js | 13 - .../workspace/Formatter/test498/A_in.js | 207 - .../workspace/Formatter/test498/A_out.js | 205 - .../workspace/Formatter/test499/A_in.js | 11 - .../workspace/Formatter/test499/A_out.js | 13 - .../workspace/Formatter/test500/A_in.js | 13 - .../workspace/Formatter/test500/A_out.js | 15 - .../workspace/Formatter/test501/A_in.js | 3 - .../workspace/Formatter/test501/A_out.js | 4 - .../workspace/Formatter/test501/formatter.xml | 183 - .../workspace/Formatter/test502/A_in.js | 2 - .../workspace/Formatter/test502/A_out.js | 4 - .../workspace/Formatter/test503/A_in.js | 5 - .../workspace/Formatter/test503/A_out.js | 7 - .../workspace/Formatter/test504/A_in.js | 5 - .../workspace/Formatter/test504/A_out.js | 6 - .../workspace/Formatter/test505/A_in.js | 5 - .../workspace/Formatter/test505/A_out.js | 6 - .../workspace/Formatter/test506/A_in.js | 77 - .../workspace/Formatter/test506/A_out.js | 87 - .../workspace/Formatter/test507/A_in.js | 9 - .../workspace/Formatter/test507/A_out.js | 13 - .../workspace/Formatter/test508/A_in.js | 17 - .../workspace/Formatter/test508/A_out.js | 22 - .../workspace/Formatter/test509/A_in.js | 11 - .../workspace/Formatter/test509/A_out.js | 19 - .../workspace/Formatter/test510/A_in.js | 11 - .../workspace/Formatter/test510/A_out.js | 19 - .../workspace/Formatter/test511/A_in.js | 8 - .../workspace/Formatter/test511/A_out.js | 19 - .../workspace/Formatter/test512/A_in.js | 8 - .../workspace/Formatter/test512/A_out.js | 19 - .../workspace/Formatter/test513/A_in.js | 1 - .../workspace/Formatter/test513/A_out.js | 3 - .../workspace/Formatter/test514/A_in.js | 7 - .../workspace/Formatter/test514/A_out.js | 9 - .../workspace/Formatter/test514/formatter.xml | 186 - .../workspace/Formatter/test515/A_in.js | 2 - .../workspace/Formatter/test515/A_out.js | 4 - .../workspace/Formatter/test516/A_in.js | 2 - .../workspace/Formatter/test516/A_out.js | 4 - .../workspace/Formatter/test517/A_in.js | 2 - .../workspace/Formatter/test517/A_out.js | 4 - .../workspace/Formatter/test518/A_in.js | 2 - .../workspace/Formatter/test518/A_out.js | 4 - .../workspace/Formatter/test519/A_in.js | 2 - .../workspace/Formatter/test519/A_out.js | 4 - .../workspace/Formatter/test520/A_in.js | 2 - .../workspace/Formatter/test520/A_out.js | 9 - .../workspace/Formatter/test521/A_in.js | 1 - .../workspace/Formatter/test521/A_out.js | 5 - .../workspace/Formatter/test522/A_in.js | 12 - .../workspace/Formatter/test522/A_out.js | 33 - .../workspace/Formatter/test523/A_in.js | 10 - .../workspace/Formatter/test523/A_out.js | 8 - .../workspace/Formatter/test524/A_in.js | 10 - .../workspace/Formatter/test524/A_out.js | 9 - .../workspace/Formatter/test525/A_in.js | 10 - .../workspace/Formatter/test525/A_out.js | 9 - .../workspace/Formatter/test526/A_in.js | 10 - .../workspace/Formatter/test526/A_out.js | 10 - .../workspace/Formatter/test527/A_in.js | 9 - .../workspace/Formatter/test527/A_out.js | 7 - .../workspace/Formatter/test528/A_in.js | 15 - .../workspace/Formatter/test528/A_out.js | 12 - .../workspace/Formatter/test529/A_in.js | 15 - .../workspace/Formatter/test529/A_out.js | 12 - .../workspace/Formatter/test530/A_in.js | 11 - .../workspace/Formatter/test530/A_out.js | 10 - .../workspace/Formatter/test531/A_in.js | 12 - .../workspace/Formatter/test531/A_out.js | 12 - .../workspace/Formatter/test532/A_in.js | 5 - .../workspace/Formatter/test532/A_out.js | 7 - .../workspace/Formatter/test533/A_in.js | 4 - .../workspace/Formatter/test533/A_out.js | 5 - .../workspace/Formatter/test534/A_in.js | 7 - .../workspace/Formatter/test534/A_out.js | 9 - .../workspace/Formatter/test535/A_in.js | 7 - .../workspace/Formatter/test535/A_out.js | 9 - .../workspace/Formatter/test536/A_in.js | 7 - .../workspace/Formatter/test536/A_out.js | 9 - .../workspace/Formatter/test537/A_in.js | 7 - .../workspace/Formatter/test537/A_out.js | 9 - .../workspace/Formatter/test538/A_in.js | 11 - .../workspace/Formatter/test538/A_out.js | 11 - .../workspace/Formatter/test539/A_in.js | 1 - .../workspace/Formatter/test539/A_out.js | 2 - .../workspace/Formatter/test540/A_in.js | 1 - .../workspace/Formatter/test540/A_out.js | 2 - .../workspace/Formatter/test541/A_in.js | 6 - .../workspace/Formatter/test541/A_out.js | 7 - .../workspace/Formatter/test542/A_in.js | 5 - .../workspace/Formatter/test542/A_out.js | 5 - .../workspace/Formatter/test543/A_in.js | 7 - .../workspace/Formatter/test543/A_out.js | 5 - .../workspace/Formatter/test544/A_in.js | 2 - .../workspace/Formatter/test544/A_out.js | 3 - .../workspace/Formatter/test545/A_in.js | 19 - .../workspace/Formatter/test545/A_out.js | 19 - .../workspace/Formatter/test546/A_in.js | 8 - .../workspace/Formatter/test546/A_out.js | 9 - .../workspace/Formatter/test547/A_in.js | 3 - .../workspace/Formatter/test547/A_out.js | 3 - .../workspace/Formatter/test548/A_in.js | 3 - .../workspace/Formatter/test548/A_out.js | 3 - .../workspace/Formatter/test549/A_in.js | 2 - .../workspace/Formatter/test549/A_out.js | 5 - .../workspace/Formatter/test550/A_in.js | 6 - .../workspace/Formatter/test550/A_out.js | 6 - .../workspace/Formatter/test551/A_in.js | 4 - .../workspace/Formatter/test551/A_out.js | 7 - .../workspace/Formatter/test552/A_in.js | 4 - .../workspace/Formatter/test552/A_out.js | 9 - .../workspace/Formatter/test553/A_in.js | 1 - .../workspace/Formatter/test553/A_out.js | 2 - .../workspace/Formatter/test554/A_in.js | 1 - .../workspace/Formatter/test554/A_out.js | 2 - .../workspace/Formatter/test555/A_in.js | 9 - .../workspace/Formatter/test555/A_out.js | 9 - .../workspace/Formatter/test556/A_in.js | 3 - .../workspace/Formatter/test556/A_out.js | 3 - .../workspace/Formatter/test557/A_in.js | 3 - .../workspace/Formatter/test557/A_out.js | 3 - .../workspace/Formatter/test558/A_in.js | 7 - .../workspace/Formatter/test558/A_out.js | 6 - .../workspace/Formatter/test559/A_in.js | 7 - .../workspace/Formatter/test559/A_out.js | 6 - .../workspace/Formatter/test560/A_in.js | 10 - .../workspace/Formatter/test560/A_out.js | 12 - .../workspace/Formatter/test561/A_in.js | 10 - .../workspace/Formatter/test561/A_out.js | 11 - .../workspace/Formatter/test562/A_in.js | 1 - .../workspace/Formatter/test562/A_out.js | 1 - .../workspace/Formatter/test563/A_in.js | 1 - .../workspace/Formatter/test563/A_out.js | 1 - .../workspace/Formatter/test564/A_in.js | 10 - .../workspace/Formatter/test564/A_out.js | 12 - .../workspace/Formatter/test565/A_in.js | 8 - .../workspace/Formatter/test565/A_out.js | 8 - .../workspace/Formatter/test566/A_in.js | 8 - .../workspace/Formatter/test566/A_out.js | 9 - .../workspace/Formatter/test567/A_in.js | 5 - .../workspace/Formatter/test567/A_out.js | 7 - .../workspace/Formatter/test568/A_in.js | 5 - .../workspace/Formatter/test568/A_out.js | 7 - .../workspace/Formatter/test569/A_in.js | 5 - .../workspace/Formatter/test569/A_out.js | 7 - .../workspace/Formatter/test570/A_in.js | 8 - .../workspace/Formatter/test570/A_out.js | 8 - .../workspace/Formatter/test571/A_in.js | 8 - .../workspace/Formatter/test571/A_out.js | 15 - .../workspace/Formatter/test572/A_in.js | 1 - .../workspace/Formatter/test572/A_out.js | 1 - .../workspace/Formatter/test573/A_in.js | 1 - .../workspace/Formatter/test573/A_out.js | 1 - .../workspace/Formatter/test574/A_in.js | 6 - .../workspace/Formatter/test574/A_out.js | 6 - .../workspace/Formatter/test575/A_in.js | 5 - .../workspace/Formatter/test575/A_out.js | 6 - .../workspace/Formatter/test576/A_in.js | 41 - .../workspace/Formatter/test576/A_out.js | 40 - .../workspace/Formatter/test577/A_in.js | 1 - .../workspace/Formatter/test577/A_out.js | 5 - .../workspace/Formatter/test578/A_in.js | 1 - .../workspace/Formatter/test578/A_out.js | 2 - .../workspace/Formatter/test579/A_in.js | 12 - .../workspace/Formatter/test579/A_out.js | 16 - .../workspace/Formatter/test580/A_in.js | 12 - .../workspace/Formatter/test580/A_out.js | 16 - .../workspace/Formatter/test581/A_in.js | 10 - .../workspace/Formatter/test581/A_out.js | 15 - .../workspace/Formatter/test582/A_in.js | 10 - .../workspace/Formatter/test582/A_out.js | 15 - .../workspace/Formatter/test583/A_in.js | 7 - .../workspace/Formatter/test583/A_out.js | 10 - .../workspace/Formatter/test584/A_in.js | 8 - .../workspace/Formatter/test584/A_out.js | 8 - .../workspace/Formatter/test585/A_in.js | 9 - .../workspace/Formatter/test585/A_out.js | 8 - .../workspace/Formatter/test586/A_in.js | 8 - .../workspace/Formatter/test586/A_out.js | 8 - .../workspace/Formatter/test587/A_in.js | 9 - .../workspace/Formatter/test587/A_out.js | 8 - .../workspace/Formatter/test588/A_in.js | 6 - .../workspace/Formatter/test588/A_out.js | 7 - .../workspace/Formatter/test589/A_in.js | 35 - .../workspace/Formatter/test589/A_out.js | 34 - .../workspace/Formatter/test590/A_in.js | 33 - .../workspace/Formatter/test590/A_out.js | 33 - .../workspace/Formatter/test591/A_in.js | 33 - .../workspace/Formatter/test591/A_out.js | 33 - .../workspace/Formatter/test592/A_in.js | 5 - .../workspace/Formatter/test592/A_out.js | 21 - .../workspace/Formatter/test593/A_in.js | 3 - .../workspace/Formatter/test593/A_out.js | 4 - .../workspace/Formatter/test594/A_in.js | 3 - .../workspace/Formatter/test594/A_out.js | 4 - .../workspace/Formatter/test595/A_in.js | 6 - .../workspace/Formatter/test595/A_out.js | 7 - .../workspace/Formatter/test596/A_in.js | 6 - .../workspace/Formatter/test596/A_out.js | 7 - .../workspace/Formatter/test597/A_in.js | 3 - .../workspace/Formatter/test597/A_out.js | 5 - .../workspace/Formatter/test598/A_in.js | 3 - .../workspace/Formatter/test598/A_out.js | 5 - .../workspace/Formatter/test599/A_in.js | 3 - .../workspace/Formatter/test599/A_out.js | 6 - .../workspace/Formatter/test600/A_in.js | 7 - .../workspace/Formatter/test600/A_out.js | 7 - .../workspace/Formatter/test601/A_in.js | 11 - .../workspace/Formatter/test601/A_out.js | 36 - .../workspace/Formatter/test605/A_in.js | 6 - .../workspace/Formatter/test605/A_out.js | 7 - .../workspace/Formatter/test606/A_in.js | 17 - .../workspace/Formatter/test606/A_out.js | 21 - .../workspace/Formatter/test607/A_in.js | 70 - .../workspace/Formatter/test607/A_out.js | 69 - .../workspace/Formatter/test608/A_in.js | 12 - .../workspace/Formatter/test608/A_out.js | 13 - .../workspace/Formatter/test609/A_in.js | 21 - .../workspace/Formatter/test609/A_out.js | 21 - .../workspace/Formatter/test610/A_in.js | 6 - .../workspace/Formatter/test610/A_out.js | 6 - .../workspace/Formatter/test610/formatter.xml | 246 - .../workspace/Formatter/test612/A_in.js | 13 - .../workspace/Formatter/test612/A_out.js | 15 - .../workspace/Formatter/test613/A_in.js | 13 - .../workspace/Formatter/test613/A_out.js | 15 - .../workspace/Formatter/test614/A_in.js | 5 - .../workspace/Formatter/test614/A_out.js | 5 - .../workspace/Formatter/test615/A_in.js | 13 - .../workspace/Formatter/test615/A_out.js | 13 - .../workspace/Formatter/test616/A_in.js | 15 - .../workspace/Formatter/test616/A_out.js | 17 - .../workspace/Formatter/test617/A_in.js | 5 - .../workspace/Formatter/test617/A_out.js | 5 - .../workspace/Formatter/test617/formatter.xml | 246 - .../workspace/Formatter/test618/A_in.js | 9 - .../workspace/Formatter/test618/A_out.js | 10 - .../workspace/Formatter/test619/A_in.js | 7 - .../workspace/Formatter/test619/A_out.js | 8 - .../workspace/Formatter/test620/A_in.js | 8 - .../workspace/Formatter/test620/A_out.js | 8 - .../workspace/Formatter/test621/A_in.js | 17 - .../workspace/Formatter/test621/A_out.js | 19 - .../workspace/Formatter/test622/A_in.js | 5 - .../workspace/Formatter/test622/A_out.js | 3 - .../workspace/Formatter/test623/A_in.js | 5 - .../workspace/Formatter/test623/A_out.js | 3 - .../workspace/Formatter/test624/A_in.js | 5 - .../workspace/Formatter/test624/A_out.js | 3 - .../workspace/Formatter/test625/A_in.js | 6 - .../workspace/Formatter/test625/A_out.js | 13298 ------------------ .../workspace/Formatter/test626/A_in.js | 4 - .../workspace/Formatter/test626/A_out.js | 6 - .../workspace/Formatter/test627/A_in.js | 1 - .../workspace/Formatter/test627/A_out.js | 3 - .../workspace/Formatter/test628/A_in.js | 3 - .../workspace/Formatter/test628/A_out.js | 5 - .../workspace/Formatter/test629/A_in.js | 3 - .../workspace/Formatter/test629/A_out.js | 5 - .../workspace/Formatter/test630/A_in.js | 13 - .../workspace/Formatter/test630/A_out.js | 12 - .../workspace/Formatter/test631/A_in.js | 13 - .../workspace/Formatter/test631/A_out.js | 12 - .../workspace/Formatter/test632/A_in.js | 13 - .../workspace/Formatter/test632/A_out.js | 12 - .../workspace/Formatter/test633/A_in.js | 19 - .../workspace/Formatter/test633/A_out.js | 19 - .../workspace/Formatter/test634/A_in.js | 19 - .../workspace/Formatter/test634/A_out.js | 17 - .../workspace/Formatter/test635/A_in.js | 18 - .../workspace/Formatter/test635/A_out.js | 16 - .../workspace/Formatter/test636/A_in.js | 17 - .../workspace/Formatter/test636/A_out.js | 19 - .../workspace/Formatter/test637/A_in.js | 21 - .../workspace/Formatter/test637/A_out.js | 18 - .../workspace/Formatter/test638/A_in.js | 17 - .../workspace/Formatter/test638/A_out.js | 17 - .../workspace/Formatter/test639/A_in.js | 21 - .../workspace/Formatter/test639/A_out.js | 18 - .../workspace/Formatter/test640/A_in.js | 17 - .../workspace/Formatter/test640/A_out.js | 17 - .../workspace/Formatter/test641/A_in.js | 7 - .../workspace/Formatter/test641/A_out.js | 8 - .../workspace/Formatter/test642/A_in.js | 11 - .../workspace/Formatter/test642/A_out.js | 12 - .../workspace/Formatter/test642/formatter.prefs | 248 - .../workspace/Formatter/test642/formatter.xml | 251 - .../workspace/Formatter/test643/A_in.js | 3 - .../workspace/Formatter/test643/A_out.js | 2 - .../workspace/Formatter/test644/A_in.js | 3 - .../workspace/Formatter/test644/A_out.js | 2 - .../workspace/Formatter/test645/A_in.js | 3 - .../workspace/Formatter/test645/A_out.js | 2 - .../workspace/Formatter/test646/A_in.js | 3 - .../workspace/Formatter/test646/A_out.js | 2 - .../workspace/Formatter/test647/A_in.js | 3 - .../workspace/Formatter/test647/A_out.js | 2 - .../workspace/Formatter/test648/A_in.js | 4 - .../workspace/Formatter/test648/A_out.js | 2 - .../workspace/Formatter/test649/A_in.js | 4 - .../workspace/Formatter/test649/A_out.js | 2 - .../workspace/Formatter/test650/A_in.js | 5 - .../workspace/Formatter/test650/A_out.js | 4 - .../workspace/Formatter/test651/A_in.js | 5 - .../workspace/Formatter/test651/A_out.js | 4 - .../workspace/Formatter/test652/A_in.js | 5 - .../workspace/Formatter/test652/A_out.js | 4 - .../workspace/Formatter/test653/A_in.js | 5 - .../workspace/Formatter/test653/A_out.js | 4 - .../workspace/Formatter/test654/A_in.js | 5 - .../workspace/Formatter/test654/A_out.js | 4 - .../workspace/Formatter/test655/A_in.js | 5 - .../workspace/Formatter/test655/A_out.js | 4 - .../workspace/JSSearch/.project | 17 - .../workspace/JSSearch/.settings/.jsdtscope | 7 - .../workspace/JSSearch/NotInClasspath/p/Y.js | 10 - .../workspace/JSSearch/otherSrc()/X31997.js | 4 - .../workspace/JSSearch/otherSrc()/X92210.js | 3 - .../workspace/JSSearch/otherSrc()/Y31997.js | 3 - .../workspace/JSSearch/src/CA.js | 16 - .../workspace/JSSearch/src/D.js | 12 - .../workspace/JSSearch/src/E.js | 7 - .../workspace/JSSearch/src/O.js | 10 - .../workspace/JSSearch/src/Test.js | 29 - .../src/TypeReferenceAsSingleNameReference.js | 14 - .../workspace/JSSearch/src/W.js | 9 - .../workspace/JSSearch/src/X.js | 10 - .../workspace/JSSearch/src/a/A.js | 13 - .../workspace/JSSearch/src/a2/X.js | 11 - .../workspace/JSSearch/src/a3/References.js | 11 - .../workspace/JSSearch/src/a3/X.js | 3 - .../workspace/JSSearch/src/a3/Y.js | 4 - .../workspace/JSSearch/src/a3/Z.js | 3 - .../workspace/JSSearch/src/a3/b/A.js | 9 - .../workspace/JSSearch/src/a3/b/B.js | 3 - .../workspace/JSSearch/src/a4/X.js | 8 - .../workspace/JSSearch/src/a5/B.js | 25 - .../workspace/JSSearch/src/a6/A.js | 26 - .../workspace/JSSearch/src/a7/X.js | 8 - .../workspace/JSSearch/src/a8/A.js | 9 - .../workspace/JSSearch/src/a9/A.js | 16 - .../workspace/JSSearch/src/b1/A.js | 5 - .../workspace/JSSearch/src/b1/B.js | 7 - .../workspace/JSSearch/src/p/A.js | 15 - .../workspace/JSSearch/src/p/X.js | 17 - .../workspace/JSSearch/src/p/Y.js | 13 - .../workspace/JSSearch/src/p/Z.js | 12 - .../workspace/JSSearch/src/p/cls1.js | 9 - .../workspace/JSSearch/src/p/usecls1.js | 6 - .../workspace/JSSearch/src/wc1/X.js | 2 - .../workspace/JSSearch/src/wc2/Y.js | 2 - .../workspace/JSSearch/src/wc3/X44884.js | 2 - .../workspace/JavaProjectSrcTests/.project | 17 - .../JavaProjectSrcTests/.settings/.jsdtscope | 6 - .../workspace/JavaProjectSrcTests/src/A.js | 1 - .../workspace/JavaProjectTests/.project | 17 - .../JavaProjectTests/.settings/.jsdtscope | 7 - .../workspace/JavaProjectTests/B.js | 1 - .../workspace/JavaProjectTests/lib.jar | Bin 783 -> 0 bytes .../workspace/JavaProjectTests/lib142530.jar | Bin 316 -> 0 bytes .../workspace/JavaProjectTests/lib148949.jar | Bin 308 -> 0 bytes .../workspace/JavaProjectTests/q/A.js | 1 - .../workspace/JavaProjectTests/q/readme.txt | 0 .../workspace/JavaProjectTests/x/readme.txt | 0 .../workspace/JavaProjectTests/x/readme2.txt | 0 .../workspace/JavaProjectTests/x/y/Main.js | 1 - .../workspace/JavaSearch/.project | 17 - .../workspace/JavaSearch/.settings/.jsdtscope | 15 - .../workspace/JavaSearch/AbortCompilation.jar | Bin 1711 -> 0 bytes .../workspace/JavaSearch/AbortCompilation.zip | Bin 2522 -> 0 bytes .../workspace/JavaSearch/MyJar.jar | Bin 2040 -> 0 bytes .../workspace/JavaSearch/MyJar.zip | Bin 533 -> 0 bytes .../workspace/JavaSearch/NotInClasspath/p/Y.js | 13 - .../workspace/JavaSearch/b111416.jar | Bin 846 -> 0 bytes .../workspace/JavaSearch/corrupt.jar | 0 .../workspace/JavaSearch/otherSrc()/X31997.js | 3 - .../workspace/JavaSearch/otherSrc()/X92210.js | 3 - .../workspace/JavaSearch/otherSrc()/Y31997.js | 3 - .../workspace/JavaSearch/src/A.js | 8 - .../workspace/JavaSearch/src/B.js | 4 - .../workspace/JavaSearch/src/CA.js | 16 - .../workspace/JavaSearch/src/D.js | 12 - .../workspace/JavaSearch/src/E.js | 7 - .../JavaSearch/src/InterfaceImplementors.js | 5 - .../JavaSearch/src/MemberTypeReference/Azz.js | 19 - .../JavaSearch/src/MemberTypeReference/B.js | 11 - .../workspace/JavaSearch/src/NoReference/A.js | 4 - .../workspace/JavaSearch/src/O.js | 9 - .../JavaSearch/src/ObjectMemberTypeReference/A.js | 8 - .../workspace/JavaSearch/src/PR_1GGNOTF.js | 12 - .../workspace/JavaSearch/src/PackageReference/A.js | 4 - .../workspace/JavaSearch/src/PackageReference/B.js | 4 - .../workspace/JavaSearch/src/PackageReference/C.js | 3 - .../workspace/JavaSearch/src/PackageReference/D.js | 4 - .../workspace/JavaSearch/src/PackageReference/E.js | 4 - .../workspace/JavaSearch/src/PackageReference/F.js | 6 - .../workspace/JavaSearch/src/PackageReference/G.js | 5 - .../workspace/JavaSearch/src/PackageReference/H.js | 6 - .../workspace/JavaSearch/src/PackageReference/I.js | 6 - .../workspace/JavaSearch/src/PackageReference/J.js | 6 - .../workspace/JavaSearch/src/PackageReference/K.js | 4 - .../src/PackageReference/NoReferenceA.js | 4 - .../src/PackageReference/NoReferenceB.js | 4 - .../src/PackageReference/NoReferenceC.js | 3 - .../src/PackageReference/NoReferenceD.js | 4 - .../src/PackageReference/NoReferenceE.js | 4 - .../src/PackageReference/NoReferenceF.js | 6 - .../src/PackageReference/NoReferenceG.js | 5 - .../src/PackageReference/NoReferenceH.js | 6 - .../src/PackageReference/NoReferenceI.js | 6 - .../src/PackageReference/NoReferenceJ.js | 6 - .../workspace/JavaSearch/src/Test.js | 22 - .../src/TypeReferenceAsSingleNameReference.js | 12 - .../JavaSearch/src/TypeReferenceInArray/A.js | 5 - .../JavaSearch/src/TypeReferenceInImport/X.js | 5 - .../JavaSearch/src/VariousTypeReferences/A.js | 3 - .../JavaSearch/src/VariousTypeReferences/B.js | 5 - .../JavaSearch/src/VariousTypeReferences/C.js | 6 - .../JavaSearch/src/VariousTypeReferences/D.js | 4 - .../workspace/JavaSearch/src/W.js | 8 - .../workspace/JavaSearch/src/X.js | 9 - .../workspace/JavaSearch/src/a/A.js | 13 - .../workspace/JavaSearch/src/a2/X.js | 11 - .../workspace/JavaSearch/src/a3/References.js | 11 - .../workspace/JavaSearch/src/a3/X.js | 3 - .../workspace/JavaSearch/src/a3/Y.js | 4 - .../workspace/JavaSearch/src/a3/Z.js | 3 - .../workspace/JavaSearch/src/a3/b/A.js | 8 - .../workspace/JavaSearch/src/a3/b/B.js | 3 - .../workspace/JavaSearch/src/a4/X.js | 8 - .../workspace/JavaSearch/src/a5/B.js | 25 - .../workspace/JavaSearch/src/a6/A.js | 15 - .../workspace/JavaSearch/src/a7/X.js | 8 - .../workspace/JavaSearch/src/a8/A.js | 9 - .../workspace/JavaSearch/src/a9/A.js | 13 - .../workspace/JavaSearch/src/b1/A.js | 5 - .../workspace/JavaSearch/src/b1/B.js | 7 - .../workspace/JavaSearch/src/b111416/X.js | 8 - .../workspace/JavaSearch/src/b2/X.js | 6 - .../workspace/JavaSearch/src/b2/Y.js | 6 - .../workspace/JavaSearch/src/b2/Z.js | 8 - .../workspace/JavaSearch/src/b3/X.js | 14 - .../workspace/JavaSearch/src/b4/A.js | 6 - .../workspace/JavaSearch/src/b5/A.js | 10 - .../workspace/JavaSearch/src/b6/A.js | 8 - .../workspace/JavaSearch/src/b7/X.js | 14 - .../workspace/JavaSearch/src/b8/Test.js | 6 - .../workspace/JavaSearch/src/b9/Foo.js | 5 - .../workspace/JavaSearch/src/c1/A.js | 5 - .../workspace/JavaSearch/src/c1/B.js | 5 - .../workspace/JavaSearch/src/c1/I.js | 5 - .../workspace/JavaSearch/src/c10/X.js | 11 - .../workspace/JavaSearch/src/c11/A.js | 11 - .../workspace/JavaSearch/src/c2/A.js | 7 - .../workspace/JavaSearch/src/c2/B.js | 9 - .../workspace/JavaSearch/src/c3/C.js | 11 - .../workspace/JavaSearch/src/c4/X.js | 8 - .../workspace/JavaSearch/src/c5/Test.js | 5 - .../workspace/JavaSearch/src/c6/X.js | 10 - .../workspace/JavaSearch/src/c7/X.js | 6 - .../workspace/JavaSearch/src/c7/Y.js | 6 - .../workspace/JavaSearch/src/c8/X.js | 4 - .../workspace/JavaSearch/src/c8/Y.js | 4 - .../workspace/JavaSearch/src/c9/X.js | 6 - .../workspace/JavaSearch/src/d1/X.js | 10 - .../workspace/JavaSearch/src/d2/Y.js | 4 - .../workspace/JavaSearch/src/d2/Z.js | 4 - .../workspace/JavaSearch/src/d3/A.js | 7 - .../workspace/JavaSearch/src/d4/X.js | 6 - .../workspace/JavaSearch/src/d4/Y.js | 6 - .../workspace/JavaSearch/src/d5/X.js | 4 - .../workspace/JavaSearch/src/d5/Y.js | 6 - .../workspace/JavaSearch/src/d6/X.js | 5 - .../workspace/JavaSearch/src/d6/Y.js | 5 - .../workspace/JavaSearch/src/d7/A.js | 13 - .../workspace/JavaSearch/src/d8/A.js | 4 - .../workspace/JavaSearch/src/d8/AA.js | 4 - .../workspace/JavaSearch/src/d9/p1/A.js | 4 - .../workspace/JavaSearch/src/d9/p2/B.js | 6 - .../workspace/JavaSearch/src/e1/A29366.js | 10 - .../workspace/JavaSearch/src/e2/X.js | 12 - .../workspace/JavaSearch/src/e3/X31985.js | 5 - .../workspace/JavaSearch/src/e3/Y31985.js | 7 - .../workspace/JavaSearch/src/e4/A.js | 7 - .../workspace/JavaSearch/src/e5/A1.js | 10 - .../workspace/JavaSearch/src/e6/A.js | 7 - .../workspace/JavaSearch/src/e7/A.js | 5 - .../workspace/JavaSearch/src/e8/A.js | 6 - .../workspace/JavaSearch/src/e9/A.js | 13 - .../workspace/JavaSearch/src/f1/X.js | 12 - .../workspace/JavaSearch/src/f2/X.js | 12 - .../workspace/JavaSearch/src/f3/X.js | 24 - .../JavaSearch/src/j1/JavadocHiddenRef.js | 18 - .../JavaSearch/src/j1/JavadocInvalidRef.js | 20 - .../workspace/JavaSearch/src/j1/JavadocSearched.js | 9 - .../workspace/JavaSearch/src/j1/JavadocValidRef.js | 17 - .../workspace/JavaSearch/src/j2/Bug47968.js | 6 - .../workspace/JavaSearch/src/j2/Bug47968s.js | 30 - .../workspace/JavaSearch/src/j3/Y.js | 5 - .../workspace/JavaSearch/src/j4/CC47209.js | 9 - .../workspace/JavaSearch/src/j4/CF47209.js | 9 - .../workspace/JavaSearch/src/j4/CM47209.js | 9 - .../workspace/JavaSearch/src/j4/CT47209.js | 9 - .../workspace/JavaSearch/src/j4/FC47209.js | 9 - .../workspace/JavaSearch/src/j4/FF47209.js | 9 - .../workspace/JavaSearch/src/j4/FM47209.js | 9 - .../workspace/JavaSearch/src/j4/FT47209.js | 9 - .../workspace/JavaSearch/src/j4/MC47209.js | 9 - .../workspace/JavaSearch/src/j4/MF47209.js | 9 - .../workspace/JavaSearch/src/j4/MM47209.js | 9 - .../workspace/JavaSearch/src/j4/MT47209.js | 9 - .../workspace/JavaSearch/src/j4/TC47209.js | 9 - .../workspace/JavaSearch/src/j4/TF47209.js | 9 - .../workspace/JavaSearch/src/j4/TM47209.js | 9 - .../workspace/JavaSearch/src/j4/TT47209.js | 9 - .../workspace/JavaSearch/src/j5/Bug49994.js | 15 - .../workspace/JavaSearch/src/j6/Bug54962.js | 8 - .../JavaSearch/src/j7/qua/li/fied/Bug54962a.js | 10 - .../JavaSearch/src/net/sf/saxon/om/Navigator.js | 637 - .../workspace/JavaSearch/src/p/A.js | 16 - .../workspace/JavaSearch/src/p/I.js | 3 - .../workspace/JavaSearch/src/p/X.js | 20 - .../workspace/JavaSearch/src/p/Y.js | 13 - .../workspace/JavaSearch/src/p/Z.js | 12 - .../workspace/JavaSearch/src/p10/a/b/dom/Y.js | 4 - .../workspace/JavaSearch/src/p10/a/b/om/X.js | 7 - .../workspace/JavaSearch/src/p2/Z.js | 3 - .../workspace/JavaSearch/src/p3/X.js | 4 - .../workspace/JavaSearch/src/p3/p2/p/X.js | 4 - .../workspace/JavaSearch/src/p4/A.js | 10 - .../workspace/JavaSearch/src/p5/A.js | 9 - .../workspace/JavaSearch/src/p6/A.js | 21 - .../workspace/JavaSearch/src/p7/A.js | 12 - .../workspace/JavaSearch/src/p71267/Test.js | 8 - .../workspace/JavaSearch/src/p71267/q71267/Test.js | 19 - .../workspace/JavaSearch/src/p8/A.js | 13 - .../workspace/JavaSearch/src/p9/X.js | 11 - .../workspace/JavaSearch/src/q1/B.js | 10 - .../workspace/JavaSearch/src/q2/A.js | 5 - .../workspace/JavaSearch/src/q3/A$B.js | 4 - .../workspace/JavaSearch/src/q4/C.js | 7 - .../workspace/JavaSearch/src/q5/AQ.js | 14 - .../workspace/JavaSearch/src/q6/CD.js | 11 - .../workspace/JavaSearch/src/q7/AQ.js | 14 - .../workspace/JavaSearch/src/q8/EclipseTest.js | 11 - .../workspace/JavaSearch/src/q9/I.js | 12 - .../workspace/JavaSearch/src/r/A.js | 20 - .../workspace/JavaSearch/src/r2/I.js | 4 - .../workspace/JavaSearch/src/r2/X.js | 6 - .../workspace/JavaSearch/src/r3/A21485.js | 4 - .../workspace/JavaSearch/src/r4/B21485.js | 5 - .../workspace/JavaSearch/src/r5/XYZ.js | 4 - .../workspace/JavaSearch/src/r6/A.js | 8 - .../workspace/JavaSearch/src/r6/B.js | 10 - .../workspace/JavaSearch/src/r7/A.js | 4 - .../workspace/JavaSearch/src/r7/B.js | 5 - .../workspace/JavaSearch/src/r8/A.js | 6 - .../workspace/JavaSearch/src/r9/A.js | 3 - .../workspace/JavaSearch/src/s1/X.js | 4 - .../workspace/JavaSearch/src/s1/Y.js | 5 - .../workspace/JavaSearch/src/s2/X.js | 4 - .../workspace/JavaSearch/src/s2/Z.js | 5 - .../workspace/JavaSearch/src/s3/A.js | 13 - .../workspace/JavaSearch/src/s4/X.js | 18 - .../workspace/JavaSearch/src/s5/A.js | 12 - .../workspace/JavaSearch/src/sd/AQ.js | 12 - .../workspace/JavaSearch/src/wc/X.js | 3 - .../workspace/JavaSearch/src/wc1/X.js | 3 - .../workspace/JavaSearch/src/wc2/Y.js | 3 - .../workspace/JavaSearch/src/wc3/X44884.js | 4 - .../workspace/JavaSearch/test20631.jar | Bin 978 -> 0 bytes .../workspace/JavaSearch/test20631.zip | Bin 208 -> 0 bytes .../workspace/JavaSearch/test24741.jar | Bin 1145 -> 0 bytes .../workspace/JavaSearch/test47909.jar | Bin 1093 -> 0 bytes .../workspace/JavaSearch/test47989.jar | Bin 1168 -> 0 bytes .../workspace/JavaSearch/test48261.jar | Bin 1207 -> 0 bytes .../workspace/JavaSearch/test48725.jar | Bin 1240 -> 0 bytes .../workspace/JavaSearch15/.classpath | 6 - .../workspace/JavaSearch15/.project | 17 - .../workspace/JavaSearch15/src/a1/Author.js | 8 - .../workspace/JavaSearch15/src/a1/Test.js | 8 - .../workspace/JavaSearch15/src/e1/Team.js | 29 - .../workspace/JavaSearch15/src/e1/Test.js | 28 - .../JavaSearch15/src/g1/t/m/def/Generic.js | 20 - .../JavaSearch15/src/g1/t/m/def/NonGeneric.js | 15 - .../workspace/JavaSearch15/src/g1/t/m/ref/R1.js | 26 - .../workspace/JavaSearch15/src/g1/t/m/ref/R2.js | 26 - .../workspace/JavaSearch15/src/g1/t/m/ref/R3.js | 26 - .../workspace/JavaSearch15/src/g1/t/m/ref/R4.js | 26 - .../JavaSearch15/src/g1/t/s/def/Generic.js | 16 - .../JavaSearch15/src/g1/t/s/def/NonGeneric.js | 12 - .../workspace/JavaSearch15/src/g1/t/s/ref/R1.js | 26 - .../workspace/JavaSearch15/src/g1/t/s/ref/R2.js | 26 - .../workspace/JavaSearch15/src/g1/t/s/ref/R3.js | 26 - .../workspace/JavaSearch15/src/g1/t/s/ref/R4.js | 26 - .../workspace/JavaSearch15/src/g2/f/m/def/R1.js | 38 - .../workspace/JavaSearch15/src/g2/f/m/def/R2.js | 38 - .../workspace/JavaSearch15/src/g2/f/m/def/R3.js | 54 - .../workspace/JavaSearch15/src/g2/f/m/def/R4.js | 38 - .../workspace/JavaSearch15/src/g2/f/m/ref/RR1.js | 21 - .../workspace/JavaSearch15/src/g2/f/m/ref/RR2.js | 21 - .../workspace/JavaSearch15/src/g2/f/m/ref/RR3.js | 21 - .../workspace/JavaSearch15/src/g2/f/m/ref/RR4.js | 21 - .../workspace/JavaSearch15/src/g2/f/s/def/R1.js | 38 - .../workspace/JavaSearch15/src/g2/f/s/def/R2.js | 38 - .../workspace/JavaSearch15/src/g2/f/s/def/R3.js | 54 - .../workspace/JavaSearch15/src/g2/f/s/def/R4.js | 38 - .../workspace/JavaSearch15/src/g2/f/s/ref/RR1.js | 21 - .../workspace/JavaSearch15/src/g2/f/s/ref/RR2.js | 21 - .../workspace/JavaSearch15/src/g2/f/s/ref/RR3.js | 21 - .../workspace/JavaSearch15/src/g2/f/s/ref/RR4.js | 21 - .../workspace/JavaSearch15/src/g3/t/def/GM.js | 20 - .../workspace/JavaSearch15/src/g3/t/def/GS.js | 16 - .../workspace/JavaSearch15/src/g3/t/def/NGM.js | 15 - .../workspace/JavaSearch15/src/g3/t/def/NGS.js | 12 - .../workspace/JavaSearch15/src/g3/t/ref/R1.js | 43 - .../workspace/JavaSearch15/src/g3/t/ref/R2.js | 43 - .../workspace/JavaSearch15/src/g3/t/ref/R3.js | 43 - .../workspace/JavaSearch15/src/g3/t/ref/R4.js | 43 - .../workspace/JavaSearch15/src/g4/v/ref/R1.js | 35 - .../workspace/JavaSearch15/src/g4/v/ref/R2.js | 36 - .../workspace/JavaSearch15/src/g4/v/ref/R3.js | 35 - .../workspace/JavaSearch15/src/g4/v/ref/R4.js | 35 - .../workspace/JavaSearch15/src/g4/v/ref/R5.js | 48 - .../JavaSearch15/src/g5/c/def/Multiple.js | 17 - .../workspace/JavaSearch15/src/g5/c/def/Single.js | 16 - .../JavaSearch15/src/g5/c/ref/RefMultiple.js | 27 - .../workspace/JavaSearch15/src/g5/c/ref/RefRaw.js | 22 - .../JavaSearch15/src/g5/c/ref/RefSingle.js | 27 - .../JavaSearch15/src/g5/m/def/Multiple.js | 32 - .../workspace/JavaSearch15/src/g5/m/def/Single.js | 32 - .../JavaSearch15/src/g5/m/ref/RefMultiple.js | 42 - .../workspace/JavaSearch15/src/g5/m/ref/RefRaw.js | 26 - .../JavaSearch15/src/g5/m/ref/RefSingle.js | 59 - .../workspace/JavaSearch15/src/g6/t/def/List.js | 2 - .../workspace/JavaSearch15/src/g6/t/def/Table.js | 4 - .../JavaSearch15/src/g6/t/ref/Multiple.js | 8 - .../JavaSearch15/src/g6/t/ref/QualifMultiple.js | 6 - .../JavaSearch15/src/g6/t/ref/QualifSingle.js | 7 - .../workspace/JavaSearch15/src/g6/t/ref/Single.js | 8 - .../workspace/JavaSearch15/src/p1/X.js | 3 - .../workspace/JavaSearch15/src/p1/Y.js | 6 - .../workspace/JavaSearch15/src/p2/X.js | 9 - .../workspace/JavaSearch15/src/p2/Y.js | 10 - .../workspace/JavaSearch15/src/p3/X.js | 6 - .../workspace/JavaSearch15/src/s1/A.js | 7 - .../workspace/JavaSearch15/src/s1/B.js | 10 - .../workspace/JavaSearch15/src/s1/C.js | 10 - .../workspace/JavaSearch15/src/s1/D.js | 9 - .../workspace/JavaSearch15/src/s1/pack/age/S.js | 8 - .../workspace/JavaSearch15/src/s2/A.js | 8 - .../workspace/JavaSearch15/src/s2/B.js | 10 - .../workspace/JavaSearch15/src/s2/C.js | 10 - .../workspace/JavaSearch15/src/s2/D.js | 9 - .../workspace/JavaSearch15/src/s2/pack/age/S.js | 8 - .../workspace/JavaSearch15/src/v1/X.js | 14 - .../workspace/JavaSearchBugs/.classpath | 19 - .../workspace/JavaSearchBugs/.project | 17 - .../workspace/JavaSearchBugs/lib/JavaSearch15.jar | Bin 8077 -> 0 bytes .../workspace/JavaSearchBugs/lib/b110422.jar | Bin 724 -> 0 bytes .../workspace/JavaSearchBugs/lib/b123679.jar | Bin 2782 -> 0 bytes .../workspace/JavaSearchBugs/lib/b124469.jar | Bin 6234 -> 0 bytes .../workspace/JavaSearchBugs/lib/b124645.jar | Bin 6715 -> 0 bytes .../workspace/JavaSearchBugs/lib/b125178.jar | Bin 2098 -> 0 bytes .../workspace/JavaSearchBugs/lib/b126330.jar | Bin 1135 -> 0 bytes .../workspace/JavaSearchBugs/lib/b128877.jar | Bin 1851 -> 0 bytes .../workspace/JavaSearchBugs/lib/b137984.jar | Bin 1688 -> 0 bytes .../workspace/JavaSearchBugs/lib/b140156.jar | Bin 928 -> 0 bytes .../workspace/JavaSearchBugs/lib/b148215.jar | Bin 1675 -> 0 bytes .../workspace/JavaSearchBugs/lib/b164791.jar | Bin 3587 -> 0 bytes .../workspace/JavaSearchBugs/lib/b166348.jar | Bin 955 -> 0 bytes .../workspace/JavaSearchBugs/lib/b86293.jar | Bin 1568 -> 0 bytes .../workspace/JavaSearchBugs/lib/b87627.jar | Bin 1169 -> 0 bytes .../workspace/JavaSearchBugs/lib/b89848/Test.js | 7 - .../workspace/JavaSearchBugs/lib/b89848/X.js | 11 - .../workspace/JavaSearchBugs/lib/b95152.jar | Bin 6646 -> 0 bytes .../workspace/JavaSearchBugs/lib/test75816.jar | Bin 1169 -> 0 bytes .../workspace/JavaSearchBugs/lib/test81556.jar | Bin 717 -> 0 bytes .../JavaSearchBugs/src/b108088/B108088.js | 7 - .../JavaSearchBugs/src/b108088/Test108088.js | 12 - .../JavaSearchBugs/src/b123679/pack/I123679.js | 3 - .../JavaSearchBugs/src/b123679/test/Test.js | 19 - .../JavaSearchBugs/src/b124645/T_124645.js | 10 - .../JavaSearchBugs/src/b124645/test/A_124645.js | 7 - .../JavaSearchBugs/src/b124645/test/X_124645.js | 7 - .../JavaSearchBugs/src/b124645/xy/X_124645.js | 5 - .../JavaSearchBugs/src/b124645/xy/Y_124645.js | 4 - .../JavaSearchBugs/src/b127628/Test127628.js | 5 - .../workspace/JavaSearchBugs/src/b137984/C.js | 15 - .../workspace/JavaSearchBugs/src/b163984/A.js | 4 - .../workspace/JavaSearchBugs/src/b163984/B.js | 4 - .../workspace/JavaSearchBugs/src/b163984/C.js | 4 - .../JavaSearchBugs/src/b81556/a/A81556.js | 9 - .../JavaSearchBugs/src/b81556/a/B81556.js | 7 - .../JavaSearchBugs/src/b81556/a/X81556.js | 4 - .../JavaSearchBugs/src/b81556/b/XX81556.js | 4 - .../workspace/JavaSearchBugs/src/b86380/Annot.js | 5 - .../workspace/JavaSearchBugs/src/b95794/Test.js | 16 - .../JavaSearchMultipleProjects1/.classpath | 6 - .../workspace/JavaSearchMultipleProjects1/.project | 17 - .../JavaSearchMultipleProjects1/lib/p/X.js | 3 - .../JavaSearchMultipleProjects2/.classpath | 8 - .../workspace/JavaSearchMultipleProjects2/.project | 18 - .../JavaSearchMultipleProjects2/lib/p/Y.js | 3 - .../JavaSearchMultipleProjects2/src/q/Z.js | 11 - .../workspace/Resolve/.project | 17 - .../workspace/Resolve/.settings/.jsdtscope | 16 - .../Resolve/class-folder/ResolveConstructorCall.js | 6 - .../ResolveConstructorCallOfMemberType.js | 6 - .../ResolveConstructorCallOfMemberType2.js | 8 - .../Resolve/class-folder/test0101/Test.js | 5 - .../workspace/Resolve/jj.jar | Bin 997 -> 0 bytes .../workspace/Resolve/jjsrc.zip | Bin 428 -> 0 bytes .../workspace/Resolve/p3.jar | Bin 483 -> 0 bytes .../workspace/Resolve/p3src.zip | Bin 328 -> 0 bytes .../workspace/Resolve/p4.jar | Bin 483 -> 0 bytes .../workspace/Resolve/p4src.zip | Bin 328 -> 0 bytes .../workspace/Resolve/src/ResolveAbstractMethod.js | 7 - .../workspace/Resolve/src/ResolveArgumentName.js | 3 - .../workspace/Resolve/src/ResolveArrayLength.js | 6 - .../src/ResolveArrayParameterInsideParent1.js | 5 - .../Resolve/src/ResolveCatchArgumentName.js | 6 - .../Resolve/src/ResolveCatchArgumentType1.js | 7 - .../Resolve/src/ResolveCatchArgumentType2.js | 5 - .../workspace/Resolve/src/ResolveClass1.js | 5 - .../workspace/Resolve/src/ResolveClass2.js | 7 - .../workspace/Resolve/src/ResolveClass3.js | 5 - .../workspace/Resolve/src/ResolveClass4.js | 7 - .../workspace/Resolve/src/ResolveClass5.js | 6 - .../workspace/Resolve/src/ResolveClass6.js | 3 - .../workspace/Resolve/src/ResolveConstructor.js | 9 - .../Resolve/src/ResolveConstructorDeclaration.js | 6 - .../Resolve/src/ResolveDeepLocalVariable.js | 24 - .../src/ResolveDuplicateFieldDeclaration.js | 10 - .../src/ResolveDuplicateFieldDeclaration3.js | 10 - .../src/ResolveDuplicateMethodDeclaration.js | 2 - .../src/ResolveDuplicateMethodDeclaration11.js | 10 - .../src/ResolveDuplicateMethodDeclaration3.js | 2 - .../src/ResolveDuplicateMethodDeclaration5.js | 4 - .../src/ResolveDuplicateMethodDeclaration7.js | 6 - .../src/ResolveDuplicateMethodDeclaration9.js | 10 - .../Resolve/src/ResolveDuplicateTypeDeclaration.js | 6 - .../src/ResolveDuplicateTypeDeclaration3.js | 10 - .../src/ResolveDuplicateTypeDeclaration5.js | 10 - .../Resolve/src/ResolveEmptySelectionOnMethod.js | 5 - .../workspace/Resolve/src/ResolveEndOfFile.js | 3 - .../src/ResolveExplicitSuperConstructorCall.js | 5 - .../src/ResolveExplicitThisConstructorCall.js | 9 - .../workspace/Resolve/src/ResolveField.js | 4 - .../workspace/Resolve/src/ResolveField0.js | 6 - .../Resolve/src/ResolveFieldDeclaration.js | 1 - .../workspace/Resolve/src/ResolveImport.js | 5 - .../Resolve/src/ResolveInnerClassAsParamater.js | 11 - .../workspace/Resolve/src/ResolveInterface.js | 3 - .../workspace/Resolve/src/ResolveLocalClass1.js | 11 - .../workspace/Resolve/src/ResolveLocalClass2.js | 9 - .../workspace/Resolve/src/ResolveLocalClass3.js | 9 - .../workspace/Resolve/src/ResolveLocalClass4.js | 13 - .../workspace/Resolve/src/ResolveLocalClass5.js | 12 - .../workspace/Resolve/src/ResolveLocalClass6.js | 8 - .../workspace/Resolve/src/ResolveLocalClass7.js | 18 - .../Resolve/src/ResolveLocalConstructor.js | 13 - .../src/ResolveLocalConstructorDeclaration.js | 10 - .../workspace/Resolve/src/ResolveLocalField.js | 10 - .../workspace/Resolve/src/ResolveLocalField2.js | 16 - .../Resolve/src/ResolveLocalFieldDeclaration.js | 7 - .../src/ResolveLocalMemberTypeDeclaration1.js | 8 - .../src/ResolveLocalMemberTypeDeclaration2.js | 10 - .../workspace/Resolve/src/ResolveLocalMethod.js | 13 - .../workspace/Resolve/src/ResolveLocalMethod2.js | 17 - .../Resolve/src/ResolveLocalMethodDeclaration.js | 10 - .../workspace/Resolve/src/ResolveLocalName.js | 15 - .../workspace/Resolve/src/ResolveLocalVariable.js | 18 - .../Resolve/src/ResolveMemberTypeDeclaration1.js | 4 - .../Resolve/src/ResolveMemberTypeDeclaration2.js | 6 - .../Resolve/src/ResolveMessageSendOnBaseType.js | 4 - .../workspace/Resolve/src/ResolveMethod.js | 7 - .../Resolve/src/ResolveMethodDeclaration.js | 6 - .../src/ResolveMethodDeclarationInAnonymous.js | 8 - .../src/ResolveMethodDeclarationInAnonymous2.js | 6 - .../src/ResolveMethodDeclarationInAnonymous3.js | 14 - .../src/ResolveMethodDeclarationInInterface.js | 6 - .../src/ResolveMethodWithIncorrectParameter.js | 5 - .../workspace/Resolve/src/ResolvePackage.js | 4 - .../Resolve/src/ResolvePartiallyQualifiedType.js | 5 - .../workspace/Resolve/src/ResolveQualifiedName1.js | 3 - .../workspace/Resolve/src/ResolveQualifiedName2.js | 3 - .../workspace/Resolve/src/ResolveQualifiedName3.js | 3 - .../workspace/Resolve/src/ResolveQualifiedName4.js | 3 - .../workspace/Resolve/src/ResolveQualifiedName5.js | 10 - .../workspace/Resolve/src/ResolveQualifiedType.js | 5 - .../Resolve/src/ResolveTypeDeclaration.js | 5 - .../Resolve/src/ResolveTypeEmptySelection.js | 3 - .../Resolve/src/ResolveTypeEmptySelection2.js | 3 - .../workspace/Resolve/src/ResolveTypeInComment.js | 4 - .../workspace/Resolve/src/ResolveUnicode.js | 3 - .../workspace/Resolve/src/SuperClass.js | 5 - .../workspace/Resolve/src/SuperInterface.js | 3 - .../workspace/Resolve/src/X1.js | 4 - .../workspace/Resolve/src/a/b/ImportedClass.js | 5 - .../workspace/Resolve/src/b120350/Test.js | 3 - .../workspace/Resolve/src/b120350/X.js | 1 - .../workspace/Resolve/src/p1/X.js | 3 - .../workspace/Resolve/src/p1/Y.js | 3 - .../workspace/Resolve/src/p2/X.js | 5 - .../workspace/Resolve/src/pp/qq/XX.js | 8 - .../workspace/Resolve/src2/test0001/Test.js | 8 - .../workspace/Resolve/src2/test0002/Test.js | 9 - .../workspace/Resolve/src2/test0003/Test.js | 9 - .../workspace/Resolve/src2/test0005/Test.js | 9 - .../workspace/Resolve/src2/test0006/Test.js | 8 - .../workspace/Resolve/src2/test0007/Test.js | 8 - .../workspace/Resolve/src2/test0008/Test.js | 9 - .../workspace/Resolve/src2/test0009/Test.js | 10 - .../workspace/Resolve/src2/test0010/Test.js | 10 - .../workspace/Resolve/src2/test0011/Test.js | 9 - .../workspace/Resolve/src2/test0012/Test.js | 10 - .../workspace/Resolve/src2/test0013/Test.js | 11 - .../workspace/Resolve/src2/test0014/Test.js | 12 - .../workspace/Resolve/src2/test0015/Test.js | 8 - .../workspace/Resolve/src2/test0016/Test.js | 7 - .../workspace/Resolve/src2/test0017/Test.js | 7 - .../workspace/Resolve/src2/test0018/Test.js | 7 - .../workspace/Resolve/src2/test0019/Test.js | 7 - .../workspace/Resolve/src2/test0020/Test.js | 10 - .../workspace/Resolve/src2/test0021/Test.js | 7 - .../workspace/Resolve/src2/test0022/A.js | 10 - .../workspace/Resolve/src2/test0022/Test.js | 8 - .../workspace/Resolve/src2/test0022/X.js | 7 - .../workspace/Resolve/src2/test0022/Y.js | 5 - .../workspace/Resolve/src2/test0023/Test.js | 8 - .../workspace/Resolve/src2/test0024/Test.js | 6 - .../workspace/Resolve/src2/test0025/Test.js | 5 - .../workspace/Resolve/test0023.jar | Bin 4537 -> 0 bytes .../workspace/Resolve/test0023src.zip | Bin 923 -> 0 bytes .../workspace/Resolve/test25888.jar | Bin 1083 -> 0 bytes .../workspace/Resolve/test25888src.zip | Bin 286 -> 0 bytes .../workspace/Resolve/test47177.jar | Bin 1236 -> 0 bytes .../workspace/Resolve/test47177src.zip | Bin 608 -> 0 bytes .../workspace/Resolve/test47214.jar | Bin 1126 -> 0 bytes .../workspace/Resolve/zzz.jar | Bin 1621 -> 0 bytes .../workspace/Resolve/zzzsrc.zip | Bin 400 -> 0 bytes .../workspace/SnippetCompletion/.classpath | 16 - .../workspace/SnippetCompletion/.project | 17 - .../class-folder/aa/bb/cc/CClass.js | 16 - .../class-folder/bug132665/Bug132665.js | 8 - .../SnippetCompletion/src/aa/bb/cc/BClass.js | 16 - .../workspace/TypeHierarchy/.project | 17 - .../workspace/TypeHierarchy/.settings/.jsdtscope | 16 - .../workspace/TypeHierarchy/NotInClasspath/e/E.js | 4 - .../workspace/TypeHierarchy/lib.jar | Bin 6026 -> 0 bytes .../TypeHierarchy/lib48459/p48459/p2/Y48459.js | 4 - .../TypeHierarchy/lib53095/p53095/X53095.js | 3 - .../workspace/TypeHierarchy/src/cycle/X.js | 3 - .../workspace/TypeHierarchy/src/cycle/Y.js | 3 - .../workspace/TypeHierarchy/src/p1/A.js | 5 - .../workspace/TypeHierarchy/src/p1/Deep.js | 3 - .../workspace/TypeHierarchy/src/p1/I1.js | 3 - .../workspace/TypeHierarchy/src/p1/I2.js | 3 - .../workspace/TypeHierarchy/src/p1/X.js | 3 - .../workspace/TypeHierarchy/src/p1/Y.js | 3 - .../workspace/TypeHierarchy/src/p1/Z.js | 3 - .../workspace/TypeHierarchy/src/p2/I.js | 3 - .../workspace/TypeHierarchy/src/p2/I1.js | 3 - .../workspace/TypeHierarchy/src/p2/I2.js | 3 - .../workspace/TypeHierarchy/src/p2/I3.js | 3 - .../workspace/TypeHierarchy/src/p2/X.js | 3 - .../workspace/TypeHierarchy/src/p2/Y.js | 3 - .../workspace/TypeHierarchy/src/p3/A.js | 4 - .../workspace/TypeHierarchy/src/p3/B.js | 4 - .../workspace/TypeHierarchy/src/p3/I.js | 4 - .../workspace/TypeHierarchy/src/p3/I1.js | 4 - .../workspace/TypeHierarchy/src/p4/X.js | 4 - .../TypeHierarchy/src/p48459/p1/X48459.js | 5 - .../TypeHierarchy/src/p48459/p1/Z48459.js | 8 - .../workspace/TypeHierarchy/src/p5/X.js | 5 - .../workspace/TypeHierarchy/src/p6/A.js | 12 - .../workspace/TypeHierarchy/src/p7/A.js | 37 - .../workspace/TypeHierarchy/src/p7/X.js | 3 - .../workspace/TypeHierarchy/src/p8/X.js | 10 - .../workspace/TypeHierarchy/src/p9/X.js | 9 - .../workspace/TypeHierarchy/src/q1/X.js | 3 - .../workspace/TypeHierarchy/src/q1/Z.js | 3 - .../workspace/TypeHierarchy/src/q2/Y.js | 3 - .../workspace/TypeHierarchy/src/q3/Z.js | 6 - .../workspace/TypeHierarchy/src/q4/X.js | 3 - .../workspace/TypeHierarchy/src/q4/Y.js | 3 - .../workspace/TypeHierarchy/src/q5/X.js | 7 - .../workspace/TypeHierarchy/src/q6/Y.js | 3 - .../workspace/TypeHierarchy/src/q6/Z.js | 3 - .../workspace/TypeHierarchy/src/q7/X.js | 11 - .../workspace/TypeHierarchy/src/wc/X.js | 3 - .../workspace/TypeHierarchy/test144976.jar | Bin 1235 -> 0 bytes .../workspace/TypeHierarchy/test49809.jar | Bin 682 -> 0 bytes .../workspace/TypeHierarchy/test54043.jar | Bin 2263 -> 0 bytes .../workspace/TypeHierarchy/test58440.jar | Bin 1620 -> 0 bytes .../workspace/TypeHierarchy/test60365.jar | Bin 902 -> 0 bytes .../workspace/TypeHierarchyDependent/.project | 18 - .../TypeHierarchyDependent/.settings/.jsdtscope | 7 - .../workspace/TypeHierarchyDependent/Dependent.js | 3 - .../workspace/TypeHierarchyNotification/.project | 17 - .../TypeHierarchyNotification/.settings/.jsdtscope | 7 - .../workspace/TypeHierarchyNotification/src/a/A.js | 3 - .../workspace/TypeHierarchyNotification/src/b/B.js | 5 - .../workspace/TypeHierarchyNotification/src/c/C.js | 5 - .../workspace/TypeHierarchyNotification/src/d/D.js | 4 - .../workspace/TypeHierarchyNotification/src/e/E.js | 4 - .../TypeHierarchyNotification/src/i/I1.js | 3 - .../TypeHierarchyNotification/src/i/I2.js | 3 - .../TypeHierarchyNotification/src/p/External.js | 4 - .../TypeHierarchyNotification/src/p/MyError.js | 3 - .../workspace/TypeHierarchyNotification/src/p/X.js | 6 - .../src/p/other/External.js | 4 - .../TypeHierarchyNotification/src/p2/A.js | 4 - .../TypeHierarchyNotification/src/p2/B.js | 4 - .../TypeHierarchyNotification/src/p3/A.js | 4 - .../TypeHierarchyNotification/src/p3/B.js | 4 - .../workspace/TypeHierarchySerialization/.project | 17 - .../.settings/.jsdtscope | 6 - .../TypeHierarchySerialization/src/p1/X.js | 3 - .../TypeHierarchySerialization/src/p1/Y.js | 2 - .../TypeHierarchySerialization/src/p1/Z.js | 2 - .../workspace/TypeResolve/.project | 17 - .../workspace/TypeResolve/.settings/.jsdtscope | 6 - .../workspace/TypeResolve/src/p/TypeResolve.js | 13 - .../workspace/TypeResolve/src/p1/X.js | 3 - .../workspace/TypeResolve/src/p2/Y.js | 3 - .../workspace/TypeResolve/src/p3/B.js | 14 - .../workspace/TypeResolve/src/p4/A.js | 8 - .../workspace/TypeResolve/src/p4/B.js | 6 - .../workspace/TypeResolve/src/p5/A.js | 10 - .../.classpath | 7 - .../org.eclipse.wst.jsdt.debug.core.tests/.project | 28 - .../.settings/org.eclipse.jdt.core.prefs | 90 - .../META-INF/MANIFEST.MF | 17 - .../OSGI-INF/l10n/bundle.properties | 12 - .../about.html | 28 - .../build.properties | 9 - .../debug/core/tests/AbstractBreakpointTest.java | 253 - .../wst/debug/core/tests/AbstractDebugTest.java | 222 - .../wst/debug/core/tests/DebugEventWaiter.java | 176 - .../eclipse/wst/debug/core/tests/DebugSuite.java | 77 - .../wst/debug/core/tests/JSDTDebugTestPlugin.java | 50 - .../debug/core/tests/JavaScriptDebugTestSuite.java | 43 - .../src/org/eclipse/wst/debug/core/tests/Util.java | 227 - .../debug/core/tests/VerticalRulerInfoStub.java | 55 - .../tests/breakpoints/LineBreakpointTests.java | 229 - .../org.eclipse.wst.jsdt.debug.core.tests/test.xml | 117 - .../testsource/test1.js | 17 - .../testsource/test2.js | 34 - .../testsource/test3.js | 49 - .../testsource/test4.js | 16 - .../.classpath | 7 - .../.project | 28 - .../.settings/org.eclipse.jdt.core.prefs | 90 - .../META-INF/MANIFEST.MF | 14 - .../OSGI-INF/l10n/bundle.properties | 12 - .../about.html | 28 - .../build.properties | 9 - .../scripts/script1.js | 17 - .../debug/rhino/tests/BreakpointRequestTests.java | 176 - .../jsdt/debug/rhino/tests/ConnectionHelper.java | 58 - .../jsdt/debug/rhino/tests/DebugSessionTest.java | 248 - .../jsdt/debug/rhino/tests/FrameRequestTests.java | 103 - .../debug/rhino/tests/RequestBadCommandTest.java | 26 - .../debug/rhino/tests/RequestContinueTest.java | 26 - .../jsdt/debug/rhino/tests/RequestDisposeTest.java | 26 - .../jsdt/debug/rhino/tests/RequestLookupTest.java | 90 - .../jsdt/debug/rhino/tests/RequestSuspendTest.java | 26 - .../wst/jsdt/debug/rhino/tests/RequestTest.java | 449 - .../jsdt/debug/rhino/tests/RequestVersionTest.java | 30 - .../debug/rhino/tests/RhinoDebugTestSuite.java | 45 - .../jsdt/debug/rhino/tests/RhinoDebuggerTest.java | 65 - .../jsdt/debug/rhino/tests/ScriptRequestTests.java | 95 - .../jsdt/debug/rhino/tests/TestEventHandler.java | 280 - .../jsdt/debug/rhino/tests/ThreadRequestTests.java | 66 - .../wst/jsdt/debug/rhino/tests/TransportTest.java | 114 - .../eclipse/wst/jsdt/debug/rhino/tests/Util.java | 216 - .../test.xml | 119 - tests/org.eclipse.wst.jsdt.ui.tests/.classpath | 7 - tests/org.eclipse.wst.jsdt.ui.tests/.cvsignore | 2 - tests/org.eclipse.wst.jsdt.ui.tests/.project | 28 - .../.settings/org.eclipse.jdt.core.prefs | 12 - .../META-INF/MANIFEST.MF | 22 - tests/org.eclipse.wst.jsdt.ui.tests/about.html | 28 - .../org.eclipse.wst.jsdt.ui.tests/build.properties | 20 - .../icons/full/eview16/package.gif | Bin 145 -> 0 bytes .../plugin.properties | 17 - tests/org.eclipse.wst.jsdt.ui.tests/plugin.xml | 14 - .../org/eclipse/wst/jsdt/ui/tests/EditorTests.java | 80 - .../org/eclipse/wst/jsdt/ui/tests/JSDTUITests.java | 64 - .../wst/jsdt/ui/tests/format/FormattingTests.java | 192 - .../wst/jsdt/ui/tests/internal/Activator.java | 29 - .../ui/tests/internal/JsStorageEditorInput.java | 164 - tests/org.eclipse.wst.jsdt.ui.tests/test.xml | 117 - 4024 files changed, 362385 deletions(-) delete mode 100644 features/org.eclipse.wst.jsdt_tests.feature/.cvsignore delete mode 100644 features/org.eclipse.wst.jsdt_tests.feature/.project delete mode 100644 features/org.eclipse.wst.jsdt_tests.feature/.settings/org.eclipse.core.resources.prefs delete mode 100644 features/org.eclipse.wst.jsdt_tests.feature/build.properties delete mode 100644 features/org.eclipse.wst.jsdt_tests.feature/eclipse_update_120.jpg delete mode 100644 features/org.eclipse.wst.jsdt_tests.feature/epl-v10.html delete mode 100644 features/org.eclipse.wst.jsdt_tests.feature/feature.properties delete mode 100644 features/org.eclipse.wst.jsdt_tests.feature/feature.xml delete mode 100644 features/org.eclipse.wst.jsdt_tests.feature/license.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/.classpath delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/.cvsignore delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/.project delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/.settings/org.eclipse.core.resources.prefs delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/.settings/org.eclipse.jdt.core.prefs delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/META-INF/MANIFEST.MF delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/META-INF/eclipse.inf delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/about.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/build.properties delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/plugin.properties delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/plugin.xml delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunCompilerTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunDOMTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunFormatterTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunJSDTCoreTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunModelTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterAST3Test.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterBindingsTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterJavadocTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterRecoveryTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterTest2.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterTestAST3_2.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTMatcherTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTModelBridgeTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTNodesCollectorVisitor.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTParserTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTPositionsTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTStructuralPropertyTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTVisitorTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/AbstractASTTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/BatchASTCreationTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/BindingsCollectorVisitor.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/CompatibilityRulesTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ConverterTestSetup.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/GetKeyVisitor.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ProfilingASTConvertionTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/RunAllTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/RunConverterTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/SampleASTs.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/DecodeCodeFormatterPreferences.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/FormatterRegressionTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/comment/CommentFormatterUtil.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/comment/CommentTestCase.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/comment/CommentsTestSuite.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/comment/JavaDocTestCase.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/comment/MultiLineTestCase.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/comment/SingleLineTestCase.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AbstractJavaModelCompletionTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AbstractJavaModelTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AbstractJavaSearchTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AbstractJavadocCompletionModelTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AccessRestrictionsTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AttachSourceTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AttachedJavadocTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/BindingKeyTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/BufferTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CancelCounter.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/Canceler.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ClassFileTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ClassNameTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ClasspathInitializerTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ClasspathTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CodeCorrectionTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CodeCorrectionTestsRequestor.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CodeSnippetParsingUtilTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompilationUnitTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionContextTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionTests2.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionTestsRequestor.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionTestsRequestor2.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionWithMissingTypesTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionWithMissingTypesTests2.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionWithMissingTypesTests_1_5.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ContainerInitializer.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CopyMoveElementsTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CopyMoveResourcesTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CopyMoveTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CreateCompilationUnitTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CreateMembersTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CreatePackageTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/DefaultJavaElementComparator.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/DeleteTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/EncodingTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ExclusionPatternsTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ExistenceTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ExternalJarDeltaTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/FactoryTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/GetSourceTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/HierarchyOnWorkingCopiesTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/InclusionPatternsTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JSDTModelTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaConventionTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaElementDeltaTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaModelTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaProjectTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaScriptLikeExtensionsTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaSearchBugsTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaSearchJavadocTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaSearchMultipleProjectsTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaSearchScopeTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaSearchTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavadocBugsCompletionModelTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavadocCompletionContextTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavadocFieldCompletionModelTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavadocMethodCompletionModelTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavadocPackageCompletionModelTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavadocTextCompletionModelTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavadocTypeCompletionModelTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/LocalElementTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/MementoTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ModifyingResourceTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/NameLookupTests2.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/NamingConventionTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/OptionTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/OverflowingCacheTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ReconcilerStatementsRecoveryTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ReconcilerTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/RenameTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ResolveTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/RootManipulationsTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/RunCompletionModelTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/RunJavaSearchTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/SearchParticipantTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/SearchTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/SelectionJavadocModelTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/Semaphore.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/SignatureTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/SnippetCompletionContextTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/SnippetCompletionTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/SnippetCompletionTests_1_5.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/SortCompilationUnitElementsTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/SuiteOfTestCases.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/TestBuffer.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/TestPessimisticProvider.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/TestProgressMonitor.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/TestvalidationParticipant.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ThreadSafetyTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/TypeHierarchyNotificationTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/TypeHierarchySerializationTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/TypeHierarchyTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/TypeResolveTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/VariablesInitializer.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/WorkingCopyNotInClasspathTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/WorkingCopyOwnerTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/WorkingCopySearchTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/WorkingCopyTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/describing/ASTRewritingExpressionsTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/describing/ASTRewritingGroupNodeTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/describing/ASTRewritingInsertBoundTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/describing/ASTRewritingJavadocTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/describing/ASTRewritingMethodDeclTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/describing/ASTRewritingMoveCodeTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/describing/ASTRewritingStatementsTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/describing/ASTRewritingTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/describing/ASTRewritingTrackingTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/describing/ASTRewritingTypeDeclTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/describing/LineCommentOffsetsTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/describing/SourceModifierTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/describing/StringAsserts.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/modifying/ASTRewritingModifyingCopyTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/modifying/ASTRewritingModifyingInsertTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/modifying/ASTRewritingModifyingMoveTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/modifying/ASTRewritingModifyingOtherTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/modifying/ASTRewritingModifyingRemoveTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/modifying/ASTRewritingModifyingReplaceTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/modifying/ASTRewritingModifyingTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/utils/SequenceReaderTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/test.xml delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/.classpath delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/.project delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/attach.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/attach2.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/attach2src.zip delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/attachsrc.new.zip delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/attachsrc.zip delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/b153133.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/full.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/fullsrc.zip delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/src.zip delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/src/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/srcLib/p/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/test.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/test2.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/test4.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/test4_src.zip delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/test5.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/test6.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/test6src.zip delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/update.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/.classpath delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/.project delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc.zip delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/allclasses-frame.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/allclasses-noframe.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/constant-values.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/deprecated-list.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/help-doc.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/index-files/index-1.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/index-files/index-10.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/index-files/index-11.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/index-files/index-12.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/index-files/index-13.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/index-files/index-14.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/index-files/index-15.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/index-files/index-2.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/index-files/index-3.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/index-files/index-4.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/index-files/index-5.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/index-files/index-6.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/index-files/index-7.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/index-files/index-8.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/index-files/index-9.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/index.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/overview-frame.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/overview-summary.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/overview-tree.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/Annot.D.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/Annot.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/Annot2.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/E.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/TestClass.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/X.A.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/X.B.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/X.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/Z.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/class-use/Annot.D.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/class-use/Annot.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/class-use/Annot2.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/class-use/E.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/class-use/TestClass.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/class-use/X.A.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/class-use/X.B.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/class-use/X.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/class-use/Z.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/p3/C.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/p3/D.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/p3/class-use/C.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/p3/class-use/D.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/p3/package-frame.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/p3/package-summary.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/p3/package-tree.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/p3/package-use.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/package-frame.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/package-summary.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/package-tree.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/package-use.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p2/X.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p2/Y.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p2/Z.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p2/class-use/X.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p2/class-use/Y.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p2/class-use/Z.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p2/package-frame.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p2/package-summary.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p2/package-tree.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p2/package-use.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/package-list delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/resources/inherit.gif delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/stylesheet.css delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/lib/test6.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/lib/test6src.zip delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/src/p1/p2/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/src/p1/p2/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/.project delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/.settings/.jsdtscope delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/lib.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/libSrc.zip delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectArgument1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectException1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectException2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectField1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectField2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectFieldType1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectFieldType2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectFieldType3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectImport1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectImport2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectImport3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectLocalVariable1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectLocalVariableType1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectLocalVariableType2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectMethod1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectMethod2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectReturnType1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectReturnType2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectSuperClass1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectSuperClass2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectSuperInterface1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectSuperInterface2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/.project delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/.settings/.jsdtscope delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/core/compiler/package.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser1.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser10.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser11.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser12.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser13.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser14.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser15.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser16.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser17.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser18.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser19.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser2.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser20.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser21.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser3.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser4.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser5.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser6.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser7.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser8.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser9.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/readableNames.properties delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/problem/messages.properties delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/util/messages.properties delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/core/compiler/CharOperation.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/core/compiler/IProblem.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/core/compiler/InvalidInputException.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/core/compiler/package.html delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ASTVisitor.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ClassFile.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/CompilationResult.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/Compiler.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ConfigurableOption.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/DefaultErrorHandlingPolicies.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ICompilerRequestor.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/IDebugRequestor.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/IErrorHandlingPolicy.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/IProblemFactory.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/AND_AND_Expression.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ASTNode.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/AbstractMethodDeclaration.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/AbstractVariableDeclaration.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/AllocationExpression.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/Annotation.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/AnnotationTypeDeclaration.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/AnnotationTypeMemberDeclaration.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/Argument.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ArrayAllocationExpression.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ArrayInitializer.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ArrayQualifiedTypeReference.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ArrayReference.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ArrayTypeReference.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/AssertStatement.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/Assignment.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/BinaryExpression.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/Block.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/BranchStatement.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/BreakStatement.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/CaseStatement.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/CastExpression.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/CharLiteral.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ClassLiteralAccess.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/Clinit.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/CompilationUnitDeclaration.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/CompoundAssignment.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ConditionalExpression.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ConstructorDeclaration.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ContinueStatement.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/DoStatement.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/DoubleLiteral.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/EmptyStatement.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/EnumConstant.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/EnumDeclaration.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/EqualExpression.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ExplicitConstructorCall.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/Expression.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ExtendedStringLiteral.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/FalseLiteral.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/FieldDeclaration.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/FieldReference.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/FloatLiteral.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ForStatement.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ForeachStatement.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/IfStatement.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ImplicitDocTypeReference.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ImportReference.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/Initializer.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/InstanceOfExpression.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/IntLiteral.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/IntLiteralMinValue.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/Javadoc.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/JavadocAllocationExpression.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/JavadocArgumentExpression.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/JavadocArrayQualifiedTypeReference.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/JavadocArraySingleTypeReference.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/JavadocFieldReference.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/JavadocImportReference.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/JavadocMessageSend.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/JavadocQualifiedTypeReference.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/JavadocReturnStatement.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/JavadocSingleNameReference.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/JavadocSingleTypeReference.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/LabeledStatement.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/Literal.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/LocalDeclaration.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/LongLiteral.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/LongLiteralMinValue.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/MagicLiteral.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/MarkerAnnotation.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/MemberValuePair.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/MessageSend.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/MethodDeclaration.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/NameReference.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/NormalAnnotation.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/NullLiteral.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/NumberLiteral.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/OR_OR_Expression.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/OperatorExpression.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/OperatorIds.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ParameterizedSingleTypeReference.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/PostfixExpression.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/PrefixExpression.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/QualifiedAllocationExpression.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/QualifiedNameReference.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/QualifiedSuperReference.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/QualifiedThisReference.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/QualifiedTypeReference.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/Reference.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ReturnStatement.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/SingleMemberAnnotation.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/SingleNameReference.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/SingleTypeReference.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/Statement.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/StringLiteral.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/StringLiteralConcatenation.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/SubRoutineStatement.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/SuperReference.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/SwitchStatement.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/SynchronizedStatement.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ThisReference.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ThrowStatement.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/TrueLiteral.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/TryStatement.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/TypeDeclaration.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/TypeParameter.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/TypeReference.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/UnaryExpression.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/WhileStatement.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/Wildcard.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/classfmt/ClassFileConstants.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/classfmt/ClassFileReader.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/classfmt/ClassFileStruct.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/classfmt/ClassFormatException.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/classfmt/FieldInfo.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/classfmt/InnerClassInfo.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/classfmt/MethodInfo.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/codegen/AttributeNamesConstants.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/codegen/CaseLabel.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/codegen/CharArrayCache.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/codegen/CodeStream.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/codegen/ConstantPool.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/codegen/DoubleCache.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/codegen/ExceptionLabel.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/codegen/FieldNameAndTypeCache.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/codegen/FloatCache.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/codegen/IntegerCache.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/codegen/Label.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/codegen/LongCache.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/codegen/MethodNameAndTypeCache.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/codegen/ObjectCache.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/codegen/Opcodes.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/codegen/QualifiedNamesConstants.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/env/IBinaryField.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/env/IBinaryMethod.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/env/IBinaryNestedType.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/env/IBinaryType.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/env/ICompilationUnit.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/env/IConstants.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/env/IDependent.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/env/IGenericField.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/env/IGenericMethod.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/env/IGenericType.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/env/INameEnvironment.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/env/ISourceField.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/env/ISourceImport.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/env/ISourceMethod.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/env/ISourceType.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/env/NameEnvironmentAnswer.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/flow/ConditionalFlowInfo.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/flow/ExceptionHandlingFlowContext.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/flow/FinallyFlowContext.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/flow/FlowContext.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/flow/FlowInfo.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/flow/InitializationFlowContext.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/flow/InsideSubRoutineFlowContext.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/flow/LabelFlowContext.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/flow/LoopingFlowContext.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/flow/SwitchFlowContext.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/flow/UnconditionalFlowInfo.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/impl/BooleanConstant.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/impl/ByteConstant.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/impl/CharConstant.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/impl/CompilerOptions.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/impl/Constant.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/impl/DoubleConstant.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/impl/FloatConstant.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/impl/ITypeRequestor.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/impl/IntConstant.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/impl/LongConstant.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/impl/ReferenceContext.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/impl/ShortConstant.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/impl/StringConstant.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/ArrayBinding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/BaseTypeBinding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/BaseTypes.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/BinaryTypeBinding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/Binding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/BindingIds.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/BlockScope.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/ClassScope.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/CompilationUnitScope.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/CompilerModifiers.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/FieldBinding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/ImportBinding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/InnerEmulationDependency.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/InvocationSite.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/LocalTypeBinding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/LocalVariableBinding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/LookupEnvironment.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/MemberTypeBinding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/MethodBinding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/MethodScope.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/MethodVerifier.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/MethodVerifier15.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/NestedTypeBinding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/PackageBinding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/ParameterizedFieldBinding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/ParameterizedMethodBinding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/ParameterizedTypeBinding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/ProblemBinding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/ProblemFieldBinding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/ProblemMethodBinding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/ProblemPackageBinding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/ProblemReasons.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/ProblemReferenceBinding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/RawTypeBinding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/ReferenceBinding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/Scope.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/SignatureWrapper.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/SourceTypeBinding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/Substitution.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/SyntheticAccessMethodBinding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/SyntheticArgumentBinding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/SyntheticFieldBinding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/TagBits.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/TypeBinding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/TypeConstants.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/TypeIds.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/TypeVariableBinding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/UnresolvedReferenceBinding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/UpdatedMethodBinding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/VariableBinding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/WildcardBinding.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/AbstractCommentParser.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/JavadocParser.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/NLSLine.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/Parser.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/ParserBasicInformation.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/RecoveredBlock.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/RecoveredElement.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/RecoveredField.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/RecoveredImport.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/RecoveredInitializer.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/RecoveredLocalVariable.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/RecoveredMethod.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/RecoveredStatement.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/RecoveredType.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/RecoveredUnit.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/Scanner.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/TerminalTokens.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/diagnose/DiagnoseParser.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/diagnose/LexStream.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/diagnose/RangeUtil.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser1.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser10.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser11.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser12.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser13.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser14.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser15.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser16.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser17.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser18.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser19.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser2.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser20.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser21.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser3.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser4.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser5.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser6.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser7.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser8.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser9.rsc delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/readableNames.properties delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/problem/AbortCompilation.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/problem/AbortCompilationUnit.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/problem/AbortMethod.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/problem/AbortType.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/problem/DefaultProblem.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/problem/DefaultProblemFactory.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/problem/ProblemHandler.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/problem/ProblemReporter.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/problem/ProblemSeverities.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/problem/ShouldNotImplement.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/problem/messages.properties delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/util/CompoundNameVector.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/util/FloatUtil.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/util/HashtableOfInt.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/util/HashtableOfIntValues.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/util/HashtableOfLong.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/util/HashtableOfObject.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/util/HashtableOfPackage.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/util/HashtableOfType.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/util/ObjectVector.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/util/SimpleLookupTable.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/util/SimpleNameVector.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/util/SuffixConstants.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/util/Util.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/util/WeakHashSet.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/util/messages.properties delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/.project delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/.settings/.jsdtscope delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/ZZZ.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/constructors.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/constructorssrc.zip delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/generics.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/genericssrc.zip delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/lib.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/pack.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/same.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CUWithSecondaryType.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/ClassWithComplexName.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/Completion2InterfacesWithSameMethod.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionAfterCase1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionAfterCase2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionAfterSupercall1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionAfterSwitch.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionAllocationExpressionIsParent1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionAllocationExpressionIsParent4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionAllocationExpressionIsParent5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousFieldName.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousFieldName3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousFieldName4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousType.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousType2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionArgumentName.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionArrayAccess1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionArraysCloneMethod.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionAssignmentInMethod1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionAssignmentInMethod2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionAssignmentInMethod3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionAssignmentInMethod4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionBasicField1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionBasicKeyword1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionBasicLocalVariable1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionBasicMethod1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionBasicMethodDeclaration1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionBasicPackage1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionBasicPotentialMethodDeclaration1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionBasicType1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionBinaryOperator1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionBinaryOperator2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionBinaryOperator3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionCaseInsensitive.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionCaseInsensitivePackage.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionCastIsParent1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionCastIsParent2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionCatchArgumentName2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionClassLiteralAfterAnonymousType1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionConditionalExpression1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionConditionalExpression2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionConditionalExpression3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionConstructorForAnonymousType.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionDefaultPackage.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionEmptyToken1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionEmptyTypeName2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionEmptyTypeName3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionEndOfCompilationUnit.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionExactNameCaseInsensitive.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionExpectedTypeIsNotValid.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFieldInitializer1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFieldInitializer2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFieldInitializer3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFieldInitializer4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFieldName.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFindClass2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFindException1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFindException2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFindField1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFindField2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFindField3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFindLocalVariable.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFindMethod1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFindMethod2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFindMethodInProcess.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFindMethodInThis.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFindSecondaryType1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFindThisDotField.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionInsideStaticMethod.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionInstanceofOperator1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionLocalName.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration10.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration7.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration8.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration9.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionMethodThrowsClause.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionMethodThrowsClause2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionNonEmptyToken1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionNonStaticFieldRelevance.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionNullRequestor.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionObjectsMethodWithInterfaceReceiver.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionOnStaticMember1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionOnStaticMember2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionOutOfBounds.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionRepeatedType.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionReturnInInitializer.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionReturnStatementIsParent1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionReturnStatementIsParent2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionSameClass.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionThrowStatement.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionType1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionUnaryOperator1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionUnaryOperator2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionUnresolvedEnclosingType.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionUnresolvedFieldType.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionUnresolvedParameterType.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionUnresolvedReturnType.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInInitializer1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInInitializer2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInInitializer3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInInitializer4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInMethod1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInMethod2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInMethod3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInMethod4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionVariableName1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionVariableName2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionVariableName3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionVariableNameUnresolvedType.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionVisibilityCheck.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionVoidMethod.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionWithBinaryFolder.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/Default.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/SuperClass.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/SuperInterface.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/TEST_FOO_MyClass.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/Test_Bar_MyClass.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/TypeWithConstructor.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/XX00.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/XX01.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/XX02.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/XX10.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/XX11.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/XX12.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/XX20.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/XX21.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/XX22.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/deprecation/Bug127628Type1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/deprecation/Bug127628Type2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/org/eclipse/jsdt/core/tests/BasicTestReferences.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/p1/ABC.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/p2/ABC.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/p3/CompletionToplevelType1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/pack1/PX.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/pack1/pack3/PX.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/pack2/PX.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/q1/CT1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/q2/CT1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/z1/z2/Qla1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/z1/z2/qla0/Qla3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/z1/z2/qla0/Qla4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/z1/z2/qla0/Wla.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/z1/z2/qla2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract10.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract11.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract12.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract13.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract14.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract15.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract16.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract7.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract8.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract9.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase10.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase7.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase8.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase9.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch10.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch7.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch8.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch9.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass10.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass11.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass12.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass13.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass14.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass15.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass16.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass17.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass18.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass19.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass20.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass21.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass22.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass23.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass24.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass7.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass8.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass9.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordContinue1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordContinue2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordContinue3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordContinue4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault10.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault7.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault8.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault9.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse7.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse8.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends10.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends7.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends8.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends9.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFalse1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFalse2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFalse3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFalse4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal10.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal11.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal12.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal13.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal14.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal15.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal16.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal17.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal18.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal7.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal8.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal9.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally10.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally11.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally12.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally13.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally14.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally7.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally8.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally9.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport7.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface10.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface11.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface12.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface13.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface14.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface15.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface16.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface17.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface18.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface7.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface8.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface9.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative7.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative8.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew10.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew11.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew12.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew13.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew14.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew15.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew16.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew7.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew8.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew9.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNull1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNull2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNull3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNull4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage7.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate10.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate7.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate8.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate9.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected10.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected7.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected8.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected9.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic10.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic11.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic12.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic13.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic14.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic15.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic16.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic17.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic18.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic19.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic20.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic7.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic8.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic9.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic10.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic7.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic8.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic9.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp7.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp8.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper10.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper11.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper7.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper8.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper9.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized10.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized11.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized12.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized7.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized8.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized9.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis10.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis11.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis12.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis13.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis14.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis7.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis8.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis9.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows7.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows8.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient7.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient8.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTrue1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTrue2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTrue3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTrue4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile7.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile8.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile10.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile7.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile8.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile9.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/p/CompletionKeywordImport2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/p/CompletionKeywordImport8.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/p/CompletionKeywordPackage2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/p/CompletionKeywordPackage8.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0001/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0002/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0003/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0004/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0009/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0010/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0023/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0024/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0025/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0028/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0030/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0032/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0033/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0034/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0035/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0036/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0037/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0038/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0039/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0048/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0049/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0050/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0057/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0060/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0064/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0067/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0068/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0069/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0070/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0072/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0073/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0074/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/test0049.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/test0049src.zip delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/tmpDoc.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/tmpDocDoc.zip delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/tmpDocsrc.zip delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/zzz.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/zzzsrc.zip delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/.project delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/.settings/.jsdtscope delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/Hello.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/NO_WORKING.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/Test0157.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/Test0158.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/Test0170.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/Test462.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/codeManipulation/bug.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/examples.oneofeach/ASTPosterChild.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test000/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test001/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test002/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test003/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test004/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test005/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test006/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test007/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test008/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test009/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test010/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test011/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test012/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test013/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test014/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test015/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test100/TestB1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test100/TestB2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test100/TestD1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test100/TestD2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test101/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test102/TestB1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test102/TestB2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test102/TestD1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test102/TestD2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test103/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test104/TestD1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test104/TestD2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test105/TestB1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test105/TestB2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test106/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test107/TestB1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test107/TestB2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test107/TestD1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test107/TestD2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test108/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug48489/TestA.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug48489/TestB.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug48489/TestC.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug48489/TestD.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug48489/TestE.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug50898/G.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug50898/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51226/X1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51226/X2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51226/X3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51226/X4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51226/X5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51226/X6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51241/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51363/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51476/X1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51476/X2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51476/X3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51478/X1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51478/X2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51478/X3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51508/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51600/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51617/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51650/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51660/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51770/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51911/TestInvalid.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51911/TestValid1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51911/TestValid2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51911/TestValid3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug52908/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug52908/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug52908a/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug52908unicode/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug52908unicode/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug53075/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug53276/TestA.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug53276/TestB.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug53276/TestC.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug53757/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug54424/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug54776/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug55221/a/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug55221/b/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug55221/c/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug55221/d/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug55223/TestA.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug55223/TestB.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug63044/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug65174/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug65253/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug65253/TestD.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug65288/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug68017/TestInvalid.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug68017/TestValid.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug68017/TestWarn1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug68017/TestWarn2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug68025/TestA.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug68025/TestB.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug68726/TestBug68726conform1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug68726/TestBug68726conform2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug68726/TestBug68726negative1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug68726/TestBug68726negative2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug69272/TestClassInvalid.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug69272/TestClassValid.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug69272/TestFieldInvalid.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug69272/TestFieldValid.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug69272/TestMethInvalid.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug69272/TestMethValid.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug69275/TestA.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug69275/TestB.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug69302/TestInvalid.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug69302/TestValid1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug69302/TestValid2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug70892/TestInvalid1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug70892/TestInvalid2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug70892/TestValid.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug73348/TestInvalid.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug73348/TestValid.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug77644/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug77644/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug77644/C.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/awtui/AboutDialog.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/awtui/Logo.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/awtui/ProgressBar.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/awtui/TestRunner.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/extensions/ActiveTestSuite.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/extensions/ExceptionTestCase.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/extensions/RepeatedTest.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/extensions/TestDecorator.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/extensions/TestSetup.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/framework/Assert.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/framework/AssertionFailedError.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/framework/ComparisonFailure.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/framework/Protectable.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/framework/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/framework/TestCase.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/framework/TestFailure.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/framework/TestListener.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/framework/TestResult.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/framework/TestSuite.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/runner/BaseTestRunner.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/runner/ClassPathTestCollector.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/runner/FailureDetailView.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/runner/LoadingTestCollector.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/runner/ReloadingTestSuiteLoader.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/runner/SimpleTestCollector.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/runner/Sorter.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/runner/StandardTestSuiteLoader.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/runner/TestCaseClassLoader.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/runner/TestCollector.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/runner/TestRunListener.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/runner/TestSuiteLoader.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/runner/Version.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/swingui/AboutDialog.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/swingui/CounterPanel.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/swingui/DefaultFailureDetailView.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/swingui/FailureRunView.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/swingui/ProgressBar.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/swingui/StatusLine.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/swingui/TestHierarchyRunView.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/swingui/TestRunContext.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/swingui/TestRunView.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/swingui/TestRunner.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/swingui/TestSelector.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/swingui/TestSuitePanel.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/swingui/TestTreeModel.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/textui/ResultPrinter.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/textui/TestRunner.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/p1/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/p2/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/p3/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0001/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0002/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0003/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0004/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0005/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0006/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0007/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0008/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0009/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0010/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0011/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0012/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0013/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0014/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0015/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0016/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0017/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0018/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0019/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0020/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0021/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0022/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0023/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0024/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0025/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0026/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0027/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0028/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0029/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0030/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0031/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0032/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0033/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0034/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0035/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0036/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0037/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0038/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0039/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0040/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0041/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0042/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0043/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0044/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0045/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0046/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0047/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0048/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0049/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0050/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0051/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0052/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0053/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0054/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0055/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0056/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0057/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0058/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0059/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0060/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0061/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0062/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0063/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0064/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0065/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0066/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0067/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0068/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0069/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0070/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0071/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0072/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0073/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0074/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0075/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0076/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0077/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0078/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0079/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0080/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0081/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0082/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0083/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0084/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0085/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0086/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0087/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0088/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0089/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0090/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0091/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0092/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0093/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0094/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0095/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0096/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0097/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0098/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0099/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0100/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0101/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0102/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0103/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0104/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0105/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0106/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0107/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0108/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0109/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0110/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0111/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0112/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0113/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0114/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0115/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0116/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0117/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0118/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0119/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0120/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0121/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0122/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0123/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0124/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0125/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0126/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0127/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0128/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0129/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0130/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0131/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0132/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0133/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0134/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0135/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0136/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0137/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0138/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0139/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0140/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0141/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0142/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0143/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0144/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0145/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0146/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0147/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0148/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0149/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0150/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0151/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0152/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0153/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0154/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0155/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0156/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0159/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0160/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0161/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0162/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0163/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0164/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0165/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0166/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0167/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0168/test1/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0169/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0171/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0172/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0173/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0174/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0175/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0176/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0177/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0178/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0179/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0180/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0181/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0182/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0183/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0184/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0185/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0186/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0187/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0188/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0189/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0190/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0191/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0192/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0193/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0194/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0195/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0196/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0197/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0198/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0199/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0200/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0201/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0202/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0203/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0204/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0205/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0206/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0207/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0208/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0209/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0210/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0211/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0212/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0213/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0214/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0215/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0216/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0217/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0218/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0219/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0220/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0221/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0222/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0223/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0224/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0225/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0226/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0227/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0228/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0229/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0230/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0231/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0232/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0233/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0234/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0235/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0236/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0238/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0239/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0240/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0241/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0242/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0243/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0244/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0245/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0246/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0247/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0248/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0249/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0250/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0251/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0252/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0253/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0254/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0255/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0256/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0257/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0258/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0259/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0260/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0261/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0262/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0263/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0264/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0265/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0266/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0267/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0268/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0269/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0270/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0271/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0272/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0273/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0274/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0275/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0276/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0277/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0278/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0279/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0280/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0281/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0282/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0283/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0284/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0285/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0286/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0287/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0288/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0289/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0290/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0291/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0292/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0293/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0294/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0295/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0296/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0297/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0298/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0299/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0300/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0301/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0302/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0303/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0304/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0307/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0308/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0309/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0310/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0311/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0312/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0313/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0314/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0315/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0317/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0318/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0319/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0320/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0321/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0322/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0323/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0324/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0325/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0326/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0327/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0328/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0329/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0330/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0331/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0332/LocalSelectionTransfer.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0333/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0334/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0335/ExceptionTestCaseTest.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0336/SorterTest.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0337/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0338/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0339/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0341/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0342/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0343/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0344/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0345/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0346/Test2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0347/Test2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0348/Test2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0349/Test2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0350/Test2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0351/Test2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0352/Test2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0353/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0354/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0355/Foo.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0356/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0356/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0357/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0358/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0359/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0360/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0361/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0362/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0363/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0364/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0365/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0366/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0367/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0368/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0369/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0370/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0371/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0372/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0373/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0374/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0375/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0376/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0377/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0378/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0379/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0380/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0381/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0382/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0383/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0384/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0385/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0386/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0387/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0388/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0389/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0390/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0391/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0392/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0393/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0394/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0395/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0396/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0397/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0398/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0399/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0400/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0401/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0402/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0403/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0404/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0405/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0406/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0406_a/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0407/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0408/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0409/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0410/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0411/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0412/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0413/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0414/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0414/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0415/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0416/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0417/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0418/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0419/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0420/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0421/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0422/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0423/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0424/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0425/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0426/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0427/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0428/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0429/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0430/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0431/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0432/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0433/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0434/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0435/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0436/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0437/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0438/D.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0438_a/W.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0439/C.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0439/E.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0440/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0441/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0442/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0443/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0444/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0445/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0446/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0447/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0448/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0449/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0450/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0451/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0453/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0454/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0455/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0456/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0457/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0458/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0459/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0460/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0461/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0463/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0464/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0465/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0466/Assert.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0467/Assert.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0468/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0470/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0471/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0473/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0474/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0475/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0476/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0477/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0478/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0479/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0480/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0481/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0482/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0483/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0484/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0485/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0486/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0487/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0488/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0489/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0490/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0490/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0491/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0492/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0493/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0494/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0495/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0496/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0497/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0498/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0499/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0500/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0501/JavaEditor.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0502/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0503/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0504/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0505/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0506/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0507/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0507/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0508/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0509/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0509/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0510/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0511/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0512/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0513/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0514/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0515/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0516/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0517/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0518/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0519/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0520/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0521/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0522/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0523/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0524/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0525/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0526/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0527/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0528/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0529/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0530/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0531/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0532/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0533/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0534/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0535/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0536/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0537/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0537/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0537/C.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0538/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0539/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0541/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0541/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0542/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0543/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0544/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0545/First.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0545/Second.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0545/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0545/Third.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0546/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0547/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0548/PaletteStackEditPart.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0549/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0550/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0551/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0552/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0553/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0554/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0554/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0555/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0555/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0556/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0557/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0559/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0560/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0561/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0562/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0563/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0564/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0565/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0566/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0567/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0568/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0569/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0570/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0573/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0573/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0573/Z.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0574/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0575/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0578/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0579/ParserTask.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0580/DiamondSquareTerrainGenerator.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0582/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0595/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0595a/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0597/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0599/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0600/C.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0600/Try.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0602/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0603/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0604/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0605/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0606/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0610/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0610/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0619/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0629/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0630/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0631/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0653/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0653/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0657/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0657/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CreateMembers/.project delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CreateMembers/.settings/.jsdtscope delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CreateMembers/src/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CreateMembers/src/A2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CreateMembers/src/Annot.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CreateMembers/src/E.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CreateMembers/src/E2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CreateMembers/src/E3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Encoding/.classpath delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Encoding/.project delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Encoding/src/testBug110576/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Encoding/src/testBug66898/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Encoding/src/testBug66898b/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Encoding/src/testUTF8/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Encoding/src/testUTF8BOM/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Encoding/testUTF8.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Encoding/testUTF8.zip delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/.project delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/.settings/.jsdtscope delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test001/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test001/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test002/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test002/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test003/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test003/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test004/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test004/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test005/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test005/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test006/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test006/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test007/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test007/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test008/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test008/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test009/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test009/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test010/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test010/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test011/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test011/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test012/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test012/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test013/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test013/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test014/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test014/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test015/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test015/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test016/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test016/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test017/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test017/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test018/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test018/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test019/A_1_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test019/A_1_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test019/A_2_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test019/A_2_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test020/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test020/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test021/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test021/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test022/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test022/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test023/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test023/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test024/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test024/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test025/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test025/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test026/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test026/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test027/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test027/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test028/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test028/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test029/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test029/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test030/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test030/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test031/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test031/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test032/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test032/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test033/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test033/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test034/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test034/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test035/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test035/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test036/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test036/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test037/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test037/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test038/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test038/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test039/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test039/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test040/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test040/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test041/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test041/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test042/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test042/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test043/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test043/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test044/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test044/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test045/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test045/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test046/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test046/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test047/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test047/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test048/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test048/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test049/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test049/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test050/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test050/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test051/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test051/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test052/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test052/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test053/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test053/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test054/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test054/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test055/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test055/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test056/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test056/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test057/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test057/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test058/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test058/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test059/Parser_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test059/Parser_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test060/Parser_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test060/Parser_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test061/Parser_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test061/Parser_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test062/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test062/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test063/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test063/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test064/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test064/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test065/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test065/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test066/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test066/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test067/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test067/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test068/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test068/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test069/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test069/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test070/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test070/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test071/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test071/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test072/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test072/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test073/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test073/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test074/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test074/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test075/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test075/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test076/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test076/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test077/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test077/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test078/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test078/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test079/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test079/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test080/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test080/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test081/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test081/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test082/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test082/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test083/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test083/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test084/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test084/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test085/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test085/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test086/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test086/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test087/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test087/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test088/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test088/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test089/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test089/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test090/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test090/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test091/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test091/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test092/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test092/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test093/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test093/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test094/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test094/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test095/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test095/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test096/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test096/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test097/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test097/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test098/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test098/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test099/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test099/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test100/B_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test100/B_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test100/C_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test100/C_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test100/D_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test100/D_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test100/E_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test100/E_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test100/F_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test100/F_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test100/G_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test100/G_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test101/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test101/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test102/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test102/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test103/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test103/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test104/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test104/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test105/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test105/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test106/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test106/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test107/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test107/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test108/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test108/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test109/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test109/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test110/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test110/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test111/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test111/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test112/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test112/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test113/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test113/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test114/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test114/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test115/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test115/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test116/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test116/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test117/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test117/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test118/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test118/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test119/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test119/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test120/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test120/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test121/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test121/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test122/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test122/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test123/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test123/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test124/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test124/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test125/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test125/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test126/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test126/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test127/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test127/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test128/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test128/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test129/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test129/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test130/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test130/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test131/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test131/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test132/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test132/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test133/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test133/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test134/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test134/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test135/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test135/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test136/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test136/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test137/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test137/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test138/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test138/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test139/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test139/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test140/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test140/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test141/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test141/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test142/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test142/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test143/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test143/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test144/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test144/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test145/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test145/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test146/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test146/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test147/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test147/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test148/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test148/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test149/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test149/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test150/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test150/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test151/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test151/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test152/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test152/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test153/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test153/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test154/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test154/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test155/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test155/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test156/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test156/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test157/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test157/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test158/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test158/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test159/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test159/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test160/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test160/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test161/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test161/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test162/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test162/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test163/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test163/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test164/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test164/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test165/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test165/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test166/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test166/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test167/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test167/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test168/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test168/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test169/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test169/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test170/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test170/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test171/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test171/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test172/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test172/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test173/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test173/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test174/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test174/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test175/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test175/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test176/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test176/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test177/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test177/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test178/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test178/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test179/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test179/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test180/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test180/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test181/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test181/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test182/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test182/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test183/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test183/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test184/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test184/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test185/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test185/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test186/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test186/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test187/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test187/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test188/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test188/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test189/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test189/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test190/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test190/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test191/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test191/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test192/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test192/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test193/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test193/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test194/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test194/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test195/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test195/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test196/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test196/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test197/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test197/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test198/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test198/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test199/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test199/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test200/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test200/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test201/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test201/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test202/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test202/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test203/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test203/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test204/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test204/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test205/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test205/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test206/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test206/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test207/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test207/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test208/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test208/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test209/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test209/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test210/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test210/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test211/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test211/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test212/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test212/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test213/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test213/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test214/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test214/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test215/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test215/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test216/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test216/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test217/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test217/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test218/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test218/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test219/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test219/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test220/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test220/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test221/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test221/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test222/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test222/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test223/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test223/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test224/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test224/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test225/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test225/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test226/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test226/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test227/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test227/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test228/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test228/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test229/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test229/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test230/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test230/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test231/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test231/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test232/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test232/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test233/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test233/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test234/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test234/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test235/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test235/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test236/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test236/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test237/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test237/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test238/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test238/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test239/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test239/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test240/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test240/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test241/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test241/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test242/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test242/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test243/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test243/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test244/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test244/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test245/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test245/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test246/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test246/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test247/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test247/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test248/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test248/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test249/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test249/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test250/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test250/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test251/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test251/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test252/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test252/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test253/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test253/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test254/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test254/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test255/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test255/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test256/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test256/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test257/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test257/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test258/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test258/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test259/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test259/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test260/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test260/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test261/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test261/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test262/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test262/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test263/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test263/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test264/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test264/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test265/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test265/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test266/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test266/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test267/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test267/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test268/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test268/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test269/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test269/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test270/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test270/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test271/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test271/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test272/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test272/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test273/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test273/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test274/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test274/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test275/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test275/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test276/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test276/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test277/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test277/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test278/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test278/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test279/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test279/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test280/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test280/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test281/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test281/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test282/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test282/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test283/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test283/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test284/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test284/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test285/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test285/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test286/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test286/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test287/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test287/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test288/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test288/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test289/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test289/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test290/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test290/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test291/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test291/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test292/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test292/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test293/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test293/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test294/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test294/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test295/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test295/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test296/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test296/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test297/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test297/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test298/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test298/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test299/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test299/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test300/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test300/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test301/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test301/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test302/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test302/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test303/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test303/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test304/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test304/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test305/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test305/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test306/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test306/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test307/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test307/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test308/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test308/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test309/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test309/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test310/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test310/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test311/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test311/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test312/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test312/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test313/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test313/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test314/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test314/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test319/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test319/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test320/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test320/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test321/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test321/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test322/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test322/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test323/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test323/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test324/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test324/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test325/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test325/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test326/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test326/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test327/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test327/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test328/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test328/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test329/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test329/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test330/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test330/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test331/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test331/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test332/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test332/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test333/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test333/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test334/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test334/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test335/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test335/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test336/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test336/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test337/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test337/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test338/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test338/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test339/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test339/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test340/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test340/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test341/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test341/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test342/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test342/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test343/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test343/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test344/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test344/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test345/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test345/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test346/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test346/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test347/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test347/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test348/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test348/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test349/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test349/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test350/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test350/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test351/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test351/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test352/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test352/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test353/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test353/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test354/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test354/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test355/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test355/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test356/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test356/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test357/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test357/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test358/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test358/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test359/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test359/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test360/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test360/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test361/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test361/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test362/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test362/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test363/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test363/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test364/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test364/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test365/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test365/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test366/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test366/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test367/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test367/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test368/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test368/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test369/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test369/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test370/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test370/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test371/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test371/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test372/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test372/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test373/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test373/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test374/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test374/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test375/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test375/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test376/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test376/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test377/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test377/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test378/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test378/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test379/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test379/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test380/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test380/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test381/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test381/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test382/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test382/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test383/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test383/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test384/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test384/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test385/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test385/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test386/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test386/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test387/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test387/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test388/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test388/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test389/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test389/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test390/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test390/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test391/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test391/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test392/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test392/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test393/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test393/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test394/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test394/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test395/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test395/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test396/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test396/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test397/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test397/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test398/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test398/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test399/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test399/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test400/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test400/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test401/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test401/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test402/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test402/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test403/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test403/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test404/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test404/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test405/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test405/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test406/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test406/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test407/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test407/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test408/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test408/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test409/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test409/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test410/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test410/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test411/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test411/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test412/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test412/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test413/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test413/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test414/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test414/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test415/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test415/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test416/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test416/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test417/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test417/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test418/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test418/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test419/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test419/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test420/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test420/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test421/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test421/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test422/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test422/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test423/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test423/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test424/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test424/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test425/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test425/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test426/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test426/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test427/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test427/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test428/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test428/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test429/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test429/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test430/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test430/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test431/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test431/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test432/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test432/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test432/formatter.xml delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test433/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test433/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test434/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test434/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test435/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test435/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test436/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test436/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test437/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test437/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test437/formatter.xml delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test438/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test438/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test438/formatter.xml delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test439/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test439/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test439/formatter.xml delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test440/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test440/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test441/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test441/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test442/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test442/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test443/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test443/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test444/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test444/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test445/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test445/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test446/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test446/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test447/test447.zip delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test448/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test448/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test449/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test449/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test450/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test450/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test451/test451.zip delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test452/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test452/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test453/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test453/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test454/test454.zip delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test455/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test455/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test456/test456.zip delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test457/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test457/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test458/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test458/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test459/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test459/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test460/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test460/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test461/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test461/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test462/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test462/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test462/formatter.xml delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test463/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test463/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test464/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test464/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test465/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test465/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test466/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test466/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test467/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test467/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test468/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test468/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test469/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test469/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test470/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test470/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test471/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test471/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test472/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test472/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test473/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test473/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test474/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test474/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test475/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test475/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test476/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test476/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test478/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test478/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test479/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test479/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test480/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test480/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test481/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test481/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test482/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test482/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test483/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test483/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test484/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test484/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test485/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test485/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test486/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test486/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test487/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test487/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test488/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test488/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test489/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test489/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test490/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test490/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test491/BundleChain_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test491/BundleChain_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test491/formatter.xml delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test492/Main_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test492/Main_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test492/core_formatting.xml delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test493/MyClass_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test493/MyClass_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test494/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test494/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test494/format.xml delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test495/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test495/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test496/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test496/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test497/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test497/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test498/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test498/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test499/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test499/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test500/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test500/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test501/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test501/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test501/formatter.xml delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test502/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test502/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test503/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test503/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test504/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test504/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test505/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test505/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test506/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test506/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test507/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test507/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test508/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test508/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test509/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test509/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test510/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test510/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test511/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test511/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test512/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test512/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test513/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test513/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test514/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test514/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test514/formatter.xml delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test515/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test515/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test516/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test516/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test517/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test517/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test518/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test518/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test519/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test519/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test520/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test520/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test521/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test521/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test522/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test522/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test523/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test523/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test524/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test524/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test525/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test525/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test526/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test526/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test527/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test527/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test528/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test528/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test529/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test529/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test530/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test530/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test531/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test531/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test532/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test532/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test533/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test533/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test534/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test534/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test535/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test535/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test536/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test536/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test537/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test537/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test538/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test538/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test539/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test539/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test540/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test540/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test541/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test541/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test542/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test542/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test543/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test543/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test544/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test544/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test545/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test545/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test546/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test546/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test547/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test547/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test548/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test548/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test549/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test549/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test550/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test550/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test551/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test551/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test552/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test552/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test553/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test553/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test554/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test554/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test555/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test555/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test556/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test556/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test557/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test557/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test558/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test558/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test559/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test559/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test560/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test560/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test561/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test561/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test562/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test562/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test563/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test563/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test564/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test564/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test565/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test565/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test566/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test566/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test567/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test567/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test568/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test568/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test569/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test569/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test570/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test570/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test571/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test571/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test572/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test572/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test573/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test573/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test574/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test574/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test575/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test575/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test576/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test576/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test577/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test577/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test578/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test578/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test579/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test579/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test580/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test580/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test581/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test581/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test582/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test582/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test583/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test583/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test584/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test584/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test585/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test585/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test586/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test586/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test587/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test587/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test588/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test588/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test589/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test589/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test590/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test590/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test591/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test591/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test592/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test592/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test593/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test593/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test594/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test594/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test595/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test595/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test596/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test596/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test597/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test597/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test598/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test598/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test599/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test599/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test600/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test600/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test601/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test601/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test605/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test605/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test606/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test606/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test607/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test607/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test608/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test608/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test609/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test609/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test610/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test610/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test610/formatter.xml delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test612/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test612/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test613/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test613/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test614/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test614/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test615/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test615/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test616/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test616/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test617/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test617/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test617/formatter.xml delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test618/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test618/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test619/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test619/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test620/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test620/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test621/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test621/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test622/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test622/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test623/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test623/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test624/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test624/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test625/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test625/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test626/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test626/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test627/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test627/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test628/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test628/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test629/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test629/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test630/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test630/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test631/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test631/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test632/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test632/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test633/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test633/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test634/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test634/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test635/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test635/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test636/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test636/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test637/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test637/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test638/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test638/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test639/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test639/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test640/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test640/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test641/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test641/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test642/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test642/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test642/formatter.prefs delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test642/formatter.xml delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test643/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test643/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test644/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test644/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test645/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test645/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test646/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test646/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test647/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test647/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test648/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test648/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test649/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test649/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test650/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test650/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test651/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test651/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test652/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test652/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test653/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test653/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test654/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test654/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test655/A_in.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test655/A_out.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/.project delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/.settings/.jsdtscope delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/NotInClasspath/p/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/otherSrc()/X31997.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/otherSrc()/X92210.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/otherSrc()/Y31997.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/CA.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/D.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/E.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/O.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/TypeReferenceAsSingleNameReference.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/W.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/a/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/a2/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/a3/References.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/a3/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/a3/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/a3/Z.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/a3/b/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/a3/b/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/a4/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/a5/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/a6/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/a7/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/a8/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/a9/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/b1/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/b1/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/p/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/p/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/p/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/p/Z.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/p/cls1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/p/usecls1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/wc1/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/wc2/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/wc3/X44884.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaProjectSrcTests/.project delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaProjectSrcTests/.settings/.jsdtscope delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaProjectSrcTests/src/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaProjectTests/.project delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaProjectTests/.settings/.jsdtscope delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaProjectTests/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaProjectTests/lib.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaProjectTests/lib142530.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaProjectTests/lib148949.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaProjectTests/q/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaProjectTests/q/readme.txt delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaProjectTests/x/readme.txt delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaProjectTests/x/readme2.txt delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaProjectTests/x/y/Main.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/.project delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/.settings/.jsdtscope delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/AbortCompilation.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/AbortCompilation.zip delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/MyJar.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/MyJar.zip delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/NotInClasspath/p/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/b111416.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/corrupt.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/otherSrc()/X31997.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/otherSrc()/X92210.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/otherSrc()/Y31997.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/CA.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/D.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/E.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/InterfaceImplementors.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/MemberTypeReference/Azz.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/MemberTypeReference/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/NoReference/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/O.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/ObjectMemberTypeReference/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PR_1GGNOTF.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/C.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/D.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/E.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/F.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/G.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/H.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/I.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/J.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/K.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceA.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceB.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceC.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceD.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceE.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceF.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceG.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceH.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceI.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceJ.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/TypeReferenceAsSingleNameReference.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/TypeReferenceInArray/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/TypeReferenceInImport/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/VariousTypeReferences/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/VariousTypeReferences/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/VariousTypeReferences/C.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/VariousTypeReferences/D.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/W.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/a/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/a2/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/a3/References.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/a3/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/a3/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/a3/Z.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/a3/b/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/a3/b/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/a4/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/a5/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/a6/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/a7/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/a8/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/a9/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/b1/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/b1/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/b111416/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/b2/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/b2/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/b2/Z.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/b3/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/b4/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/b5/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/b6/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/b7/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/b8/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/b9/Foo.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/c1/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/c1/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/c1/I.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/c10/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/c11/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/c2/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/c2/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/c3/C.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/c4/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/c5/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/c6/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/c7/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/c7/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/c8/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/c8/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/c9/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/d1/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/d2/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/d2/Z.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/d3/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/d4/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/d4/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/d5/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/d5/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/d6/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/d6/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/d7/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/d8/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/d8/AA.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/d9/p1/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/d9/p2/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/e1/A29366.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/e2/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/e3/X31985.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/e3/Y31985.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/e4/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/e5/A1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/e6/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/e7/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/e8/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/e9/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/f1/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/f2/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/f3/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j1/JavadocHiddenRef.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j1/JavadocInvalidRef.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j1/JavadocSearched.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j1/JavadocValidRef.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j2/Bug47968.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j2/Bug47968s.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j3/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j4/CC47209.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j4/CF47209.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j4/CM47209.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j4/CT47209.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j4/FC47209.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j4/FF47209.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j4/FM47209.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j4/FT47209.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j4/MC47209.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j4/MF47209.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j4/MM47209.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j4/MT47209.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j4/TC47209.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j4/TF47209.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j4/TM47209.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j4/TT47209.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j5/Bug49994.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j6/Bug54962.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j7/qua/li/fied/Bug54962a.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/net/sf/saxon/om/Navigator.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p/I.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p/Z.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p10/a/b/dom/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p10/a/b/om/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p2/Z.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p3/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p3/p2/p/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p4/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p5/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p6/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p7/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p71267/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p71267/q71267/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p8/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p9/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/q1/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/q2/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/q3/A$B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/q4/C.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/q5/AQ.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/q6/CD.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/q7/AQ.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/q8/EclipseTest.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/q9/I.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/r/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/r2/I.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/r2/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/r3/A21485.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/r4/B21485.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/r5/XYZ.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/r6/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/r6/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/r7/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/r7/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/r8/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/r9/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/s1/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/s1/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/s2/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/s2/Z.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/s3/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/s4/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/s5/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/sd/AQ.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/wc/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/wc1/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/wc2/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/wc3/X44884.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/test20631.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/test20631.zip delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/test24741.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/test47909.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/test47989.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/test48261.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/test48725.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/.classpath delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/.project delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/a1/Author.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/a1/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/e1/Team.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/e1/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g1/t/m/def/Generic.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g1/t/m/def/NonGeneric.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g1/t/m/ref/R1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g1/t/m/ref/R2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g1/t/m/ref/R3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g1/t/m/ref/R4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g1/t/s/def/Generic.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g1/t/s/def/NonGeneric.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g1/t/s/ref/R1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g1/t/s/ref/R2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g1/t/s/ref/R3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g1/t/s/ref/R4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g2/f/m/def/R1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g2/f/m/def/R2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g2/f/m/def/R3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g2/f/m/def/R4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g2/f/m/ref/RR1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g2/f/m/ref/RR2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g2/f/m/ref/RR3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g2/f/m/ref/RR4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g2/f/s/def/R1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g2/f/s/def/R2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g2/f/s/def/R3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g2/f/s/def/R4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g2/f/s/ref/RR1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g2/f/s/ref/RR2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g2/f/s/ref/RR3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g2/f/s/ref/RR4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g3/t/def/GM.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g3/t/def/GS.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g3/t/def/NGM.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g3/t/def/NGS.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g3/t/ref/R1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g3/t/ref/R2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g3/t/ref/R3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g3/t/ref/R4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g4/v/ref/R1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g4/v/ref/R2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g4/v/ref/R3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g4/v/ref/R4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g4/v/ref/R5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g5/c/def/Multiple.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g5/c/def/Single.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g5/c/ref/RefMultiple.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g5/c/ref/RefRaw.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g5/c/ref/RefSingle.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g5/m/def/Multiple.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g5/m/def/Single.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g5/m/ref/RefMultiple.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g5/m/ref/RefRaw.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g5/m/ref/RefSingle.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g6/t/def/List.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g6/t/def/Table.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g6/t/ref/Multiple.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g6/t/ref/QualifMultiple.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g6/t/ref/QualifSingle.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g6/t/ref/Single.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/p1/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/p1/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/p2/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/p2/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/p3/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/s1/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/s1/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/s1/C.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/s1/D.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/s1/pack/age/S.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/s2/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/s2/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/s2/C.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/s2/D.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/s2/pack/age/S.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/v1/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/.classpath delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/.project delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/JavaSearch15.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b110422.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b123679.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b124469.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b124645.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b125178.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b126330.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b128877.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b137984.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b140156.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b148215.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b164791.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b166348.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b86293.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b87627.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b89848/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b89848/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b95152.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/test75816.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/test81556.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b108088/B108088.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b108088/Test108088.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b123679/pack/I123679.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b123679/test/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b124645/T_124645.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b124645/test/A_124645.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b124645/test/X_124645.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b124645/xy/X_124645.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b124645/xy/Y_124645.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b127628/Test127628.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b137984/C.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b163984/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b163984/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b163984/C.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b81556/a/A81556.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b81556/a/B81556.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b81556/a/X81556.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b81556/b/XX81556.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b86380/Annot.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b95794/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchMultipleProjects1/.classpath delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchMultipleProjects1/.project delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchMultipleProjects1/lib/p/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchMultipleProjects2/.classpath delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchMultipleProjects2/.project delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchMultipleProjects2/lib/p/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchMultipleProjects2/src/q/Z.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/.project delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/.settings/.jsdtscope delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/class-folder/ResolveConstructorCall.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/class-folder/ResolveConstructorCallOfMemberType.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/class-folder/ResolveConstructorCallOfMemberType2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/class-folder/test0101/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/jj.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/jjsrc.zip delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/p3.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/p3src.zip delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/p4.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/p4src.zip delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveAbstractMethod.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveArgumentName.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveArrayLength.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveArrayParameterInsideParent1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveCatchArgumentName.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveCatchArgumentType1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveCatchArgumentType2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveClass1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveClass2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveClass3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveClass4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveClass5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveClass6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveConstructor.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveConstructorDeclaration.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveDeepLocalVariable.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveDuplicateFieldDeclaration.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveDuplicateFieldDeclaration3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveDuplicateMethodDeclaration.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveDuplicateMethodDeclaration11.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveDuplicateMethodDeclaration3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveDuplicateMethodDeclaration5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveDuplicateMethodDeclaration7.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveDuplicateMethodDeclaration9.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveDuplicateTypeDeclaration.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveDuplicateTypeDeclaration3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveDuplicateTypeDeclaration5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveEmptySelectionOnMethod.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveEndOfFile.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveExplicitSuperConstructorCall.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveExplicitThisConstructorCall.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveField.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveField0.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveFieldDeclaration.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveImport.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveInnerClassAsParamater.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveInterface.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalClass1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalClass2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalClass3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalClass4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalClass5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalClass6.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalClass7.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalConstructor.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalConstructorDeclaration.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalField.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalField2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalFieldDeclaration.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalMemberTypeDeclaration1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalMemberTypeDeclaration2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalMethod.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalMethod2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalMethodDeclaration.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalName.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalVariable.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveMemberTypeDeclaration1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveMemberTypeDeclaration2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveMessageSendOnBaseType.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveMethod.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveMethodDeclaration.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveMethodDeclarationInAnonymous.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveMethodDeclarationInAnonymous2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveMethodDeclarationInAnonymous3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveMethodDeclarationInInterface.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveMethodWithIncorrectParameter.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolvePackage.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolvePartiallyQualifiedType.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveQualifiedName1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveQualifiedName2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveQualifiedName3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveQualifiedName4.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveQualifiedName5.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveQualifiedType.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveTypeDeclaration.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveTypeEmptySelection.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveTypeEmptySelection2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveTypeInComment.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveUnicode.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/SuperClass.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/SuperInterface.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/X1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/a/b/ImportedClass.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/b120350/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/b120350/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/p1/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/p1/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/p2/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/pp/qq/XX.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0001/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0002/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0003/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0005/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0006/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0007/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0008/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0009/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0010/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0011/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0012/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0013/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0014/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0015/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0016/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0017/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0018/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0019/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0020/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0021/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0022/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0022/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0022/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0022/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0023/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0024/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0025/Test.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/test0023.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/test0023src.zip delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/test25888.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/test25888src.zip delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/test47177.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/test47177src.zip delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/test47214.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/zzz.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/zzzsrc.zip delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/SnippetCompletion/.classpath delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/SnippetCompletion/.project delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/CClass.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/SnippetCompletion/class-folder/bug132665/Bug132665.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/SnippetCompletion/src/aa/bb/cc/BClass.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/.project delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/.settings/.jsdtscope delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/NotInClasspath/e/E.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/lib.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/lib48459/p48459/p2/Y48459.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/lib53095/p53095/X53095.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/cycle/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/cycle/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p1/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p1/Deep.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p1/I1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p1/I2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p1/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p1/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p1/Z.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p2/I.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p2/I1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p2/I2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p2/I3.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p2/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p2/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p3/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p3/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p3/I.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p3/I1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p4/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p48459/p1/X48459.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p48459/p1/Z48459.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p5/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p6/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p7/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p7/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p8/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p9/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/q1/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/q1/Z.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/q2/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/q3/Z.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/q4/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/q4/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/q5/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/q6/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/q6/Z.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/q7/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/wc/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/test144976.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/test49809.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/test54043.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/test58440.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/test60365.jar delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyDependent/.project delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyDependent/.settings/.jsdtscope delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyDependent/Dependent.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/.project delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/.settings/.jsdtscope delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/src/a/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/src/b/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/src/c/C.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/src/d/D.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/src/e/E.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/src/i/I1.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/src/i/I2.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/src/p/External.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/src/p/MyError.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/src/p/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/src/p/other/External.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/src/p2/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/src/p2/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/src/p3/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/src/p3/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchySerialization/.project delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchySerialization/.settings/.jsdtscope delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/Z.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeResolve/.project delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeResolve/.settings/.jsdtscope delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeResolve/src/p/TypeResolve.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeResolve/src/p1/X.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeResolve/src/p2/Y.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeResolve/src/p3/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeResolve/src/p4/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeResolve/src/p4/B.js delete mode 100644 tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeResolve/src/p5/A.js delete mode 100644 tests/org.eclipse.wst.jsdt.debug.core.tests/.classpath delete mode 100644 tests/org.eclipse.wst.jsdt.debug.core.tests/.project delete mode 100644 tests/org.eclipse.wst.jsdt.debug.core.tests/.settings/org.eclipse.jdt.core.prefs delete mode 100644 tests/org.eclipse.wst.jsdt.debug.core.tests/META-INF/MANIFEST.MF delete mode 100644 tests/org.eclipse.wst.jsdt.debug.core.tests/OSGI-INF/l10n/bundle.properties delete mode 100755 tests/org.eclipse.wst.jsdt.debug.core.tests/about.html delete mode 100644 tests/org.eclipse.wst.jsdt.debug.core.tests/build.properties delete mode 100644 tests/org.eclipse.wst.jsdt.debug.core.tests/src/org/eclipse/wst/debug/core/tests/AbstractBreakpointTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.debug.core.tests/src/org/eclipse/wst/debug/core/tests/AbstractDebugTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.debug.core.tests/src/org/eclipse/wst/debug/core/tests/DebugEventWaiter.java delete mode 100755 tests/org.eclipse.wst.jsdt.debug.core.tests/src/org/eclipse/wst/debug/core/tests/DebugSuite.java delete mode 100644 tests/org.eclipse.wst.jsdt.debug.core.tests/src/org/eclipse/wst/debug/core/tests/JSDTDebugTestPlugin.java delete mode 100644 tests/org.eclipse.wst.jsdt.debug.core.tests/src/org/eclipse/wst/debug/core/tests/JavaScriptDebugTestSuite.java delete mode 100644 tests/org.eclipse.wst.jsdt.debug.core.tests/src/org/eclipse/wst/debug/core/tests/Util.java delete mode 100644 tests/org.eclipse.wst.jsdt.debug.core.tests/src/org/eclipse/wst/debug/core/tests/VerticalRulerInfoStub.java delete mode 100644 tests/org.eclipse.wst.jsdt.debug.core.tests/src/org/eclipse/wst/debug/core/tests/breakpoints/LineBreakpointTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.debug.core.tests/test.xml delete mode 100644 tests/org.eclipse.wst.jsdt.debug.core.tests/testsource/test1.js delete mode 100644 tests/org.eclipse.wst.jsdt.debug.core.tests/testsource/test2.js delete mode 100644 tests/org.eclipse.wst.jsdt.debug.core.tests/testsource/test3.js delete mode 100644 tests/org.eclipse.wst.jsdt.debug.core.tests/testsource/test4.js delete mode 100644 tests/org.eclipse.wst.jsdt.debug.rhino.tests/.classpath delete mode 100644 tests/org.eclipse.wst.jsdt.debug.rhino.tests/.project delete mode 100644 tests/org.eclipse.wst.jsdt.debug.rhino.tests/.settings/org.eclipse.jdt.core.prefs delete mode 100644 tests/org.eclipse.wst.jsdt.debug.rhino.tests/META-INF/MANIFEST.MF delete mode 100644 tests/org.eclipse.wst.jsdt.debug.rhino.tests/OSGI-INF/l10n/bundle.properties delete mode 100755 tests/org.eclipse.wst.jsdt.debug.rhino.tests/about.html delete mode 100644 tests/org.eclipse.wst.jsdt.debug.rhino.tests/build.properties delete mode 100644 tests/org.eclipse.wst.jsdt.debug.rhino.tests/scripts/script1.js delete mode 100644 tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/BreakpointRequestTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/ConnectionHelper.java delete mode 100644 tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/DebugSessionTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/FrameRequestTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/RequestBadCommandTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/RequestContinueTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/RequestDisposeTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/RequestLookupTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/RequestSuspendTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/RequestTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/RequestVersionTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/RhinoDebugTestSuite.java delete mode 100644 tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/RhinoDebuggerTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/ScriptRequestTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/TestEventHandler.java delete mode 100644 tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/ThreadRequestTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/TransportTest.java delete mode 100644 tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/Util.java delete mode 100644 tests/org.eclipse.wst.jsdt.debug.rhino.tests/test.xml delete mode 100644 tests/org.eclipse.wst.jsdt.ui.tests/.classpath delete mode 100644 tests/org.eclipse.wst.jsdt.ui.tests/.cvsignore delete mode 100644 tests/org.eclipse.wst.jsdt.ui.tests/.project delete mode 100644 tests/org.eclipse.wst.jsdt.ui.tests/.settings/org.eclipse.jdt.core.prefs delete mode 100644 tests/org.eclipse.wst.jsdt.ui.tests/META-INF/MANIFEST.MF delete mode 100644 tests/org.eclipse.wst.jsdt.ui.tests/about.html delete mode 100644 tests/org.eclipse.wst.jsdt.ui.tests/build.properties delete mode 100644 tests/org.eclipse.wst.jsdt.ui.tests/icons/full/eview16/package.gif delete mode 100644 tests/org.eclipse.wst.jsdt.ui.tests/plugin.properties delete mode 100644 tests/org.eclipse.wst.jsdt.ui.tests/plugin.xml delete mode 100644 tests/org.eclipse.wst.jsdt.ui.tests/src/org/eclipse/wst/jsdt/ui/tests/EditorTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.ui.tests/src/org/eclipse/wst/jsdt/ui/tests/JSDTUITests.java delete mode 100644 tests/org.eclipse.wst.jsdt.ui.tests/src/org/eclipse/wst/jsdt/ui/tests/format/FormattingTests.java delete mode 100644 tests/org.eclipse.wst.jsdt.ui.tests/src/org/eclipse/wst/jsdt/ui/tests/internal/Activator.java delete mode 100644 tests/org.eclipse.wst.jsdt.ui.tests/src/org/eclipse/wst/jsdt/ui/tests/internal/JsStorageEditorInput.java delete mode 100644 tests/org.eclipse.wst.jsdt.ui.tests/test.xml diff --git a/features/org.eclipse.wst.jsdt_tests.feature/.cvsignore b/features/org.eclipse.wst.jsdt_tests.feature/.cvsignore deleted file mode 100644 index c14487c..0000000 --- a/features/org.eclipse.wst.jsdt_tests.feature/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -build.xml diff --git a/features/org.eclipse.wst.jsdt_tests.feature/.project b/features/org.eclipse.wst.jsdt_tests.feature/.project deleted file mode 100644 index 808c20f..0000000 --- a/features/org.eclipse.wst.jsdt_tests.feature/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - org.eclipse.wst.jsdt_tests.feature - - - - - - org.eclipse.pde.FeatureBuilder - - - - - - org.eclipse.pde.FeatureNature - - diff --git a/features/org.eclipse.wst.jsdt_tests.feature/.settings/org.eclipse.core.resources.prefs b/features/org.eclipse.wst.jsdt_tests.feature/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 06da1cb..0000000 --- a/features/org.eclipse.wst.jsdt_tests.feature/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Wed Dec 12 03:20:23 EST 2007 -eclipse.preferences.version=1 -encoding/=ISO-8859-1 diff --git a/features/org.eclipse.wst.jsdt_tests.feature/build.properties b/features/org.eclipse.wst.jsdt_tests.feature/build.properties deleted file mode 100644 index 27affc5..0000000 --- a/features/org.eclipse.wst.jsdt_tests.feature/build.properties +++ /dev/null @@ -1,5 +0,0 @@ -bin.includes = feature.xml,\ - epl-v10.html,\ - eclipse_update_120.jpg,\ - license.html,\ - feature.properties diff --git a/features/org.eclipse.wst.jsdt_tests.feature/eclipse_update_120.jpg b/features/org.eclipse.wst.jsdt_tests.feature/eclipse_update_120.jpg deleted file mode 100644 index bfdf708..0000000 Binary files a/features/org.eclipse.wst.jsdt_tests.feature/eclipse_update_120.jpg and /dev/null differ diff --git a/features/org.eclipse.wst.jsdt_tests.feature/epl-v10.html b/features/org.eclipse.wst.jsdt_tests.feature/epl-v10.html deleted file mode 100644 index ed4b196..0000000 --- a/features/org.eclipse.wst.jsdt_tests.feature/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - \ No newline at end of file diff --git a/features/org.eclipse.wst.jsdt_tests.feature/feature.properties b/features/org.eclipse.wst.jsdt_tests.feature/feature.properties deleted file mode 100644 index 791fb8b..0000000 --- a/features/org.eclipse.wst.jsdt_tests.feature/feature.properties +++ /dev/null @@ -1,168 +0,0 @@ -############################################################################### -# Copyright (c) 2007, 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 -############################################################################### -# feature.properties -# contains externalized strings for feature.xml -# "%foo" in feature.xml corresponds to the key "foo" in this file -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file should be translated. - -# "featureName" property - name of the feature -featureName=JSDT Tests - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse Web Tools Platform - - -# "description" property - description of the feature -description=JSDT Tests - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2000, 2010 IBM Corporation and others.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - IBM Corporation - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -Eclipse Foundation Software User Agreement\n\ -April 14, 2010\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the\n\ -Eclipse Foundation is provided to you under the terms and conditions of\n\ -the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ -provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse Foundation source code\n\ -repository ("Repository") in software modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ -Update License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties" found within a Feature.\n\ -Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ -terms and conditions (or references to such terms and conditions) that\n\ -govern your use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -\n\Use of Provisioning Technology\n\ -\n\ -The Eclipse Foundation makes available provisioning software, examples of which include,\n\ -but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ -the purpose of allowing users to install software, documentation, information and/or\n\ -other materials (collectively "Installable Software"). This capability is provided with\n\ -the intent of allowing such users to install, extend and update Eclipse-based products.\n\ -Information about packaging Installable Software is available at\n\ -http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ -\n\ -You may use Provisioning Technology to allow other parties to install Installable Software.\n\ -You shall be responsible for enabling the applicable license agreements relating to the\n\ -Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ -in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ -making it available in accordance with the Specification, you further acknowledge your\n\ -agreement to, and the acquisition of all necessary rights to permit the following:\n\ -\n\ - 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ - the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ - extending or updating the functionality of an Eclipse-based product.\n\ - 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ - Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ - 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ - govern the use of the Installable Software ("Installable Software Agreement") and such\n\ - Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ - with the Specification. Such Installable Software Agreement must inform the user of the\n\ - terms and conditions that govern the Installable Software and must solicit acceptance by\n\ - the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ - indication of agreement by the user, the provisioning Technology will complete installation\n\ - of the Installable Software.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use, and\n\ -re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/features/org.eclipse.wst.jsdt_tests.feature/feature.xml b/features/org.eclipse.wst.jsdt_tests.feature/feature.xml deleted file mode 100644 index 30a25fe..0000000 --- a/features/org.eclipse.wst.jsdt_tests.feature/feature.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - %description - - - - %copyright - - - - %license - - - - - - - - - - - - - - - - - diff --git a/features/org.eclipse.wst.jsdt_tests.feature/license.html b/features/org.eclipse.wst.jsdt_tests.feature/license.html deleted file mode 100644 index c184ca3..0000000 --- a/features/org.eclipse.wst.jsdt_tests.feature/license.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - -Eclipse Foundation Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

April 14, 2010

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code - repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

- - - -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- - - -

Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- - -

Use of Provisioning Technology

- -

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse - Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or - other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to - install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html - ("Specification").

- -

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the - applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology - in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the - Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

- -
    -
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology - on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based - product.
  2. -
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be - accessed and copied to the Target Machine.
  4. -
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable - Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target - Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern - the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such - indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. -
- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

- - diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/.classpath b/tests/org.eclipse.wst.jsdt.core.tests.model/.classpath deleted file mode 100644 index ce73933..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/.cvsignore b/tests/org.eclipse.wst.jsdt.core.tests.model/.cvsignore deleted file mode 100644 index 7722bc8..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -build.xml -javaCompiler...args diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/.project b/tests/org.eclipse.wst.jsdt.core.tests.model/.project deleted file mode 100644 index 15cf2d2..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - org.eclipse.wst.jsdt.core.tests.model - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/.settings/org.eclipse.core.resources.prefs b/tests/org.eclipse.wst.jsdt.core.tests.model/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 039fac0..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,4 +0,0 @@ -#Mon Jan 28 15:47:49 CST 2008 -eclipse.preferences.version=1 -encoding/=ISO-8859-1 -instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.wst.jsdt.core.tests.model/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index d8c99ee..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -#Tue Apr 17 15:48:57 CDT 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 diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/META-INF/MANIFEST.MF b/tests/org.eclipse.wst.jsdt.core.tests.model/META-INF/MANIFEST.MF deleted file mode 100644 index 5ddee01..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/META-INF/MANIFEST.MF +++ /dev/null @@ -1,25 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-SymbolicName: org.eclipse.wst.jsdt.core.tests.model; singleton:=true -Bundle-Version: 1.0.400.qualifier -Bundle-Vendor: %providerName -Bundle-Localization: plugin -Export-Package: org.eclipse.wst.jsdt.core.tests, - org.eclipse.wst.jsdt.core.tests.dom, - org.eclipse.wst.jsdt.core.tests.formatter, - org.eclipse.wst.jsdt.core.tests.formatter.comment, - org.eclipse.wst.jsdt.core.tests.model, - org.eclipse.wst.jsdt.core.tests.rewrite.describing, - org.eclipse.wst.jsdt.core.tests.rewrite.modifying -Import-Package: com.ibm.icu.text; version="3.8", - com.ibm.icu.util; version="3.8" -Require-Bundle: org.eclipse.core.resources, - org.eclipse.core.runtime, - org.junit;bundle-version=3.8.2, - org.eclipse.wst.jsdt.core.tests.compiler, - org.eclipse.team.core, - org.eclipse.text, - org.eclipse.wst.jsdt.core -Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: J2SE-1.4 diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/META-INF/eclipse.inf b/tests/org.eclipse.wst.jsdt.core.tests.model/META-INF/eclipse.inf deleted file mode 100644 index fdcf47e..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/META-INF/eclipse.inf +++ /dev/null @@ -1,6 +0,0 @@ -# We do not want any nested jars -# signed or normalized for packing -# see bug 274743 Some unit tests are sensitive to details of build -# https://bugs.eclipse.org/bugs/show_bug.cgi?id=274743 - -jarprocessor.exclude.children=true \ No newline at end of file diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/about.html b/tests/org.eclipse.wst.jsdt.core.tests.model/about.html deleted file mode 100644 index 4602330..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/about.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - -About - - -

About This Content

- -

June 2, 2006

-

License

- -

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise -indicated below, the Content is provided to you under the terms and conditions of the -Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available -at http://www.eclipse.org/legal/epl-v10.html. -For purposes of the EPL, "Program" will mean the Content.

- -

If you did not receive this Content directly from the Eclipse Foundation, the Content is -being redistributed by another party ("Redistributor") 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 http://www.eclipse.org.

- - - \ No newline at end of file diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/build.properties b/tests/org.eclipse.wst.jsdt.core.tests.model/build.properties deleted file mode 100644 index fe0e4e9..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/build.properties +++ /dev/null @@ -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 = plugin.xml,\ - workspace/,\ - .,\ - test.xml,\ - plugin.properties,\ - META-INF/,\ - about.html -source.. = src/ diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/plugin.properties b/tests/org.eclipse.wst.jsdt.core.tests.model/plugin.properties deleted file mode 100644 index 48b40c9..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/plugin.properties +++ /dev/null @@ -1,19 +0,0 @@ -############################################################################### -# Copyright (c) 2007, 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 -############################################################################### - -# -# Messages in plugin.xml. -# -pluginName=JSDT Core Model Tests -providerName=Eclipse Web Tools Platform - -JsGlobalScopeVariableInitializer.deprecated.0 = Test deprecated flag -JsGlobalScopeVariableInitializer.deprecated.1 = A deprecated and read-only initializer diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/plugin.xml b/tests/org.eclipse.wst.jsdt.core.tests.model/plugin.xml deleted file mode 100644 index d7451dc..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/plugin.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; - - - - - - - - - - diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunCompilerTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunCompilerTests.java deleted file mode 100644 index faae149..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunCompilerTests.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -/** - * Runs all compiler tests (including parser tests) See AbstractCompilerTests - * for more details. - */ -public class RunCompilerTests extends TestCase { - - public RunCompilerTests(String name) { - super(name); - } - - public static Class[] getAllTestClasses() { - return new Class[] { - org.eclipse.wst.jsdt.core.tests.compiler.regression.TestAll.class, - org.eclipse.wst.jsdt.core.tests.compiler.parser.TestAll.class }; - } - - public static Test suite() { - TestSuite ts = new TestSuite(RunCompilerTests.class.getName()); - - Class[] testClasses = getAllTestClasses(); - 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/RunDOMTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunDOMTests.java deleted file mode 100644 index 7358ecf..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunDOMTests.java +++ /dev/null @@ -1,32 +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 - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -import org.eclipse.wst.jsdt.core.tests.dom.RunAllTests; - -/** - * Runs all DOM AST tests. - */ -public class RunDOMTests extends TestCase { - -public RunDOMTests(String name) { - super(name); -} -public static Test suite() { - TestSuite suite = new TestSuite(RunDOMTests.class.getName()); - suite.addTest(RunAllTests.suite()); - return suite; -} -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunFormatterTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunFormatterTests.java deleted file mode 100644 index ff18a39..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunFormatterTests.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -import org.eclipse.wst.jsdt.core.tests.formatter.FormatterRegressionTests; -import org.eclipse.wst.jsdt.core.tests.formatter.comment.CommentsTestSuite; - -/** - * Runs all formatter tests. - */ -public class RunFormatterTests extends TestCase { - - public static Class[] getAllTestClasses() { - return new Class[] { - FormatterRegressionTests.class, - CommentsTestSuite.class, - }; - } - public static Test suite() { - TestSuite ts = new TestSuite(RunFormatterTests.class.getName()); - - Class[] testClasses = getAllTestClasses(); - 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; - } - -public RunFormatterTests(String name) { - super(name); -} -} - diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunJSDTCoreTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunJSDTCoreTests.java deleted file mode 100644 index 309911f..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunJSDTCoreTests.java +++ /dev/null @@ -1,35 +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; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -import org.eclipse.wst.jsdt.core.tests.utils.SequenceReaderTests; - -/** - * Runs all JDT Core tests. - */ -public class RunJSDTCoreTests extends TestCase { -public RunJSDTCoreTests(String name) { - super(name); -} -public static Test suite() { - TestSuite suite = new TestSuite("JSDT 'Model' Tests"); - suite.addTest(RunDOMTests.suite()); - suite.addTest(RunFormatterTests.suite()); - suite.addTest(RunModelTests.suite()); - suite.addTestSuite(SequenceReaderTests.class); - return suite; -} -} - diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunModelTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunModelTests.java deleted file mode 100644 index 1f53b8e..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunModelTests.java +++ /dev/null @@ -1,32 +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 - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -import org.eclipse.wst.jsdt.core.tests.model.JSDTModelTests; - -/** - * Runs all Java model tests. - */ -public class RunModelTests extends TestCase { -public RunModelTests(String name) { - super(name); -} -public static Test suite() { - TestSuite suite = new TestSuite(RunModelTests.class.getName()); - suite.addTest(JSDTModelTests.suite()); - return suite; -} -} - diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterAST3Test.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterAST3Test.java deleted file mode 100644 index 2e407ba..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterAST3Test.java +++ /dev/null @@ -1,9467 +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.util.List; - -import junit.framework.Test; - -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.dom.AST; -import org.eclipse.wst.jsdt.core.dom.ASTMatcher; -import org.eclipse.wst.jsdt.core.dom.ASTNode; -import org.eclipse.wst.jsdt.core.dom.AbstractTypeDeclaration; -import org.eclipse.wst.jsdt.core.dom.AnonymousClassDeclaration; -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.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.ContinueStatement; -import org.eclipse.wst.jsdt.core.dom.DoStatement; -import org.eclipse.wst.jsdt.core.dom.EmptyStatement; -import org.eclipse.wst.jsdt.core.dom.Expression; -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.IBinding; -import org.eclipse.wst.jsdt.core.dom.IFunctionBinding; -import org.eclipse.wst.jsdt.core.dom.IPackageBinding; -import org.eclipse.wst.jsdt.core.dom.ITypeBinding; -import org.eclipse.wst.jsdt.core.dom.IVariableBinding; -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.Modifier; -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.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.Statement; -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.ThisExpression; -import org.eclipse.wst.jsdt.core.dom.ThrowStatement; -import org.eclipse.wst.jsdt.core.dom.TryStatement; -import org.eclipse.wst.jsdt.core.dom.Type; -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; -import org.eclipse.wst.jsdt.core.util.IModifierConstants; - -public class ASTConverterAST3Test extends ConverterTestSetup { - - public void setUpSuite() throws Exception { - super.setUpSuite(); - this.ast = AST.newAST(AST.JLS3); - } - - public ASTConverterAST3Test(String name) { - super(name); - } - - static { - } - - public static Test suite() { - return buildModelTestSuite(ASTConverterAST3Test.class); - } - - public void test0001() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0001", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - - // check that we have the right tree - JavaScriptUnit unit = this.ast.newJavaScriptUnit(); - FunctionDeclaration methodDeclaration = this.ast.newFunctionDeclaration(); - methodDeclaration.setConstructor(false); - methodDeclaration.setName(this.ast.newSimpleName("main"));//$NON-NLS-1$ - SingleVariableDeclaration variableDeclaration = this.ast.newSingleVariableDeclaration(); - variableDeclaration.setName(this.ast.newSimpleName("args"));//$NON-NLS-1$ - methodDeclaration.parameters().add(variableDeclaration); - org.eclipse.wst.jsdt.core.dom.Block block = this.ast.newBlock(); - FunctionInvocation methodInvocation = this.ast.newFunctionInvocation(); - methodInvocation.setName(this.ast.newSimpleName("print")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setOperator(InfixExpression.Operator.PLUS); - StringLiteral literal = this.ast.newStringLiteral(); - literal.setLiteralValue("Hello");//$NON-NLS-1$ - infixExpression.setLeftOperand(literal); - literal = this.ast.newStringLiteral(); - literal.setLiteralValue(" world");//$NON-NLS-1$ - infixExpression.setRightOperand(literal);//$NON-NLS-1$ - methodInvocation.arguments().add(infixExpression); - ExpressionStatement expressionStatement = this.ast.newExpressionStatement(methodInvocation); - block.statements().add(expressionStatement); - methodDeclaration.setBody(block); - assertTrue("Both AST trees should be identical", result.subtreeMatch(new ASTMatcher(), unit));//$NON-NLS-1$ - String expected = - "function main(args) {\n" + - " print(\"Hello\" + \" world\");\n" + - "}"; - checkSourceRange(result, expected, source); - } - - /** - * Test allocation expression: new Object() ==> ClassInstanceCreation - */ - public void test0002() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0002", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = this.ast.newClassInstanceCreation(); - classInstanceCreation.setType(this.ast.newSimpleType(this.ast.newSimpleName("Object"))); //$NON-NLS-1$ - assertTrue("Both AST trees should be identical", classInstanceCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "new Object()", source); //$NON-NLS-1$ - } - - /** - * Test allocation expression: new java.lang.Object() ==> ClassInstanceCreation - */ - public void test0003() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0003", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = this.ast.newClassInstanceCreation(); - QualifiedName name = - this.ast.newQualifiedName( - this.ast.newQualifiedName( - this.ast.newSimpleName("java"), //$NON-NLS-1$ - this.ast.newSimpleName("lang")), //$NON-NLS-1$ - this.ast.newSimpleName("Object"));//$NON-NLS-1$ - classInstanceCreation.setType(this.ast.newSimpleType(name)); - assertTrue("Both AST trees should be identical", classInstanceCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "new java.lang.Object()", source); //$NON-NLS-1$ - } - - /** - * Test allocation expression: new java.lang.Exception("ERROR") ==> ClassInstanceCreation - */ - public void test0004() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0004", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = this.ast.newClassInstanceCreation(); - QualifiedName name = - this.ast.newQualifiedName( - this.ast.newQualifiedName( - this.ast.newSimpleName("java"), //$NON-NLS-1$ - this.ast.newSimpleName("lang")), //$NON-NLS-1$ - this.ast.newSimpleName("Exception"));//$NON-NLS-1$ - classInstanceCreation.setType(this.ast.newSimpleType(name)); - StringLiteral literal = this.ast.newStringLiteral(); - literal.setLiteralValue("ERROR"); //$NON-NLS-1$ - classInstanceCreation.arguments().add(literal); - assertTrue("Both AST trees should be identical", classInstanceCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "new java.lang.Exception(\"ERROR\")", source); //$NON-NLS-1$ - } - - /** - * Test allocation expression: new java.lang.Object() {} ==> ClassInstanceCreation - */ - public void test0005() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0005", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = this.ast.newClassInstanceCreation(); - QualifiedName name = - this.ast.newQualifiedName( - this.ast.newQualifiedName( - this.ast.newSimpleName("java"), //$NON-NLS-1$ - this.ast.newSimpleName("lang")), //$NON-NLS-1$ - this.ast.newSimpleName("Object"));//$NON-NLS-1$ - classInstanceCreation.setType(this.ast.newSimpleType(name)); - AnonymousClassDeclaration anonymousClassDeclaration = this.ast.newAnonymousClassDeclaration(); - classInstanceCreation.setAnonymousClassDeclaration(anonymousClassDeclaration); - assertTrue("Both AST trees should be identical", classInstanceCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "new java.lang.Object() {}", source); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation2 = (ClassInstanceCreation) expression; - Type type = classInstanceCreation2.getType(); - checkSourceRange(type, "java.lang.Object", source); //$NON-NLS-1$ - } - - - /** - * Test allocation expression: new java.lang.Runnable() { public void run() {}} ==> ClassInstanceCreation - */ - public void test0006() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0006", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = this.ast.newClassInstanceCreation(); - QualifiedName name = - this.ast.newQualifiedName( - this.ast.newQualifiedName( - this.ast.newSimpleName("java"), //$NON-NLS-1$ - this.ast.newSimpleName("lang")), //$NON-NLS-1$ - this.ast.newSimpleName("Runnable"));//$NON-NLS-1$ - classInstanceCreation.setType(this.ast.newSimpleType(name)); - FunctionDeclaration methodDeclaration = this.ast.newFunctionDeclaration(); - methodDeclaration.setBody(this.ast.newBlock()); - methodDeclaration.setConstructor(false); - methodDeclaration.modifiers().add(this.ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD)); - methodDeclaration.setName(this.ast.newSimpleName("run"));//$NON-NLS-1$ - methodDeclaration.setReturnType2(this.ast.newPrimitiveType(PrimitiveType.VOID)); - AnonymousClassDeclaration anonymousClassDeclaration = this.ast.newAnonymousClassDeclaration(); - anonymousClassDeclaration.bodyDeclarations().add(methodDeclaration); - classInstanceCreation.setAnonymousClassDeclaration(anonymousClassDeclaration); - assertTrue("Both AST trees should be identical", classInstanceCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "new java.lang.Runnable() { public void run() {}}", source); //$NON-NLS-1$ - } - - /** - * Test allocation expression: new Test().new D() ==> ClassInstanceCreation - */ - public void test0007() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0007", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - ASTNode expression = (ASTNode) ((FunctionInvocation) expressionStatement.getExpression()).arguments().get(0); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = this.ast.newClassInstanceCreation(); - classInstanceCreation.setType(this.ast.newSimpleType(this.ast.newSimpleName("D"))); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreationExpression = this.ast.newClassInstanceCreation(); - classInstanceCreationExpression.setType(this.ast.newSimpleType(this.ast.newSimpleName("Test"))); //$NON-NLS-1$ - classInstanceCreation.setExpression(classInstanceCreationExpression); - assertTrue("Both AST trees should be identical", classInstanceCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "new Test().new D()", source); //$NON-NLS-1$ - } - - /** - * Test allocation expression: new int[] {1, 2, 3, 4} ==> ArrayCreation - */ - public void test0008() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0008", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - ArrayCreation arrayCreation = this.ast.newArrayCreation(); - arrayCreation.setType(this.ast.newArrayType(this.ast.newPrimitiveType(PrimitiveType.INT), 1)); - ArrayInitializer arrayInitializer = this.ast.newArrayInitializer(); - arrayInitializer.expressions().add(this.ast.newNumberLiteral("1"));//$NON-NLS-1$ - arrayInitializer.expressions().add(this.ast.newNumberLiteral("2"));//$NON-NLS-1$ - arrayInitializer.expressions().add(this.ast.newNumberLiteral("3"));//$NON-NLS-1$ - arrayInitializer.expressions().add(this.ast.newNumberLiteral("4"));//$NON-NLS-1$ - arrayCreation.setInitializer(arrayInitializer); - assertTrue("Both AST trees should be identical", arrayCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "new int[] {1, 2, 3, 4}", source); //$NON-NLS-1$ - } - - /** - * Test allocation expression: new int[][] {{1}, {2}} ==> ArrayCreation - */ - public void test0009() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0009", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - ArrayCreation arrayCreation = this.ast.newArrayCreation(); - arrayCreation.setType(this.ast.newArrayType(this.ast.newPrimitiveType(PrimitiveType.INT), 2)); - ArrayInitializer arrayInitializer = this.ast.newArrayInitializer(); - ArrayInitializer innerArrayInitializer = this.ast.newArrayInitializer(); - innerArrayInitializer.expressions().add(this.ast.newNumberLiteral("1"));//$NON-NLS-1$ - arrayInitializer.expressions().add(innerArrayInitializer); - innerArrayInitializer = this.ast.newArrayInitializer(); - innerArrayInitializer.expressions().add(this.ast.newNumberLiteral("2"));//$NON-NLS-1$ - arrayInitializer.expressions().add(innerArrayInitializer); - arrayCreation.setInitializer(arrayInitializer); - assertTrue("Both AST trees should be identical", arrayCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "new int[][] {{1}, {2}}", source); //$NON-NLS-1$ - } - - /** - * Test allocation expression: new int[3] ==> ArrayCreation - */ - public void test0010() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0010", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - ArrayCreation arrayCreation = this.ast.newArrayCreation(); - arrayCreation.setType(this.ast.newArrayType(this.ast.newPrimitiveType(PrimitiveType.INT), 1)); - arrayCreation.dimensions().add(this.ast.newNumberLiteral("3")); //$NON-NLS-1$ - assertTrue("Both AST trees should be identical", arrayCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "new int[3]", source); //$NON-NLS-1$ - } - - /** - * Test allocation expression: new int[3][] ==> ArrayCreation - */ - public void test0011() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0011", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - ArrayCreation arrayCreation = this.ast.newArrayCreation(); - arrayCreation.setType(this.ast.newArrayType(this.ast.newPrimitiveType(PrimitiveType.INT), 2)); - arrayCreation.dimensions().add(this.ast.newNumberLiteral("3")); //$NON-NLS-1$ - assertTrue("Both AST trees should be identical", arrayCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "new int[3][]", source); //$NON-NLS-1$ - } - - /** - * Test allocation expression: new int[][] {{},{}} ==> ArrayCreation - */ - public void test0012() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0012", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - ArrayCreation arrayCreation = this.ast.newArrayCreation(); - arrayCreation.setType(this.ast.newArrayType(this.ast.newPrimitiveType(PrimitiveType.INT), 2)); - ArrayInitializer arrayInitializer = this.ast.newArrayInitializer(); - ArrayInitializer innerArrayInitializer = this.ast.newArrayInitializer(); - arrayInitializer.expressions().add(innerArrayInitializer); - innerArrayInitializer = this.ast.newArrayInitializer(); - arrayInitializer.expressions().add(innerArrayInitializer); - arrayCreation.setInitializer(arrayInitializer); - assertTrue("Both AST trees should be identical", arrayCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "new int[][] {{}, {}}", source); //$NON-NLS-1$ - } - - /** - * int i; ==> VariableDeclarationFragment - */ - public void test0013() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0013", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$ - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "int i;", source); //$NON-NLS-1$ - } - - /** - * int i = 0; ==> VariableDeclarationFragment - */ - public void test0014() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0014", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$ - variableDeclarationFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$ - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "int i = 0;", source); //$NON-NLS-1$ - } - - /** - * i = 1; ==> ExpressionStatement(Assignment) - */ - public void test0015() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0015", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - Assignment assignment = this.ast.newAssignment(); - assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$ - assignment.setRightHandSide(this.ast.newNumberLiteral("1")); //$NON-NLS-1$ - assignment.setOperator(Assignment.Operator.ASSIGN); - ExpressionStatement statement = this.ast.newExpressionStatement(assignment); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "i = 1;", source); //$NON-NLS-1$ - } - - /** - * i += 2; ==> ExpressionStatement(Assignment) - */ - public void test0016() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0016", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - Assignment assignment = this.ast.newAssignment(); - assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$ - assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$ - assignment.setOperator(Assignment.Operator.PLUS_ASSIGN); - ExpressionStatement statement = this.ast.newExpressionStatement(assignment); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "i += 2;", source); //$NON-NLS-1$ - } - - /** - * i -= 2; ==> ExpressionStatement(Assignment) - */ - public void test0017() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0017", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - Assignment assignment = this.ast.newAssignment(); - assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$ - assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$ - assignment.setOperator(Assignment.Operator.MINUS_ASSIGN); - ExpressionStatement statement = this.ast.newExpressionStatement(assignment); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "i -= 2;", source); //$NON-NLS-1$ - } - - /** - * i *= 2; ==> ExpressionStatement(Assignment) - */ - public void test0018() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0018", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - Assignment assignment = this.ast.newAssignment(); - assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$ - assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$ - assignment.setOperator(Assignment.Operator.TIMES_ASSIGN); - ExpressionStatement statement = this.ast.newExpressionStatement(assignment); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "i *= 2;", source); //$NON-NLS-1$ - } - - /** - * i /= 2; ==> ExpressionStatement(Assignment) - */ - public void test0019() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0019", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - Assignment assignment = this.ast.newAssignment(); - assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$ - assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$ - assignment.setOperator(Assignment.Operator.DIVIDE_ASSIGN); - ExpressionStatement statement = this.ast.newExpressionStatement(assignment); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "i /= 2;", source); //$NON-NLS-1$ - } - - /** - * i &= 2 ==> ExpressionStatement(Assignment) - */ - public void test0020() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0020", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - Assignment assignment = this.ast.newAssignment(); - assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$ - assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$ - assignment.setOperator(Assignment.Operator.BIT_AND_ASSIGN); - ExpressionStatement statement = this.ast.newExpressionStatement(assignment); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "i &= 2;", source); //$NON-NLS-1$ - } - - /** - * i |= 2; ==> ExpressionStatement(Assignment) - */ - public void test0021() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0021", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - Assignment assignment = this.ast.newAssignment(); - assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$ - assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$ - assignment.setOperator(Assignment.Operator.BIT_OR_ASSIGN); - ExpressionStatement statement = this.ast.newExpressionStatement(assignment); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "i |= 2;", source); //$NON-NLS-1$ - } - - /** - * i ^= 2; ==> ExpressionStatement(Assignment) - */ - public void test0022() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0022", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - Assignment assignment = this.ast.newAssignment(); - assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$ - assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$ - assignment.setOperator(Assignment.Operator.BIT_XOR_ASSIGN); - ExpressionStatement statement = this.ast.newExpressionStatement(assignment); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "i ^= 2;", source); //$NON-NLS-1$ - } - - /** - * i %= 2; ==> ExpressionStatement(Assignment) - */ - public void test0023() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0023", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - Assignment assignment = this.ast.newAssignment(); - assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$ - assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$ - assignment.setOperator(Assignment.Operator.REMAINDER_ASSIGN); - ExpressionStatement statement = this.ast.newExpressionStatement(assignment); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "i %= 2;", source); //$NON-NLS-1$ - } - - /** - * i <<= 2; ==> ExpressionStatement(Assignment) - */ - public void test0024() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0024", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - Assignment assignment = this.ast.newAssignment(); - assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$ - assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$ - assignment.setOperator(Assignment.Operator.LEFT_SHIFT_ASSIGN); - ExpressionStatement statement = this.ast.newExpressionStatement(assignment); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "i <<= 2;", source); //$NON-NLS-1$ - } - - /** - * i >>= 2; ==> ExpressionStatement(Assignment) - */ - public void test0025() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0025", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - Assignment assignment = this.ast.newAssignment(); - assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$ - assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$ - assignment.setOperator(Assignment.Operator.RIGHT_SHIFT_SIGNED_ASSIGN); - ExpressionStatement statement = this.ast.newExpressionStatement(assignment); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "i >>= 2;", source); //$NON-NLS-1$ - } - - /** - * i >>>= 2; ==> ExpressionStatement(Assignment) - */ - public void test0026() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0026", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - Assignment assignment = this.ast.newAssignment(); - assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$ - assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$ - assignment.setOperator(Assignment.Operator.RIGHT_SHIFT_UNSIGNED_ASSIGN); - ExpressionStatement statement = this.ast.newExpressionStatement(assignment); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "i >>>= 2;", source); //$NON-NLS-1$ - } - - /** - * --i; ==> ExpressionStatement(PrefixExpression) - */ - public void test0027() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0027", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - PrefixExpression prefixExpression = this.ast.newPrefixExpression(); - prefixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$ - prefixExpression.setOperator(PrefixExpression.Operator.DECREMENT);//$NON-NLS-1$ - ExpressionStatement statement = this.ast.newExpressionStatement(prefixExpression); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "--i;", source); //$NON-NLS-1$ - } - - /** - * --i; ==> ExpressionStatement(PrefixExpression) - */ - public void test0028() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0028", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - PrefixExpression prefixExpression = this.ast.newPrefixExpression(); - prefixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$ - prefixExpression.setOperator(PrefixExpression.Operator.INCREMENT);//$NON-NLS-1$ - ExpressionStatement statement = this.ast.newExpressionStatement(prefixExpression); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "++i;", source); //$NON-NLS-1$ - } - - /** - * i--; ==> ExpressionStatement(PostfixExpression) - */ - public void test0029() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0029", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - PostfixExpression postfixExpression = this.ast.newPostfixExpression(); - postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$ - postfixExpression.setOperator(PostfixExpression.Operator.DECREMENT);//$NON-NLS-1$ - ExpressionStatement statement = this.ast.newExpressionStatement(postfixExpression); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "i--;", source); //$NON-NLS-1$ - } - - /** - * i++; ==> ExpressionStatement(PostfixExpression) - */ - public void test0030() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0030", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - PostfixExpression postfixExpression = this.ast.newPostfixExpression(); - postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$ - postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);//$NON-NLS-1$ - ExpressionStatement statement = this.ast.newExpressionStatement(postfixExpression); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "i++;", source); //$NON-NLS-1$ - } - - /** - * int.class; ==> ExpressionStatement(TypeLiteral) - */ - public void test0038() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0038", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("c")); //$NON-NLS-1$ - TypeLiteral typeLiteral = this.ast.newTypeLiteral(); - typeLiteral.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - variableDeclarationFragment.setInitializer(typeLiteral); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setType(this.ast.newSimpleType(this.ast.newSimpleName("Class")));//$NON-NLS-1$ - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(((VariableDeclarationFragment)((VariableDeclarationStatement)node).fragments().get(0)).getInitializer(), "int.class", source); //$NON-NLS-1$ - } - - /** - * void.class; ==> ExpressionStatement(TypeLiteral) - */ - public void test0039() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0039", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("c")); //$NON-NLS-1$ - TypeLiteral typeLiteral = this.ast.newTypeLiteral(); - typeLiteral.setType(this.ast.newPrimitiveType(PrimitiveType.VOID)); - variableDeclarationFragment.setInitializer(typeLiteral); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setType(this.ast.newSimpleType(this.ast.newSimpleName("Class")));//$NON-NLS-1$ - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(((VariableDeclarationFragment)((VariableDeclarationStatement)node).fragments().get(0)).getInitializer(), "void.class", source); //$NON-NLS-1$ - } - - /** - * double.class; ==> ExpressionStatement(TypeLiteral) - */ - public void test0040() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0040", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("c")); //$NON-NLS-1$ - TypeLiteral typeLiteral = this.ast.newTypeLiteral(); - typeLiteral.setType(this.ast.newPrimitiveType(PrimitiveType.DOUBLE)); - variableDeclarationFragment.setInitializer(typeLiteral); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setType(this.ast.newSimpleType(this.ast.newSimpleName("Class")));//$NON-NLS-1$ - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(((VariableDeclarationFragment)((VariableDeclarationStatement)node).fragments().get(0)).getInitializer(), "double.class", source); //$NON-NLS-1$ - } - - /** - * long.class; ==> ExpressionStatement(TypeLiteral) - */ - public void test0041() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0041", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("c")); //$NON-NLS-1$ - TypeLiteral typeLiteral = this.ast.newTypeLiteral(); - typeLiteral.setType(this.ast.newPrimitiveType(PrimitiveType.LONG)); - variableDeclarationFragment.setInitializer(typeLiteral); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setType(this.ast.newSimpleType(this.ast.newSimpleName("Class")));//$NON-NLS-1$ - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(((VariableDeclarationFragment)((VariableDeclarationStatement)node).fragments().get(0)).getInitializer(), "long.class", source); //$NON-NLS-1$ - } - - /** - * false ==> BooleanLiteral - */ - public void test0042() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0042", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - BooleanLiteral literal = this.ast.newBooleanLiteral(false); - assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "false", source); //$NON-NLS-1$ - } - - /** - * true ==> BooleanLiteral - */ - public void test0043() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0043", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - BooleanLiteral literal = this.ast.newBooleanLiteral(true); - assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "true", source); //$NON-NLS-1$ - } - - /** - * null ==> NullLiteral - */ - public void test0044() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0044", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - NullLiteral literal = this.ast.newNullLiteral(); - assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "null", source); //$NON-NLS-1$ - } - - /** - * CharLiteral ==> CharacterLiteral - */ - public void test0045() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0045", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - CharacterLiteral literal = this.ast.newCharacterLiteral(); - literal.setEscapedValue("'c'"); //$NON-NLS-1$ - assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "'c'", source); //$NON-NLS-1$ - } - - /** - * DoubleLiteral ==> NumberLiteral - */ - public void test0046() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0046", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - NumberLiteral literal = this.ast.newNumberLiteral("1.00001");//$NON-NLS-1$ - assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "1.00001", source); //$NON-NLS-1$ - } - - /** - * FloatLiteral ==> NumberLiteral - */ - public void test0047() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0047", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - NumberLiteral literal = this.ast.newNumberLiteral("1.00001f");//$NON-NLS-1$ - assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "1.00001f", source); //$NON-NLS-1$ - } - - /** - * IntLiteral ==> NumberLiteral - */ - public void test0048() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0048", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - NumberLiteral literal = this.ast.newNumberLiteral("30000");//$NON-NLS-1$ - assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "30000", source); //$NON-NLS-1$ - } - - /** - * IntLiteralMinValue ==> NumberLiteral - */ - public void test0049() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0049", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - NumberLiteral literal = this.ast.newNumberLiteral("-2147483648");//$NON-NLS-1$ - assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "-2147483648", source); //$NON-NLS-1$ - } - - /** - * LongLiteral ==> NumberLiteral - */ - public void test0050() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0050", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - NumberLiteral literal = this.ast.newNumberLiteral("2147483648L");//$NON-NLS-1$ - assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "2147483648L", source); //$NON-NLS-1$ - } - - /** - * LongLiteral ==> NumberLiteral (negative value) - */ - public void test0051() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0051", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - NumberLiteral literal = this.ast.newNumberLiteral("2147483648L");//$NON-NLS-1$ - PrefixExpression prefixExpression = this.ast.newPrefixExpression(); - prefixExpression.setOperand(literal); - prefixExpression.setOperator(PrefixExpression.Operator.MINUS); - assertTrue("Both AST trees should be identical", prefixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "-2147483648L", source); //$NON-NLS-1$ - } - - /** - * LongLiteralMinValue ==> NumberLiteral - */ - public void test0052() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0052", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - NumberLiteral literal = this.ast.newNumberLiteral("-9223372036854775808L");//$NON-NLS-1$ - assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "-9223372036854775808L", source); //$NON-NLS-1$ - } - - /** - * ExtendedStringLiteral ==> StringLiteral - */ - public void test0053() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0053", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - /* - StringLiteral literal = this.ast.newStringLiteral();//$NON-NLS-1$ - literal.setLiteralValue("Hello World");*/ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setOperator(InfixExpression.Operator.PLUS); - StringLiteral literal = this.ast.newStringLiteral(); - literal.setLiteralValue("Hello");//$NON-NLS-1$ - infixExpression.setLeftOperand(literal); - literal = this.ast.newStringLiteral(); - literal.setLiteralValue(" World");//$NON-NLS-1$ - infixExpression.setRightOperand(literal);//$NON-NLS-1$ - - assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "\"Hello\" + \" World\"", source); //$NON-NLS-1$ - } - - /** - * AND_AND_Expression ==> InfixExpression - */ - public void test0054() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0054", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("b3")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$ - infixExpression.setRightOperand(this.ast.newSimpleName("b2")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.CONDITIONAL_AND); - variableDeclarationFragment.setInitializer(infixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "boolean b3 = b && b2;", source); //$NON-NLS-1$ - } - - /** - * OR_OR_Expression ==> InfixExpression - */ - public void test0055() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0055", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("b3")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$ - infixExpression.setRightOperand(this.ast.newSimpleName("b2")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.CONDITIONAL_OR); - variableDeclarationFragment.setInitializer(infixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "boolean b3 = b || b2;", source); //$NON-NLS-1$ - } - - /** - * EqualExpression ==> InfixExpression - */ - public void test0056() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0056", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("b3")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$ - infixExpression.setRightOperand(this.ast.newSimpleName("b2")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.EQUALS); - variableDeclarationFragment.setInitializer(infixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "boolean b3 = b == b2;", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression (+) ==> InfixExpression - */ - public void test0057() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0057", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$ - infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.PLUS); - variableDeclarationFragment.setInitializer(infixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "int n = i + j;", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression (-) ==> InfixExpression - */ - public void test0058() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0058", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$ - infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.MINUS); - variableDeclarationFragment.setInitializer(infixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "int n = i - j;", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression (*) ==> InfixExpression - */ - public void test0059() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0059", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$ - infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.TIMES); - variableDeclarationFragment.setInitializer(infixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "int n = i * j;", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression (/) ==> InfixExpression - */ - public void test0060() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0060", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$ - infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.DIVIDE); - variableDeclarationFragment.setInitializer(infixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "int n = i / j;", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression (%) ==> InfixExpression - */ - public void test0061() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0061", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$ - infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.REMAINDER); - variableDeclarationFragment.setInitializer(infixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "int n = i % j;", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression (^) ==> InfixExpression - */ - public void test0062() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0062", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$ - infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.XOR); - variableDeclarationFragment.setInitializer(infixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "int n = i ^ j;", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression (&) ==> InfixExpression - */ - public void test0063() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0063", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$ - infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.AND); - variableDeclarationFragment.setInitializer(infixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "int n = i & j;", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression (|) ==> InfixExpression - */ - public void test0064() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0064", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$ - infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.OR); - variableDeclarationFragment.setInitializer(infixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "int n = i | j;", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression (<) ==> InfixExpression - */ - public void test0065() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0065", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("b2")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$ - infixExpression.setRightOperand(this.ast.newSimpleName("b1")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.LESS); - variableDeclarationFragment.setInitializer(infixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "boolean b2 = b < b1;", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression (<=) ==> InfixExpression - */ - public void test0066() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0066", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("b2")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$ - infixExpression.setRightOperand(this.ast.newSimpleName("b1")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.LESS_EQUALS); - variableDeclarationFragment.setInitializer(infixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "boolean b2 = b <= b1;", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression (>) ==> InfixExpression - */ - public void test0067() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0067", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("b2")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$ - infixExpression.setRightOperand(this.ast.newSimpleName("b1")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.GREATER); - variableDeclarationFragment.setInitializer(infixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "boolean b2 = b > b1;", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression (>=) ==> InfixExpression - */ - public void test0068() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0068", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("b2")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$ - infixExpression.setRightOperand(this.ast.newSimpleName("b1")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.GREATER_EQUALS); - variableDeclarationFragment.setInitializer(infixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "boolean b2 = b >= b1;", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression (!=) ==> InfixExpression - */ - public void test0069() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0069", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("b2")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$ - infixExpression.setRightOperand(this.ast.newSimpleName("b1")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.NOT_EQUALS); - variableDeclarationFragment.setInitializer(infixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "boolean b2 = b != b1;", source); //$NON-NLS-1$ - } - - /** - * InstanceofExpression ==> InfixExpression - */ - public void test0070() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0070", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("b")); //$NON-NLS-1$ - InstanceofExpression instanceOfExpression = this.ast.newInstanceofExpression(); - instanceOfExpression.setLeftOperand(this.ast.newSimpleName("o"));//$NON-NLS-1$ - SimpleType simpleType = this.ast.newSimpleType(this.ast.newSimpleName("Integer"));//$NON-NLS-1$ - instanceOfExpression.setRightOperand(simpleType); - variableDeclarationFragment.setInitializer(instanceOfExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "boolean b = o instanceof Integer;", source); //$NON-NLS-1$ - } - - /** - * InstanceofExpression ==> InfixExpression - */ - public void test0071() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0071", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("b")); //$NON-NLS-1$ - InstanceofExpression instanceOfExpression = this.ast.newInstanceofExpression(); - instanceOfExpression.setLeftOperand(this.ast.newSimpleName("o")); //$NON-NLS-1$ - QualifiedName name = - this.ast.newQualifiedName( - this.ast.newQualifiedName( - this.ast.newSimpleName("java"), //$NON-NLS-1$ - this.ast.newSimpleName("lang")), //$NON-NLS-1$ - this.ast.newSimpleName("Integer")); //$NON-NLS-1$ - Type type = ast.newSimpleType(name); - instanceOfExpression.setRightOperand(type); - variableDeclarationFragment.setInitializer(instanceOfExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "boolean b = o instanceof java.lang.Integer;", source); //$NON-NLS-1$ - } - - /** - * UnaryExpression (!) ==> PrefixExpression - */ - public void test0072() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0072", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("b1")); //$NON-NLS-1$ - PrefixExpression prefixExpression = this.ast.newPrefixExpression(); - prefixExpression.setOperator(PrefixExpression.Operator.NOT); - prefixExpression.setOperand(this.ast.newSimpleName("b"));//$NON-NLS-1$ - variableDeclarationFragment.setInitializer(prefixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "boolean b1 = !b;", source); //$NON-NLS-1$ - } - - /** - * UnaryExpression (~) ==> PrefixExpression - */ - public void test0073() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0073", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$ - PrefixExpression prefixExpression = this.ast.newPrefixExpression(); - prefixExpression.setOperator(PrefixExpression.Operator.COMPLEMENT); - prefixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$ - variableDeclarationFragment.setInitializer(prefixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "int n = ~i;", source); //$NON-NLS-1$ - } - - /** - * UnaryExpression (+) ==> PrefixExpression - */ - public void test0074() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0074", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$ - PrefixExpression prefixExpression = this.ast.newPrefixExpression(); - prefixExpression.setOperator(PrefixExpression.Operator.PLUS); - prefixExpression.setOperand(this.ast.newNumberLiteral("2"));//$NON-NLS-1$ - variableDeclarationFragment.setInitializer(prefixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "int i = +2;", source); //$NON-NLS-1$ - } - - /** - * UnaryExpression (-) ==> PrefixExpression - */ - public void test0075() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0075", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$ - PrefixExpression prefixExpression = this.ast.newPrefixExpression(); - prefixExpression.setOperator(PrefixExpression.Operator.MINUS); - prefixExpression.setOperand(this.ast.newNumberLiteral("2"));//$NON-NLS-1$ - variableDeclarationFragment.setInitializer(prefixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "int i = -2;", source); //$NON-NLS-1$ - } - - /** - * ConditionalExpression ==> ConditionalExpression - */ - public void test0076() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0076", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("b")); //$NON-NLS-1$ - ConditionalExpression conditionalExpression = this.ast.newConditionalExpression(); - InfixExpression condition = this.ast.newInfixExpression(); - condition.setLeftOperand(this.ast.newSimpleName("args")); //$NON-NLS-1$ - condition.setRightOperand(this.ast.newNullLiteral()); //$NON-NLS-1$ - condition.setOperator(InfixExpression.Operator.NOT_EQUALS); - conditionalExpression.setExpression(condition); - conditionalExpression.setThenExpression(this.ast.newBooleanLiteral(true)); - conditionalExpression.setElseExpression(this.ast.newBooleanLiteral(false)); - variableDeclarationFragment.setInitializer(conditionalExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN)); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "boolean b = args != null ? true : false;", source); //$NON-NLS-1$ - } - - /** - * ConditionalExpression ==> ConditionalExpression - */ - public void test0077() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0077", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$ - ConditionalExpression conditionalExpression = this.ast.newConditionalExpression(); - conditionalExpression.setExpression(this.ast.newBooleanLiteral(true)); - QualifiedName name = - this.ast.newQualifiedName( - this.ast.newSimpleName("args"), //$NON-NLS-1$ - this.ast.newSimpleName("length")); //$NON-NLS-1$ - conditionalExpression.setThenExpression(name); - conditionalExpression.setElseExpression(this.ast.newNumberLiteral("0"));//$NON-NLS-1$ - variableDeclarationFragment.setInitializer(conditionalExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "int i = true ? args.length: 0;", source); //$NON-NLS-1$ - } - - /** - * MessageSend ==> SuperMethodInvocation - */ - public void test0078() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0078", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - SuperMethodInvocation superMethodInvocation = this.ast.newSuperMethodInvocation(); - superMethodInvocation.setName(this.ast.newSimpleName("bar")); //$NON-NLS-1$ - ExpressionStatement statement = this.ast.newExpressionStatement(superMethodInvocation); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "super.bar();", source); //$NON-NLS-1$ - } - - /** - * MessageSend ==> SuperMethodInvocation - */ - public void test0079() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0079", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - SuperMethodInvocation superMethodInvocation = this.ast.newSuperMethodInvocation(); - superMethodInvocation.setName(this.ast.newSimpleName("bar")); //$NON-NLS-1$ - superMethodInvocation.arguments().add(this.ast.newNumberLiteral("4"));//$NON-NLS-1$ - ExpressionStatement statement = this.ast.newExpressionStatement(superMethodInvocation); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "super.bar(4);", source); //$NON-NLS-1$ - } - - /** - * MessageSend ==> FunctionInvocation - */ - public void test0080() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0080", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - FunctionInvocation methodInvocation = this.ast.newFunctionInvocation(); - methodInvocation.setName(this.ast.newSimpleName("bar")); //$NON-NLS-1$ - methodInvocation.arguments().add(this.ast.newNumberLiteral("4"));//$NON-NLS-1$ - ExpressionStatement statement = this.ast.newExpressionStatement(methodInvocation); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "bar(4);", source); //$NON-NLS-1$ - } - - /** - * MessageSend ==> FunctionInvocation - */ - public void test0081() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0081", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - FunctionInvocation methodInvocation = this.ast.newFunctionInvocation(); - methodInvocation.setName(this.ast.newSimpleName("bar")); //$NON-NLS-1$ - methodInvocation.setExpression(this.ast.newThisExpression()); - methodInvocation.arguments().add(this.ast.newNumberLiteral("4"));//$NON-NLS-1$ - ExpressionStatement statement = this.ast.newExpressionStatement(methodInvocation); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "this.bar(4);", source); //$NON-NLS-1$ - } - - /** - * ForStatement ==> ForStatement - */ - public void test0082() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0082", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - ForStatement forStatement = this.ast.newForStatement(); - forStatement.setBody(this.ast.newEmptyStatement()); - assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "for (;;);", source); //$NON-NLS-1$ - } - - /** - * ForStatement ==> ForStatement - */ - public void test0083() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0083", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - ForStatement forStatement = this.ast.newForStatement(); - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$ - variableDeclarationFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$ - VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(variableDeclarationFragment); - variableDeclarationExpression.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - forStatement.initializers().add(variableDeclarationExpression); - PostfixExpression postfixExpression = this.ast.newPostfixExpression(); - postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$ - postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT); - forStatement.updaters().add(postfixExpression); - forStatement.setBody(this.ast.newBlock()); - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.LESS); - infixExpression.setRightOperand(this.ast.newNumberLiteral("10")); //$NON-NLS-1$ - forStatement.setExpression(infixExpression); - assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "for (int i = 0; i < 10; i++) {}", source); //$NON-NLS-1$ - } - - /** - * ForStatement ==> ForStatement - */ - public void test0084() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0084", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - ForStatement forStatement = this.ast.newForStatement(); - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$ - variableDeclarationFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$ - - VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(variableDeclarationFragment); - variableDeclarationExpression.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - - forStatement.initializers().add(variableDeclarationExpression); - PostfixExpression postfixExpression = this.ast.newPostfixExpression(); - postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$ - postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT); - forStatement.updaters().add(postfixExpression); - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.LESS); - infixExpression.setRightOperand(this.ast.newNumberLiteral("10")); //$NON-NLS-1$ - forStatement.setExpression(infixExpression); - forStatement.setBody(this.ast.newEmptyStatement()); - assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "for (int i = 0; i < 10; i++);", source); //$NON-NLS-1$ - } - - /** - * ForStatement ==> ForStatement - */ - public void test0085() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0085", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - ForStatement forStatement = this.ast.newForStatement(); - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$ - variableDeclarationFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$ - - VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(variableDeclarationFragment); - variableDeclarationExpression.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - - forStatement.initializers().add(variableDeclarationExpression); - PostfixExpression postfixExpression = this.ast.newPostfixExpression(); - postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$ - postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT); - forStatement.updaters().add(postfixExpression); - forStatement.setBody(this.ast.newEmptyStatement()); - assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "for (int i = 0;; i++);", source); //$NON-NLS-1$ - } - - /** - * ForStatement ==> ForStatement - */ - public void test0086() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0086", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - ForStatement forStatement = this.ast.newForStatement(); - PostfixExpression postfixExpression = this.ast.newPostfixExpression(); - postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$ - postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT); - forStatement.updaters().add(postfixExpression); - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.LESS); - infixExpression.setRightOperand(this.ast.newNumberLiteral("10")); //$NON-NLS-1$ - forStatement.setExpression(infixExpression); - forStatement.setBody(this.ast.newEmptyStatement()); - assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "for (; i < 10; i++);", source); //$NON-NLS-1$ - } - - /** - * ForStatement ==> ForStatement - */ - public void test0087() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0087", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - ForStatement forStatement = this.ast.newForStatement(); - PostfixExpression postfixExpression = this.ast.newPostfixExpression(); - postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$ - postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT); - forStatement.updaters().add(postfixExpression); - forStatement.setBody(this.ast.newEmptyStatement()); - assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "for (;;i++);", source); //$NON-NLS-1$ - } - - /** - * LocalDeclaration ==> VariableDeclarationStatement - */ - public void test0088() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0088", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$ - - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "int i;", source); //$NON-NLS-1$ - } - - /** - * LocalDeclaration ==> VariableDeclarationStatement - */ - public void test0089() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0089", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("s")); //$NON-NLS-1$ - - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - QualifiedName name = - this.ast.newQualifiedName( - this.ast.newQualifiedName( - this.ast.newSimpleName("java"),//$NON-NLS-1$ - this.ast.newSimpleName("lang")//$NON-NLS-1$ - ), - this.ast.newSimpleName("String") //$NON-NLS-1$ - ); - statement.setType(this.ast.newSimpleType(name)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "java.lang.String s;", source); //$NON-NLS-1$ - } - - /** - * LocalDeclaration ==> VariableDeclarationStatement - */ - public void test0090() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0090", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - ArrayInitializer initializer = this.ast.newArrayInitializer(); - initializer.expressions().add(this.ast.newNumberLiteral("1"));//$NON-NLS-1$ - initializer.expressions().add(this.ast.newNumberLiteral("2"));//$NON-NLS-1$ - variableDeclarationFragment.setInitializer(initializer); - variableDeclarationFragment.setName(this.ast.newSimpleName("tab")); //$NON-NLS-1$ - - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setType(this.ast.newArrayType(this.ast.newPrimitiveType(PrimitiveType.INT), 1)); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "int[] tab = {1, 2};", source); //$NON-NLS-1$ - } - - /** - * Argument ==> SingleVariableDeclaration - */ - public void test0091() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0091", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - FunctionDeclaration method = (FunctionDeclaration)((TypeDeclaration) ((JavaScriptUnit) result).types().get(0)).bodyDeclarations().get(0); - SingleVariableDeclaration node = (SingleVariableDeclaration) method.parameters().get(0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - SingleVariableDeclaration variableDeclaration = this.ast.newSingleVariableDeclaration(); - variableDeclaration.setType(this.ast.newSimpleType(this.ast.newSimpleName("String")));//$NON-NLS-1$ - variableDeclaration.setName(this.ast.newSimpleName("s")); //$NON-NLS-1$ - assertTrue("Both AST trees should be identical", variableDeclaration.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "String s", source); //$NON-NLS-1$ - } - - /** - * Argument ==> SingleVariableDeclaration - */ - public void test0092() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0092", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - FunctionDeclaration method = (FunctionDeclaration)((TypeDeclaration) ((JavaScriptUnit) result).types().get(0)).bodyDeclarations().get(0); - SingleVariableDeclaration node = (SingleVariableDeclaration) method.parameters().get(0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - SingleVariableDeclaration variableDeclaration = this.ast.newSingleVariableDeclaration(); - variableDeclaration.modifiers().add(this.ast.newModifier(Modifier.ModifierKeyword.FINAL_KEYWORD)); - variableDeclaration.setType(this.ast.newSimpleType(this.ast.newSimpleName("String")));//$NON-NLS-1$ - variableDeclaration.setName(this.ast.newSimpleName("s")); //$NON-NLS-1$ - assertTrue("Both AST trees should be identical", variableDeclaration.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "final String s", source); //$NON-NLS-1$ - assertEquals("Wrong dimension", 0, node.getExtraDimensions()); //$NON-NLS-1$ - } - - /** - * Break ==> BreakStatement - */ - public void test0093() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0093", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - ForStatement forStatement = (ForStatement) node; - BreakStatement statement = (BreakStatement) ((Block) forStatement.getBody()).statements().get(0); - assertNotNull("Expression should not be null", statement); //$NON-NLS-1$ - BreakStatement breakStatement = this.ast.newBreakStatement(); - assertTrue("Both AST trees should be identical", breakStatement.subtreeMatch(new ASTMatcher(), statement)); //$NON-NLS-1$ - checkSourceRange(statement, "break;", source); //$NON-NLS-1$ - } - - /** - * Continue ==> ContinueStatement - */ - public void test0094() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0094", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - ForStatement forStatement = (ForStatement) node; - ContinueStatement statement = (ContinueStatement) ((Block) forStatement.getBody()).statements().get(0); - assertNotNull("Expression should not be null", statement); //$NON-NLS-1$ - ContinueStatement continueStatement = this.ast.newContinueStatement(); - assertTrue("Both AST trees should be identical", continueStatement.subtreeMatch(new ASTMatcher(), statement)); //$NON-NLS-1$ - checkSourceRange(statement, "continue;", source); //$NON-NLS-1$ - } - - /** - * Continue with Label ==> ContinueStatement - */ - public void test0095() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0095", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - LabeledStatement labeledStatement = (LabeledStatement) getASTNode((JavaScriptUnit) result, 0, 0, 0); - ForStatement forStatement = (ForStatement) labeledStatement.getBody(); - ContinueStatement statement = (ContinueStatement) ((Block) forStatement.getBody()).statements().get(0); - assertNotNull("Expression should not be null", statement); //$NON-NLS-1$ - ContinueStatement continueStatement = this.ast.newContinueStatement(); - continueStatement.setLabel(this.ast.newSimpleName("label")); //$NON-NLS-1$ - assertTrue("Both AST trees should be identical", continueStatement.subtreeMatch(new ASTMatcher(), statement)); //$NON-NLS-1$ - checkSourceRange(statement, "continue label;", source); //$NON-NLS-1$ - } - - /** - * Break + label ==> BreakStatement - */ - public void test0096() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0096", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - LabeledStatement labeledStatement = (LabeledStatement) getASTNode((JavaScriptUnit) result, 0, 0, 0); - ForStatement forStatement = (ForStatement) labeledStatement.getBody(); - BreakStatement statement = (BreakStatement) ((Block) forStatement.getBody()).statements().get(0); - assertNotNull("Expression should not be null", statement); //$NON-NLS-1$ - BreakStatement breakStatement = this.ast.newBreakStatement(); - breakStatement.setLabel(this.ast.newSimpleName("label")); //$NON-NLS-1$ - assertTrue("Both AST trees should be identical", breakStatement.subtreeMatch(new ASTMatcher(), statement)); //$NON-NLS-1$ - checkSourceRange(statement, "break label;", source); //$NON-NLS-1$ - } - - /** - * SwitchStatement ==> SwitchStatement - */ - public void test0097() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0097", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - SwitchStatement switchStatement = this.ast.newSwitchStatement(); - switchStatement.setExpression(this.ast.newSimpleName("i"));//$NON-NLS-1$ - SwitchCase _case = this.ast.newSwitchCase(); - _case.setExpression(this.ast.newNumberLiteral("1"));//$NON-NLS-1$ - switchStatement.statements().add(_case); - switchStatement.statements().add(this.ast.newBreakStatement()); - _case = this.ast.newSwitchCase(); - _case.setExpression(this.ast.newNumberLiteral("2"));//$NON-NLS-1$ - switchStatement.statements().add(_case); - FunctionInvocation methodInvocation = this.ast.newFunctionInvocation(); - QualifiedName name = - this.ast.newQualifiedName( - this.ast.newSimpleName("System"),//$NON-NLS-1$ - this.ast.newSimpleName("out"));//$NON-NLS-1$ - methodInvocation.setExpression(name); - methodInvocation.setName(this.ast.newSimpleName("println")); //$NON-NLS-1$ - methodInvocation.arguments().add(this.ast.newNumberLiteral("2"));//$NON-NLS-1$ - ExpressionStatement expressionStatement = this.ast.newExpressionStatement(methodInvocation); - switchStatement.statements().add(expressionStatement); - switchStatement.statements().add(this.ast.newBreakStatement()); - _case = this.ast.newSwitchCase(); - _case.setExpression(null); - switchStatement.statements().add(_case); - methodInvocation = this.ast.newFunctionInvocation(); - name = - this.ast.newQualifiedName( - this.ast.newSimpleName("System"),//$NON-NLS-1$ - this.ast.newSimpleName("out"));//$NON-NLS-1$ - methodInvocation.setExpression(name); - methodInvocation.setName(this.ast.newSimpleName("println")); //$NON-NLS-1$ - StringLiteral literal = this.ast.newStringLiteral(); - literal.setLiteralValue("default"); //$NON-NLS-1$ - methodInvocation.arguments().add(literal); - expressionStatement = this.ast.newExpressionStatement(methodInvocation); - switchStatement.statements().add(expressionStatement); - assertTrue("Both AST trees should be identical", switchStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - String expectedSource = "switch(i) {\n" +//$NON-NLS-1$ - " case 1: \n" +//$NON-NLS-1$ - " break;\n" +//$NON-NLS-1$ - " case 2:\n" +//$NON-NLS-1$ - " System.out.println(2);\n" +//$NON-NLS-1$ - " break;\n" +//$NON-NLS-1$ - " default:\n" +//$NON-NLS-1$ - " System.out.println(\"default\");\n" +//$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(node, expectedSource, source); - SwitchStatement switchStatement2 = (SwitchStatement) node; - List statements = switchStatement2.statements(); - assertEquals("wrong size", 7, statements.size()); //$NON-NLS-1$ - Statement stmt = (Statement) statements.get(5); - assertTrue("Not a case statement", stmt instanceof SwitchCase); //$NON-NLS-1$ - SwitchCase switchCase = (SwitchCase) stmt; - assertTrue("Not the default case", switchCase.isDefault()); //$NON-NLS-1$ - } - - /** - * EmptyStatement ==> EmptyStatement - */ - public void test0098() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0098", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - EmptyStatement emptyStatement = this.ast.newEmptyStatement(); - assertTrue("Both AST trees should be identical", emptyStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, ";", source); //$NON-NLS-1$ - } - - /** - * DoStatement ==> DoStatement - */ - public void test0099() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0099", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - DoStatement doStatement = this.ast.newDoStatement(); - Block block = this.ast.newBlock(); - block.statements().add(this.ast.newEmptyStatement()); - doStatement.setBody(block); - doStatement.setExpression(this.ast.newBooleanLiteral(true)); - assertTrue("Both AST trees should be identical", doStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - String expectedSource = "do {;\n" +//$NON-NLS-1$ - " } while(true);";//$NON-NLS-1$ - checkSourceRange(node, expectedSource, source); - } - - /** - * WhileStatement ==> WhileStatement - */ - public void test0100() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0100", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - WhileStatement whileStatement = this.ast.newWhileStatement(); - whileStatement.setExpression(this.ast.newBooleanLiteral(true)); - whileStatement.setBody(this.ast.newEmptyStatement()); - assertTrue("Both AST trees should be identical", whileStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "while(true);", source);//$NON-NLS-1$ - } - - /** - * WhileStatement ==> WhileStatement - */ - public void test0101() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0101", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - WhileStatement whileStatement = this.ast.newWhileStatement(); - whileStatement.setExpression(this.ast.newBooleanLiteral(true)); - whileStatement.setBody(this.ast.newBlock()); - assertTrue("Both AST trees should be identical", whileStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "while(true) {}", source);//$NON-NLS-1$ - } - - /** - * ExtendedStringLiteral ==> StringLiteral - */ - public void test0102() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0102", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setOperator(InfixExpression.Operator.PLUS); - StringLiteral literal = this.ast.newStringLiteral();//$NON-NLS-1$ - literal.setLiteralValue("Hello"); //$NON-NLS-1$ - infixExpression.setLeftOperand(literal); - literal = this.ast.newStringLiteral();//$NON-NLS-1$ - literal.setLiteralValue(" World"); //$NON-NLS-1$ - infixExpression.setRightOperand(literal); - literal = this.ast.newStringLiteral();//$NON-NLS-1$ - literal.setLiteralValue("!"); //$NON-NLS-1$ - infixExpression.extendedOperands().add(literal); - assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "\"Hello\" + \" World\" + \"!\"", source);//$NON-NLS-1$ - } - - /** - * ExtendedStringLiteral ==> StringLiteral - */ - public void test0103() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0103", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setOperator(InfixExpression.Operator.PLUS); - StringLiteral literal = this.ast.newStringLiteral();//$NON-NLS-1$ - literal.setLiteralValue("Hello"); //$NON-NLS-1$ - infixExpression.setLeftOperand(literal); - literal = this.ast.newStringLiteral();//$NON-NLS-1$ - literal.setLiteralValue(" World"); //$NON-NLS-1$ - infixExpression.setRightOperand(literal); - literal = this.ast.newStringLiteral();//$NON-NLS-1$ - literal.setLiteralValue("!"); //$NON-NLS-1$ - infixExpression.extendedOperands().add(literal); - literal = this.ast.newStringLiteral();//$NON-NLS-1$ - literal.setLiteralValue("!"); //$NON-NLS-1$ - infixExpression.extendedOperands().add(literal); - assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "\"Hello\" + \" World\" + \"!\" + \"!\"", source);//$NON-NLS-1$ - } - - /** - * ExtendedStringLiteral ==> StringLiteral - */ - public void test0104() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0104", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setOperator(InfixExpression.Operator.PLUS); - StringLiteral literal = this.ast.newStringLiteral();//$NON-NLS-1$ - literal.setLiteralValue("Hello"); //$NON-NLS-1$ - infixExpression.setLeftOperand(literal); - literal = this.ast.newStringLiteral();//$NON-NLS-1$ - literal.setLiteralValue(" World"); //$NON-NLS-1$ - infixExpression.setRightOperand(literal); - literal = this.ast.newStringLiteral();//$NON-NLS-1$ - literal.setLiteralValue("!"); //$NON-NLS-1$ - infixExpression.extendedOperands().add(literal); - NumberLiteral numberLiteral = this.ast.newNumberLiteral();//$NON-NLS-1$ - numberLiteral.setToken("4"); //$NON-NLS-1$ - infixExpression.extendedOperands().add(numberLiteral); - assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "\"Hello\" + \" World\" + \"!\" + 4", source);//$NON-NLS-1$ - } - - /** - * NumberLiteral ==> InfixExpression - */ - public void test0105() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0105", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setOperator(InfixExpression.Operator.PLUS); - NumberLiteral literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("4"); //$NON-NLS-1$ - infixExpression.setLeftOperand(literal); - literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("5"); //$NON-NLS-1$ - infixExpression.setRightOperand(literal); - literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("6"); //$NON-NLS-1$ - infixExpression.extendedOperands().add(literal); - literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("4"); //$NON-NLS-1$ - infixExpression.extendedOperands().add(literal); - assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "4 + 5 + 6 + 4", source);//$NON-NLS-1$ - } - - /** - * NumberLiteral ==> InfixExpression - */ - public void test0106() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0106", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setOperator(InfixExpression.Operator.MINUS); - NumberLiteral literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("4"); //$NON-NLS-1$ - infixExpression.setLeftOperand(literal); - literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("5"); //$NON-NLS-1$ - infixExpression.setRightOperand(literal); - - InfixExpression infixExpression2 = this.ast.newInfixExpression(); - infixExpression2.setOperator(InfixExpression.Operator.PLUS); - infixExpression2.setLeftOperand(infixExpression); - literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("6"); //$NON-NLS-1$ - infixExpression2.setRightOperand(literal); - - InfixExpression infixExpression3 = this.ast.newInfixExpression(); - infixExpression3.setOperator(InfixExpression.Operator.PLUS); - infixExpression3.setLeftOperand(infixExpression2); - literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("4"); //$NON-NLS-1$ - infixExpression3.setRightOperand(literal); - - assertTrue("Both AST trees should be identical", infixExpression3.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "4 - 5 + 6 + 4", source);//$NON-NLS-1$ - } - - /** - * NumberLiteral ==> InfixExpression - */ - public void test0107() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0107", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setOperator(InfixExpression.Operator.MINUS); - NumberLiteral literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("4"); //$NON-NLS-1$ - infixExpression.setLeftOperand(literal); - literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("5"); //$NON-NLS-1$ - infixExpression.setRightOperand(literal); - literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("6"); //$NON-NLS-1$ - infixExpression.extendedOperands().add(literal); - literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("4"); //$NON-NLS-1$ - infixExpression.extendedOperands().add(literal); - assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "4 - 5 - 6 - 4", source);//$NON-NLS-1$ - } - - /** - * NumberLiteral ==> InfixExpression - */ - public void test0108() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0108", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setOperator(InfixExpression.Operator.PLUS); - StringLiteral stringLiteral = this.ast.newStringLiteral();//$NON-NLS-1$ - stringLiteral.setLiteralValue("4"); //$NON-NLS-1$ - infixExpression.setLeftOperand(stringLiteral); - NumberLiteral literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("5"); //$NON-NLS-1$ - infixExpression.setRightOperand(literal); - literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("6"); //$NON-NLS-1$ - infixExpression.extendedOperands().add(literal); - literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("4"); //$NON-NLS-1$ - infixExpression.extendedOperands().add(literal); - assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "\"4\" + 5 + 6 + 4", source);//$NON-NLS-1$ - } - - /** - * NumberLiteral ==> InfixExpression - */ - public void test0109() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0109", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setOperator(InfixExpression.Operator.MINUS); - StringLiteral stringLiteral = this.ast.newStringLiteral();//$NON-NLS-1$ - stringLiteral.setLiteralValue("4"); //$NON-NLS-1$ - infixExpression.setLeftOperand(stringLiteral); - NumberLiteral literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("5"); //$NON-NLS-1$ - infixExpression.setRightOperand(literal); - - InfixExpression infixExpression2 = this.ast.newInfixExpression(); - infixExpression2.setOperator(InfixExpression.Operator.PLUS); - infixExpression2.setLeftOperand(infixExpression); - literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("6"); //$NON-NLS-1$ - infixExpression2.setRightOperand(literal); - - InfixExpression infixExpression3 = this.ast.newInfixExpression(); - infixExpression3.setOperator(InfixExpression.Operator.PLUS); - infixExpression3.setLeftOperand(infixExpression2); - literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("4"); //$NON-NLS-1$ - infixExpression3.setRightOperand(literal); - - assertTrue("Both AST trees should be identical", infixExpression3.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "\"4\" - 5 + 6 + 4", source);//$NON-NLS-1$ - } - - /** - * ReturnStatement ==> ReturnStatement - */ - public void test0110() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0110", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - ReturnStatement returnStatement = this.ast.newReturnStatement(); - NumberLiteral literal = this.ast.newNumberLiteral(); - literal.setToken("2");//$NON-NLS-1$ - returnStatement.setExpression(literal); - assertTrue("Both AST trees should be identical", returnStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "return 2;", source);//$NON-NLS-1$ - } - - /** - * ReturnStatement ==> ReturnStatement - */ - public void test0111() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0111", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - ReturnStatement returnStatement = this.ast.newReturnStatement(); - NumberLiteral literal = this.ast.newNumberLiteral(); - literal.setToken("2");//$NON-NLS-1$ - returnStatement.setExpression(literal); - assertTrue("Both AST trees should be identical", returnStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "return 2\\u003B", source);//$NON-NLS-1$ - } - - - - /** - * TryStatement ==> TryStatement - */ - public void test0113() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0113", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - TryStatement tryStatement = this.ast.newTryStatement(); - tryStatement.setBody(this.ast.newBlock()); - tryStatement.setFinally(this.ast.newBlock()); - CatchClause catchBlock = this.ast.newCatchClause(); - catchBlock.setBody(this.ast.newBlock()); - SingleVariableDeclaration exceptionVariable = this.ast.newSingleVariableDeclaration(); - exceptionVariable.setName(this.ast.newSimpleName("e"));//$NON-NLS-1$ - exceptionVariable.setType(this.ast.newSimpleType(this.ast.newSimpleName("Exception")));//$NON-NLS-1$ - catchBlock.setException(exceptionVariable); - tryStatement.catchClauses().add(catchBlock); - assertTrue("Both AST trees should be identical", tryStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - String expectedSource = "try {\n" +//$NON-NLS-1$ - " } catch(Exception e) {\n" +//$NON-NLS-1$ - " } finally {\n" +//$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(node, expectedSource, source); - } - - /** - * TryStatement ==> TryStatement - */ - public void test0114() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0114", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - TryStatement tryStatement = this.ast.newTryStatement(); - tryStatement.setBody(this.ast.newBlock()); - CatchClause catchBlock = this.ast.newCatchClause(); - catchBlock.setBody(this.ast.newBlock()); - SingleVariableDeclaration exceptionVariable = this.ast.newSingleVariableDeclaration(); - exceptionVariable.setName(this.ast.newSimpleName("e"));//$NON-NLS-1$ - exceptionVariable.setType(this.ast.newSimpleType(this.ast.newSimpleName("Exception")));//$NON-NLS-1$ - catchBlock.setException(exceptionVariable); - tryStatement.catchClauses().add(catchBlock); - assertTrue("Both AST trees should be identical", tryStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - String expectedSource = "try {\n" +//$NON-NLS-1$ - " } catch(Exception e) {\n" +//$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(node, expectedSource, source); - } - - /** - * TryStatement ==> TryStatement - */ - public void test0115() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0115", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - TryStatement tryStatement = this.ast.newTryStatement(); - Block block = this.ast.newBlock(); - ReturnStatement returnStatement = this.ast.newReturnStatement(); - NumberLiteral literal = this.ast.newNumberLiteral(); - literal.setToken("2");//$NON-NLS-1$ - returnStatement.setExpression(literal); - block.statements().add(returnStatement); - tryStatement.setBody(block); - CatchClause catchBlock = this.ast.newCatchClause(); - catchBlock.setBody(this.ast.newBlock()); - SingleVariableDeclaration exceptionVariable = this.ast.newSingleVariableDeclaration(); - exceptionVariable.setName(this.ast.newSimpleName("e"));//$NON-NLS-1$ - exceptionVariable.setType(this.ast.newSimpleType(this.ast.newSimpleName("Exception")));//$NON-NLS-1$ - catchBlock.setException(exceptionVariable); - tryStatement.catchClauses().add(catchBlock); - assertTrue("Both AST trees should be identical", tryStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - String expectedSource = "try {\n" +//$NON-NLS-1$ - " return 2;\n" +//$NON-NLS-1$ - " } catch(Exception e) {\n" +//$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(node, expectedSource, source); - } - - /** - * ThrowStatement ==> ThrowStatement - */ - public void test0116() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0116", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - ThrowStatement throwStatement = this.ast.newThrowStatement(); - throwStatement.setExpression(this.ast.newSimpleName("e")); //$NON-NLS-1$ - assertTrue("Both AST trees should be identical", throwStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "throw e \\u003B", source);//$NON-NLS-1$ - } - - /** - * ThrowStatement ==> ThrowStatement - */ - public void test0117() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0117", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - ThrowStatement throwStatement = this.ast.newThrowStatement(); - throwStatement.setExpression(this.ast.newSimpleName("e")); //$NON-NLS-1$ - assertTrue("Both AST trees should be identical", throwStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "throw e /* comment in the middle of a throw */ \\u003B", source);//$NON-NLS-1$ - } - - /** - * ThrowStatement ==> ThrowStatement - */ - public void test0118() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0118", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - ThrowStatement throwStatement = this.ast.newThrowStatement(); - throwStatement.setExpression(this.ast.newSimpleName("e")); //$NON-NLS-1$ - assertTrue("Both AST trees should be identical", throwStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "throw e /* comment in the middle of a throw */ \\u003B", source);//$NON-NLS-1$ - } - - /** - * IfStatement ==> IfStatement - */ - public void test0119() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0119", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - IfStatement ifStatement = this.ast.newIfStatement(); - ifStatement.setExpression(this.ast.newBooleanLiteral(true)); - ifStatement.setThenStatement(this.ast.newEmptyStatement()); - assertTrue("Both AST trees should be identical", ifStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "if (true)\\u003B", source);//$NON-NLS-1$ - } - - /** - * IfStatement ==> IfStatement - */ - public void test0120() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0120", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - IfStatement ifStatement = this.ast.newIfStatement(); - ifStatement.setExpression(this.ast.newBooleanLiteral(true)); - ifStatement.setThenStatement(this.ast.newEmptyStatement()); - ifStatement.setElseStatement(this.ast.newEmptyStatement()); - assertTrue("Both AST trees should be identical", ifStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - String expectedSource = "if (true)\\u003B\n" +//$NON-NLS-1$ - "\t\telse ;"; //$NON-NLS-1$ - checkSourceRange(node, expectedSource, source); - } - - /** - * IfStatement ==> IfStatement - */ - public void test0121() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0121", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - IfStatement ifStatement = this.ast.newIfStatement(); - ifStatement.setExpression(this.ast.newBooleanLiteral(true)); - ifStatement.setThenStatement(this.ast.newBlock()); - ifStatement.setElseStatement(this.ast.newEmptyStatement()); - assertTrue("Both AST trees should be identical", ifStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - String expectedSource = "if (true) {}\n" +//$NON-NLS-1$ - " else ;"; //$NON-NLS-1$ - checkSourceRange(node, expectedSource, source); - } - - /** - * IfStatement ==> IfStatement - */ - public void test0122() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0122", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - IfStatement ifStatement = this.ast.newIfStatement(); - ifStatement.setExpression(this.ast.newBooleanLiteral(true)); - ReturnStatement returnStatement = this.ast.newReturnStatement(); - NumberLiteral literal = this.ast.newNumberLiteral(); - literal.setToken("2");//$NON-NLS-1$ - returnStatement.setExpression(literal); - ifStatement.setThenStatement(returnStatement); - assertTrue("Both AST trees should be identical", ifStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "if (true) return 2\\u003B", source);//$NON-NLS-1$ - } - - /** - * IfStatement ==> IfStatement - */ - public void test0123() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0123", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - IfStatement ifStatement = this.ast.newIfStatement(); - ifStatement.setExpression(this.ast.newBooleanLiteral(true)); - ReturnStatement returnStatement = this.ast.newReturnStatement(); - NumberLiteral literal = this.ast.newNumberLiteral(); - literal.setToken("2");//$NON-NLS-1$ - returnStatement.setExpression(literal); - ifStatement.setThenStatement(returnStatement); - returnStatement = this.ast.newReturnStatement(); - literal = this.ast.newNumberLiteral(); - literal.setToken("3");//$NON-NLS-1$ - returnStatement.setExpression(literal); - ifStatement.setElseStatement(returnStatement); - assertTrue("Both AST trees should be identical", ifStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - String expectedSource = "if (true) return 2;\n" +//$NON-NLS-1$ - " else return 3;"; //$NON-NLS-1$ - checkSourceRange(node, expectedSource, source); - } - - /** - * Multiple local declaration => VariabledeclarationStatement - */ - public void test0124() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0124", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - VariableDeclarationFragment fragment = this.ast.newVariableDeclarationFragment(); - fragment.setName(this.ast.newSimpleName("x"));//$NON-NLS-1$ - NumberLiteral literal = this.ast.newNumberLiteral(); - literal.setToken("10");//$NON-NLS-1$ - fragment.setInitializer(literal); - fragment.setExtraDimensions(0); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(fragment); - fragment = this.ast.newVariableDeclarationFragment(); - fragment.setName(this.ast.newSimpleName("z"));//$NON-NLS-1$ - fragment.setInitializer(this.ast.newNullLiteral()); - fragment.setExtraDimensions(1); - statement.fragments().add(fragment); - fragment = this.ast.newVariableDeclarationFragment(); - fragment.setName(this.ast.newSimpleName("i"));//$NON-NLS-1$ - fragment.setExtraDimensions(0); - statement.fragments().add(fragment); - fragment = this.ast.newVariableDeclarationFragment(); - fragment.setName(this.ast.newSimpleName("j"));//$NON-NLS-1$ - fragment.setExtraDimensions(2); - statement.fragments().add(fragment); - statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - VariableDeclarationFragment[] fragments = (VariableDeclarationFragment[])((VariableDeclarationStatement) node).fragments().toArray(new VariableDeclarationFragment[4]); - assertTrue("fragments.length != 4", fragments.length == 4); //$NON-NLS-1$ - checkSourceRange(fragments[0], "x= 10", source);//$NON-NLS-1$ - checkSourceRange(fragments[1], "z[] = null", source);//$NON-NLS-1$ - checkSourceRange(fragments[2], "i", source);//$NON-NLS-1$ - checkSourceRange(fragments[3], "j[][]", source);//$NON-NLS-1$ - checkSourceRange(node, "int x= 10, z[] = null, i, j[][];", source);//$NON-NLS-1$ - } - - /** - * Multiple local declaration => VariabledeclarationStatement - */ - public void test0125() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0125", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - VariableDeclarationFragment fragment = this.ast.newVariableDeclarationFragment(); - fragment.setName(this.ast.newSimpleName("x"));//$NON-NLS-1$ - NumberLiteral literal = this.ast.newNumberLiteral(); - literal.setToken("10");//$NON-NLS-1$ - fragment.setInitializer(literal); - fragment.setExtraDimensions(0); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(fragment); - fragment = this.ast.newVariableDeclarationFragment(); - fragment.setName(this.ast.newSimpleName("z"));//$NON-NLS-1$ - fragment.setInitializer(this.ast.newNullLiteral()); - fragment.setExtraDimensions(1); - statement.fragments().add(fragment); - fragment = this.ast.newVariableDeclarationFragment(); - fragment.setName(this.ast.newSimpleName("i"));//$NON-NLS-1$ - fragment.setExtraDimensions(0); - statement.fragments().add(fragment); - fragment = this.ast.newVariableDeclarationFragment(); - fragment.setName(this.ast.newSimpleName("j"));//$NON-NLS-1$ - fragment.setExtraDimensions(2); - statement.fragments().add(fragment); - statement.setType(this.ast.newArrayType(this.ast.newPrimitiveType(PrimitiveType.INT), 1)); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "int[] x= 10, z[] = null, i, j[][];", source); //$NON-NLS-1$ - VariableDeclarationFragment[] fragments = (VariableDeclarationFragment[])((VariableDeclarationStatement) node).fragments().toArray(new VariableDeclarationFragment[4]); - assertTrue("fragments.length != 4", fragments.length == 4); //$NON-NLS-1$ - checkSourceRange(fragments[0], "x= 10", source);//$NON-NLS-1$ - checkSourceRange(fragments[1], "z[] = null", source);//$NON-NLS-1$ - checkSourceRange(fragments[2], "i", source);//$NON-NLS-1$ - checkSourceRange(fragments[3], "j[][]", source);//$NON-NLS-1$ - } - - /** - * ForStatement - */ - public void test0126() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0126", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - ForStatement forStatement = this.ast.newForStatement(); - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("tab")); //$NON-NLS-1$ - variableDeclarationFragment.setInitializer(this.ast.newNullLiteral());//$NON-NLS-1$ - variableDeclarationFragment.setExtraDimensions(1); - VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(variableDeclarationFragment); - variableDeclarationExpression.setType(this.ast.newArrayType(this.ast.newSimpleType(this.ast.newSimpleName("String")), 1));//$NON-NLS-1$ - forStatement.initializers().add(variableDeclarationExpression); - PrefixExpression prefixExpression = this.ast.newPrefixExpression(); - prefixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$ - prefixExpression.setOperator(PrefixExpression.Operator.INCREMENT); - forStatement.updaters().add(prefixExpression); - forStatement.setBody(this.ast.newBlock()); - assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "for (String[] tab[] = null;; ++i) {}", source); //$NON-NLS-1$ - checkSourceRange((ASTNode) ((ForStatement) node).updaters().get(0), "++i", source); //$NON-NLS-1$ - checkSourceRange((ASTNode) ((ForStatement) node).initializers().get(0), "String[] tab[] = null", source); //$NON-NLS-1$ - } - - /** - * ForStatement - */ - public void test0127() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0127", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - ForStatement forStatement = this.ast.newForStatement(); - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("tab")); //$NON-NLS-1$ - variableDeclarationFragment.setInitializer(this.ast.newNullLiteral());//$NON-NLS-1$ - variableDeclarationFragment.setExtraDimensions(1); - VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(variableDeclarationFragment); - variableDeclarationExpression.setType(this.ast.newSimpleType(this.ast.newSimpleName("String")));//$NON-NLS-1$ - forStatement.initializers().add(variableDeclarationExpression); - PrefixExpression prefixExpression = this.ast.newPrefixExpression(); - prefixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$ - prefixExpression.setOperator(PrefixExpression.Operator.INCREMENT); - forStatement.updaters().add(prefixExpression); - forStatement.setBody(this.ast.newBlock()); - assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "for (String tab[] = null;; ++i) {}", source); //$NON-NLS-1$ - checkSourceRange((ASTNode) ((ForStatement) node).updaters().get(0), "++i", source); //$NON-NLS-1$ - checkSourceRange((ASTNode) ((ForStatement) node).initializers().get(0), "String tab[] = null", source); //$NON-NLS-1$ - } - - /** - * ForStatement - */ - public void test0128() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0128", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - ForStatement forStatement = this.ast.newForStatement(); - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("tab")); //$NON-NLS-1$ - variableDeclarationFragment.setInitializer(this.ast.newNullLiteral());//$NON-NLS-1$ - variableDeclarationFragment.setExtraDimensions(1); - VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(variableDeclarationFragment); - variableDeclarationExpression.setType(this.ast.newSimpleType(this.ast.newSimpleName("String")));//$NON-NLS-1$ - forStatement.initializers().add(variableDeclarationExpression); - PostfixExpression postfixExpression = this.ast.newPostfixExpression(); - postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$ - postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT); - forStatement.updaters().add(postfixExpression); - forStatement.setBody(this.ast.newBlock()); - assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "for (String tab[] = null;; i++/**/) {}", source); //$NON-NLS-1$ - checkSourceRange((ASTNode) ((ForStatement) node).updaters().get(0), "i++", source); //$NON-NLS-1$ - checkSourceRange((ASTNode) ((ForStatement) node).initializers().get(0), "String tab[] = null", source); //$NON-NLS-1$ - } - - /** - * FieldDeclaration - */ - public void test0129() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0129", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - VariableDeclarationFragment frag = (VariableDeclarationFragment) ((FieldDeclaration) node).fragments().get(0); - assertTrue("Not a declaration", frag.getName().isDeclaration()); //$NON-NLS-1$ - VariableDeclarationFragment fragment = this.ast.newVariableDeclarationFragment(); - fragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$ - fragment.setExtraDimensions(0); - FieldDeclaration fieldDeclaration = this.ast.newFieldDeclaration(fragment); - fieldDeclaration.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - assertTrue("Both AST trees should be identical", fieldDeclaration.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "int i;", source); //$NON-NLS-1$ - } - - /** - * FieldDeclaration - */ - public void test0130() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0130", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - VariableDeclarationFragment fragment = this.ast.newVariableDeclarationFragment(); - fragment.setName(this.ast.newSimpleName("x")); //$NON-NLS-1$ - NumberLiteral literal = this.ast.newNumberLiteral(); - literal.setToken("10"); //$NON-NLS-1$ - fragment.setInitializer(literal); - fragment.setExtraDimensions(0); - FieldDeclaration fieldDeclaration = this.ast.newFieldDeclaration(fragment); - fieldDeclaration.modifiers().add(this.ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD)); - fieldDeclaration.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - fragment = this.ast.newVariableDeclarationFragment(); - fragment.setName(this.ast.newSimpleName("y"));//$NON-NLS-1$ - fragment.setExtraDimensions(1); - fragment.setInitializer(this.ast.newNullLiteral()); - fieldDeclaration.fragments().add(fragment); - fragment = this.ast.newVariableDeclarationFragment(); - fragment.setName(this.ast.newSimpleName("i"));//$NON-NLS-1$ - fragment.setExtraDimensions(0); - fieldDeclaration.fragments().add(fragment); - fragment = this.ast.newVariableDeclarationFragment(); - fragment.setName(this.ast.newSimpleName("j"));//$NON-NLS-1$ - fragment.setExtraDimensions(2); - fieldDeclaration.fragments().add(fragment); - assertTrue("Both AST trees should be identical", fieldDeclaration.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "public int x= 10, y[] = null, i, j[][];", source); //$NON-NLS-1$ - VariableDeclarationFragment[] fragments = (VariableDeclarationFragment[])((FieldDeclaration) node).fragments().toArray(new VariableDeclarationFragment[4]); - assertTrue("fragments.length != 4", fragments.length == 4); //$NON-NLS-1$ - checkSourceRange(fragments[0], "x= 10", source);//$NON-NLS-1$ - checkSourceRange(fragments[1], "y[] = null", source);//$NON-NLS-1$ - checkSourceRange(fragments[2], "i", source);//$NON-NLS-1$ - checkSourceRange(fragments[3], "j[][]", source);//$NON-NLS-1$ - } - - /** - * Argument with final modifier - */ - public void test0131() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0131", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - assertTrue("Not a declaration", ((FunctionDeclaration) node).getName().isDeclaration()); //$NON-NLS-1$ - List parameters = ((FunctionDeclaration) node).parameters(); - assertTrue("Parameters.length != 1", parameters.size() == 1); //$NON-NLS-1$ - SingleVariableDeclaration arg = (SingleVariableDeclaration) ((FunctionDeclaration) node).parameters().get(0); - SingleVariableDeclaration singleVariableDeclaration = this.ast.newSingleVariableDeclaration(); - singleVariableDeclaration.modifiers().add(this.ast.newModifier(Modifier.ModifierKeyword.FINAL_KEYWORD)); - singleVariableDeclaration.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$ - singleVariableDeclaration.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - assertTrue("Both AST trees should be identical", singleVariableDeclaration.subtreeMatch(new ASTMatcher(), arg)); //$NON-NLS-1$ - checkSourceRange(node, "void foo(final int i) {}", source); //$NON-NLS-1$ - checkSourceRange(arg, "final int i", source); //$NON-NLS-1$ - } - - /** - * Check javadoc for FunctionDeclaration - * @deprecated marking deprecated since using deprecated code - */ - public void test0132() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0132", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - JSdoc actualJavadoc = ((FunctionDeclaration) node).getJavadoc(); - checkSourceRange(node, "/** JavaDoc Comment*/\n void foo(final int i) {}", source); //$NON-NLS-1$ - checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$ - } - - /** - * Check javadoc for FunctionDeclaration - */ - public void test0133() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0133", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - JSdoc actualJavadoc = ((FunctionDeclaration) node).getJavadoc(); - assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ - checkSourceRange(node, "void foo(final int i) {}", source); //$NON-NLS-1$ - } - - /** - * Check javadoc for FunctionDeclaration - */ - public void test0134() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0134", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - JSdoc actualJavadoc = ((FunctionDeclaration) node).getJavadoc(); - assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ - checkSourceRange(node, "void foo(final int i) {}", source); //$NON-NLS-1$ - } - - /** - * Check javadoc for FieldDeclaration - * @deprecated marking deprecated since using deprecated code - */ - public void test0135() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0135", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$ -// Javadoc actualJavadoc = ((FieldDeclaration) node).getJavadoc(); - checkSourceRange(node, "/** JavaDoc Comment*/\n int i;", source); //$NON-NLS-1$ - } - - /** - * Check javadoc for FieldDeclaration - */ - public void test0136() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0136", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - JSdoc actualJavadoc = ((FieldDeclaration) node).getJavadoc(); - assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ - checkSourceRange(node, "int i;", source); //$NON-NLS-1$ - } - - /** - * Check javadoc for FieldDeclaration - */ - public void test0137() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0137", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - JSdoc actualJavadoc = ((FieldDeclaration) node).getJavadoc(); - assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ - checkSourceRange(node, "int i;", source); //$NON-NLS-1$ - } - - /** - * Check javadoc for TypeDeclaration - */ - public void test0138() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0138", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - JSdoc actualJavadoc = ((TypeDeclaration) node).getJavadoc(); - assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ - String expectedContents = "public class Test {\n" +//$NON-NLS-1$ - " int i;\n" +//$NON-NLS-1$ - "}";//$NON-NLS-1$ - checkSourceRange(node, expectedContents, source); //$NON-NLS-1$ - } - - /** - * Check javadoc for TypeDeclaration - */ - public void test0139() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0139", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - JSdoc actualJavadoc = ((TypeDeclaration) node).getJavadoc(); - assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ - String expectedContents = "public class Test {\n" +//$NON-NLS-1$ - " int i;\n" +//$NON-NLS-1$ - "}";//$NON-NLS-1$ - checkSourceRange(node, expectedContents, source); //$NON-NLS-1$ - } - - /** - * Check javadoc for TypeDeclaration - * @deprecated marking deprecated since using deprecated code - */ - public void test0140() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0140", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - JSdoc actualJavadoc = ((TypeDeclaration) node).getJavadoc(); - String expectedContents = - "/** JavaDoc Comment*/\n" + //$NON-NLS-1$ - "public class Test {\n" +//$NON-NLS-1$ - " int i;\n" +//$NON-NLS-1$ - "}";//$NON-NLS-1$ - checkSourceRange(node, expectedContents, source); //$NON-NLS-1$ - checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$ - } - - /** - * Check javadoc for MemberTypeDeclaration - * @deprecated marking deprecated since using deprecated code - */ - public void test0141() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0141", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - JSdoc actualJavadoc = ((TypeDeclaration) node).getJavadoc(); - String expectedContents = - "/** JavaDoc Comment*/\n" + //$NON-NLS-1$ - " class B {}";//$NON-NLS-1$ - checkSourceRange(node, expectedContents, source); //$NON-NLS-1$ - checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$ - } - - /** - * Check javadoc for MemberTypeDeclaration - */ - public void test0142() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0142", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - JSdoc actualJavadoc = ((TypeDeclaration) node).getJavadoc(); - assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ - checkSourceRange(node, "class B {}", source); //$NON-NLS-1$ - } - - /** - * Check javadoc for MemberTypeDeclaration - */ - public void test0143() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0143", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - JSdoc actualJavadoc = ((TypeDeclaration) node).getJavadoc(); - assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ - checkSourceRange(node, "public static class B {}", source); //$NON-NLS-1$ - } - - /** - * Check javadoc for MemberTypeDeclaration - */ - public void test0144() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0144", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - JSdoc actualJavadoc = ((TypeDeclaration) node).getJavadoc(); - assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ - checkSourceRange(node, "public static class B {}", source); //$NON-NLS-1$ - } - - /** - * Checking initializers - */ - public void test0145() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0145", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - checkSourceRange(node, "{}", source); //$NON-NLS-1$ - } - - /** - * Checking initializers - */ - public void test0146() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0146", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - checkSourceRange(node, "static {}", source); //$NON-NLS-1$ - } - - /** - * Checking initializers - * @deprecated marking deprecated since using deprecated code - */ - public void test0147() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0147", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - JSdoc actualJavadoc = ((Initializer) node).getJavadoc(); - assertNotNull("Javadoc comment should no be null", actualJavadoc); //$NON-NLS-1$ - String expectedContents = - "/** JavaDoc Comment*/\n" + //$NON-NLS-1$ - " static {}";//$NON-NLS-1$ - checkSourceRange(node, expectedContents, source); //$NON-NLS-1$ - checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$ - - } - - /** - * Checking initializers - * @deprecated marking deprecated since using deprecated code - */ - public void test0148() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0148", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - JSdoc actualJavadoc = ((Initializer) node).getJavadoc(); - assertNotNull("Javadoc comment should not be null", actualJavadoc); //$NON-NLS-1$ - String expectedContents = - "/** JavaDoc Comment*/\n" + //$NON-NLS-1$ - " {}";//$NON-NLS-1$ - checkSourceRange(node, expectedContents, source); //$NON-NLS-1$ - checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$ - - } - - /** - * Checking initializers - */ - public void test0149() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0149", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - JSdoc actualJavadoc = ((Initializer) node).getJavadoc(); - assertNull("Javadoc comment should be null", actualJavadoc); //$NON-NLS-1$ - checkSourceRange(node, "{}", source); //$NON-NLS-1$ - } - - /** - * Checking syntax error - */ - public void test0150() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0150", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - assertNotNull("Expression should not be null", result); //$NON-NLS-1$ - assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertTrue("The compilation unit is malformed", !isMalformed(unit)); //$NON-NLS-1$ - assertTrue("The package declaration is not malformed", isMalformed(unit.getPackage())); //$NON-NLS-1$ - List imports = unit.imports(); - assertTrue("The imports list size is not one", imports.size() == 1); //$NON-NLS-1$ - assertTrue("The first import is malformed", !isMalformed((ASTNode) imports.get(0))); //$NON-NLS-1$ - } - - /** - * Checking syntax error - */ - public void test0151() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0151", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - assertNotNull("Expression should not be null", result); //$NON-NLS-1$ - assertTrue("The compilation unit is malformed", !isMalformed(result)); //$NON-NLS-1$ - } - - /** - * Checking syntax error - */ - public void test0152() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0152", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - assertNotNull("Expression should not be null", result); //$NON-NLS-1$ - assertTrue("The compilation unit is malformed", !isMalformed(result)); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The type is malformed", !isMalformed(node)); //$NON-NLS-1$ - node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The field is not malformed", isMalformed(node)); //$NON-NLS-1$ - node = getASTNode((JavaScriptUnit) result, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The method is not malformed", isMalformed(node)); //$NON-NLS-1$ - } - - /** - * Checking syntax error - */ - public void test0153() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0153", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - assertNotNull("Expression should not be null", result); //$NON-NLS-1$ - assertTrue("The compilation unit is malformed", !isMalformed(result)); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The method is not original", isOriginal(node)); //$NON-NLS-1$ - assertTrue("The method is not malformed", isMalformed(node)); //$NON-NLS-1$ - } - - /** - * Checking binding of package declaration - */ - public void test0154() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0154", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("Expression should not be null", result); //$NON-NLS-1$ - assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - IBinding binding = compilationUnit.getPackage().getName().resolveBinding(); - assertNotNull("The package binding is null", binding); //$NON-NLS-1$ - assertTrue("The binding is not a package binding", binding instanceof IPackageBinding); //$NON-NLS-1$ - IPackageBinding packageBinding = (IPackageBinding) binding; - assertEquals("The package name is incorrect", "test0154", packageBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - IBinding binding2 = compilationUnit.getPackage().getName().resolveBinding(); - assertTrue("The package binding is not canonical", binding == binding2); //$NON-NLS-1$ - } - - /** - * Checking arguments positions - */ - public void test0155() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0155", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("Expression should not be null", result); //$NON-NLS-1$ - assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("The result is not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - FunctionDeclaration methodDecl = (FunctionDeclaration) node; - List parameters = methodDecl.parameters(); - assertTrue("The parameters size is different from 2", parameters.size() == 2); //$NON-NLS-1$ - Object parameter = parameters.get(0); - assertTrue("The parameter is not a SingleVariableDeclaration", parameter instanceof SingleVariableDeclaration); //$NON-NLS-1$ - checkSourceRange((ASTNode) parameter, "int i", source); //$NON-NLS-1$ - parameter = parameters.get(1); - assertTrue("The parameter is not a SingleVariableDeclaration", parameter instanceof SingleVariableDeclaration); //$NON-NLS-1$ - checkSourceRange((ASTNode) parameter, "final boolean b", source); //$NON-NLS-1$ - } - - /** - * Checking arguments positions - */ - public void test0156() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0156", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("Expression should not be null", result); //$NON-NLS-1$ - assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("The result is not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - FunctionDeclaration methodDecl = (FunctionDeclaration) node; - List parameters = methodDecl.parameters(); - assertTrue("The parameters size is different from 1", parameters.size() == 1); //$NON-NLS-1$ - Object parameter = parameters.get(0); - assertTrue("The parameter is not a SingleVariableDeclaration", parameter instanceof SingleVariableDeclaration); //$NON-NLS-1$ - checkSourceRange((ASTNode) parameter, "int i", source); //$NON-NLS-1$ - Block block = methodDecl.getBody(); - List statements = block.statements(); - assertTrue("The statements size is different from 2", statements.size() == 2); //$NON-NLS-1$ - ASTNode statement = (ASTNode) statements.get(0); - assertTrue("The statements[0] is a postfixExpression statement", statement instanceof ExpressionStatement); //$NON-NLS-1$ - } - - /** - * Check canonic binding for fields - */ - public void test0157() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "", "Test0157.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("Expression should not be null", result); //$NON-NLS-1$ - assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - List types = compilationUnit.types(); - assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0); - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertNotNull("Type binding is null", typeBinding); //$NON-NLS-1$ - assertTrue("The type binding is canonical", typeBinding == typeDeclaration.resolveBinding()); //$NON-NLS-1$ - List bodyDeclarations = typeDeclaration.bodyDeclarations(); - assertTrue("The body declaration list is empty", bodyDeclarations.size() != 0); //$NON-NLS-1$ - BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); - assertTrue("This is not a field", bodyDeclaration instanceof FieldDeclaration); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) bodyDeclaration; - List variableFragments = fieldDeclaration.fragments(); - assertTrue("The fragment list is empty", variableFragments.size() != 0); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableFragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - assertNotNull("the field binding is null", variableBinding); //$NON-NLS-1$ - assertFalse("Not a parameter", variableBinding.isParameter()); - assertTrue("The field binding is not canonical", variableBinding == fragment.resolveBinding()); //$NON-NLS-1$ - typeBinding = variableBinding.getType(); - assertTrue("The type is not an array type", typeBinding.isArray()); //$NON-NLS-1$ - assertTrue("The type binding for the field is not canonical", typeBinding == variableBinding.getType()); //$NON-NLS-1$ - SimpleName name = fragment.getName(); - assertTrue("is a declaration", name.isDeclaration()); //$NON-NLS-1$ - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertEquals("wrong type", IBinding.VARIABLE, binding.getKind()); //$NON-NLS-1$ - assertTrue("not a field", ((IVariableBinding) binding).isField()); //$NON-NLS-1$ - } - - /** - * Check canonic bindings for fields - */ - public void test0158() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "", "Test0158.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("Expression should not be null", result); //$NON-NLS-1$ - assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - List types = compilationUnit.types(); - assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0); - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertNotNull("Type binding is null", typeBinding); //$NON-NLS-1$ - assertTrue("The type binding is canonical", typeBinding == typeDeclaration.resolveBinding()); //$NON-NLS-1$ - SimpleName simpleName = typeDeclaration.getName(); - assertTrue("is a declaration", simpleName.isDeclaration()); //$NON-NLS-1$ - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertEquals("wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$ - assertEquals("wrong name", simpleName.getIdentifier(), binding.getName()); //$NON-NLS-1$ - List bodyDeclarations = typeDeclaration.bodyDeclarations(); - assertTrue("The body declaration list is empty", bodyDeclarations.size() != 0); //$NON-NLS-1$ - BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); - assertTrue("This is not a field", bodyDeclaration instanceof FieldDeclaration); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) bodyDeclaration; - List variableFragments = fieldDeclaration.fragments(); - assertTrue("The fragment list is empty", variableFragments.size() != 0); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableFragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - assertNotNull("the field binding is null", variableBinding); //$NON-NLS-1$ - assertTrue("The field binding is not canonical", variableBinding == fragment.resolveBinding()); //$NON-NLS-1$ - ITypeBinding typeBinding2 = variableBinding.getType(); - assertTrue("The type is not an array type", typeBinding2.isArray()); //$NON-NLS-1$ - assertTrue("The type binding for the field is not canonical", typeBinding2 == variableBinding.getType()); //$NON-NLS-1$ - assertTrue("The type binding for the field is not canonical with the declaration type binding", typeBinding == typeBinding2.getElementType()); //$NON-NLS-1$ - } - - /** - * Define an anonymous type - */ - public void test0159() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0159", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("Expression should not be null", result); //$NON-NLS-1$ - assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - } - - /** - * Check bindings for multiple field declarations - */ - public void test0160() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0160", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("Expression should not be null", result); //$NON-NLS-1$ - assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - List types = compilationUnit.types(); - assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0); - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertNotNull("Type binding is null", typeBinding); //$NON-NLS-1$ - assertTrue("The type binding is canonical", typeBinding == typeDeclaration.resolveBinding()); //$NON-NLS-1$ - List bodyDeclarations = typeDeclaration.bodyDeclarations(); - assertTrue("The body declaration list is empty", bodyDeclarations.size() != 0); //$NON-NLS-1$ - BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); - assertTrue("This is not a field", bodyDeclaration instanceof FieldDeclaration); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) bodyDeclaration; - List variableFragments = fieldDeclaration.fragments(); - assertTrue("The fragment list size is not 2", variableFragments.size() == 2); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableFragments.get(0); - IVariableBinding variableBinding1 = fragment.resolveBinding(); - assertNotNull("the field binding is null", variableBinding1); //$NON-NLS-1$ - assertTrue("The field binding is not canonical", variableBinding1 == fragment.resolveBinding()); //$NON-NLS-1$ - ITypeBinding type1 = variableBinding1.getType(); - assertNotNull("The type is null", type1); //$NON-NLS-1$ - assertTrue("The field type is canonical", type1 == variableBinding1.getType()); //$NON-NLS-1$ - assertTrue("The type is not an array type",type1.isArray()); //$NON-NLS-1$ - assertTrue("The type dimension is 1", type1.getDimensions() == 1); //$NON-NLS-1$ - fragment = (VariableDeclarationFragment) variableFragments.get(1); - IVariableBinding variableBinding2 = fragment.resolveBinding(); - assertNotNull("the field binding is null", variableBinding2); //$NON-NLS-1$ - assertTrue("The field binding is not canonical", variableBinding2 == fragment.resolveBinding()); //$NON-NLS-1$ - ITypeBinding type2 = variableBinding2.getType(); - type2 = variableBinding2.getType(); - assertNotNull("The type is null", type2); //$NON-NLS-1$ - assertTrue("The field type is canonical", type2 == variableBinding2.getType()); //$NON-NLS-1$ - assertTrue("The type is not an array type",type2.isArray()); //$NON-NLS-1$ - assertTrue("The type dimension is 2", type2.getDimensions() == 2); //$NON-NLS-1$ - assertTrue("Element type is canonical", type1.getElementType() == type2.getElementType()); //$NON-NLS-1$ - assertTrue("type1.id < type2.id", variableBinding1.getVariableId() < variableBinding2.getVariableId()); //$NON-NLS-1$ - - } - - /** - * Check ITypeBinding APIs: - * - getModifiers() - * - getElementType() when it is not an array type - * - getDimensions() when it is not an array type - * - getDeclaringClass() - * - getDeclaringName() - * - getName() - * - isNested() - * - isAnonymous() - * - isLocal() - * - isMember() - * - isArray() - * - getDeclaredMethods() => returns binding for default constructor - * - isPrimitive() - * - isTopLevel() - * - getSuperclass() - */ - public void test0161() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0161", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("Expression should not be null", result); //$NON-NLS-1$ - assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - List types = compilationUnit.types(); - assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0); - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertNotNull("The type binding should not be null", typeBinding); //$NON-NLS-1$ - assertEquals("The modifier is PUBLIC", Modifier.PUBLIC, typeBinding.getModifiers()); //$NON-NLS-1$ - assertNull("There is no element type", typeBinding.getElementType()); //$NON-NLS-1$ - assertEquals("There is no dimension", 0, typeBinding.getDimensions()); //$NON-NLS-1$ - assertNull("This is not a member type", typeBinding.getDeclaringClass()); //$NON-NLS-1$ - IFunctionBinding[] methods = typeBinding.getDeclaredMethods(); - assertEquals("Contains the default constructor", 1, methods.length); //$NON-NLS-1$ - assertEquals("The name is not Test", "Test", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue("An anonymous class", !typeBinding.isAnonymous()); //$NON-NLS-1$ - assertTrue("A local class", !typeBinding.isLocal()); //$NON-NLS-1$ - assertTrue("A nested class", !typeBinding.isNested()); //$NON-NLS-1$ - assertTrue("A member class", !typeBinding.isMember()); //$NON-NLS-1$ - assertTrue("An array", !typeBinding.isArray()); //$NON-NLS-1$ - assertTrue("Not a class", typeBinding.isClass()); //$NON-NLS-1$ - assertTrue("Not from source", typeBinding.isFromSource()); //$NON-NLS-1$ - assertTrue("Is nested", typeBinding.isTopLevel()); //$NON-NLS-1$ - assertTrue("A primitive type", !typeBinding.isPrimitive()); //$NON-NLS-1$ - ITypeBinding superclass = typeBinding.getSuperclass(); - assertNotNull("No superclass", superclass); //$NON-NLS-1$ - assertTrue("From source", !superclass.isFromSource()); //$NON-NLS-1$ - ITypeBinding supersuperclass = superclass.getSuperclass(); - assertNull("No superclass for java.lang.Object", supersuperclass); //$NON-NLS-1$ - assertEquals("Has fields", 0, typeBinding.getDeclaredFields().length); //$NON-NLS-1$ - } - - /** - * Check ITypeBinding APIs: - * - getModifiers() - * - getElementType() when it is not an array type - * - getDimensions() when it is not an array type - * - getDeclaringClass() - * - getDeclaringName() - * - getName() - * - isNested() - * - isAnonymous() - * - isLocal() - * - isMember() - * - isArray() - * - getDeclaredMethods() => returns binding for default constructor - * - isPrimitive() - * - isTopLevel() - * - getSuperclass() - */ - public void test0162() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0162", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("Expression should not be null", result); //$NON-NLS-1$ - assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - List types = compilationUnit.types(); - assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0); - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertNotNull("The type binding should not be null", typeBinding); //$NON-NLS-1$ - assertEquals("The modifier is PUBLIC", Modifier.PUBLIC, typeBinding.getModifiers()); //$NON-NLS-1$ - assertNull("There is no element type", typeBinding.getElementType()); //$NON-NLS-1$ - assertEquals("There is no dimension", 0, typeBinding.getDimensions()); //$NON-NLS-1$ - assertNull("This is not a member type", typeBinding.getDeclaringClass()); //$NON-NLS-1$ - IFunctionBinding[] methods = typeBinding.getDeclaredMethods(); - assertEquals("Contains no methos", 0, methods.length); //$NON-NLS-1$ - assertEquals("The name is not Test", "Test", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue("An anonymous class", !typeBinding.isAnonymous()); //$NON-NLS-1$ - assertTrue("A local class", !typeBinding.isLocal()); //$NON-NLS-1$ - assertTrue("A nested class", !typeBinding.isNested()); //$NON-NLS-1$ - assertTrue("A member class", !typeBinding.isMember()); //$NON-NLS-1$ - assertTrue("An array", !typeBinding.isArray()); //$NON-NLS-1$ - assertTrue("A class", !typeBinding.isClass()); //$NON-NLS-1$ - assertTrue("Not from source", typeBinding.isFromSource()); //$NON-NLS-1$ - assertTrue("Is nested", typeBinding.isTopLevel()); //$NON-NLS-1$ - assertTrue("A primitive type", !typeBinding.isPrimitive()); //$NON-NLS-1$ - ITypeBinding superclass = typeBinding.getSuperclass(); - assertNull("No superclass", superclass); //$NON-NLS-1$ - assertEquals("Has fields", 0, typeBinding.getDeclaredFields().length); //$NON-NLS-1$ - } - - /** - * Test binding for anonymous declaration: new java.lang.Object() {} - */ - public void test0163() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0163", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - assertTrue("Not an anonymous type declaration", expression instanceof ClassInstanceCreation); //$NON-NLS-1$ - ClassInstanceCreation anonymousClass = (ClassInstanceCreation) expression; - ITypeBinding typeBinding = anonymousClass.resolveTypeBinding(); - assertNotNull("No binding", typeBinding); //$NON-NLS-1$ - assertTrue("Not an anonymous class", typeBinding.isAnonymous()); //$NON-NLS-1$ - assertEquals("The modifier is not default", Modifier.NONE, typeBinding.getModifiers()); //$NON-NLS-1$ - assertNull("There is no element type", typeBinding.getElementType()); //$NON-NLS-1$ - assertEquals("There is no dimension", 0, typeBinding.getDimensions()); //$NON-NLS-1$ - assertNotNull("This is a member type", typeBinding.getDeclaringClass()); //$NON-NLS-1$ - assertEquals("The name is not empty", "", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - IFunctionBinding[] methods = typeBinding.getDeclaredMethods(); - assertEquals("Contains the default constructor", 1, methods.length); //$NON-NLS-1$ - assertTrue("Not a local class", typeBinding.isLocal()); //$NON-NLS-1$ - assertTrue("Not a nested class", typeBinding.isNested()); //$NON-NLS-1$ - assertTrue("A member class", !typeBinding.isMember()); //$NON-NLS-1$ - assertTrue("An array", !typeBinding.isArray()); //$NON-NLS-1$ - assertTrue("Not a class", typeBinding.isClass()); //$NON-NLS-1$ - assertTrue("Not from source", typeBinding.isFromSource()); //$NON-NLS-1$ - assertTrue("Is a top level", !typeBinding.isTopLevel()); //$NON-NLS-1$ - assertTrue("A primitive type", !typeBinding.isPrimitive()); //$NON-NLS-1$ - assertEquals("wrong qualified name", "", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$ - ITypeBinding superclass = typeBinding.getSuperclass(); - assertNotNull("No superclass", superclass); //$NON-NLS-1$ - assertEquals("Has fields", 0, typeBinding.getDeclaredFields().length); //$NON-NLS-1$ - } - - /** - * Test binding for member type declaration - */ - public void test0164() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0164", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("Not an type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertNotNull("No binding", typeBinding); //$NON-NLS-1$ - assertTrue("An anonymous class", !typeBinding.isAnonymous()); //$NON-NLS-1$ - assertEquals("The modifier is not default", Modifier.PRIVATE, typeBinding.getModifiers()); //$NON-NLS-1$ - assertNull("There is no element type", typeBinding.getElementType()); //$NON-NLS-1$ - assertEquals("There is no dimension", 0, typeBinding.getDimensions()); //$NON-NLS-1$ - assertNotNull("This is not a member type", typeBinding.getDeclaringClass()); //$NON-NLS-1$ - assertEquals("The name is not 'B'", "B", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - IFunctionBinding[] methods = typeBinding.getDeclaredMethods(); - assertEquals("Contains the default constructor", 1, methods.length); //$NON-NLS-1$ - assertTrue("A local class", !typeBinding.isLocal()); //$NON-NLS-1$ - assertTrue("Not a nested class", typeBinding.isNested()); //$NON-NLS-1$ - assertTrue("Not a member class", typeBinding.isMember()); //$NON-NLS-1$ - assertTrue("An array", !typeBinding.isArray()); //$NON-NLS-1$ - assertTrue("Not a class", typeBinding.isClass()); //$NON-NLS-1$ - assertTrue("Not from source", typeBinding.isFromSource()); //$NON-NLS-1$ - assertTrue("Is a top level", !typeBinding.isTopLevel()); //$NON-NLS-1$ - assertTrue("A primitive type", !typeBinding.isPrimitive()); //$NON-NLS-1$ - ITypeBinding superclass = typeBinding.getSuperclass(); - assertNotNull("No superclass", superclass); //$NON-NLS-1$ - assertEquals("Has fields", 0, typeBinding.getDeclaredFields().length); //$NON-NLS-1$ - } - - /** - * Test binding for local type declaration - */ - public void test0165() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0165", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("Not an type declaration", node instanceof TypeDeclarationStatement); //$NON-NLS-1$ - TypeDeclarationStatement statement = (TypeDeclarationStatement) node; - AbstractTypeDeclaration typeDeclaration = statement.getDeclaration(); - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertNotNull("No binding", typeBinding); //$NON-NLS-1$ - assertTrue("An anonymous class", !typeBinding.isAnonymous()); //$NON-NLS-1$ - assertEquals("The modifier is not default", Modifier.NONE, typeBinding.getModifiers()); //$NON-NLS-1$ - assertNull("There is no element type", typeBinding.getElementType()); //$NON-NLS-1$ - assertEquals("There is no dimension", 0, typeBinding.getDimensions()); //$NON-NLS-1$ - assertNotNull("This is not a member type", typeBinding.getDeclaringClass()); //$NON-NLS-1$ - assertEquals("The name is not 'C'", "C", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - IFunctionBinding[] methods = typeBinding.getDeclaredMethods(); - assertEquals("Contains the default constructor", 1, methods.length); //$NON-NLS-1$ - assertTrue("Not a local class", typeBinding.isLocal()); //$NON-NLS-1$ - assertTrue("Not a nested class", typeBinding.isNested()); //$NON-NLS-1$ - assertTrue("A member class", !typeBinding.isMember()); //$NON-NLS-1$ - assertTrue("An array", !typeBinding.isArray()); //$NON-NLS-1$ - assertTrue("Not a class", typeBinding.isClass()); //$NON-NLS-1$ - assertTrue("Not from source", typeBinding.isFromSource()); //$NON-NLS-1$ - assertTrue("Is a top level", !typeBinding.isTopLevel()); //$NON-NLS-1$ - assertTrue("A primitive type", !typeBinding.isPrimitive()); //$NON-NLS-1$ - assertEquals("wrong qualified name", "", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$ - ITypeBinding superclass = typeBinding.getSuperclass(); - assertNotNull("No superclass", superclass); //$NON-NLS-1$ - assertEquals("Has fields", 0, typeBinding.getDeclaredFields().length); //$NON-NLS-1$ - } - - /** - * Multiple local declaration => VariabledeclarationStatement - */ - public void test0166() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0166", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - List fragments = variableDeclarationStatement.fragments(); - assertTrue("Fragment list is not 4 ", fragments.size() == 4); //$NON-NLS-1$ - VariableDeclarationFragment fragment1 = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding binding1 = fragment1.resolveBinding(); - assertNotNull("Binding is null", binding1); //$NON-NLS-1$ - assertEquals("wrong name for binding1", "x", binding1.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("wrong modifier for binding1", 0, binding1.getModifiers()); //$NON-NLS-1$ - assertTrue("a field", !binding1.isField()); //$NON-NLS-1$ - assertNull("declaring class is not null", binding1.getDeclaringClass()); //$NON-NLS-1$ - ITypeBinding typeBinding1 = binding1.getType(); - assertNotNull("typeBinding1 is null", typeBinding1); //$NON-NLS-1$ - assertTrue("typeBinding1 is not a primitive type", typeBinding1.isPrimitive()); //$NON-NLS-1$ - assertTrue("typeBinding1 is not canonical", typeBinding1 == binding1.getType()); //$NON-NLS-1$ - VariableDeclarationFragment fragment2 = (VariableDeclarationFragment) fragments.get(1); - IVariableBinding binding2 = fragment2.resolveBinding(); - assertNotNull("Binding is null", binding2); //$NON-NLS-1$ - assertEquals("wrong name for binding2", "z", binding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("wrong modifier for binding2", 0, binding2.getModifiers()); //$NON-NLS-1$ - assertTrue("a field", !binding2.isField()); //$NON-NLS-1$ - assertNull("declaring class is not null", binding2.getDeclaringClass()); //$NON-NLS-1$ - ITypeBinding typeBinding2 = binding2.getType(); - assertNotNull("typeBinding2 is null", typeBinding2); //$NON-NLS-1$ - assertTrue("typeBinding2 is not an array type", typeBinding2.isArray()); //$NON-NLS-1$ - assertTrue("typeBinding2 is not canonical", typeBinding2 == binding2.getType()); //$NON-NLS-1$ - assertTrue("primitive type is not canonical", typeBinding1 == typeBinding2.getElementType()); //$NON-NLS-1$ - assertEquals("dimension is 1", 1, typeBinding2.getDimensions()); //$NON-NLS-1$ - assertEquals("it is not int[]", "int[]", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - VariableDeclarationFragment fragment3 = (VariableDeclarationFragment) fragments.get(2); - IVariableBinding binding3 = fragment3.resolveBinding(); - assertNotNull("Binding is null", binding3); //$NON-NLS-1$ - assertEquals("wrong name for binding3", "i", binding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("wrong modifier for binding3", 0, binding3.getModifiers()); //$NON-NLS-1$ - assertTrue("a field", !binding3.isField()); //$NON-NLS-1$ - assertNull("declaring class is not null", binding3.getDeclaringClass()); //$NON-NLS-1$ - ITypeBinding typeBinding3 = binding3.getType(); - assertNotNull("typeBinding3 is null", typeBinding3); //$NON-NLS-1$ - assertTrue("typeBinding3 is not an primitive type", typeBinding3.isPrimitive()); //$NON-NLS-1$ - assertTrue("typeBinding3 is not canonical", typeBinding3 == binding3.getType()); //$NON-NLS-1$ - assertTrue("primitive type is not canonical", typeBinding1 == typeBinding3); //$NON-NLS-1$ - assertEquals("dimension is 0", 0, typeBinding3.getDimensions()); //$NON-NLS-1$ - assertEquals("it is not the primitive type int", "int", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - VariableDeclarationFragment fragment4 = (VariableDeclarationFragment) fragments.get(3); - IVariableBinding binding4 = fragment4.resolveBinding(); - assertNotNull("Binding is null", binding4); //$NON-NLS-1$ - assertEquals("wrong name for binding4", "j", binding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("wrong modifier for binding4", 0, binding4.getModifiers()); //$NON-NLS-1$ - assertTrue("a field", !binding4.isField()); //$NON-NLS-1$ - assertNull("declaring class is not null", binding4.getDeclaringClass()); //$NON-NLS-1$ - ITypeBinding typeBinding4 = binding4.getType(); - assertNotNull("typeBinding4 is null", typeBinding4); //$NON-NLS-1$ - assertTrue("typeBinding4 is not an array type", typeBinding4.isArray()); //$NON-NLS-1$ - assertTrue("typeBinding4 is not canonical", typeBinding4 == binding4.getType()); //$NON-NLS-1$ - assertTrue("primitive type is not canonical", typeBinding1 == typeBinding4.getElementType()); //$NON-NLS-1$ - assertEquals("dimension is 2", 2, typeBinding4.getDimensions()); //$NON-NLS-1$ - assertEquals("it is not int[][]", "int[][]", typeBinding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue("ids in the wrong order", binding1.getVariableId() < binding2.getVariableId()); //$NON-NLS-1$ - assertTrue("ids in the wrong order", binding2.getVariableId() < binding3.getVariableId()); //$NON-NLS-1$ - assertTrue("ids in the wrong order", binding3.getVariableId() < binding4.getVariableId()); //$NON-NLS-1$ - } - - /** - * Check source position for new Test[1+2].length. - */ - public void test0167() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0167", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("Instance of VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - List fragments = variableDeclarationStatement.fragments(); - assertTrue("fragment list size is not 1", fragments.size() == 1); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression initialization = fragment.getInitializer(); - assertNotNull("No initialization", initialization); //$NON-NLS-1$ - assertTrue("Not a FieldAccess", initialization instanceof FieldAccess); //$NON-NLS-1$ - checkSourceRange(initialization, "new Test[1+2].length", source); //$NON-NLS-1$ - } - - /** - * Check package binding: test0168.test - */ - public void test0168() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0168.test1", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("Expression should not be null", result); //$NON-NLS-1$ - assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - List types = compilationUnit.types(); - assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0); - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertNotNull("Binding not null", typeBinding); //$NON-NLS-1$ - IPackageBinding packageBinding = typeBinding.getPackage(); - assertNotNull("No package binding", packageBinding); //$NON-NLS-1$ - assertEquals("wrong name", "test0168.test1", packageBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - String[] components = packageBinding.getNameComponents(); - assertNotNull("no components", components); //$NON-NLS-1$ - assertTrue("components size != 2", components.length == 2); //$NON-NLS-1$ - assertEquals("wrong component name", "test0168", components[0]); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("wrong component name", "test1", components[1]); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("wrong type", IBinding.PACKAGE, packageBinding.getKind()); //$NON-NLS-1$ - assertTrue("Unnamed package", !packageBinding.isUnnamed()); //$NON-NLS-1$ - assertTrue("Package binding is not canonical", packageBinding == typeBinding.getPackage()); //$NON-NLS-1$ - } - - /** - * Check package binding: test0169 - */ - public void test0169() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0169", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("Expression should not be null", result); //$NON-NLS-1$ - assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - List types = compilationUnit.types(); - assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0); - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertNotNull("Binding not null", typeBinding); //$NON-NLS-1$ - IPackageBinding packageBinding = typeBinding.getPackage(); - assertNotNull("No package binding", packageBinding); //$NON-NLS-1$ - assertEquals("wrong name", "test0169", packageBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - String[] components = packageBinding.getNameComponents(); - assertNotNull("no components", components); //$NON-NLS-1$ - assertTrue("components size != 1", components.length == 1); //$NON-NLS-1$ - assertEquals("wrong component name", "test0169", components[0]); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("wrong type", IBinding.PACKAGE, packageBinding.getKind()); //$NON-NLS-1$ - assertTrue("Unnamed package", !packageBinding.isUnnamed()); //$NON-NLS-1$ - assertTrue("Package binding is not canonical", packageBinding == typeBinding.getPackage()); //$NON-NLS-1$ - } - - /** - * Check package binding: test0170 - */ - public void test0170() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "", "Test0170.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("Expression should not be null", result); //$NON-NLS-1$ - assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - List types = compilationUnit.types(); - assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0); - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertNotNull("Binding not null", typeBinding); //$NON-NLS-1$ - IPackageBinding packageBinding = typeBinding.getPackage(); - assertNotNull("No package binding", packageBinding); //$NON-NLS-1$ - assertEquals("wrong name", "", packageBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - String[] components = packageBinding.getNameComponents(); - assertNotNull("no components", components); //$NON-NLS-1$ - assertTrue("components size != 0", components.length == 0); //$NON-NLS-1$ - assertEquals("wrong type", IBinding.PACKAGE, packageBinding.getKind()); //$NON-NLS-1$ - assertTrue("Not an unnamed package", packageBinding.isUnnamed()); //$NON-NLS-1$ - assertTrue("Package binding is not canonical", packageBinding == typeBinding.getPackage()); //$NON-NLS-1$ - } - - /** - * Check package binding: test0171 - */ - public void test0171() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0171", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("Expression should not be null", result); //$NON-NLS-1$ - assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - List types = compilationUnit.types(); - assertTrue("The types list is empty", types.size() == 2); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0); - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertNotNull("Binding not null", typeBinding); //$NON-NLS-1$ - IPackageBinding packageBinding = typeBinding.getPackage(); - assertNotNull("No package binding", packageBinding); //$NON-NLS-1$ - assertEquals("wrong name", "test0171", packageBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - String[] components = packageBinding.getNameComponents(); - assertNotNull("no components", components); //$NON-NLS-1$ - assertTrue("components size != 1", components.length == 1); //$NON-NLS-1$ - assertEquals("wrong component name", "test0171", components[0]); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("wrong type", IBinding.PACKAGE, packageBinding.getKind()); //$NON-NLS-1$ - assertTrue("Unnamed package", !packageBinding.isUnnamed()); //$NON-NLS-1$ - assertTrue("Package binding is not canonical", packageBinding == typeBinding.getPackage()); //$NON-NLS-1$ - - typeDeclaration = (TypeDeclaration) types.get(1); - typeBinding = typeDeclaration.resolveBinding(); - assertNotNull("Binding not null", typeBinding); //$NON-NLS-1$ - IPackageBinding packageBinding2 = typeBinding.getPackage(); - assertNotNull("No package binding", packageBinding); //$NON-NLS-1$ - assertTrue("Package binding is not canonical", packageBinding == packageBinding2); //$NON-NLS-1$ - } - - /** - * Check method binding - */ - public void test0172() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0172", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("Expression should not be null", result); //$NON-NLS-1$ - assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - List types = compilationUnit.types(); - assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0); - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertNotNull("Binding not null", typeBinding); //$NON-NLS-1$ - IFunctionBinding[] methods = typeBinding.getDeclaredMethods(); - assertEquals("methods.length != 4", 4, methods.length); //$NON-NLS-1$ - List bodyDeclarations = typeDeclaration.bodyDeclarations(); - assertEquals("body declaration size != 3", 3, bodyDeclarations.size()); //$NON-NLS-1$ - FunctionDeclaration method1 = (FunctionDeclaration) bodyDeclarations.get(0); - IFunctionBinding methodBinding1 = method1.resolveBinding(); - assertNotNull("No method binding for foo", methodBinding1); //$NON-NLS-1$ - SimpleName simpleName = method1.getName(); - assertTrue("not a declaration", simpleName.isDeclaration()); //$NON-NLS-1$ - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertEquals("wrong name", binding.getName(), simpleName.getIdentifier()); //$NON-NLS-1$ - // search method foo - IFunctionBinding methodBinding = null; - loop: for (int i = 0, max = methods.length; i < max; i++) { - IFunctionBinding currentMethod = methods[i]; - if ("foo".equals(currentMethod.getName())) { - methodBinding = currentMethod; - break loop; - } - } - assertNotNull("Cannot be null", methodBinding); - assertTrue("Canonical method binding", methodBinding1 == methodBinding); //$NON-NLS-1$ - assertTrue("declaring class is canonical", typeBinding == methodBinding1.getDeclaringClass()); //$NON-NLS-1$ - assertEquals("wrong modifier", Modifier.NONE, methodBinding1.getModifiers()); //$NON-NLS-1$ - assertEquals("wrong name for method", "foo", methodBinding1.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - ITypeBinding[] parameters = methodBinding1.getParameterTypes(); - assertNotNull("No parameters", parameters); //$NON-NLS-1$ - assertEquals("wrong size", 1, parameters.length); //$NON-NLS-1$ - assertEquals("wrong type", "int[]", parameters[0].getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("wrong return type", "void", methodBinding1.getReturnType().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue("A constructor", !methodBinding1.isConstructor()); //$NON-NLS-1$ - - FunctionDeclaration method2 = (FunctionDeclaration) bodyDeclarations.get(1); - IFunctionBinding methodBinding2 = method2.resolveBinding(); - assertNotNull("No method binding for main", methodBinding2); //$NON-NLS-1$ - // search main - methodBinding = null; - loop: for (int i = 0, max = methods.length; i < max; i++) { - IFunctionBinding currentMethod = methods[i]; - if ("main".equals(currentMethod.getName())) { - methodBinding = currentMethod; - break loop; - } - } - assertNotNull("Cannot be null", methodBinding); - assertTrue("Canonical method binding", methodBinding2 == methodBinding); //$NON-NLS-1$ - assertTrue("declaring class is canonical", typeBinding == methodBinding2.getDeclaringClass()); //$NON-NLS-1$ - assertEquals("wrong modifier", Modifier.PUBLIC | Modifier.STATIC, methodBinding2.getModifiers()); //$NON-NLS-1$ - assertEquals("wrong name for method", "main", methodBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - ITypeBinding[] parameters2 = methodBinding2.getParameterTypes(); - assertNotNull("No parameters", parameters2); //$NON-NLS-1$ - assertEquals("wrong size", 1, parameters2.length); //$NON-NLS-1$ - assertEquals("wrong type for parameter2[0]", "String[]", parameters2[0].getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("wrong return type", "void", methodBinding2.getReturnType().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue("A constructor", !methodBinding2.isConstructor()); //$NON-NLS-1$ - - FunctionDeclaration method3 = (FunctionDeclaration) bodyDeclarations.get(2); - IFunctionBinding methodBinding3 = method3.resolveBinding(); - assertNotNull("No method binding for bar", methodBinding3); //$NON-NLS-1$ - // search method bar - methodBinding = null; - loop: for (int i = 0, max = methods.length; i < max; i++) { - IFunctionBinding currentMethod = methods[i]; - if ("bar".equals(currentMethod.getName())) { - methodBinding = currentMethod; - break loop; - } - } - assertNotNull("Cannot be null", methodBinding); - assertTrue("Canonical method binding", methodBinding3 == methodBinding); //$NON-NLS-1$ - assertTrue("declaring class is canonical", typeBinding == methodBinding3.getDeclaringClass()); //$NON-NLS-1$ - assertEquals("wrong modifier", Modifier.PRIVATE, methodBinding3.getModifiers()); //$NON-NLS-1$ - assertEquals("wrong name for method", "bar", methodBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - ITypeBinding[] parameters3 = methodBinding3.getParameterTypes(); - assertNotNull("No parameters", parameters3); //$NON-NLS-1$ - assertEquals("wrong size", 1, parameters3.length); //$NON-NLS-1$ - assertEquals("wrong type", "String", parameters3[0].getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("wrong return type", "String", methodBinding3.getReturnType().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue("A constructor", !methodBinding3.isConstructor()); //$NON-NLS-1$ - assertTrue("The binding is not canonical", parameters3[0] == methodBinding3.getReturnType()); //$NON-NLS-1$ - } - - /** - * i++; IVariableBinding - */ - public void test0173() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0173", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("Not an expressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression ex = expressionStatement.getExpression(); - assertTrue("Not a postfixexpression", ex instanceof PostfixExpression); //$NON-NLS-1$ - PostfixExpression postfixExpression = (PostfixExpression) ex; - Expression expr = postfixExpression.getOperand(); - assertTrue("Not a simpleName", expr instanceof SimpleName); //$NON-NLS-1$ - SimpleName name = (SimpleName) expr; - assertTrue("a declaration", !name.isDeclaration()); //$NON-NLS-1$ - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2; - List fragments = variableDeclarationStatement.fragments(); - assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - assertTrue(variableBinding == binding); - } - - /** - * i++; IVariableBinding (field) - */ - public void test0174() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0174", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 1, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("Not an expressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression ex = expressionStatement.getExpression(); - assertTrue("Not a postfixexpression", ex instanceof PostfixExpression); //$NON-NLS-1$ - PostfixExpression postfixExpression = (PostfixExpression) ex; - Expression expr = postfixExpression.getOperand(); - assertTrue("Not a simpleName", expr instanceof SimpleName); //$NON-NLS-1$ - SimpleName name = (SimpleName) expr; - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("FieldDeclaration", node2 instanceof FieldDeclaration); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node2; - List fragments = fieldDeclaration.fragments(); - assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - assertTrue(variableBinding == binding); - } - - /** - * int i = 0; Test IntBinding for the field declaration and the 0 literal - */ - public void test0175() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0175", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("VariableDeclarationStatement", node2 instanceof FieldDeclaration); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node2; - List fragments = fieldDeclaration.fragments(); - assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - ITypeBinding typeBinding = fragment.getInitializer().resolveTypeBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertTrue("Not a primitive type", typeBinding.isPrimitive()); //$NON-NLS-1$ - assertEquals("Not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue(variableBinding.getType() == typeBinding); - } - - /** - * ThisReference - */ - public void test0176() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0176", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 1, 0); - assertTrue("Return statement", node2 instanceof ReturnStatement); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node2; - assertTrue("Not a field access", returnStatement.getExpression() instanceof FieldAccess); //$NON-NLS-1$ - FieldAccess fieldAccess = (FieldAccess) returnStatement.getExpression(); - ITypeBinding typeBinding = fieldAccess.resolveTypeBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertTrue("Not a primitive type", typeBinding.isPrimitive()); //$NON-NLS-1$ - assertEquals("Not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - Expression expr = fieldAccess.getExpression(); - assertTrue("Not a this expression", expr instanceof ThisExpression); //$NON-NLS-1$ - ThisExpression thisExpression = (ThisExpression) expr; - ITypeBinding typeBinding2 = thisExpression.resolveTypeBinding(); - assertNotNull("No type binding2", typeBinding2); //$NON-NLS-1$ - assertEquals("Not Test", "Test", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * i++; IVariableBinding - */ - public void test0177() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0177", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 1, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("Not an expressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression ex = expressionStatement.getExpression(); - assertTrue("Not a postfixexpression", ex instanceof PostfixExpression); //$NON-NLS-1$ - PostfixExpression postfixExpression = (PostfixExpression) ex; - Expression expr = postfixExpression.getOperand(); - assertTrue("Not a simpleName", expr instanceof SimpleName); //$NON-NLS-1$ - SimpleName name = (SimpleName) expr; - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 1, 0); - assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2; - List fragments = variableDeclarationStatement.fragments(); - assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - assertEquals("return type is not int", "int", variableBinding.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue(variableBinding == binding); - } - - /** - * SuperReference - */ - public void test0178() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0178", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 1, 0, 0); - assertTrue("Return statement", node2 instanceof ReturnStatement); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node2; - Expression expr = returnStatement.getExpression(); - assertTrue("Not a field access", expr instanceof SuperFieldAccess); //$NON-NLS-1$ - SuperFieldAccess fieldAccess = (SuperFieldAccess) expr; - ITypeBinding typeBinding = fieldAccess.resolveTypeBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertTrue("Not a primitive type", typeBinding.isPrimitive()); //$NON-NLS-1$ - assertEquals("Not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * Allocation expression - */ - public void test0179() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0179", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2; - List fragments = variableDeclarationStatement.fragments(); - assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - Expression initialization = fragment.getInitializer(); - ITypeBinding typeBinding = initialization.resolveTypeBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertTrue(variableBinding.getType() == typeBinding); - } - - /** - * Allocation expression - */ - public void test0180() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0180", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2; - List fragments = variableDeclarationStatement.fragments(); - assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - Expression initialization = fragment.getInitializer(); - assertTrue("No an array creation", initialization instanceof ArrayCreation); //$NON-NLS-1$ - ITypeBinding typeBinding = initialization.resolveTypeBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertTrue("Not an array", typeBinding.isArray()); //$NON-NLS-1$ - assertTrue(variableBinding.getType() == typeBinding); - } - - /** - * Allocation expression - */ - public void test0181() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0181", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2; - List fragments = variableDeclarationStatement.fragments(); - assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - Expression initialization = fragment.getInitializer(); - ITypeBinding typeBinding = initialization.resolveTypeBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertTrue("Not an array", typeBinding.isArray()); //$NON-NLS-1$ - assertTrue(variableBinding.getType() == typeBinding); - } - - /** - * BinaryExpression - */ - public void test0182() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0182", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertTrue("IfStatement", node2 instanceof IfStatement); //$NON-NLS-1$ - IfStatement ifStatement = (IfStatement) node2; - Expression expr = ifStatement.getExpression(); - assertNotNull("No condition", expr); //$NON-NLS-1$ - ITypeBinding typeBinding = expr.resolveTypeBinding(); - assertNotNull("No binding", typeBinding); //$NON-NLS-1$ - assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - checkSourceRange(expr, "i < 10", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression - */ - public void test0183() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0183", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertTrue("IfStatement", node2 instanceof IfStatement); //$NON-NLS-1$ - IfStatement ifStatement = (IfStatement) node2; - Expression expr = ifStatement.getExpression(); - assertNotNull("No condition", expr); //$NON-NLS-1$ - ITypeBinding typeBinding = expr.resolveTypeBinding(); - assertNotNull("No binding", typeBinding); //$NON-NLS-1$ - assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - checkSourceRange(expr, "i < 10 && i < 20", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression - */ - public void test0184() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0184", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertTrue("IfStatement", node2 instanceof IfStatement); //$NON-NLS-1$ - IfStatement ifStatement = (IfStatement) node2; - Expression expr = ifStatement.getExpression(); - assertNotNull("No condition", expr); //$NON-NLS-1$ - ITypeBinding typeBinding = expr.resolveTypeBinding(); - assertNotNull("No binding", typeBinding); //$NON-NLS-1$ - assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - checkSourceRange(expr, "i < 10 || i < 20", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression - */ - public void test0185() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0185", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertTrue("IfStatement", node2 instanceof IfStatement); //$NON-NLS-1$ - IfStatement ifStatement = (IfStatement) node2; - Expression expr = ifStatement.getExpression(); - assertNotNull("No condition", expr); //$NON-NLS-1$ - ITypeBinding typeBinding = expr.resolveTypeBinding(); - assertNotNull("No binding", typeBinding); //$NON-NLS-1$ - assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - checkSourceRange(expr, "i == 10", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression - */ - public void test0186() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0186", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertTrue("IfStatement", node2 instanceof IfStatement); //$NON-NLS-1$ - IfStatement ifStatement = (IfStatement) node2; - Expression expr = ifStatement.getExpression(); - assertNotNull("No condition", expr); //$NON-NLS-1$ - ITypeBinding typeBinding = expr.resolveTypeBinding(); - assertNotNull("No binding", typeBinding); //$NON-NLS-1$ - assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - checkSourceRange(expr, "o == o", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression - */ - public void test0187() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0187", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertTrue("IfStatement", node2 instanceof WhileStatement); //$NON-NLS-1$ - WhileStatement whileStatement = (WhileStatement) node2; - Expression expr = whileStatement.getExpression(); - assertNotNull("No condition", expr); //$NON-NLS-1$ - ITypeBinding typeBinding = expr.resolveTypeBinding(); - assertNotNull("No binding", typeBinding); //$NON-NLS-1$ - assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - checkSourceRange(expr, "i <= 10", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression - */ - public void test0188() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0188", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertTrue("DoStatement", node2 instanceof DoStatement); //$NON-NLS-1$ - DoStatement statement = (DoStatement) node2; - Expression expr = statement.getExpression(); - assertNotNull("No condition", expr); //$NON-NLS-1$ - ITypeBinding typeBinding = expr.resolveTypeBinding(); - assertNotNull("No binding", typeBinding); //$NON-NLS-1$ - assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - checkSourceRange(expr, "i <= 10", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression - */ - public void test0189() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0189", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("ForStatement", node2 instanceof ForStatement); //$NON-NLS-1$ - ForStatement statement = (ForStatement) node2; - Expression expr = statement.getExpression(); - assertNotNull("No condition", expr); //$NON-NLS-1$ - ITypeBinding typeBinding = expr.resolveTypeBinding(); - assertNotNull("No binding", typeBinding); //$NON-NLS-1$ - assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - checkSourceRange(expr, "i < 10", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression - */ - public void test0190() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0190", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 2, 1); - assertTrue("IfStatement", node2 instanceof IfStatement); //$NON-NLS-1$ - IfStatement statement = (IfStatement) node2; - Expression expr = statement.getExpression(); - assertNotNull("No condition", expr); //$NON-NLS-1$ - ITypeBinding typeBinding = expr.resolveTypeBinding(); - assertNotNull("No binding", typeBinding); //$NON-NLS-1$ - assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - checkSourceRange(expr, "scanner.x < selection.start && selection.start < scanner.y", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression - */ - public void test0191() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0191", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node2; - Expression ex = expressionStatement.getExpression(); - assertTrue("Assignment", ex instanceof Assignment); //$NON-NLS-1$ - Assignment statement = (Assignment) ex; - Expression rightExpr = statement.getRightHandSide(); - assertTrue("Not an infix expression", rightExpr instanceof InfixExpression); //$NON-NLS-1$ - InfixExpression infixExpression = (InfixExpression) rightExpr; - Expression expr = infixExpression.getRightOperand(); - assertNotNull("No right hand side expression", expr); //$NON-NLS-1$ - ITypeBinding typeBinding = expr.resolveTypeBinding(); - assertNotNull("No binding", typeBinding); //$NON-NLS-1$ - assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - checkSourceRange(expr, "2 < 20", source); //$NON-NLS-1$ - } - - /** - * Initializer - */ - public void test0192() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0192", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2; - List fragments = variableDeclarationStatement.fragments(); - assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - Expression initialization = fragment.getInitializer(); - ITypeBinding typeBinding = initialization.resolveTypeBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertTrue(variableBinding.getType() == typeBinding); - checkSourceRange(initialization, "0", source); //$NON-NLS-1$ - } - - /** - * Initializer - */ - public void test0193() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0193", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 1, 0); - assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2; - List fragments = variableDeclarationStatement.fragments(); - assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - Expression initialization = fragment.getInitializer(); - ITypeBinding typeBinding = initialization.resolveTypeBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertTrue(variableBinding.getType() == typeBinding); - checkSourceRange(initialization, "new Inner()", source); //$NON-NLS-1$ - assertEquals("Wrong type", "Inner", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * Initializer - */ - public void test0194() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0194", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 1, 0); - assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2; - List fragments = variableDeclarationStatement.fragments(); - assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - Expression initialization = fragment.getInitializer(); - ITypeBinding typeBinding = initialization.resolveTypeBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertTrue(variableBinding.getType() == typeBinding); - checkSourceRange(initialization, "new Inner[10]", source); //$NON-NLS-1$ - assertTrue("Not an array", typeBinding.isArray()); //$NON-NLS-1$ - assertEquals("Wrong type", "Inner[]", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * Initializer - */ - public void test0195() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0195", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 1, 0, 1); - assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node2; - Expression ex = expressionStatement.getExpression(); - assertTrue("FunctionInvocation", ex instanceof FunctionInvocation); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) ex; - checkSourceRange(methodInvocation, "a.useFile(/*]*/a.getFile()/*[*/)", source); //$NON-NLS-1$ - List list = methodInvocation.arguments(); - assertTrue("Parameter list not empty", list.size() == 1); //$NON-NLS-1$ - Expression parameter = (Expression) list.get(0); - assertTrue("Not a method invocation", parameter instanceof FunctionInvocation); //$NON-NLS-1$ - ITypeBinding typeBinding = parameter.resolveTypeBinding(); - assertNotNull("No binding", typeBinding); //$NON-NLS-1$ - assertEquals("Not a boolean", "File", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - checkSourceRange(parameter, "a.getFile()", source); //$NON-NLS-1$ - } - - /** - * Initializer - */ - public void test0196() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0196", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 1, 2); - assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node2; - Expression ex = expressionStatement.getExpression(); - assertTrue("Assignment", ex instanceof Assignment); //$NON-NLS-1$ - Assignment statement = (Assignment) ex; - Expression rightExpr = statement.getRightHandSide(); - assertTrue("Not an instanceof expression", rightExpr instanceof InstanceofExpression); //$NON-NLS-1$ - ITypeBinding typeBinding = rightExpr.resolveTypeBinding(); - assertNotNull("No binding", typeBinding); //$NON-NLS-1$ - assertEquals("wrong type", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - checkSourceRange(rightExpr, "inner instanceof Inner", source); //$NON-NLS-1$ - } - - /** - * Initializer - */ - public void test0197() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0197", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) result; - assertProblemsSize(unit, 0); - ASTNode node2 = getASTNode(unit, 1, 0, 1); - assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node2; - Expression ex = expressionStatement.getExpression(); - assertTrue("FunctionInvocation", ex instanceof FunctionInvocation); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) ex; - checkSourceRange(methodInvocation, "a.getFile()/*[*/.getName()", source); //$NON-NLS-1$ - Expression receiver = methodInvocation.getExpression(); - assertTrue("Not a method invocation", receiver instanceof FunctionInvocation); //$NON-NLS-1$ - FunctionInvocation methodInvocation2 = (FunctionInvocation) receiver; - ITypeBinding typeBinding = methodInvocation2.resolveTypeBinding(); - assertNotNull("No binding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "File", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - checkSourceRange(methodInvocation2, "a.getFile()", source); //$NON-NLS-1$ - } - - /** - * Initializer - */ - public void test0198() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0198", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("ReturnStatement", node2 instanceof ReturnStatement); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node2; - Expression expr = returnStatement.getExpression(); - assertTrue("Not an infixExpression", expr instanceof InfixExpression); //$NON-NLS-1$ - InfixExpression infixExpression = (InfixExpression) expr; - Expression left = infixExpression.getLeftOperand(); - assertTrue("Not an InfixExpression", left instanceof InfixExpression); //$NON-NLS-1$ - InfixExpression infixExpression2 = (InfixExpression) left; - Expression right = infixExpression2.getRightOperand(); - assertTrue("Not an InfixExpression", right instanceof InfixExpression); //$NON-NLS-1$ - InfixExpression infixExpression3 = (InfixExpression) right; - assertEquals("A multiplication", InfixExpression.Operator.TIMES, infixExpression3.getOperator()); //$NON-NLS-1$ - ITypeBinding typeBinding = infixExpression3.resolveTypeBinding(); - assertNotNull("No binding", typeBinding); //$NON-NLS-1$ - assertEquals("Not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - checkSourceRange(infixExpression3, "20 * 30", source); //$NON-NLS-1$ - } - - /** - * Initializer - */ - public void test0199() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0199", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2; - List fragments = variableDeclarationStatement.fragments(); - assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression initialization = fragment.getInitializer(); - assertTrue("Not an infixExpression", initialization instanceof InfixExpression); //$NON-NLS-1$ - InfixExpression infixExpression = (InfixExpression) initialization; - Expression left = infixExpression.getLeftOperand(); - assertTrue("Not an InfixExpression", left instanceof InfixExpression); //$NON-NLS-1$ - InfixExpression infixExpression2 = (InfixExpression) left; - Expression right = infixExpression2.getRightOperand(); - assertTrue("Not an InfixExpression", right instanceof InfixExpression); //$NON-NLS-1$ - InfixExpression infixExpression3 = (InfixExpression) right; - assertEquals("A multiplication", InfixExpression.Operator.TIMES, infixExpression3.getOperator()); //$NON-NLS-1$ - ITypeBinding typeBinding = infixExpression3.resolveTypeBinding(); - assertNotNull("No binding", typeBinding); //$NON-NLS-1$ - assertEquals("Not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - checkSourceRange(infixExpression3, "10 * 30", source); //$NON-NLS-1$ - } - - /** - * Initializer - */ - public void test0200() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0200", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 1, 0, 0); - assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2; - List fragments = variableDeclarationStatement.fragments(); - assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression initialization = fragment.getInitializer(); - assertTrue("Not an infixExpression", initialization instanceof FieldAccess); //$NON-NLS-1$ - FieldAccess fieldAccess = (FieldAccess) initialization; - Expression receiver = fieldAccess.getExpression(); - assertTrue("ArrayCreation", receiver instanceof ArrayCreation); //$NON-NLS-1$ - ArrayCreation arrayCreation = (ArrayCreation) receiver; - List dimensions = arrayCreation.dimensions(); - assertEquals("Wrong dimension", 1, dimensions.size()); //$NON-NLS-1$ - Expression dim = (Expression) dimensions.get(0); - assertTrue("InfixExpression", dim instanceof InfixExpression); //$NON-NLS-1$ - InfixExpression infixExpression = (InfixExpression) dim; - ITypeBinding typeBinding = infixExpression.resolveTypeBinding(); - assertNotNull("No binding", typeBinding); //$NON-NLS-1$ - assertEquals("Not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - checkSourceRange(infixExpression, "1 + 2", source); //$NON-NLS-1$ - } - - /** - * Position inside for statement: PR 3300 - */ - public void test0201() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0201", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertTrue("ForStatement", node2 instanceof ForStatement); //$NON-NLS-1$ - ForStatement forStatement = (ForStatement) node2; - List initializers = forStatement.initializers(); - assertTrue("wrong size", initializers.size() == 1); //$NON-NLS-1$ - Expression init = (Expression) initializers.get(0); - checkSourceRange(init, "int i= 0", source); //$NON-NLS-1$ - } - - /** - * PR 7386 - */ - public void test0202() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0202", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("FieldDeclaration", node2 instanceof FieldDeclaration); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node2; - checkSourceRange(fieldDeclaration, "int f= (2);", source); //$NON-NLS-1$ - List fragments = fieldDeclaration.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression initialization = fragment.getInitializer(); - assertTrue("Not a parenthesized expression", initialization instanceof ParenthesizedExpression); //$NON-NLS-1$ - checkSourceRange(initialization, "(2)", source); //$NON-NLS-1$ - ITypeBinding typeBinding = initialization.resolveTypeBinding(); - assertNotNull("no binding", typeBinding); //$NON-NLS-1$ - assertEquals("not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * PR 7386 - */ - public void test0203() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0203", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("FieldDeclaration", node2 instanceof FieldDeclaration); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node2; - checkSourceRange(fieldDeclaration, "int f= (2);", source); //$NON-NLS-1$ - List fragments = fieldDeclaration.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression initialization = fragment.getInitializer(); - assertTrue("Not a parenthesized expression", initialization instanceof ParenthesizedExpression); //$NON-NLS-1$ - ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) initialization; - checkSourceRange(parenthesizedExpression, "(2)", source); //$NON-NLS-1$ - Expression expr = parenthesizedExpression.getExpression(); - checkSourceRange(expr, "2", source); //$NON-NLS-1$ - ITypeBinding typeBinding = expr.resolveTypeBinding(); - assertNotNull("no binding", typeBinding); //$NON-NLS-1$ - assertEquals("not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue("type binding is canonical", typeBinding == parenthesizedExpression.resolveTypeBinding()); //$NON-NLS-1$ - } - - /** - * PR 7386 - */ - public void test0204() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0204", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("FieldDeclaration", node2 instanceof FieldDeclaration); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node2; - checkSourceRange(fieldDeclaration, "int f= ((2));", source); //$NON-NLS-1$ - List fragments = fieldDeclaration.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression initialization = fragment.getInitializer(); - assertTrue("Not a parenthesized expression", initialization instanceof ParenthesizedExpression); //$NON-NLS-1$ - ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) initialization; - checkSourceRange(parenthesizedExpression, "((2))", source); //$NON-NLS-1$ - Expression expr = parenthesizedExpression.getExpression(); - assertTrue("Not a parenthesized expression", expr instanceof ParenthesizedExpression); //$NON-NLS-1$ - ParenthesizedExpression parenthesizedExpression2 = (ParenthesizedExpression) expr; - checkSourceRange(parenthesizedExpression2, "(2)", source); //$NON-NLS-1$ - expr = parenthesizedExpression2.getExpression(); - checkSourceRange(expr, "2", source); //$NON-NLS-1$ - ITypeBinding typeBinding = expr.resolveTypeBinding(); - assertNotNull("no binding", typeBinding); //$NON-NLS-1$ - assertEquals("not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - typeBinding = parenthesizedExpression.resolveTypeBinding(); - assertNotNull("no binding", typeBinding); //$NON-NLS-1$ - assertEquals("not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue("type binding is canonical", typeBinding == parenthesizedExpression2.resolveTypeBinding()); //$NON-NLS-1$ - } - - - /** - * Local class end position when trailing comment - */ - public void test0205() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0205", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("TypeDeclarationStatement", node2 instanceof TypeDeclarationStatement); //$NON-NLS-1$ - TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) node2; - AbstractTypeDeclaration typeDeclaration = typeDeclarationStatement.getDeclaration(); - assertEquals("wrong name", "AA", typeDeclaration.getName().getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$ - checkSourceRange(typeDeclaration, "class AA extends Test {}", source); //$NON-NLS-1$ - } - - /** - * QualifiedName - */ - public void test0206() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0206", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 5, 0); - assertTrue("ReturnStatement", node2 instanceof ReturnStatement); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node2; - Expression expr = returnStatement.getExpression(); - assertTrue("Not a qualifiedName", expr instanceof QualifiedName); //$NON-NLS-1$ - QualifiedName qualifiedName = (QualifiedName) expr; - ITypeBinding typeBinding = expr.resolveTypeBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertEquals("Not an int (typeBinding)", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - checkSourceRange(qualifiedName, "field1.field2.field3.field4.i", source); //$NON-NLS-1$ - assertTrue("Not a simple name", qualifiedName.getName().isSimpleName()); //$NON-NLS-1$ - SimpleName simpleName = qualifiedName.getName(); - assertTrue("a declaration", !simpleName.isDeclaration()); //$NON-NLS-1$ - checkSourceRange(simpleName, "i", source); //$NON-NLS-1$ - ITypeBinding typeBinding2 = simpleName.resolveTypeBinding(); - assertNotNull("No typebinding2", typeBinding2); //$NON-NLS-1$ - assertEquals("Not an int (typeBinding2)", "int", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertTrue("VariableBinding", binding instanceof IVariableBinding); //$NON-NLS-1$ - IVariableBinding variableBinding = (IVariableBinding) binding; - assertEquals("Not Test", "Test", variableBinding.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Not default", Modifier.PUBLIC, variableBinding.getModifiers()); //$NON-NLS-1$ - Name qualifierName = qualifiedName.getQualifier(); - assertTrue("Not a qualified name", qualifierName.isQualifiedName()); //$NON-NLS-1$ - checkSourceRange(qualifierName, "field1.field2.field3.field4", source); //$NON-NLS-1$ - ITypeBinding typeBinding5 = qualifierName.resolveTypeBinding(); - assertNotNull("No binding5", typeBinding5); //$NON-NLS-1$ - assertEquals("Not Test", "Test", typeBinding5.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - - qualifiedName = (QualifiedName) qualifierName; - simpleName = qualifiedName.getName(); - checkSourceRange(simpleName, "field4", source); //$NON-NLS-1$ - ITypeBinding typeBinding6 = simpleName.resolveTypeBinding(); - assertNotNull("No binding6", typeBinding6); //$NON-NLS-1$ - assertEquals("Not Test", "Test", typeBinding6.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - - qualifierName = qualifiedName.getQualifier(); - assertTrue("Not a qualified name", qualifierName.isQualifiedName()); //$NON-NLS-1$ - checkSourceRange(qualifierName, "field1.field2.field3", source); //$NON-NLS-1$ - ITypeBinding typeBinding7 = qualifierName.resolveTypeBinding(); - assertNotNull("No binding7", typeBinding7); //$NON-NLS-1$ - assertEquals("Not Test", "Test", typeBinding7.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - - qualifiedName = (QualifiedName) qualifierName; - simpleName = qualifiedName.getName(); - checkSourceRange(simpleName, "field3", source); //$NON-NLS-1$ - qualifierName = qualifiedName.getQualifier(); - assertTrue("Not a qualified name", qualifierName.isQualifiedName()); //$NON-NLS-1$ - checkSourceRange(qualifierName, "field1.field2", source); //$NON-NLS-1$ - ITypeBinding typeBinding3 = qualifierName.resolveTypeBinding(); - assertNotNull("No binding3", typeBinding3); //$NON-NLS-1$ - assertEquals("Not Test", "Test", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - qualifiedName = (QualifiedName) qualifierName; - simpleName = qualifiedName.getName(); - checkSourceRange(simpleName, "field2", source); //$NON-NLS-1$ - qualifierName = qualifiedName.getQualifier(); - assertTrue("Not a simple name", qualifierName.isSimpleName()); //$NON-NLS-1$ - assertTrue("a declaration", !((SimpleName)qualifierName).isDeclaration()); //$NON-NLS-1$ - checkSourceRange(qualifierName, "field1", source); //$NON-NLS-1$ - ITypeBinding typeBinding4 = qualifierName.resolveTypeBinding(); - assertNotNull("No binding4", typeBinding4); //$NON-NLS-1$ - assertEquals("Not Test", "Test", typeBinding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * Check javadoc for FunctionDeclaration - * @deprecated marking deprecated since using deprecated code - */ - public void test0207() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0207", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - JSdoc actualJavadoc = ((FunctionDeclaration) node).getJavadoc(); - checkSourceRange(node, "/** JavaDoc Comment*/\n void foo(final int i) {}", source); //$NON-NLS-1$ - checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$ - } - - /** - * Check javadoc for FunctionDeclaration - */ - public void test0208() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0208", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - JSdoc actualJavadoc = ((FunctionDeclaration) node).getJavadoc(); - assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ - checkSourceRange(node, "void foo(final int i) {}", source); //$NON-NLS-1$ - } - - /** - * Check javadoc for FunctionDeclaration - */ - public void test0209() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0209", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - JSdoc actualJavadoc = ((FunctionDeclaration) node).getJavadoc(); - assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ - checkSourceRange(node, "void foo(final int i) {}", source); //$NON-NLS-1$ - } - - /** - * Check javadoc for FieldDeclaration - * @deprecated marking deprecated since using deprecated code - */ - public void test0210() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0210", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$ -// Javadoc actualJavadoc = ((FieldDeclaration) node).getJavadoc(); - checkSourceRange(node, "/** JavaDoc Comment*/\n int i;", source); //$NON-NLS-1$ - } - - /** - * Check javadoc for FieldDeclaration - */ - public void test0211() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0211", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - JSdoc actualJavadoc = ((FieldDeclaration) node).getJavadoc(); - assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ - checkSourceRange(node, "int i;", source); //$NON-NLS-1$ - } - - /** - * Check javadoc for FieldDeclaration - */ - public void test0212() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0212", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - JSdoc actualJavadoc = ((FieldDeclaration) node).getJavadoc(); - assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ - checkSourceRange(node, "int i;", source); //$NON-NLS-1$ - } - - /** - * Check javadoc for TypeDeclaration - */ - public void test0213() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0213", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - JSdoc actualJavadoc = ((TypeDeclaration) node).getJavadoc(); - assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ - String expectedContents = "public class Test {\n" +//$NON-NLS-1$ - " int i;\n" +//$NON-NLS-1$ - "}";//$NON-NLS-1$ - checkSourceRange(node, expectedContents, source); //$NON-NLS-1$ - } - - /** - * Check javadoc for TypeDeclaration - */ - public void test0214() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0214", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - JSdoc actualJavadoc = ((TypeDeclaration) node).getJavadoc(); - assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ - String expectedContents = "public class Test {\n" +//$NON-NLS-1$ - " int i;\n" +//$NON-NLS-1$ - "}";//$NON-NLS-1$ - checkSourceRange(node, expectedContents, source); //$NON-NLS-1$ - } - - /** - * Check javadoc for TypeDeclaration - * @deprecated marking deprecated since using deprecated code - */ - public void test0215() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0215", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - JSdoc actualJavadoc = ((TypeDeclaration) node).getJavadoc(); - String expectedContents = - "/** JavaDoc Comment*/\n" + //$NON-NLS-1$ - "public class Test {\n" +//$NON-NLS-1$ - " int i;\n" +//$NON-NLS-1$ - "}";//$NON-NLS-1$ - checkSourceRange(node, expectedContents, source); //$NON-NLS-1$ - checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$ - } - - /** - * Check javadoc for MemberTypeDeclaration - * @deprecated marking deprecated since using deprecated code - */ - public void test0216() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0216", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - JSdoc actualJavadoc = ((TypeDeclaration) node).getJavadoc(); - String expectedContents = - "/** JavaDoc Comment*/\n" + //$NON-NLS-1$ - " class B {}";//$NON-NLS-1$ - checkSourceRange(node, expectedContents, source); //$NON-NLS-1$ - checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$ - } - - /** - * Check javadoc for MemberTypeDeclaration - */ - public void test0217() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0217", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - JSdoc actualJavadoc = ((TypeDeclaration) node).getJavadoc(); - assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ - checkSourceRange(node, "class B {}", source); //$NON-NLS-1$ - } - - /** - * Check javadoc for MemberTypeDeclaration - */ - public void test0218() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0218", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - JSdoc actualJavadoc = ((TypeDeclaration) node).getJavadoc(); - assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ - checkSourceRange(node, "public static class B {}", source); //$NON-NLS-1$ - } - - /** - * Check javadoc for MemberTypeDeclaration - */ - public void test0219() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0219", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - JSdoc actualJavadoc = ((TypeDeclaration) node).getJavadoc(); - assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ - checkSourceRange(node, "public static class B {}", source); //$NON-NLS-1$ - } - - /** - * Checking initializers - */ - public void test0220() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0220", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - checkSourceRange(node, "{}", source); //$NON-NLS-1$ - } - - /** - * Checking initializers - */ - public void test0221() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0221", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - checkSourceRange(node, "static {}", source); //$NON-NLS-1$ - } - - /** - * Checking initializers - * @deprecated marking deprecated since using deprecated code - */ - public void test0222() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0222", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - JSdoc actualJavadoc = ((Initializer) node).getJavadoc(); - assertNotNull("Javadoc comment should no be null", actualJavadoc); //$NON-NLS-1$ - String expectedContents = - "/** JavaDoc Comment*/\n" + //$NON-NLS-1$ - " static {}";//$NON-NLS-1$ - checkSourceRange(node, expectedContents, source); //$NON-NLS-1$ - checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$ - - } - - /** - * Checking initializers - * @deprecated marking deprecated since using deprecated code - */ - public void test0223() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0223", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - JSdoc actualJavadoc = ((Initializer) node).getJavadoc(); - assertNotNull("Javadoc comment should not be null", actualJavadoc); //$NON-NLS-1$ - String expectedContents = - "/** JavaDoc Comment*/\n" + //$NON-NLS-1$ - " {}";//$NON-NLS-1$ - checkSourceRange(node, expectedContents, source); //$NON-NLS-1$ - checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$ - - } - - /** - * Checking initializers - */ - public void test0224() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0224", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - JSdoc actualJavadoc = ((Initializer) node).getJavadoc(); - assertNull("Javadoc comment should be null", actualJavadoc); //$NON-NLS-1$ - checkSourceRange(node, "{}", source); //$NON-NLS-1$ - } - - /** - * Continue ==> ContinueStatement - */ - public void test0225() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0225", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - LabeledStatement labeledStatement = (LabeledStatement) getASTNode((JavaScriptUnit) result, 0, 0, 0); - checkSourceRange(labeledStatement.getLabel(), "label", source); //$NON-NLS-1$ - ForStatement forStatement = (ForStatement) labeledStatement.getBody(); - ContinueStatement statement = (ContinueStatement) ((Block) forStatement.getBody()).statements().get(0); - assertNotNull("Expression should not be null", statement); //$NON-NLS-1$ - ContinueStatement continueStatement = this.ast.newContinueStatement(); - continueStatement.setLabel(this.ast.newSimpleName("label")); //$NON-NLS-1$ - assertTrue("Both AST trees should be identical", continueStatement.subtreeMatch(new ASTMatcher(), statement)); //$NON-NLS-1$ - checkSourceRange(statement, "continue label;", source); //$NON-NLS-1$ - checkSourceRange(statement.getLabel(), "label", source); //$NON-NLS-1$ - } - - /** - * Break + label ==> BreakStatement - */ - public void test0226() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0226", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - LabeledStatement labeledStatement = (LabeledStatement) getASTNode((JavaScriptUnit) result, 0, 0, 0); - checkSourceRange(labeledStatement.getLabel(), "label", source); //$NON-NLS-1$ - ForStatement forStatement = (ForStatement) labeledStatement.getBody(); - BreakStatement statement = (BreakStatement) ((Block) forStatement.getBody()).statements().get(0); - assertNotNull("Expression should not be null", statement); //$NON-NLS-1$ - BreakStatement breakStatement = this.ast.newBreakStatement(); - breakStatement.setLabel(this.ast.newSimpleName("label")); //$NON-NLS-1$ - assertTrue("Both AST trees should be identical", breakStatement.subtreeMatch(new ASTMatcher(), statement)); //$NON-NLS-1$ - checkSourceRange(statement, "break label;", source); //$NON-NLS-1$ - checkSourceRange(statement.getLabel(), "label", source); //$NON-NLS-1$ - } - - /** - * QualifiedName - */ - public void test0227() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0227", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 3, 2, 0); - assertTrue("ReturnStatement", node2 instanceof ReturnStatement); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node2; - Expression expr = returnStatement.getExpression(); - assertTrue("Not a qualifiedName", expr instanceof QualifiedName); //$NON-NLS-1$ - QualifiedName qualifiedName = (QualifiedName) expr; - ITypeBinding typeBinding = expr.resolveTypeBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertEquals("Not an long (typeBinding)", "long", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - checkSourceRange(qualifiedName, "field.fB.fA.j", source); //$NON-NLS-1$ - - SimpleName simpleName = qualifiedName.getName(); - checkSourceRange(simpleName, "j", source); //$NON-NLS-1$ - ITypeBinding typeBinding2 = simpleName.resolveTypeBinding(); - assertEquals("Not an long (typeBinding2)", "long", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertTrue("VariableBinding", binding instanceof IVariableBinding); //$NON-NLS-1$ - IVariableBinding variableBinding = (IVariableBinding) binding; - assertEquals("Not A", "A", variableBinding.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Not default", Modifier.NONE, variableBinding.getModifiers()); //$NON-NLS-1$ - assertEquals("wrong name", "j", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - - Name qualifierName = qualifiedName.getQualifier(); - assertTrue("Not a qualified name", qualifierName.isQualifiedName()); //$NON-NLS-1$ - checkSourceRange(qualifierName, "field.fB.fA", source); //$NON-NLS-1$ - qualifiedName = (QualifiedName) qualifierName; - ITypeBinding typeBinding3 = qualifiedName.resolveTypeBinding(); - assertNotNull("No type binding3", typeBinding3); //$NON-NLS-1$ - assertEquals("Not an A", "A", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - simpleName = qualifiedName.getName(); - checkSourceRange(simpleName, "fA", source); //$NON-NLS-1$ - ITypeBinding typeBinding4 = simpleName.resolveTypeBinding(); - assertNotNull("No typeBinding4", typeBinding4); //$NON-NLS-1$ - assertEquals("Not an A", "A", typeBinding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - IBinding binding2 = qualifiedName.resolveBinding(); - assertNotNull("No binding2", binding2); //$NON-NLS-1$ - assertTrue("VariableBinding", binding2 instanceof IVariableBinding); //$NON-NLS-1$ - IVariableBinding variableBinding2 = (IVariableBinding) binding2; - assertEquals("Not B", "B", variableBinding2.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Not default", Modifier.NONE, variableBinding2.getModifiers()); //$NON-NLS-1$ - assertEquals("wrong name", "fA", variableBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - - qualifierName = qualifiedName.getQualifier(); - assertTrue("Not a qualified name", qualifierName.isQualifiedName()); //$NON-NLS-1$ - checkSourceRange(qualifierName, "field.fB", source); //$NON-NLS-1$ - qualifiedName = (QualifiedName) qualifierName; - ITypeBinding typeBinding5 = qualifiedName.resolveTypeBinding(); - assertNotNull("No typeBinding5", typeBinding5); //$NON-NLS-1$ - assertEquals("Not a B", "B", typeBinding5.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - simpleName = qualifiedName.getName(); - checkSourceRange(simpleName, "fB", source); //$NON-NLS-1$ - ITypeBinding typeBinding6 = simpleName.resolveTypeBinding(); - assertNotNull("No typebinding6", typeBinding6); //$NON-NLS-1$ - assertEquals("not a B", "B", typeBinding6.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - IBinding binding3 = qualifiedName.resolveBinding(); - assertNotNull("No binding2", binding3); //$NON-NLS-1$ - assertTrue("VariableBinding", binding3 instanceof IVariableBinding); //$NON-NLS-1$ - IVariableBinding variableBinding3 = (IVariableBinding) binding3; - assertEquals("Not C", "C", variableBinding3.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Not default", Modifier.NONE, variableBinding3.getModifiers()); //$NON-NLS-1$ - assertEquals("wrong name", "fB", variableBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - - qualifierName = qualifiedName.getQualifier(); - assertTrue("Not a simple name", qualifierName.isSimpleName()); //$NON-NLS-1$ - checkSourceRange(qualifierName, "field", source); //$NON-NLS-1$ - simpleName = (SimpleName) qualifierName; - ITypeBinding typeBinding7 = simpleName.resolveTypeBinding(); - assertNotNull("No typeBinding7", typeBinding7); //$NON-NLS-1$ - assertEquals("Not a C", "C", typeBinding7.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - IBinding binding4 = simpleName.resolveBinding(); - assertNotNull("No binding4", binding4); //$NON-NLS-1$ - assertTrue("VariableBinding", binding4 instanceof IVariableBinding); //$NON-NLS-1$ - IVariableBinding variableBinding4 = (IVariableBinding) binding4; - assertEquals("Not Test", "Test", variableBinding4.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Not public", Modifier.PUBLIC, variableBinding4.getModifiers()); //$NON-NLS-1$ - assertEquals("wrong name", "field", variableBinding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("wrong return type", "C", variableBinding4.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * QualifiedName as TypeReference - */ - public void test0228() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0228", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 1, 0); - assertTrue("ReturnStatement", node2 instanceof ReturnStatement); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node2; - Expression expr = returnStatement.getExpression(); - checkSourceRange(expr, "test0228.Test.foo()", source); //$NON-NLS-1$ - assertTrue("FunctionInvocation", expr instanceof FunctionInvocation); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expr; - Expression qualifier = methodInvocation.getExpression(); - assertNotNull("no qualifier", qualifier); //$NON-NLS-1$ - assertTrue("QualifiedName", qualifier instanceof QualifiedName); //$NON-NLS-1$ - QualifiedName qualifiedName = (QualifiedName) qualifier; - checkSourceRange(qualifiedName, "test0228.Test", source); //$NON-NLS-1$ - ITypeBinding typeBinding = qualifiedName.resolveTypeBinding(); - assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong type", "Test", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - IBinding binding = qualifiedName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertEquals("Not a type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$ - - } - - /** - * FunctionInvocation - */ - public void test0229() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0229", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node2; - Expression expr = expressionStatement.getExpression(); - assertTrue("FunctionInvocation", expr instanceof FunctionInvocation); //$NON-NLS-1$ - checkSourceRange(expr, "System.err.println()", source); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expr; - Expression qualifier = methodInvocation.getExpression(); - assertTrue("QualifiedName", qualifier instanceof QualifiedName); //$NON-NLS-1$ - QualifiedName qualifiedName = (QualifiedName) qualifier; - ITypeBinding typeBinding = qualifier.resolveTypeBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "PrintStream", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - IBinding binding = qualifiedName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertTrue("VariableBinding", binding instanceof IVariableBinding); //$NON-NLS-1$ - IVariableBinding variableBinding = (IVariableBinding) binding; - assertEquals("wrong name", "err", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - SimpleName methodName = methodInvocation.getName(); - IBinding binding2 = methodName.resolveBinding(); - assertNotNull("No binding2", binding2); //$NON-NLS-1$ - } - - /** - * FunctionInvocation - */ - public void test0230() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0230", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 1, 0); - assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node2; - Expression expr = expressionStatement.getExpression(); - assertTrue("FunctionInvocation", expr instanceof FunctionInvocation); //$NON-NLS-1$ - checkSourceRange(expr, "err.println()", source); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expr; - Expression qualifier = methodInvocation.getExpression(); - assertTrue("SimpleName", qualifier instanceof SimpleName); //$NON-NLS-1$ - SimpleName name = (SimpleName) qualifier; - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertEquals("Wrong name", "err", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - ITypeBinding typeBinding = name.resolveTypeBinding(); - assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ - assertEquals("Wron type name", "PrintStream", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * FunctionInvocation - */ - public void test0231() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0231", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node2; - Expression expr = expressionStatement.getExpression(); - assertTrue("FunctionInvocation", expr instanceof FunctionInvocation); //$NON-NLS-1$ - checkSourceRange(expr, "System.err.println()", source); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expr; - Expression qualifier = methodInvocation.getExpression(); - assertTrue("QualifiedName", qualifier instanceof QualifiedName); //$NON-NLS-1$ - QualifiedName qualifiedName = (QualifiedName) qualifier; - ITypeBinding typeBinding = qualifier.resolveTypeBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "PrintStream", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - IBinding binding = qualifiedName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertTrue("VariableBinding", binding instanceof IVariableBinding); //$NON-NLS-1$ - IVariableBinding variableBinding = (IVariableBinding) binding; - assertEquals("wrong name", "err", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - SimpleName methodName = methodInvocation.getName(); - IBinding binding2 = methodName.resolveBinding(); - assertNotNull("No binding2", binding2); //$NON-NLS-1$ - Name name = qualifiedName.getQualifier(); - assertTrue("SimpleName", name.isSimpleName()); //$NON-NLS-1$ - SimpleName simpleName = (SimpleName) name; - ITypeBinding typeBinding2 = simpleName.resolveTypeBinding(); - assertNotNull("No typeBinding2", typeBinding2); //$NON-NLS-1$ - assertEquals("wrong type name", "System", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * FunctionInvocation - */ - public void test0232() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0232", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2; - List fragments = variableDeclarationStatement.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression initialization = variableDeclarationFragment.getInitializer(); - ITypeBinding typeBinding = initialization.resolveTypeBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertTrue("Not a primitive type", typeBinding.isPrimitive()); //$NON-NLS-1$ - assertEquals("wrong name", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue("QualifiedName", initialization instanceof QualifiedName); //$NON-NLS-1$ - QualifiedName qualifiedName = (QualifiedName) initialization; - SimpleName simpleName = qualifiedName.getName(); - ITypeBinding typeBinding2 = simpleName.resolveTypeBinding(); - assertNotNull("No type binding", typeBinding2); //$NON-NLS-1$ - assertTrue("Not a primitive type", typeBinding2.isPrimitive()); //$NON-NLS-1$ - assertEquals("wrong name", "int", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertTrue("IVariableBinding", binding instanceof IVariableBinding); //$NON-NLS-1$ - IVariableBinding variableBinding = (IVariableBinding) binding; - assertNull("No declaring class", variableBinding.getDeclaringClass()); //$NON-NLS-1$ - } - - /** - * Checking that only syntax errors are reported for the MALFORMED tag - */ - public void test0233() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0233", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("Expression should not be null", result); //$NON-NLS-1$ - assertTrue("The compilation unit is malformed", !isMalformed(result)); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("The fiels is not malformed", !isMalformed(node)); //$NON-NLS-1$ - assertEquals("No problem found", 1, unit.getMessages().length); //$NON-NLS-1$ - assertEquals("No problem found", 1, unit.getProblems().length); //$NON-NLS-1$ - } - - /** - * Checking that null is returned for a resolveBinding if the type is unknown - */ - public void test0234() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0234", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("The fiels is not malformed", !isMalformed(node)); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("No problem found", 1, unit.getMessages().length); //$NON-NLS-1$ - assertEquals("No problem found", 1, unit.getProblems().length); //$NON-NLS-1$ - assertTrue("FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - List fragments = fieldDeclaration.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - assertNull("binding not null", variableBinding); //$NON-NLS-1$ - } - - /** - * Checking that null is returned for a resolveBinding if the type is unknown - */ - public void test0235() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0235", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("The fiels is not malformed", !isMalformed(node)); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("problems found", 0, unit.getMessages().length); //$NON-NLS-1$ - assertEquals("problems found", 0, unit.getProblems().length); //$NON-NLS-1$ - assertTrue("FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - List fragments = fieldDeclaration.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=9452 - */ - public void test0237() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "junit.framework", "TestCase.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - } - - /** - * Check ThisExpression - */ - public void test0238() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0238", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - char[] source = sourceUnit.getSource().toCharArray(); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("Not a type declaration statement", node instanceof TypeDeclarationStatement); //$NON-NLS-1$ - TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) node; - AbstractTypeDeclaration typeDecl = typeDeclarationStatement.getDeclaration(); - Object o = typeDecl.bodyDeclarations().get(0); - assertTrue("Not a method", o instanceof FunctionDeclaration); //$NON-NLS-1$ - FunctionDeclaration methodDecl = (FunctionDeclaration) o; - Block block = methodDecl.getBody(); - List statements = block.statements(); - assertEquals("Not 1", 1, statements.size()); //$NON-NLS-1$ - Statement stmt = (Statement) statements.get(0); - assertTrue("Not a return statement", stmt instanceof ReturnStatement); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) stmt; - Expression expr = returnStatement.getExpression(); - assertTrue("Not a method invocation", expr instanceof FunctionInvocation); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expr; - checkSourceRange(methodInvocation, "Test.this.bar()", source); //$NON-NLS-1$ - Expression qualifier = methodInvocation.getExpression(); - assertTrue("Not a ThisExpression", qualifier instanceof ThisExpression); //$NON-NLS-1$ - ThisExpression thisExpression = (ThisExpression) qualifier; - Name name = thisExpression.getQualifier(); - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertEquals("wrong name", "Test", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * Check ThisExpression - */ - public void test0239() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0239", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0, 0); - assertTrue("Not a type declaration statement", node instanceof TypeDeclarationStatement); //$NON-NLS-1$ - TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) node; - AbstractTypeDeclaration typeDecl = typeDeclarationStatement.getDeclaration(); - Object o = typeDecl.bodyDeclarations().get(0); - assertTrue("Not a method", o instanceof FunctionDeclaration); //$NON-NLS-1$ - FunctionDeclaration methodDecl = (FunctionDeclaration) o; - Block block = methodDecl.getBody(); - List statements = block.statements(); - assertEquals("Not 1", 1, statements.size()); //$NON-NLS-1$ - Statement stmt = (Statement) statements.get(0); - assertTrue("Not a return statement", stmt instanceof ReturnStatement); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) stmt; - Expression expr = returnStatement.getExpression(); - assertTrue("Not a SuperMethodInvocation", expr instanceof SuperMethodInvocation); //$NON-NLS-1$ - SuperMethodInvocation superMethodInvocation = (SuperMethodInvocation) expr; - Name name = superMethodInvocation.getQualifier(); - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertTrue("A type binding", binding instanceof ITypeBinding); //$NON-NLS-1$ - assertEquals("Not Test", "Test", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - Name methodName = superMethodInvocation.getName(); - IBinding binding2 = methodName.resolveBinding(); - assertNotNull("No binding2", binding2); //$NON-NLS-1$ - assertTrue("No an IFunctionBinding", binding2 instanceof IFunctionBinding); //$NON-NLS-1$ - IFunctionBinding methodBinding = (IFunctionBinding) binding2; - assertEquals("Not bar", "bar", methodBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Not T", "T", methodBinding.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * Check FieldAccess - */ - public void test0240() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0240", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("Not a type declaration statement", node instanceof TypeDeclarationStatement); //$NON-NLS-1$ - TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) node; - AbstractTypeDeclaration typeDecl = typeDeclarationStatement.getDeclaration(); - Object o = typeDecl.bodyDeclarations().get(0); - assertTrue("Not a method", o instanceof FunctionDeclaration); //$NON-NLS-1$ - FunctionDeclaration methodDecl = (FunctionDeclaration) o; - Block block = methodDecl.getBody(); - List statements = block.statements(); - assertEquals("Not 1", 1, statements.size()); //$NON-NLS-1$ - Statement stmt = (Statement) statements.get(0); - assertTrue("Not a return statement", stmt instanceof ReturnStatement); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) stmt; - Expression expr = returnStatement.getExpression(); - assertTrue("Not a field access", expr instanceof FieldAccess); //$NON-NLS-1$ - FieldAccess fieldAccess = (FieldAccess) expr; - Expression qualifier = fieldAccess.getExpression(); - assertTrue("Not a ThisExpression", qualifier instanceof ThisExpression); //$NON-NLS-1$ - ThisExpression thisExpression = (ThisExpression) qualifier; - Name name = thisExpression.getQualifier(); - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertEquals("Not Test", "Test", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - Name fieldName = fieldAccess.getName(); - IBinding binding2 = fieldName.resolveBinding(); - assertNotNull("No binding2", binding2); //$NON-NLS-1$ - assertEquals("Wrong name", "f", binding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Wrong modifier", Modifier.PUBLIC, binding2.getModifiers()); //$NON-NLS-1$ - ITypeBinding typeBinding = fieldName.resolveTypeBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertEquals("Not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * Check order of body declarations - */ - public void test0241() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0241", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0); - assertTrue("Not a type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - assertTrue("Not a declaration", ((TypeDeclaration) node).getName().isDeclaration()); //$NON-NLS-1$ - assertEquals("Wrong size", 11, ((TypeDeclaration)node).bodyDeclarations().size()); //$NON-NLS-1$ - node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - node = getASTNode((JavaScriptUnit) result, 0, 1); - assertTrue("Not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - node = getASTNode((JavaScriptUnit) result, 0, 2); - assertTrue("Not a Type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - node = getASTNode((JavaScriptUnit) result, 0, 3); - assertTrue("Not a Type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - node = getASTNode((JavaScriptUnit) result, 0, 4); - assertTrue("Not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - node = getASTNode((JavaScriptUnit) result, 0, 5); - assertTrue("Not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - node = getASTNode((JavaScriptUnit) result, 0, 6); - assertTrue("Not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - node = getASTNode((JavaScriptUnit) result, 0, 7); - assertTrue("Not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - node = getASTNode((JavaScriptUnit) result, 0, 8); - assertTrue("Not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - node = getASTNode((JavaScriptUnit) result, 0, 9); - assertTrue("Not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - node = getASTNode((JavaScriptUnit) result, 0, 10); - assertTrue("Not a Type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - } - - /** - * Check ThisExpression - */ - public void test0242() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0242", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0, 0); - assertTrue("Not a type declaration statement", node instanceof TypeDeclarationStatement); //$NON-NLS-1$ - TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) node; - AbstractTypeDeclaration typeDecl = typeDeclarationStatement.getDeclaration(); - Object o = typeDecl.bodyDeclarations().get(0); - assertTrue("Not a method", o instanceof FunctionDeclaration); //$NON-NLS-1$ - FunctionDeclaration methodDecl = (FunctionDeclaration) o; - Block block = methodDecl.getBody(); - List statements = block.statements(); - assertEquals("Not 1", 1, statements.size()); //$NON-NLS-1$ - Statement stmt = (Statement) statements.get(0); - assertTrue("Not a return statement", stmt instanceof ReturnStatement); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) stmt; - Expression expr = returnStatement.getExpression(); - assertTrue("Not a SuperFieldAccess", expr instanceof SuperFieldAccess); //$NON-NLS-1$ - SuperFieldAccess superFieldAccess = (SuperFieldAccess) expr; - Name name = superFieldAccess.getQualifier(); - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertTrue("A type binding", binding instanceof ITypeBinding); //$NON-NLS-1$ - assertEquals("Not Test", "Test", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - Name fieldName = superFieldAccess.getName(); - IBinding binding2 = fieldName.resolveBinding(); - assertNotNull("No binding2", binding2); //$NON-NLS-1$ - assertTrue("No an IVariableBinding", binding2 instanceof IVariableBinding); //$NON-NLS-1$ - IVariableBinding variableBinding = (IVariableBinding) binding2; - assertEquals("Not f", "f", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Not T", "T", variableBinding.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - ITypeBinding typeBinding2 = fieldName.resolveTypeBinding(); - assertNotNull("No type binding", typeBinding2); //$NON-NLS-1$ - assertEquals("Not int", "int", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * Check catch clause positions: - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10570 - */ - public void test0243() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0243", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("Not a try statement", node instanceof TryStatement); //$NON-NLS-1$ - TryStatement tryStatement = (TryStatement) node; - List catchClauses = tryStatement.catchClauses(); - assertEquals("wrong size", 1, catchClauses.size()); //$NON-NLS-1$ - CatchClause catchClause = (CatchClause) catchClauses.get(0); - checkSourceRange(catchClause, "catch (Exception e){m();}", source); //$NON-NLS-1$ - } - - /** - * Check catch clause positions: - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10570 - */ - public void test0244() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0244", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("Not a try statement", node instanceof TryStatement); //$NON-NLS-1$ - TryStatement tryStatement = (TryStatement) node; - List catchClauses = tryStatement.catchClauses(); - assertEquals("wrong size", 2, catchClauses.size()); //$NON-NLS-1$ - CatchClause catchClause = (CatchClause) catchClauses.get(0); - checkSourceRange(catchClause, "catch (RuntimeException e){m();}", source); //$NON-NLS-1$ - catchClause = (CatchClause) catchClauses.get(1); - checkSourceRange(catchClause, "catch(Exception e) {}", source); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=10587 - */ - public void test0245() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0245", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node; - Expression expr = returnStatement.getExpression(); - assertTrue("not a name", expr instanceof Name); //$NON-NLS-1$ - Name name = (Name) expr; - IBinding binding = name.resolveBinding(); - assertTrue("Not a variable binding", binding instanceof IVariableBinding); //$NON-NLS-1$ - IVariableBinding variableBinding = (IVariableBinding) binding; - assertEquals("Not i", "i", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Not int", "int", variableBinding.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - ASTNode declaringNode = unit.findDeclaringNode(variableBinding); - assertNotNull("No declaring node", declaringNode); //$NON-NLS-1$ - assertTrue("Not a VariableDeclarationFragment", declaringNode instanceof VariableDeclarationFragment); //$NON-NLS-1$ - } - - /** - * Test binding resolution for import declaration - */ - public void test0246() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0246", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - List imports = unit.imports(); - assertEquals("wrong imports size", 2, imports.size()); //$NON-NLS-1$ - ImportDeclaration importDeclaration = (ImportDeclaration) imports.get(0); - assertTrue("Not on demand", importDeclaration.isOnDemand()); //$NON-NLS-1$ - checkSourceRange(importDeclaration, "import java.util.*;", source); //$NON-NLS-1$ - IBinding binding = importDeclaration.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertEquals("Wrong type", IBinding.PACKAGE, binding.getKind()); //$NON-NLS-1$ - assertEquals("Wrong name", "java.util", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - importDeclaration = (ImportDeclaration) imports.get(1); - assertTrue("On demand", !importDeclaration.isOnDemand()); //$NON-NLS-1$ - checkSourceRange(importDeclaration, "import java.io.IOException;", source); //$NON-NLS-1$ - binding = importDeclaration.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$ - assertEquals("Wrong name", "IOException", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * Test binding resolution for import declaration - */ - public void test0247() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0247", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - PackageDeclaration packageDeclaration = unit.getPackage(); - checkSourceRange(packageDeclaration, "package test0247;", source); //$NON-NLS-1$ - IPackageBinding binding = packageDeclaration.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertEquals("Wrong type", IBinding.PACKAGE, binding.getKind()); //$NON-NLS-1$ - assertEquals("Wrong name", "test0247", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10592 - */ - public void test0248() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0248", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - List parameters = methodDeclaration.parameters(); - assertEquals("wrong size", 1, parameters.size()); //$NON-NLS-1$ - SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0); - Name name = singleVariableDeclaration.getName(); - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertTrue("Not a variable binding", binding instanceof IVariableBinding); //$NON-NLS-1$ - IVariableBinding variableBinding = (IVariableBinding) binding; - assertEquals("Wrong name", "i", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Wrong type", "int", variableBinding.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10592 - */ - public void test0249() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0249", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 2, 1); - assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertTrue("Not an assignment", expression instanceof Assignment); //$NON-NLS-1$ - Assignment assignment = (Assignment) expression; - Expression leftHandSide = assignment.getLeftHandSide(); - assertTrue("Not a qualified name", leftHandSide instanceof QualifiedName); //$NON-NLS-1$ - QualifiedName qualifiedName = (QualifiedName) leftHandSide; - Name simpleName = qualifiedName.getName(); - IBinding binding = simpleName.resolveBinding(); - assertNotNull("no binding", binding); //$NON-NLS-1$ - assertTrue("Not a IVariableBinding", binding instanceof IVariableBinding); //$NON-NLS-1$ - IVariableBinding variableBinding = (IVariableBinding) binding; - assertEquals("Wrong name", "k", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Wrong modifier", Modifier.STATIC, variableBinding.getModifiers()); //$NON-NLS-1$ - assertEquals("Wrong type", "int", variableBinding.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Wrong declaring class name", "j", variableBinding.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10592 - */ - public void test0250() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0250", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - List parameters = methodDeclaration.parameters(); - assertEquals("wrong size", 2, parameters.size()); //$NON-NLS-1$ - SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0); - Name name = singleVariableDeclaration.getName(); - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertTrue("Not a variable binding", binding instanceof IVariableBinding); //$NON-NLS-1$ - IVariableBinding variableBinding = (IVariableBinding) binding; - assertEquals("Wrong name", "i", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Wrong type", "int", variableBinding.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * Check qualified name resolution for static fields - */ - public void test0251() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0251", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("Not a ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertTrue("Not a method invocation", expression instanceof FunctionInvocation); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - checkSourceRange(methodInvocation, "java.lang.System.out.println()", source); //$NON-NLS-1$ - Expression qualifier = methodInvocation.getExpression(); - assertTrue("Not a qualified name", qualifier instanceof QualifiedName); //$NON-NLS-1$ - checkSourceRange(qualifier, "java.lang.System.out", source); //$NON-NLS-1$ - QualifiedName qualifiedName = (QualifiedName) qualifier; - Name typeName = qualifiedName.getQualifier(); - assertTrue("Not a QualifiedName", typeName instanceof QualifiedName); //$NON-NLS-1$ - QualifiedName qualifiedTypeName = (QualifiedName) typeName; - IBinding binding = qualifiedTypeName.getName().resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertEquals("Wrong name", "System", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - binding = qualifiedTypeName.getQualifier().resolveBinding(); - assertNotNull("No binding2", binding); //$NON-NLS-1$ - assertEquals("Wrong type binding", IBinding.PACKAGE, binding.getKind()); //$NON-NLS-1$ - } - - /** - * Check binding for anonymous class - */ - public void test0252() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0252", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node; - Expression expression = returnStatement.getExpression(); - assertTrue("Not a classinstancecreation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression; - IFunctionBinding methodBinding = classInstanceCreation.resolveConstructorBinding(); - assertNotNull("No methodBinding", methodBinding); //$NON-NLS-1$ - assertTrue("Not a constructor", methodBinding.isConstructor()); //$NON-NLS-1$ - assertTrue("Not an anonymous class", methodBinding.getDeclaringClass().isAnonymous()); //$NON-NLS-1$ - assertEquals("Not an anonymous class of java.lang.Object", "Object", methodBinding.getDeclaringClass().getSuperclass().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Not an anonymous class of java.lang.Object", "java.lang", methodBinding.getDeclaringClass().getSuperclass().getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * Check binding for allocation expression - */ - public void test0253() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0253", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node; - Expression expression = returnStatement.getExpression(); - assertTrue("Not a classinstancecreation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression; - IFunctionBinding methodBinding = classInstanceCreation.resolveConstructorBinding(); - assertNotNull("No methodBinding", methodBinding); //$NON-NLS-1$ - assertTrue("Not a constructor", methodBinding.isConstructor()); //$NON-NLS-1$ - assertEquals("Wrong size", 1, methodBinding.getParameterTypes().length); //$NON-NLS-1$ - assertEquals("Wrong type", "String", methodBinding.getParameterTypes()[0].getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * Check binding for allocation expression - */ - public void test0254() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0254", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 1, 0); - assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node; - Expression expression = returnStatement.getExpression(); - assertTrue("Not a class instance creation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression; - IFunctionBinding binding = classInstanceCreation.resolveConstructorBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertEquals("wrong type", "C", binding.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - - /** - * Check binding for allocation expression - */ - public void test0255() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0255", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertTrue("Not a FunctionInvocation", expression instanceof FunctionInvocation); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - List arguments = methodInvocation.arguments(); - assertEquals("wrong size", 1, arguments.size()); //$NON-NLS-1$ - } - - /** - * Check binding for allocation expression - */ - public void test0256() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0256", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertTrue("Not a FunctionInvocation", expression instanceof FunctionInvocation); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - List arguments = methodInvocation.arguments(); - assertEquals("wrong size", 1, arguments.size()); //$NON-NLS-1$ - } - - /** - * Check binding for allocation expression - */ - public void test0257() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0257", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertTrue("Not a FunctionInvocation", expression instanceof FunctionInvocation); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - List arguments = methodInvocation.arguments(); - assertEquals("wrong size", 1, arguments.size()); //$NON-NLS-1$ - } - - /** - * Check binding for allocation expression - */ - public void test0258() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0258", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertTrue("Not a FunctionInvocation", expression instanceof FunctionInvocation); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - List arguments = methodInvocation.arguments(); - assertEquals("wrong size", 1, arguments.size()); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10663 - */ - public void test0259() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0259", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10592 - */ - public void test0260() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0260", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - List parameters = methodDeclaration.parameters(); - assertEquals("wrong size", 2, parameters.size()); //$NON-NLS-1$ - SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0); - IBinding binding = singleVariableDeclaration.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - Name name = singleVariableDeclaration.getName(); - assertTrue("Not a simple name", name instanceof SimpleName); //$NON-NLS-1$ - SimpleName simpleName = (SimpleName) name; - assertEquals("Wrong name", "i", simpleName.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$ - IBinding binding2 = name.resolveBinding(); - assertNotNull("No binding", binding2); //$NON-NLS-1$ - assertTrue("binding == binding2", binding == binding2); //$NON-NLS-1$ - assertTrue("Not a variable binding", binding2 instanceof IVariableBinding); //$NON-NLS-1$ - IVariableBinding variableBinding = (IVariableBinding) binding2; - assertEquals("Wrong name", "i", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Wrong type", "int", variableBinding.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10679 - */ - public void test0261() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0261", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("Wrong msg size", 1, compilationUnit.getMessages().length); //$NON-NLS-1$ - assertEquals("Wrong pb size", 1, compilationUnit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node; - Expression expression = returnStatement.getExpression(); - ITypeBinding binding = expression.resolveTypeBinding(); - assertNull("got a binding", binding); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10676 - */ - public void test0262() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0262", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expr = expressionStatement.getExpression(); - assertTrue("Not a FunctionInvocation", expr instanceof FunctionInvocation); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expr; - List arguments = methodInvocation.arguments(); - assertEquals("Wrong argument list size", 1, arguments.size()); //$NON-NLS-1$ - Expression expr2 = (Expression) arguments.get(0); - assertTrue("Not a class instance creation", expr2 instanceof ClassInstanceCreation); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expr2; - arguments = classInstanceCreation.arguments(); - assertEquals("Wrong size", 1, arguments.size()); //$NON-NLS-1$ - Expression expression2 = (Expression) arguments.get(0); - assertTrue("Not a string literal", expression2 instanceof StringLiteral); //$NON-NLS-1$ - StringLiteral stringLiteral = (StringLiteral) expression2; - ITypeBinding typeBinding = stringLiteral.resolveTypeBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "String", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10700 - */ - public void test0263() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0263", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expr = expressionStatement.getExpression(); - assertTrue("Not a FunctionInvocation", expr instanceof FunctionInvocation); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expr; - List arguments = methodInvocation.arguments(); - assertEquals("Wrong argument list size", 1, arguments.size()); //$NON-NLS-1$ - Expression expr2 = (Expression) arguments.get(0); - assertTrue("Not a simple name", expr2 instanceof SimpleName); //$NON-NLS-1$ - SimpleName simpleName = (SimpleName) expr2; - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10699 - */ - public void test0264() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0264", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - List fragments = variableDeclarationStatement.fragments(); - assertEquals("Wrong fragment size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - assertTrue("Not a classinstancecreation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression; - AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration(); - assertNotNull("No anonymousclassdeclaration", anonymousClassDeclaration); //$NON-NLS-1$ - String expectedSourceRange = - "{\n"+ //$NON-NLS-1$ - " void m(int k){\n"+ //$NON-NLS-1$ - " k= i;\n"+ //$NON-NLS-1$ - " }\n"+ //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(anonymousClassDeclaration, expectedSourceRange, source); - List bodyDeclarations = anonymousClassDeclaration.bodyDeclarations(); - assertEquals("Wrong size", 1, bodyDeclarations.size()); //$NON-NLS-1$ - BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); - assertTrue("Not a method declaration", bodyDeclaration instanceof FunctionDeclaration); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration; - assertEquals("Wrong name", "m", methodDeclaration.getName().getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10698 - */ - public void test0265() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0265", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10759 - */ - public void test0266() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0266", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 1, 0); - assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - Type type = variableDeclarationStatement.getType(); - checkSourceRange(type, "Inner\\u005b]", source); //$NON-NLS-1$ - assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$ - ArrayType arrayType = (ArrayType) type; - Type type2 = arrayType.getElementType(); - assertTrue("Not a simple type", type2.isSimpleType()); //$NON-NLS-1$ - SimpleType simpleType = (SimpleType) type2; - checkSourceRange(simpleType, "Inner", source); //$NON-NLS-1$ - Name name = simpleType.getName(); - assertTrue("not a simple name", name.isSimpleName()); //$NON-NLS-1$ - SimpleName simpleName = (SimpleName) name; - checkSourceRange(simpleName, "Inner", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10759 - */ - public void test0267() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0267", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 1, 0); - assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - Type type = variableDeclarationStatement.getType(); - checkSourceRange(type, "Inner[]", source); //$NON-NLS-1$ - assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$ - ArrayType arrayType = (ArrayType) type; - Type type2 = arrayType.getElementType(); - assertTrue("Not a simple type", type2.isSimpleType()); //$NON-NLS-1$ - SimpleType simpleType = (SimpleType) type2; - checkSourceRange(simpleType, "Inner", source); //$NON-NLS-1$ - Name name = simpleType.getName(); - assertTrue("not a simple name", name.isSimpleName()); //$NON-NLS-1$ - SimpleName simpleName = (SimpleName) name; - checkSourceRange(simpleName, "Inner", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10759 - */ - public void test0268() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0268", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 1, 0); - assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - Type type = variableDeclarationStatement.getType(); - checkSourceRange(type, "test0268.Test.Inner[]", source); //$NON-NLS-1$ - assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$ - ArrayType arrayType = (ArrayType) type; - Type type2 = arrayType.getElementType(); - assertTrue("Not a simple type", type2.isSimpleType()); //$NON-NLS-1$ - SimpleType simpleType = (SimpleType) type2; - checkSourceRange(simpleType, "test0268.Test.Inner", source); //$NON-NLS-1$ - Name name = simpleType.getName(); - assertTrue("not a qualified name", name.isQualifiedName()); //$NON-NLS-1$ - checkSourceRange(name, "test0268.Test.Inner", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10759 - */ - public void test0269() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0269", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 1, 0); - assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - Type type = variableDeclarationStatement.getType(); - checkSourceRange(type, "test0269.Test.Inner[/**/]", source); //$NON-NLS-1$ - assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$ - ArrayType arrayType = (ArrayType) type; - Type type2 = arrayType.getElementType(); - assertTrue("Not a simple type", type2.isSimpleType()); //$NON-NLS-1$ - SimpleType simpleType = (SimpleType) type2; - checkSourceRange(simpleType, "test0269.Test.Inner", source); //$NON-NLS-1$ - Name name = simpleType.getName(); - assertTrue("not a qualified name", name.isQualifiedName()); //$NON-NLS-1$ - checkSourceRange(name, "test0269.Test.Inner", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10759 - */ - public void test0270() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0270", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 1, 0); - assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - Type type = variableDeclarationStatement.getType(); - checkSourceRange(type, "test0270.Test.Inner", source); //$NON-NLS-1$ - assertTrue("Not a simple type", type.isSimpleType()); //$NON-NLS-1$ - SimpleType simpleType = (SimpleType) type; - Name name = simpleType.getName(); - assertTrue("not a qualified name", name.isQualifiedName()); //$NON-NLS-1$ - checkSourceRange(name, "test0270.Test.Inner", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10759 - */ - public void test0271() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0271", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 1, 0); - assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - Type type = variableDeclarationStatement.getType(); - checkSourceRange(type, "test0271.Test.Inner[]", source); //$NON-NLS-1$ - assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$ - ArrayType arrayType = (ArrayType) type; - Type type2 = arrayType.getElementType(); - assertTrue("Not a simple type", type2.isSimpleType()); //$NON-NLS-1$ - SimpleType simpleType = (SimpleType) type2; - checkSourceRange(simpleType, "test0271.Test.Inner", source); //$NON-NLS-1$ - Name name = simpleType.getName(); - assertTrue("not a qualified name", name.isQualifiedName()); //$NON-NLS-1$ - checkSourceRange(name, "test0271.Test.Inner", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10843 - */ - public void test0272() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0272", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not a For statement", node instanceof ForStatement); //$NON-NLS-1$ - ForStatement forStatement = (ForStatement) node; - checkSourceRange(forStatement, "for (int i= 0; i < 10; i++) foo();", source); //$NON-NLS-1$ - Statement action = forStatement.getBody(); - checkSourceRange(action, "foo();", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10843 - */ - public void test0273() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0273", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not a For statement", node instanceof ForStatement); //$NON-NLS-1$ - ForStatement forStatement = (ForStatement) node; - checkSourceRange(forStatement, "for (int i= 0; i < 10; i++) { foo(); }", source); //$NON-NLS-1$ - Statement action = forStatement.getBody(); - checkSourceRange(action, "{ foo(); }", source); //$NON-NLS-1$ - assertTrue("Not a block", action instanceof Block); //$NON-NLS-1$ - Block block = (Block) action; - List statements = block.statements(); - assertEquals("Wrong size", 1, statements.size()); //$NON-NLS-1$ - Statement stmt = (Statement) statements.get(0); - checkSourceRange(stmt, "foo();", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10843 - */ - public void test0274() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0274", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 1); - assertTrue("Not a While statement", node instanceof WhileStatement); //$NON-NLS-1$ - WhileStatement whileStatement = (WhileStatement) node; - checkSourceRange(whileStatement, "while (i < 10) { foo(i++); }", source); //$NON-NLS-1$ - Statement action = whileStatement.getBody(); - checkSourceRange(action, "{ foo(i++); }", source); //$NON-NLS-1$ - assertTrue("Not a block", action instanceof Block); //$NON-NLS-1$ - Block block = (Block) action; - List statements = block.statements(); - assertEquals("Wrong size", 1, statements.size()); //$NON-NLS-1$ - Statement stmt = (Statement) statements.get(0); - checkSourceRange(stmt, "foo(i++);", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10843 - */ - public void test0275() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0275", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 1); - assertTrue("Not a While statement", node instanceof WhileStatement); //$NON-NLS-1$ - WhileStatement whileStatement = (WhileStatement) node; - checkSourceRange(whileStatement, "while (i < 10) foo(i++);", source); //$NON-NLS-1$ - Statement action = whileStatement.getBody(); - checkSourceRange(action, "foo(i++);", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10798 - */ - public void test0276() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0276", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - String expectedSource = - "public void foo() {\n" + //$NON-NLS-1$ - " foo();\n" + //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(methodDeclaration, expectedSource, source); - expectedSource = - "{\n" + //$NON-NLS-1$ - " foo();\n" + //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(methodDeclaration.getBody(), expectedSource, source); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10798 - */ - public void test0277() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0277", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - String expectedSource = - "public void foo() {\n" + //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(methodDeclaration, expectedSource, source); - expectedSource = - "{\n" + //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(methodDeclaration.getBody(), expectedSource, source); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10861 - */ - public void test0278() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0278", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - checkSourceRange(fieldDeclaration, "Class c = java.lang.String.class;", source); //$NON-NLS-1$ - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - assertTrue("Not a type literal", expression instanceof TypeLiteral); //$NON-NLS-1$ - ITypeBinding typeBinding = expression.resolveTypeBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "Class", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10861 - */ - public void test0279() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0279", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0,0); - assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - checkSourceRange(variableDeclarationStatement, "Class c = java.lang.String.class;", source); //$NON-NLS-1$ - List fragments = variableDeclarationStatement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - assertTrue("Not a type literal", expression instanceof TypeLiteral); //$NON-NLS-1$ - ITypeBinding typeBinding = expression.resolveTypeBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "Class", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10865 - * Check well known types - */ - public void test0280() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0280", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - AST newAst = result.getAST(); - ITypeBinding typeBinding = newAst.resolveWellKnownType("boolean"); //$NON-NLS-1$ - assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - typeBinding = newAst.resolveWellKnownType("char"); //$NON-NLS-1$ - assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "char", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - typeBinding = newAst.resolveWellKnownType("byte"); //$NON-NLS-1$ - assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "byte", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - typeBinding = newAst.resolveWellKnownType("short"); //$NON-NLS-1$ - assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "short", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - typeBinding = newAst.resolveWellKnownType("int"); //$NON-NLS-1$ - assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - typeBinding = newAst.resolveWellKnownType("long"); //$NON-NLS-1$ - assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "long", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - typeBinding = newAst.resolveWellKnownType("float"); //$NON-NLS-1$ - assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "float", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - typeBinding = newAst.resolveWellKnownType("double"); //$NON-NLS-1$ - assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "double", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - typeBinding = newAst.resolveWellKnownType("void"); //$NON-NLS-1$ - assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "void", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - typeBinding = newAst.resolveWellKnownType("java.lang.Object"); //$NON-NLS-1$ - assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "Object", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - typeBinding = newAst.resolveWellKnownType("java.lang.String"); //$NON-NLS-1$ - assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "String", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - typeBinding = newAst.resolveWellKnownType("java.lang.StringBuffer"); //$NON-NLS-1$ - assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "StringBuffer", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - typeBinding = newAst.resolveWellKnownType("java.lang.Throwable"); //$NON-NLS-1$ - assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "Throwable", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - typeBinding = newAst.resolveWellKnownType("java.lang.Exception"); //$NON-NLS-1$ - assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "Exception", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - typeBinding = newAst.resolveWellKnownType("java.lang.RuntimeException"); //$NON-NLS-1$ - assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "RuntimeException", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - typeBinding = newAst.resolveWellKnownType("java.lang.Error"); //$NON-NLS-1$ - assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "Error", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - typeBinding = newAst.resolveWellKnownType("java.lang.Class"); //$NON-NLS-1$ - assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "Class", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - typeBinding = newAst.resolveWellKnownType("java.lang.Runnable"); //$NON-NLS-1$ - assertNull("typeBinding not null", typeBinding); //$NON-NLS-1$ - typeBinding = newAst.resolveWellKnownType("java.lang.Cloneable"); //$NON-NLS-1$ - assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$ - typeBinding = newAst.resolveWellKnownType("java.io.Serializable"); //$NON-NLS-1$ - assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$ - typeBinding = newAst.resolveWellKnownType("java.lang.Boolean"); //$NON-NLS-1$ - assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$ - typeBinding = newAst.resolveWellKnownType("java.lang.Byte"); //$NON-NLS-1$ - assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$ - typeBinding = newAst.resolveWellKnownType("java.lang.Character"); //$NON-NLS-1$ - assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$ - typeBinding = newAst.resolveWellKnownType("java.lang.Double"); //$NON-NLS-1$ - assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$ - typeBinding = newAst.resolveWellKnownType("java.lang.Float"); //$NON-NLS-1$ - assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$ - typeBinding = newAst.resolveWellKnownType("java.lang.Integer"); //$NON-NLS-1$ - assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$ - typeBinding = newAst.resolveWellKnownType("java.lang.Long"); //$NON-NLS-1$ - assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$ - typeBinding = newAst.resolveWellKnownType("java.lang.Short"); //$NON-NLS-1$ - assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$ - typeBinding = newAst.resolveWellKnownType("java.lang.Void"); //$NON-NLS-1$ - assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874 - */ - public void test0281() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0281", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - checkSourceRange(fieldDeclaration, "Object o= /*]*/new Object()/*[*/;", source); //$NON-NLS-1$ - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - checkSourceRange(expression, "new Object()", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874 - */ - public void test0282() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0282", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - checkSourceRange(fieldDeclaration, "boolean b = /*]*/true/*[*/;", source); //$NON-NLS-1$ - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - checkSourceRange(expression, "true", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874 - */ - public void test0283() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0283", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - checkSourceRange(fieldDeclaration, "char c = /*]*/'c'/*[*/;", source); //$NON-NLS-1$ - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - checkSourceRange(expression, "'c'", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874 - */ - public void test0284() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0284", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - checkSourceRange(fieldDeclaration, "Object o = /*]*/null/*[*/;", source); //$NON-NLS-1$ - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - checkSourceRange(expression, "null", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874 - */ - public void test0285() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0285", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - checkSourceRange(fieldDeclaration, "Object o = /*]*/Object.class/*[*/;", source); //$NON-NLS-1$ - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - checkSourceRange(expression, "Object.class", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874 - */ - public void test0286() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0286", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - checkSourceRange(fieldDeclaration, "int i = /**/(2)/**/;", source); //$NON-NLS-1$ - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - checkSourceRange(expression, "(2)", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874 - */ - public void test0287() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0287", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - checkSourceRange(fieldDeclaration, "String[] tab = /**/new String[3]/**/;", source); //$NON-NLS-1$ - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - checkSourceRange(expression, "new String[3]", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874 - */ - public void test0288() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0288", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - checkSourceRange(fieldDeclaration, "String[] tab = /**/{ }/**/;", source); //$NON-NLS-1$ - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - checkSourceRange(expression, "{ }", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874 - */ - public void test0289() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0289", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 1); - assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - checkSourceRange(fieldDeclaration, "String s = /**/tab1[0]/**/;", source); //$NON-NLS-1$ - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - checkSourceRange(expression, "tab1[0]", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874 - */ - public void test0290() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0290", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - checkSourceRange(fieldDeclaration, "Object o = /*]*/new java.lang.Object()/*[*/;", source); //$NON-NLS-1$ - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - checkSourceRange(expression, "new java.lang.Object()", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10898 - */ - public void test0291() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0291", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("no errors", 1, unit.getMessages().length); //$NON-NLS-1$ - assertEquals("no errors", 1, unit.getProblems().length); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10913 - */ - public void test0292() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0292", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node; - Expression expression = returnStatement.getExpression(); - assertTrue("Not a qualifiedName", expression instanceof QualifiedName); //$NON-NLS-1$ - QualifiedName qualifiedName = (QualifiedName) expression; - SimpleName simpleName = qualifiedName.getName(); - assertEquals("Wrong name", "x", simpleName.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$ - IBinding binding = simpleName.resolveBinding(); - assertNotNull("NO binding", binding); //$NON-NLS-1$ - assertTrue("Not a variable binding", binding instanceof IVariableBinding); //$NON-NLS-1$ - assertEquals("wrong name", "x", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - Name name = qualifiedName.getQualifier(); - assertTrue("Not a simpleName", name instanceof SimpleName); //$NON-NLS-1$ - SimpleName simpleName2 = (SimpleName) name; - IBinding binding2 = simpleName2.resolveBinding(); - assertNotNull("No binding2", binding2); //$NON-NLS-1$ - assertTrue("Not a type binding", binding2 instanceof ITypeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "Test", binding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10933 - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10935 - */ - public void test0293() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0293", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - List fragments = variableDeclarationStatement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - assertTrue("Not a class instance creation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression; - AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration(); - assertNotNull("No body", anonymousClassDeclaration); //$NON-NLS-1$ - String expectedSource = - "{\n" + //$NON-NLS-1$ - " public void run() {\n" + //$NON-NLS-1$ - " /*]*/foo();/*[*/\n" + //$NON-NLS-1$ - " }\n" + //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(anonymousClassDeclaration, expectedSource, source); - expectedSource = - "run= new Runnable() {\n" + //$NON-NLS-1$ - " public void run() {\n" + //$NON-NLS-1$ - " /*]*/foo();/*[*/\n" + //$NON-NLS-1$ - " }\n" + //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(variableDeclarationFragment, expectedSource, source); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10984 - */ - public void test0294() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0294", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - String expectedSource = - "public void fails() {\n" + //$NON-NLS-1$ - " foo()\n" + //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(methodDeclaration, expectedSource, source); - Block block = methodDeclaration.getBody(); - expectedSource = - "{\n" + //$NON-NLS-1$ - " foo()\n" + //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(block, expectedSource, source); - node = getASTNode(compilationUnit, 0, 1); - assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - methodDeclaration = (FunctionDeclaration) node; - block = methodDeclaration.getBody(); - List statements = block.statements(); - assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10986 - */ - public void test0295() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0295", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("Wrong size", 2, compilationUnit.getMessages().length); //$NON-NLS-1$ - assertEquals("Wrong size", 2, compilationUnit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 1, 0); - assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertTrue("not a method invocation", expression instanceof FunctionInvocation); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - ITypeBinding typeBinding = methodInvocation.resolveTypeBinding(); - assertNull("type binding is not null", typeBinding); //$NON-NLS-1$ - } - - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10984 - */ - public void test0296() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0296", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - String expectedSource = - "public void fails() {\n" + //$NON-NLS-1$ - " foo()\n" + //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(methodDeclaration, expectedSource, source); - Block block = methodDeclaration.getBody(); - expectedSource = - "{\n" + //$NON-NLS-1$ - " foo()\n" + //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(block, expectedSource, source); - node = getASTNode(compilationUnit, 0, 1); - assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - methodDeclaration = (FunctionDeclaration) node; - block = methodDeclaration.getBody(); - List statements = block.statements(); - assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=11037 - */ - public void test0297() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0297", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - runConversion(AST.JLS3, sourceUnit, false); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10984 - */ - public void test0298() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0298", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not a ReturnStatement", node instanceof ReturnStatement); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node; - Expression expression = returnStatement.getExpression(); - checkSourceRange(expression, "a().length != 3", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874 - * http://dev.eclipse.org/bugs/show_bug.cgi?id=11104 - */ - public void test0299() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0299", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - checkSourceRange(fieldDeclaration, "int i = (/**/2/**/);", source); //$NON-NLS-1$ - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - assertTrue("Not a parenthesized expression", expression instanceof ParenthesizedExpression); //$NON-NLS-1$ - ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression; - Expression expression2 = parenthesizedExpression.getExpression(); - checkSourceRange(expression2, "2", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874 - * http://dev.eclipse.org/bugs/show_bug.cgi?id=11104 - */ - public void test0300() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0300", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - checkSourceRange(fieldDeclaration, "boolean b = /**/true/**/;", source); //$NON-NLS-1$ - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - checkSourceRange(expression, "true", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874 - * http://dev.eclipse.org/bugs/show_bug.cgi?id=11104 - */ - public void test0301() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0301", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - checkSourceRange(fieldDeclaration, "Object o = /**/null/**/;", source); //$NON-NLS-1$ - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - checkSourceRange(expression, "null", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=11106 - */ - public void test0302() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0302", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not a DoStatement", node instanceof DoStatement); //$NON-NLS-1$ - DoStatement doStatement = (DoStatement) node; - String expectedSource = - "do\n" + //$NON-NLS-1$ - " foo();\n" + //$NON-NLS-1$ - " while(1 < 10);"; //$NON-NLS-1$ - checkSourceRange(doStatement, expectedSource, source); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=11129 - */ - public void test0303() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0303", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 1); - assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression2 = expressionStatement.getExpression(); - assertTrue("Not an Assignement", expression2 instanceof Assignment); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=11151 - */ - public void test0304() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0304", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - checkSourceRange(node, "public void foo(int arg);", source); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - Block block = methodDeclaration.getBody(); - assertNull("Has a body", block); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=11125 - */ - public void test0305() { - char[] source = - ("package test0305;\n" + //$NON-NLS-1$ - "\n" + //$NON-NLS-1$ - "class Test {\n" + //$NON-NLS-1$ - " public void foo(int arg) {}\n" + //$NON-NLS-1$ - "}").toCharArray(); //$NON-NLS-1$ - IJavaScriptProject project = getJavaProject("Converter"); //$NON-NLS-1$ - ASTNode result = runConversion(AST.JLS3, source, "Test.js", project, true); //$NON-NLS-1$ - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0); - assertTrue("not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "Test", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Wrong package", "test0305", typeBinding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue("Not an interface", typeBinding.isClass()); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=11125 - */ - public void test0306() { - char[] source = - ("package java.lang;\n" + //$NON-NLS-1$ - "\n" + //$NON-NLS-1$ - "class Object {\n" + //$NON-NLS-1$ - " public void foo(int arg) {}\n" + //$NON-NLS-1$ - "}").toCharArray(); //$NON-NLS-1$ - IJavaScriptProject project = getJavaProject("Converter"); //$NON-NLS-1$ - ASTNode result = runConversion(AST.JLS3, source, "Object.js", project, true); //$NON-NLS-1$ - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0); - assertTrue("not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "Object", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Wrong package", "java.lang", typeBinding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue("Not an interface", typeBinding.isClass()); //$NON-NLS-1$ - assertEquals("Wrong size", 2, typeBinding.getDeclaredMethods().length); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=11371 - */ - public void test0307() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0307", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 1, 0); - assertTrue("not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - Block block = methodDeclaration.getBody(); - assertNotNull("No body", block); //$NON-NLS-1$ - List statements = block.statements(); - assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$ - Statement statement = (Statement) statements.get(0); - assertTrue("Not a super constructor invocation", statement instanceof SuperConstructorInvocation); //$NON-NLS-1$ - checkSourceRange(statement, "super(10);", source); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=11371 - */ - public void test0308() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0308", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 1, 0); - assertTrue("not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - Block block = methodDeclaration.getBody(); - assertNotNull("No body", block); //$NON-NLS-1$ - List statements = block.statements(); - assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$ - Statement statement = (Statement) statements.get(0); - assertTrue("Not a super constructor invocation", statement instanceof SuperConstructorInvocation); //$NON-NLS-1$ - SuperConstructorInvocation superConstructorInvocation = (SuperConstructorInvocation) statement; - IFunctionBinding methodBinding = superConstructorInvocation.resolveConstructorBinding(); - assertNotNull("No methodBinding", methodBinding); //$NON-NLS-1$ - IFunctionBinding methodBinding2 = methodDeclaration.resolveBinding(); - assertNotNull("No methodBinding2", methodBinding2); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=11380 - */ - public void test0309() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0309", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - List fragments = variableDeclarationStatement.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - assertTrue("Not a conditional expression", expression instanceof ConditionalExpression); //$NON-NLS-1$ - ConditionalExpression conditionalExpression = (ConditionalExpression) expression; - ITypeBinding typeBinding = conditionalExpression.resolveTypeBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertEquals("wrong name", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=11380 - */ - public void test0310() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0310", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("not a FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - List fragments = fieldDeclaration.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - assertTrue("Not a qualified name", expression instanceof QualifiedName); //$NON-NLS-1$ - QualifiedName qualifiedName = (QualifiedName) expression; - Name qualifier = qualifiedName.getQualifier(); - IBinding binding = qualifier.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertEquals("wrong name", "I", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=11638 - */ - public void test0311() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0311", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 1); - assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - List fragments = variableDeclarationStatement.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - assertTrue("not a class instance creation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression; - AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration(); - assertNotNull("No body", anonymousClassDeclaration); //$NON-NLS-1$ - List bodyDeclarations = anonymousClassDeclaration.bodyDeclarations(); - assertEquals("wrong size for body declarations", 1, bodyDeclarations.size()); //$NON-NLS-1$ - BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); - assertTrue("Not a method declaration", bodyDeclaration instanceof FunctionDeclaration); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration; - Block block = methodDeclaration.getBody(); - assertNotNull("no body", block); //$NON-NLS-1$ - List statements = block.statements(); - assertEquals("Wrong size for statements", 1, statements.size()); //$NON-NLS-1$ - Statement statement = (Statement) statements.get(0); - assertTrue("not a variable declaration statement", statement instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement2 = (VariableDeclarationStatement) statement; - List fragments2 = variableDeclarationStatement2.fragments(); - assertEquals("wrong size for fragments2", 1, fragments2.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment2 = (VariableDeclarationFragment) fragments2.get(0); - Expression expression2 = variableDeclarationFragment2.getInitializer(); - assertTrue("Not a name", expression2 instanceof Name); //$NON-NLS-1$ - Name name = (Name) expression2; - checkSourceRange(name, "j", source); //$NON-NLS-1$ - IBinding binding = name.resolveBinding(); - ASTNode declaringNode = compilationUnit.findDeclaringNode(binding); - assertNotNull("No declaring node", declaringNode); //$NON-NLS-1$ - checkSourceRange(declaringNode, "int j", source); //$NON-NLS-1$ - assertTrue("Not a single variable declaration", declaringNode instanceof SingleVariableDeclaration); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=11638 - * There is a error in this source. A is unresolved. Then there is no - * declaring node. - */ - public void test0312() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0312", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 1); - assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - List fragments = variableDeclarationStatement.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - assertTrue("not a class instance creation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression; - AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration(); - assertNotNull("No body", anonymousClassDeclaration); //$NON-NLS-1$ - List bodyDeclarations = anonymousClassDeclaration.bodyDeclarations(); - assertEquals("wrong size for body declarations", 1, bodyDeclarations.size()); //$NON-NLS-1$ - BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); - assertTrue("Not a method declaration", bodyDeclaration instanceof FunctionDeclaration); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration; - Block block = methodDeclaration.getBody(); - assertNotNull("no body", block); //$NON-NLS-1$ - List statements = block.statements(); - assertEquals("Wrong size for statements", 1, statements.size()); //$NON-NLS-1$ - Statement statement = (Statement) statements.get(0); - assertTrue("not a variable declaration statement", statement instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement2 = (VariableDeclarationStatement) statement; - List fragments2 = variableDeclarationStatement2.fragments(); - assertEquals("wrong size for fragments2", 1, fragments2.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment2 = (VariableDeclarationFragment) fragments2.get(0); - Expression expression2 = variableDeclarationFragment2.getInitializer(); - assertTrue("Not a name", expression2 instanceof Name); //$NON-NLS-1$ - Name name = (Name) expression2; - checkSourceRange(name, "j", source); //$NON-NLS-1$ - IBinding binding = name.resolveBinding(); - ASTNode declaringNode = compilationUnit.findDeclaringNode(binding); - assertNull("No declaring node is available", declaringNode); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=11659 - */ - public void test0313() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0313", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - List fragments = variableDeclarationStatement.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - assertTrue("Not an InfixExpression", expression instanceof InfixExpression); //$NON-NLS-1$ - InfixExpression infixExpression = (InfixExpression) expression; - checkSourceRange(infixExpression, "i+j", source); //$NON-NLS-1$ - Expression expression2 = infixExpression.getLeftOperand(); - checkSourceRange(expression2, "i", source); //$NON-NLS-1$ - assertTrue("Not a name", expression2 instanceof Name); //$NON-NLS-1$ - Name name = (Name) expression2; - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - ASTNode astNode = compilationUnit.findDeclaringNode(binding); - assertNotNull("No declaring node", astNode); //$NON-NLS-1$ - checkSourceRange(astNode, "int i", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=12326 - */ - public void test0314() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0314", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - assertNotNull("No result", result); //$NON-NLS-1$ - assertTrue("Not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("Wrong line number", 1, compilationUnit.getLineNumber(0)); //$NON-NLS-1$ - // ensure that last character is on the last line - assertEquals("Wrong line number", 3, compilationUnit.getLineNumber(source.length - 1)); //$NON-NLS-1$ - // source.length is beyond the size of the compilation unit source - assertEquals("Wrong line number", -1, compilationUnit.getLineNumber(source.length)); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=12326 - */ - public void test0315() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0315", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not a Return statement", node instanceof ReturnStatement); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node; - Expression expression = returnStatement.getExpression(); - assertTrue("Not an instanceof expression", expression instanceof InstanceofExpression); //$NON-NLS-1$ - InstanceofExpression instanceOfExpression = (InstanceofExpression) expression; - Type rightOperand = instanceOfExpression.getRightOperand(); - assertTrue("Not a simpleType", rightOperand instanceof SimpleType); //$NON-NLS-1$ - SimpleType simpleType = (SimpleType) rightOperand; - Name n = simpleType.getName(); - assertTrue("Not a qualified name", n instanceof QualifiedName); //$NON-NLS-1$ - QualifiedName name = (QualifiedName) n; - checkSourceRange(name, "java.io.Serializable", source); //$NON-NLS-1$ - ITypeBinding typeBinding = name.resolveTypeBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "Serializable", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - Name qualifier = name.getQualifier(); - assertTrue("Not a qualified name", qualifier instanceof QualifiedName); //$NON-NLS-1$ - ITypeBinding typeBinding2 = qualifier.resolveTypeBinding(); - assertNull("typebinding2 is not null", typeBinding2); //$NON-NLS-1$ - IBinding binding = qualifier.resolveBinding(); - assertNotNull("no binding", binding); //$NON-NLS-1$ - assertEquals("Wrong type", IBinding.PACKAGE, binding.getKind()); //$NON-NLS-1$ - IPackageBinding pBinding = (IPackageBinding) binding; - assertEquals("Wrong name", "java.io", pBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=12454 - */ - public void test0316() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "", "Hello.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No result", result); //$NON-NLS-1$ - assertTrue("Not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("Wrong size", 1, compilationUnit.getMessages().length); //$NON-NLS-1$ - assertEquals("Wrong size", 1, compilationUnit.getProblems().length); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=12781 - */ - public void test0317() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0317", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node; - Expression expression = returnStatement.getExpression(); - assertTrue("not an instanceof expression", expression instanceof InstanceofExpression); //$NON-NLS-1$ - InstanceofExpression instanceOfExpression = (InstanceofExpression) expression; - Expression left = instanceOfExpression.getLeftOperand(); - assertTrue("Not a Name", left instanceof Name); //$NON-NLS-1$ - Name name = (Name) left; - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertEquals("wrong name", "x", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - ITypeBinding typeBinding = name.resolveTypeBinding(); - assertNotNull("No typebinding", typeBinding); //$NON-NLS-1$ - assertEquals("wrong type", "Object", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - Type right = instanceOfExpression.getRightOperand(); - assertTrue("Not a simpleType", right instanceof SimpleType); //$NON-NLS-1$ - SimpleType simpleType = (SimpleType) right; - name = simpleType.getName(); - assertTrue("Not a simpleName", name instanceof SimpleName); //$NON-NLS-1$ - SimpleName simpleName = (SimpleName) name; - IBinding binding2 = simpleName.resolveBinding(); - assertNotNull("No binding2", binding2); //$NON-NLS-1$ - assertEquals("Wrong name", "Vector", binding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - ITypeBinding typeBinding2 = simpleName.resolveTypeBinding(); - assertNotNull("No typeBinding2", typeBinding2); //$NON-NLS-1$ - assertEquals("Wrong name", "Vector", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=13233 - */ - public void test0318() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0318", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("No error", 1, unit.getMessages().length); //$NON-NLS-1$ - assertEquals("No error", 1, unit.getProblems().length); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=13807 - */ - public void test0319() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0319", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - List fragments = variableDeclarationStatement.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - assertTrue("Not an array creation", expression instanceof ArrayCreation); //$NON-NLS-1$ - ArrayCreation arrayCreation = (ArrayCreation) expression; - ITypeBinding typeBinding = arrayCreation.resolveTypeBinding(); - assertNotNull("no type binding", typeBinding); //$NON-NLS-1$ - assertEquals("wrong name", "Object[]", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - ArrayType arrayType = arrayCreation.getType(); - ITypeBinding typeBinding2 = arrayType.resolveBinding(); - assertNotNull("no type binding2", typeBinding2); //$NON-NLS-1$ - assertEquals("wrong name", "Object[]", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - Type type = arrayType.getElementType(); - assertTrue("Not a simple type", type instanceof SimpleType); //$NON-NLS-1$ - SimpleType simpleType = (SimpleType) type; - ITypeBinding typeBinding3 = simpleType.resolveBinding(); - assertNotNull("no type binding3", typeBinding3); //$NON-NLS-1$ - assertEquals("wrong name", "Object", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=13807 - */ - public void test0320() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0320", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - Type type = variableDeclarationStatement.getType(); - checkSourceRange(type, "int[]", source); //$NON-NLS-1$ - assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$ - ArrayType arrayType = (ArrayType) type; - ITypeBinding typeBinding = arrayType.resolveBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - Type elementType = arrayType.getElementType(); - assertTrue("Not a simple type", elementType.isPrimitiveType()); //$NON-NLS-1$ - ITypeBinding typeBinding2 = elementType.resolveBinding(); - assertNotNull("No type binding2", typeBinding2); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=13807 - */ - public void test0321() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0321", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - Type type = variableDeclarationStatement.getType(); - assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$ - ArrayType arrayType = (ArrayType) type; - ITypeBinding typeBinding = arrayType.resolveBinding(); - checkSourceRange(type, "java.lang.Object[][]", source); //$NON-NLS-1$ - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - Type elementType = arrayType.getComponentType(); - ITypeBinding typeBinding2 = elementType.resolveBinding(); - assertNotNull("No type binding2", typeBinding2); //$NON-NLS-1$ - assertEquals("wrong dimension", 1, typeBinding2.getDimensions()); //$NON-NLS-1$ - assertEquals("wrong name", "Object[]", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue("Not an array type", elementType.isArrayType()); //$NON-NLS-1$ - Type elementType2 = ((ArrayType) elementType).getComponentType(); - assertTrue("Not a simple type", elementType2.isSimpleType()); //$NON-NLS-1$ - ITypeBinding typeBinding3 = elementType2.resolveBinding(); - assertNotNull("No type binding3", typeBinding3); //$NON-NLS-1$ - assertEquals("wrong dimension", 0, typeBinding3.getDimensions()); //$NON-NLS-1$ - assertEquals("wrong name", "Object", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=13231 - */ - public void test0322() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0322", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - List fragments = fieldDeclaration.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - assertTrue("Not a null literal", expression instanceof NullLiteral); //$NON-NLS-1$ - NullLiteral nullLiteral = (NullLiteral) expression; - ITypeBinding typeBinding = nullLiteral.resolveTypeBinding(); - assertNotNull("no type binding", typeBinding); //$NON-NLS-1$ - assertTrue("Not the null type", typeBinding.isNullType()); //$NON-NLS-1$ - assertEquals("Wrong qualified name", typeBinding.getQualifiedName(), "null"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=14198 - */ - public void test0323() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0323", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 1); - assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression2 = expressionStatement.getExpression(); - assertTrue("Not an Assignement", expression2 instanceof Assignment); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=14198 - */ - public void test0324() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0324", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 1); - assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression2 = expressionStatement.getExpression(); - assertTrue("Not an Assignement", expression2 instanceof Assignment); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=14198 - */ - public void test0325() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0325", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 1); - assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression2 = expressionStatement.getExpression(); - assertTrue("Not an Assignement", expression2 instanceof Assignment); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=14217 - */ - public void test0326() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0326", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - char[] source = sourceUnit.getSource().toCharArray(); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 1, 0); - assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - checkSourceRange(expressionStatement.getExpression(), "a().f= a()", source); //$NON-NLS-1$ - checkSourceRange(expressionStatement, "a().f= a();", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=14198 - */ - public void test0327() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0327", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("Wrong number of errors", 2, compilationUnit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not an VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - List fragments = variableDeclarationStatement.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=13807 - */ - public void test0328() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0328", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - Type type = variableDeclarationStatement.getType(); - checkSourceRange(type, "java.lang.Object[]", source); //$NON-NLS-1$ - assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$ - ArrayType arrayType = (ArrayType) type; - ITypeBinding typeBinding = arrayType.resolveBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertEquals("wrong name", "Object[]", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - Type elementType = arrayType.getElementType(); - assertTrue("Not a simple type", elementType.isSimpleType()); //$NON-NLS-1$ - ITypeBinding typeBinding2 = elementType.resolveBinding(); - assertNotNull("No type binding2", typeBinding2); //$NON-NLS-1$ - assertEquals("wrong name", "Object", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - List fragments = variableDeclarationStatement.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - assertTrue("Not a array creation", expression instanceof ArrayCreation); //$NON-NLS-1$ - ITypeBinding typeBinding3 = expression.resolveTypeBinding(); - assertNotNull("No typeBinding3", typeBinding3); //$NON-NLS-1$ - assertEquals("wrong name", "Object[]", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - ArrayCreation arrayCreation = (ArrayCreation) expression; - ArrayInitializer arrayInitializer = arrayCreation.getInitializer(); - assertNotNull("not array initializer", arrayInitializer); //$NON-NLS-1$ - ITypeBinding typeBinding4 = arrayInitializer.resolveTypeBinding(); - assertNotNull("No typeBinding4", typeBinding3); //$NON-NLS-1$ - assertEquals("wrong name", "Object[]", typeBinding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=13807 - */ - public void test0329() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0329", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - Type type = variableDeclarationStatement.getType(); - checkSourceRange(type, "java.lang.Object[]", source); //$NON-NLS-1$ - assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$ - ArrayType arrayType = (ArrayType) type; - ITypeBinding typeBinding = arrayType.resolveBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertEquals("wrong name", "Object[]", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - Type elementType = arrayType.getElementType(); - assertTrue("Not a simple type", elementType.isSimpleType()); //$NON-NLS-1$ - ITypeBinding typeBinding2 = elementType.resolveBinding(); - assertNotNull("No type binding2", typeBinding2); //$NON-NLS-1$ - assertEquals("wrong name", "Object", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - List fragments = variableDeclarationStatement.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - assertTrue("Not a array creation", expression instanceof ArrayCreation); //$NON-NLS-1$ - ITypeBinding typeBinding3 = expression.resolveTypeBinding(); - assertNotNull("No typeBinding3", typeBinding3); //$NON-NLS-1$ - assertEquals("wrong name", "Object[]", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - ArrayCreation arrayCreation = (ArrayCreation) expression; - ArrayInitializer arrayInitializer = arrayCreation.getInitializer(); - assertNotNull("not array initializer", arrayInitializer); //$NON-NLS-1$ - ITypeBinding typeBinding4 = arrayInitializer.resolveTypeBinding(); - assertNotNull("No typeBinding4", typeBinding3); //$NON-NLS-1$ - assertEquals("wrong name", "Object[]", typeBinding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=14313 - */ - public void test0330() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0330", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("wrong size", 2, compilationUnit.getMessages().length); //$NON-NLS-1$ - assertEquals("wrong size", 2, compilationUnit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0); - assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertNotNull("no type binding", typeBinding); //$NON-NLS-1$ - IFunctionBinding[] methods = typeBinding.getDeclaredMethods(); - assertEquals("wrong size", 1, methods.length); //$NON-NLS-1$ - assertTrue("not a constructor", methods[0].isConstructor()); //$NON-NLS-1$ - assertTrue("wrong name", !methods[0].getName().equals("foo")); //$NON-NLS-1$ //$NON-NLS-2$ - node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a methodDeclaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - IFunctionBinding methodBinding = methodDeclaration.resolveBinding(); - assertNull("method binding not null", methodBinding); //$NON-NLS-1$ - node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node; - Expression expression = returnStatement.getExpression(); - ITypeBinding typeBinding2 = expression.resolveTypeBinding(); - assertNotNull("no type binding2", typeBinding2); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=14322 - */ - public void test0331() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0331", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not an VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - List fragments = variableDeclarationStatement.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - assertTrue("Not a QualifiedName", expression instanceof QualifiedName); //$NON-NLS-1$ - QualifiedName qualifiedName = (QualifiedName) expression; - IBinding binding = qualifiedName.getName().resolveBinding(); - assertNotNull("no binding", binding); //$NON-NLS-1$ - assertEquals("Wrong type", IBinding.VARIABLE, binding.getKind()); //$NON-NLS-1$ - IVariableBinding variableBinding = (IVariableBinding) binding; - assertTrue("Not a field", variableBinding.isField()); //$NON-NLS-1$ - assertNull("Got a declaring class", variableBinding.getDeclaringClass()); //$NON-NLS-1$ - assertEquals("wrong name", "length", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=14403 - */ - public void test0332() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0332", "LocalSelectionTransfer.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=13807 - */ - public void test0333() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0333", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - List fragments = variableDeclarationStatement.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - assertTrue("Not an array creation", expression instanceof ArrayCreation); //$NON-NLS-1$ - ArrayCreation arrayCreation = (ArrayCreation) expression; - ITypeBinding typeBinding = arrayCreation.resolveTypeBinding(); - assertNotNull("no type binding", typeBinding); //$NON-NLS-1$ - assertEquals("wrong name", "Object[][]", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - ArrayType arrayType = arrayCreation.getType(); - ITypeBinding typeBinding2 = arrayType.resolveBinding(); - assertNotNull("no type binding2", typeBinding2); //$NON-NLS-1$ - assertEquals("wrong name", "Object[][]", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - Type type = arrayType.getElementType(); - assertTrue("Not a simple type", type instanceof SimpleType); //$NON-NLS-1$ - SimpleType simpleType = (SimpleType) type; - ITypeBinding typeBinding3 = simpleType.resolveBinding(); - assertNotNull("no type binding3", typeBinding3); //$NON-NLS-1$ - assertEquals("wrong name", "Object", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - type = arrayType.getComponentType(); - assertTrue("Not an array type", type instanceof ArrayType); //$NON-NLS-1$ - ArrayType arrayType2 = (ArrayType) type; - ITypeBinding typeBinding4 = arrayType2.resolveBinding(); - assertNotNull("no type binding4", typeBinding4); //$NON-NLS-1$ - assertEquals("wrong name", "Object[]", typeBinding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=13807 - */ - public void test0334() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0334", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - List fragments = variableDeclarationStatement.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - assertTrue("Not an array creation", expression instanceof ArrayCreation); //$NON-NLS-1$ - ArrayCreation arrayCreation = (ArrayCreation) expression; - ITypeBinding typeBinding = arrayCreation.resolveTypeBinding(); - assertNotNull("no type binding", typeBinding); //$NON-NLS-1$ - assertEquals("wrong name", "Object[][][]", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - ArrayType arrayType = arrayCreation.getType(); - checkSourceRange(arrayType, "Object[10][][]", source); //$NON-NLS-1$ - ITypeBinding typeBinding2 = arrayType.resolveBinding(); - assertNotNull("no type binding2", typeBinding2); //$NON-NLS-1$ - assertEquals("wrong name", "Object[][][]", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - Type type = arrayType.getElementType(); - assertTrue("Not a simple type", type instanceof SimpleType); //$NON-NLS-1$ - SimpleType simpleType = (SimpleType) type; - checkSourceRange(simpleType, "Object", source); //$NON-NLS-1$ - ITypeBinding typeBinding3 = simpleType.resolveBinding(); - assertNotNull("no type binding3", typeBinding3); //$NON-NLS-1$ - assertEquals("wrong name", "Object", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - type = arrayType.getComponentType(); - assertTrue("Not an array type", type instanceof ArrayType); //$NON-NLS-1$ - ArrayType arrayType2 = (ArrayType) type; - checkSourceRange(arrayType2, "Object[10][]", source); //$NON-NLS-1$ - ITypeBinding typeBinding4 = arrayType2.resolveBinding(); - assertNotNull("no type binding4", typeBinding4); //$NON-NLS-1$ - assertEquals("wrong name", "Object[][]", typeBinding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - type = arrayType2.getComponentType(); - assertTrue("Not an array type", type instanceof ArrayType); //$NON-NLS-1$ - ArrayType arrayType3 = (ArrayType) type; - ITypeBinding typeBinding5 = arrayType3.resolveBinding(); - assertNotNull("no type binding5", typeBinding5); //$NON-NLS-1$ - assertEquals("wrong name", "Object[]", typeBinding5.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - checkSourceRange(arrayType3, "Object[10]", source); //$NON-NLS-1$ - } - - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=14526 - */ - public void test0335() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0335", "ExceptionTestCaseTest.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0); - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - assertEquals("errors found", 0, compilationUnit.getProblems().length); //$NON-NLS-1$ - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("not a type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - Type superclassType = typeDeclaration.getSuperclassType(); - assertNotNull("no super class", superclassType); //$NON-NLS-1$ - assertEquals("Wrong type", superclassType.getNodeType(), ASTNode.SIMPLE_TYPE); - SimpleType simpleType = (SimpleType) superclassType; - Name name = simpleType.getName(); - assertTrue("not a qualified name", name.isQualifiedName()); //$NON-NLS-1$ - QualifiedName qualifiedName = (QualifiedName) name; - name = qualifiedName.getQualifier(); - assertTrue("not a qualified name", name.isQualifiedName()); //$NON-NLS-1$ - qualifiedName = (QualifiedName) name; - name = qualifiedName.getQualifier(); - assertTrue("not a simple name", name.isSimpleName()); //$NON-NLS-1$ - SimpleName simpleName = (SimpleName) name; - IBinding binding = simpleName.resolveBinding(); - assertNotNull("no binding", binding); //$NON-NLS-1$ - assertEquals("wrong type", IBinding.PACKAGE, binding.getKind()); //$NON-NLS-1$ - assertEquals("wrong name", "junit", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=14526 - */ - public void test0336() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0336", "SorterTest.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - assertEquals("errors found", 0, compilationUnit.getProblems().length); //$NON-NLS-1$ - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("not a type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=14602 - */ - public void test0337() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0337", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - checkSourceRange(variableDeclarationFragment, "message= Test.m(\"s\", new String[]{\"g\"})", source); //$NON-NLS-1$ - checkSourceRange(fieldDeclaration, "String message= Test.m(\"s\", new String[]{\"g\"});", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=14852 - */ - public void test0338() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0338", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - List thrownExceptions = methodDeclaration.thrownExceptions(); - assertEquals("Wrong size", 1, thrownExceptions.size()); //$NON-NLS-1$ - Name name = (Name) thrownExceptions.get(0); - IBinding binding = name.resolveBinding(); - assertEquals("wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$ - assertEquals("wrong name", "IOException", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=15061 - */ - public void test0339() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0339", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("No errors found", 3, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("not a Type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - List bodyDeclarations = typeDeclaration.bodyDeclarations(); - assertEquals("wrong size", 1, bodyDeclarations.size()); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclarations.get(0); - checkSourceRange(methodDeclaration, "int doQuery(boolean x);", source); //$NON-NLS-1$ - node = getASTNode(compilationUnit, 0, 1); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - String expectedSource = - "public void setX(boolean x) {\n" + //$NON-NLS-1$ - " {\n" + //$NON-NLS-1$ - " z\n" + //$NON-NLS-1$ - " }\n" + //$NON-NLS-1$ - "}"; //$NON-NLS-1$ - checkSourceRange(node, expectedSource, source); - int methodEndPosition = node.getStartPosition() + node.getLength(); - node = getASTNode(compilationUnit, 0); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - int typeEndPosition = node.getStartPosition() + node.getLength(); - assertEquals("different positions", methodEndPosition, typeEndPosition); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=14852 - */ - public void test0340() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "p3", "B.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertTrue("Not an method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - Expression expression2 = methodInvocation.getExpression(); - assertNotNull("No receiver", expression2); //$NON-NLS-1$ - ITypeBinding binding = expression2.resolveTypeBinding(); - assertNotNull("No type binding", binding); //$NON-NLS-1$ - assertEquals("wrong name", "A", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("wrong name", "p2", binding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue("Not a qualified name", expression2.getNodeType() == ASTNode.QUALIFIED_NAME); //$NON-NLS-1$ - QualifiedName qualifiedName = (QualifiedName) expression2; - SimpleName simpleName = qualifiedName.getName(); - assertEquals("wrong name", "A", simpleName.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$ - ITypeBinding typeBinding = simpleName.resolveTypeBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertEquals("wrong name", "A", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("wrong name", "p2", typeBinding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - Name name = qualifiedName.getQualifier(); - assertTrue("Not a simple name", name.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$ - SimpleName simpleName2 = (SimpleName) name; - assertEquals("wrong name", "p2", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$ - IBinding binding2 = simpleName2.resolveBinding(); - assertNotNull("No binding", binding2); //$NON-NLS-1$ - assertEquals("wrong type", IBinding.PACKAGE, binding2.getKind()); //$NON-NLS-1$ - assertEquals("wrong name", "p2", binding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - node = getASTNode(compilationUnit, 0, 1, 0); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement2 = (ExpressionStatement) node; - Expression expression3 = expressionStatement2.getExpression(); - assertTrue("Not an method invocation", expression3.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$ - FunctionInvocation methodInvocation2 = (FunctionInvocation) expression3; - Expression expression4 = methodInvocation2.getExpression(); - assertNotNull("No receiver", expression4); //$NON-NLS-1$ - ITypeBinding binding3 = expression4.resolveTypeBinding(); - assertNotNull("No type binding", binding3); //$NON-NLS-1$ - assertEquals("wrong name", "A", binding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("wrong name", "p1", binding3.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=15804 - */ - public void test0341() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0341", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 1, 0); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("Not an if statement", node.getNodeType() == ASTNode.IF_STATEMENT); //$NON-NLS-1$ - String expectedSource = - "if (field != null) {\n" + //$NON-NLS-1$ - " throw new IOException();\n" + //$NON-NLS-1$ - " } else if (field == null) {\n" + //$NON-NLS-1$ - " throw new MalformedURLException();\n" + //$NON-NLS-1$ - " } else if (field == null) {\n" + //$NON-NLS-1$ - " throw new InterruptedIOException();\n" + //$NON-NLS-1$ - " } else {\n" + //$NON-NLS-1$ - " throw new UnsupportedEncodingException();\n" + //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(node, expectedSource, source); - IfStatement ifStatement = (IfStatement) node; - Statement thenStatement = ifStatement.getThenStatement(); - expectedSource = - "{\n" + //$NON-NLS-1$ - " throw new IOException();\n" + //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(thenStatement, expectedSource, source); - Statement elseStatement = ifStatement.getElseStatement(); - expectedSource = - "if (field == null) {\n" + //$NON-NLS-1$ - " throw new MalformedURLException();\n" + //$NON-NLS-1$ - " } else if (field == null) {\n" + //$NON-NLS-1$ - " throw new InterruptedIOException();\n" + //$NON-NLS-1$ - " } else {\n" + //$NON-NLS-1$ - " throw new UnsupportedEncodingException();\n" + //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(elseStatement, expectedSource, source); - assertTrue("Not a if statement", elseStatement.getNodeType() == ASTNode.IF_STATEMENT); //$NON-NLS-1$ - ifStatement = (IfStatement) elseStatement; - thenStatement = ifStatement.getThenStatement(); - expectedSource = - "{\n" + //$NON-NLS-1$ - " throw new MalformedURLException();\n" + //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(thenStatement, expectedSource, source); - elseStatement = ifStatement.getElseStatement(); - expectedSource = - "if (field == null) {\n" + //$NON-NLS-1$ - " throw new InterruptedIOException();\n" + //$NON-NLS-1$ - " } else {\n" + //$NON-NLS-1$ - " throw new UnsupportedEncodingException();\n" + //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(elseStatement, expectedSource, source); - assertTrue("Not a if statement", elseStatement.getNodeType() == ASTNode.IF_STATEMENT); //$NON-NLS-1$ - ifStatement = (IfStatement) elseStatement; - thenStatement = ifStatement.getThenStatement(); - expectedSource = - "{\n" + //$NON-NLS-1$ - " throw new InterruptedIOException();\n" + //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(thenStatement, expectedSource, source); - elseStatement = ifStatement.getElseStatement(); - expectedSource = - "{\n" + //$NON-NLS-1$ - " throw new UnsupportedEncodingException();\n" + //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(elseStatement, expectedSource, source); - } - -// /** -// * http://dev.eclipse.org/bugs/show_bug.cgi?id=15657 -// * @deprecated marked deprecated to suppress JDOM-related deprecation warnings -// */ -// public void test0342() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0342", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// IDOMCompilationUnit dcompUnit = new DOMFactory().createCompilationUnit(sourceUnit.getSource(), sourceUnit.getElementName()); -// assertNotNull("dcompUnit is null", dcompUnit); //$NON-NLS-1$ -// -// // searching class -// IDOMType classNode = null; -// Enumeration children = dcompUnit.getChildren(); -// assertNotNull("dcompUnit has no children", children); //$NON-NLS-1$ -// -// while (children.hasMoreElements()) { -// IDOMNode child = (IDOMNode) children.nextElement(); -// if (child.getNodeType() == IDOMNode.TYPE) { -// classNode = (IDOMType) child; -// break; -// } -// } -// assertNotNull("classNode is null", classNode); //$NON-NLS-1$ -// -// // searching for methods -// children = classNode.getChildren(); -// -// assertNotNull("classNode has no children", children); //$NON-NLS-1$ -// -// while (children.hasMoreElements()) { -// IDOMNode child = (IDOMNode) children.nextElement(); -// if (child.getNodeType() == IDOMNode.METHOD) { -// IDOMMethod childMethod = (IDOMMethod) child; -// -// // returnType is always null; -// String returnType = childMethod.getReturnType(); -// if (childMethod.isConstructor()) { -// assertNull(returnType); -// } else { -// assertNotNull("no return type", returnType); //$NON-NLS-1$ -// } -// } -// } -// } -// - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=16051 - */ - public void test0343() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0343", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 1, 1); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("Not an if statement", node.getNodeType() == ASTNode.IF_STATEMENT); //$NON-NLS-1$ - String expectedSource = - "if (flag)\n" + //$NON-NLS-1$ - " i= 10;"; //$NON-NLS-1$ - checkSourceRange(node, expectedSource, source); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=16132 - */ - public void test0344() throws JavaScriptModelException { - IJavaScriptProject project = null; - String pb_assert = null; - String compiler_source = null; - String compiler_compliance = null; - try { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0344", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - project = sourceUnit.getJavaScriptProject(); - pb_assert = project.getOption(JavaScriptCore.COMPILER_PB_ASSERT_IDENTIFIER, true); - compiler_source = project.getOption(JavaScriptCore.COMPILER_SOURCE, true); - compiler_compliance = project.getOption(JavaScriptCore.COMPILER_COMPLIANCE, true); - project.setOption(JavaScriptCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaScriptCore.ERROR); - project.setOption(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_4); - project.setOption(JavaScriptCore.COMPILER_COMPLIANCE, JavaScriptCore.VERSION_1_4); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - } finally { - if (project != null) { - project.setOption(JavaScriptCore.COMPILER_PB_ASSERT_IDENTIFIER, pb_assert); - project.setOption(JavaScriptCore.COMPILER_SOURCE, compiler_source); - project.setOption(JavaScriptCore.COMPILER_COMPLIANCE, compiler_compliance); - } - } - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=17922 - */ - public void test0345() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0345", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("Not an field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - List fragments = fieldDeclaration.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - assertTrue("Not an ArrayCreation", expression.getNodeType() == ASTNode.ARRAY_CREATION); //$NON-NLS-1$ - ArrayCreation arrayCreation = (ArrayCreation) expression; - ArrayType arrayType = arrayCreation.getType(); - IBinding binding2 = arrayType.resolveBinding(); - assertNotNull("no binding2", binding2); //$NON-NLS-1$ - assertEquals("not a type", binding2.getKind(), IBinding.TYPE); //$NON-NLS-1$ - ITypeBinding typeBinding2 = (ITypeBinding) binding2; - assertTrue("Not an array type binding2", typeBinding2.isArray()); //$NON-NLS-1$ - Type type = arrayType.getElementType(); - assertTrue("Not a simple type", type.isSimpleType()); //$NON-NLS-1$ - SimpleType simpleType = (SimpleType) type; - Name name = simpleType.getName(); - assertTrue("QualifiedName", name.getNodeType() == ASTNode.QUALIFIED_NAME); //$NON-NLS-1$ - SimpleName simpleName = ((QualifiedName) name).getName(); - IBinding binding = simpleName.resolveBinding(); - assertNotNull("no binding", binding); //$NON-NLS-1$ - assertEquals("not a type", binding.getKind(), IBinding.TYPE); //$NON-NLS-1$ - ITypeBinding typeBinding = (ITypeBinding) binding; - assertTrue("An array type binding", !typeBinding.isArray()); //$NON-NLS-1$ - Type type2 = fieldDeclaration.getType(); - assertTrue("Not a array type", type2.isArrayType()); //$NON-NLS-1$ - ArrayType arrayType2 = (ArrayType) type2; - Type type3 = arrayType2.getElementType(); - assertTrue("Not a simple type", type3.isSimpleType()); //$NON-NLS-1$ - SimpleType simpleType2 = (SimpleType) type3; - Name name2 = simpleType2.getName(); - assertTrue("Not a qualified name", name2.getNodeType() == ASTNode.QUALIFIED_NAME); //$NON-NLS-1$ - SimpleName simpleName2 = ((QualifiedName) name2).getName(); - IBinding binding3 = simpleName2.resolveBinding(); - assertNotNull("no binding", binding3); //$NON-NLS-1$ - assertEquals("not a type", binding3.getKind(), IBinding.TYPE); //$NON-NLS-1$ - ITypeBinding typeBinding3 = (ITypeBinding) binding3; - assertTrue("An array type binding", !typeBinding3.isArray()); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=18138 - */ - public void test0346() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0346", "Test2.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("Not an variable declaration", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - Type type = variableDeclarationStatement.getType(); - checkSourceRange(type, "Vector", source); //$NON-NLS-1$ - assertTrue("not an array type", !type.isArrayType()); //$NON-NLS-1$ - assertTrue("Not a simple type", type.isSimpleType()); //$NON-NLS-1$ - SimpleType simpleType = (SimpleType) type; - Name name = simpleType.getName(); - assertTrue("Not a simpleName", name.isSimpleName()); //$NON-NLS-1$ - SimpleName simpleName = (SimpleName) name; - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$ - ITypeBinding typeBinding = (ITypeBinding) binding; - assertTrue("An array", !typeBinding.isArray()); //$NON-NLS-1$ - assertEquals("Wrong name", "Vector", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - ITypeBinding typeBinding2 = simpleType.resolveBinding(); - assertNotNull("No binding", typeBinding2); //$NON-NLS-1$ - assertEquals("Wrong type", IBinding.TYPE, typeBinding2.getKind()); //$NON-NLS-1$ - assertTrue("An array", !typeBinding2.isArray()); //$NON-NLS-1$ - assertEquals("Wrong name", "Vector", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=18138 - */ - public void test0347() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0347", "Test2.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("Not an variable declaration", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - Type type = variableDeclarationStatement.getType(); - checkSourceRange(type, "Vector[]", source); //$NON-NLS-1$ - assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$ - ArrayType arrayType = (ArrayType) type; - ITypeBinding binding = arrayType.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$ - assertTrue("Not an array type", binding.isArray()); //$NON-NLS-1$ - assertEquals("Wrong name", "Vector[]", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=18138 - */ - public void test0348() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0348", "Test2.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("Not an variable declaration", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - Type type = variableDeclarationStatement.getType(); - checkSourceRange(type, "Vector[][]", source); //$NON-NLS-1$ - assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$ - ArrayType arrayType = (ArrayType) type; - ITypeBinding binding = arrayType.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$ - assertTrue("Not an array type", binding.isArray()); //$NON-NLS-1$ - assertEquals("Wrong name", "Vector[][]", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=18138 - */ - public void test0349() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0349", "Test2.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("Not an field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - Type type = fieldDeclaration.getType(); - checkSourceRange(type, "Vector[][]", source); //$NON-NLS-1$ - assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$ - ArrayType arrayType = (ArrayType) type; - ITypeBinding binding = arrayType.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$ - assertTrue("Not an array type", binding.isArray()); //$NON-NLS-1$ - assertEquals("Wrong name", "Vector[][]", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=18138 - */ - public void test0350() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0350", "Test2.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("Not an field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - Type type = fieldDeclaration.getType(); - checkSourceRange(type, "Vector", source); //$NON-NLS-1$ - assertTrue("not a simple type", type.isSimpleType()); //$NON-NLS-1$ - SimpleType simpleType = (SimpleType) type; - ITypeBinding binding = simpleType.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$ - assertTrue("An array type", binding.isClass()); //$NON-NLS-1$ - assertEquals("Wrong name", "Vector", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=18169 - */ - public void test0351() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0351", "Test2.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("Not an method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - List parameters = methodDeclaration.parameters(); - assertEquals("wrong size", 2, parameters.size()); //$NON-NLS-1$ - SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0); - checkSourceRange(singleVariableDeclaration, "int a", source); //$NON-NLS-1$ - singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(1); - checkSourceRange(singleVariableDeclaration, "int[] b", source); //$NON-NLS-1$ - node = getASTNode(compilationUnit, 0, 1); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("Not an method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - methodDeclaration = (FunctionDeclaration) node; - parameters = methodDeclaration.parameters(); - assertEquals("wrong size", 2, parameters.size()); //$NON-NLS-1$ - singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0); - checkSourceRange(singleVariableDeclaration, "int a", source); //$NON-NLS-1$ - singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(1); - checkSourceRange(singleVariableDeclaration, "int b[]", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=18169 - */ - public void test0352() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0352", "Test2.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("Not an method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - List parameters = methodDeclaration.parameters(); - assertEquals("wrong size", 2, parameters.size()); //$NON-NLS-1$ - SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0); - checkSourceRange(singleVariableDeclaration, "final int a", source); //$NON-NLS-1$ - singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(1); - checkSourceRange(singleVariableDeclaration, "final int[] b", source); //$NON-NLS-1$ - node = getASTNode(compilationUnit, 0, 1); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("Not an method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - methodDeclaration = (FunctionDeclaration) node; - parameters = methodDeclaration.parameters(); - assertEquals("wrong size", 2, parameters.size()); //$NON-NLS-1$ - singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0); - checkSourceRange(singleVariableDeclaration, "final int a", source); //$NON-NLS-1$ - singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(1); - checkSourceRange(singleVariableDeclaration, "final int b[]", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=18042 - */ - public void test0353() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0353", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("Not an variable declaration", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - Type type = variableDeclarationStatement.getType(); - checkSourceRange(type, "InputStream", source); //$NON-NLS-1$ - assertTrue("not a simple type", type.isSimpleType()); //$NON-NLS-1$ - ITypeBinding binding = type.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$ - assertTrue("Not a class", binding.isClass()); //$NON-NLS-1$ - assertEquals("Wrong name", "InputStream", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Wrong package", "java.io", binding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - SimpleType simpleType = (SimpleType) type; - Name name = simpleType.getName(); - IBinding binding2 = name.resolveBinding(); - assertNotNull("No binding", binding2); //$NON-NLS-1$ - assertEquals("Wrong type", IBinding.TYPE, binding2.getKind()); //$NON-NLS-1$ - ITypeBinding typeBinding = (ITypeBinding) binding2; - assertTrue("Not a class", typeBinding.isClass()); //$NON-NLS-1$ - assertEquals("Wrong name", "InputStream", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Wrong package", "java.io", typeBinding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=19851 - */ - public void test0354() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0354", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 2, compilationUnit.getMessages().length); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=20520 - */ - public void test0355() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0355", "Foo.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull(node); - assertTrue("Not an if statement", node.getNodeType() == ASTNode.IF_STATEMENT); //$NON-NLS-1$ - IfStatement ifStatement = (IfStatement) node; - Expression condition = ifStatement.getExpression(); - assertTrue("Not an infixExpression", condition.getNodeType() == ASTNode.INFIX_EXPRESSION); //$NON-NLS-1$ - InfixExpression infixExpression = (InfixExpression) condition; - Expression expression = infixExpression.getLeftOperand(); - assertTrue("Not a method invocation expression", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - Expression expression2 = methodInvocation.getExpression(); - assertTrue("Not a parenthesis expression", expression2.getNodeType() == ASTNode.PARENTHESIZED_EXPRESSION); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=20865 - */ - public void test0356() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0356", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 1, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull(node); - assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - Type type = variableDeclarationStatement.getType(); - ITypeBinding binding = type.resolveBinding(); - assertNotNull("Binding should NOT be null for type: "+type, binding); - - // Verify that class instance creation has a null binding - List fragments = variableDeclarationStatement.fragments(); - assertEquals("Expect only one fragment for VariableDeclarationStatement: "+variableDeclarationStatement, 1, fragments.size()); - node = (ASTNode) fragments.get(0); - assertEquals("Not a variable declaration fragment", ASTNode.VARIABLE_DECLARATION_FRAGMENT, node.getNodeType()); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) node; - Expression initializer = fragment.getInitializer(); - assertEquals("Expect a class instance creation for initializer: "+initializer, ASTNode.CLASS_INSTANCE_CREATION, initializer.getNodeType()); //$NON-NLS-1$ - ClassInstanceCreation instanceCreation = (ClassInstanceCreation) initializer; - type = instanceCreation.getType(); - binding = type.resolveBinding(); - assertNull("Binding should BE null for type: "+type, binding); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=21757 - */ - public void test0357() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0357", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0); - assertNotNull(node); - assertTrue("Not a type declaration statement", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - SimpleName name = typeDeclaration.getName(); - checkSourceRange(name, "A", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=21768 - */ - public void test0358() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0358", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0,0); - assertNotNull(node); - assertTrue("Not a method declaration statement", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - SimpleName name = methodDeclaration.getName(); - checkSourceRange(name, "mdd", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=21768 - */ - public void test0359() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0359", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0,0); - assertNotNull(node); - assertTrue("Not a method declaration statement", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - SimpleName name = methodDeclaration.getName(); - checkSourceRange(name, "mdd", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=21916 - */ - public void test0360() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0360", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0,0, 0); - assertNotNull(node); - assertTrue("Not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$ - ForStatement forStatement = (ForStatement) node; - List initializers = forStatement.initializers(); - assertEquals("Wrong size", 1, initializers.size()); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=21916 - */ - public void test0361() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0361", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0,0, 0); - assertNotNull(node); - assertTrue("Not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$ - ForStatement forStatement = (ForStatement) node; - List initializers = forStatement.initializers(); - assertEquals("Wrong size", 1, initializers.size()); //$NON-NLS-1$ - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=21916 - */ - public void test0362() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0362", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - ForStatement forStatement = this.ast.newForStatement(); - - VariableDeclarationFragment iFragment = this.ast.newVariableDeclarationFragment(); - iFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$ - iFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$ - VariableDeclarationFragment jFragment = this.ast.newVariableDeclarationFragment(); - jFragment.setName(this.ast.newSimpleName("j")); //$NON-NLS-1$ - jFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$ - VariableDeclarationFragment kFragment = this.ast.newVariableDeclarationFragment(); - kFragment.setName(this.ast.newSimpleName("k")); //$NON-NLS-1$ - kFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$ - - VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(iFragment); - variableDeclarationExpression.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - variableDeclarationExpression.fragments().add(jFragment); - variableDeclarationExpression.fragments().add(kFragment); - forStatement.initializers().add(variableDeclarationExpression); - - PostfixExpression iPostfixExpression = this.ast.newPostfixExpression(); - iPostfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$ - iPostfixExpression.setOperator(PostfixExpression.Operator.INCREMENT); - forStatement.updaters().add(iPostfixExpression); - - PostfixExpression jPostfixExpression = this.ast.newPostfixExpression(); - jPostfixExpression.setOperand(this.ast.newSimpleName("j"));//$NON-NLS-1$ - jPostfixExpression.setOperator(PostfixExpression.Operator.INCREMENT); - forStatement.updaters().add(jPostfixExpression); - - PostfixExpression kPostfixExpression = this.ast.newPostfixExpression(); - kPostfixExpression.setOperand(this.ast.newSimpleName("k"));//$NON-NLS-1$ - kPostfixExpression.setOperator(PostfixExpression.Operator.INCREMENT); - forStatement.updaters().add(kPostfixExpression); - - forStatement.setBody(this.ast.newBlock()); - - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.LESS); - infixExpression.setRightOperand(this.ast.newNumberLiteral("10")); //$NON-NLS-1$ - forStatement.setExpression(infixExpression); - - assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "for (int i=0, j=0, k=0; i<10 ; i++, j++, k++) {}", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=22939 - */ - public void test0363() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0363", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 1); - assertNotNull(node); - assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - List fragments = variableDeclarationStatement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - assertTrue("Not a parenthesized expression", expression.getNodeType() == ASTNode.PARENTHESIZED_EXPRESSION); //$NON-NLS-1$ - Expression expression2 = ((ParenthesizedExpression) expression).getExpression(); - checkSourceRange(expression2, "xxxx", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=11529 - */ - public void test0364() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0364", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull(node); - assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - List fragments = variableDeclarationStatement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - checkSourceRange(variableDeclarationStatement, "int local;", source); //$NON-NLS-1$ - SimpleName simpleName = variableDeclarationFragment.getName(); - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=11529 - */ - public void test0365() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0365", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull(node); - assertTrue("Not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$ - ForStatement forStatement = (ForStatement) node; - List initializers = forStatement.initializers(); - assertEquals("Wrong size", 1, initializers.size()); //$NON-NLS-1$ - VariableDeclarationExpression variableDeclarationExpression = (VariableDeclarationExpression) initializers.get(0); - List fragments = variableDeclarationExpression.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - SimpleName simpleName = variableDeclarationFragment.getName(); - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23048 - */ - public void test0366() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0366", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull(node); - assertTrue("Not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$ - ForStatement forStatement = (ForStatement) node; - checkSourceRange(forStatement, "for (int i = 0; i < 5; ++i);", source); //$NON-NLS-1$ - Statement statement = forStatement.getBody(); - assertTrue("Not an empty statement", statement.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$ - checkSourceRange(statement, ";", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23048 - */ - public void test0367() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0367", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull(node); - assertTrue("Not a while statement", node.getNodeType() == ASTNode.WHILE_STATEMENT); //$NON-NLS-1$ - WhileStatement whileStatement = (WhileStatement) node; - checkSourceRange(whileStatement, "while(i == 2);", source); //$NON-NLS-1$ - Statement statement = whileStatement.getBody(); - assertTrue("Not an empty statement", statement.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$ - checkSourceRange(statement, ";", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23048 - */ - public void test0368() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0368", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertProblemsSize(compilationUnit, 1, "The label test is never explicitly referenced"); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull(node); - assertTrue("Not a labeled statement", node.getNodeType() == ASTNode.LABELED_STATEMENT); //$NON-NLS-1$ - LabeledStatement labeledStatement = (LabeledStatement) node; - checkSourceRange(labeledStatement, "test:;", source); //$NON-NLS-1$ - Statement statement = labeledStatement.getBody(); - assertTrue("Not an empty statement", statement.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$ - checkSourceRange(statement, ";", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23048 - */ - public void test0369() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0369", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertProblemsSize(compilationUnit, 1, "The label test is never explicitly referenced"); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull(node); - assertTrue("Not a labeled statement", node.getNodeType() == ASTNode.LABELED_STATEMENT); //$NON-NLS-1$ - LabeledStatement labeledStatement = (LabeledStatement) node; - checkSourceRange(labeledStatement, "test:\\u003B", source); //$NON-NLS-1$ - Statement statement = labeledStatement.getBody(); - assertTrue("Not an empty statement", statement.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$ - checkSourceRange(statement, "\\u003B", source); //$NON-NLS-1$ - } - - /** - * DoStatement ==> DoStatement - */ - public void test0370() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0370", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - DoStatement doStatement = this.ast.newDoStatement(); - doStatement.setBody(this.ast.newEmptyStatement()); - doStatement.setExpression(this.ast.newBooleanLiteral(true)); - assertTrue("Both AST trees should be identical", doStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - String expectedSource = "do ; while(true);";//$NON-NLS-1$ - checkSourceRange(node, expectedSource, source); - DoStatement doStatement2 = (DoStatement) node; - Statement statement = doStatement2.getBody(); - assertTrue("Not an empty statement", statement.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$ - checkSourceRange(statement, ";", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23048 - */ - public void test0371() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0371", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull(node); - assertTrue("Not a labeled statement", node.getNodeType() == ASTNode.IF_STATEMENT); //$NON-NLS-1$ - IfStatement ifStatement = (IfStatement) node; - checkSourceRange(ifStatement, "if (i == 6);", source); //$NON-NLS-1$ - Statement statement = ifStatement.getThenStatement(); - assertTrue("Not an empty statement", statement.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$ - checkSourceRange(statement, ";", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23048 - */ - public void test0372() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0372", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull(node); - assertTrue("Not a labeled statement", node.getNodeType() == ASTNode.IF_STATEMENT); //$NON-NLS-1$ - IfStatement ifStatement = (IfStatement) node; - checkSourceRange(ifStatement, "if (i == 6) {} else ;", source); //$NON-NLS-1$ - Statement statement = ifStatement.getElseStatement(); - assertTrue("Not an empty statement", statement.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$ - checkSourceRange(statement, ";", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23118 - */ - public void test0373() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0373", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull(node); - assertTrue("Not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$ - ForStatement forStatement = (ForStatement) node; - Statement statement = forStatement.getBody(); - assertTrue("Not a block statement", statement.getNodeType() == ASTNode.BLOCK); //$NON-NLS-1$ - Block block = (Block) statement; - List statements = block.statements(); - assertEquals("Wrong size", 1, statements.size()); //$NON-NLS-1$ - Statement statement2 = (Statement) statements.get(0); - assertTrue("Not a break statement", statement2.getNodeType() == ASTNode.BREAK_STATEMENT); //$NON-NLS-1$ - BreakStatement breakStatement = (BreakStatement) statement2; - checkSourceRange(breakStatement, "break;", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23118 - */ - public void test0374() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0374", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull(node); - assertTrue("Not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$ - ForStatement forStatement = (ForStatement) node; - Statement statement = forStatement.getBody(); - assertTrue("Not a block statement", statement.getNodeType() == ASTNode.BLOCK); //$NON-NLS-1$ - Block block = (Block) statement; - List statements = block.statements(); - assertEquals("Wrong size", 1, statements.size()); //$NON-NLS-1$ - Statement statement2 = (Statement) statements.get(0); - assertTrue("Not a break statement", statement2.getNodeType() == ASTNode.CONTINUE_STATEMENT); //$NON-NLS-1$ - ContinueStatement continueStatement = (ContinueStatement) statement2; - checkSourceRange(continueStatement, "continue;", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23052 - */ - public void test0375() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0375", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("problems found", 1, compilationUnit.getMessages().length); //$NON-NLS-1$ - List imports = compilationUnit.imports(); - assertEquals("wrong size", 1, imports.size()); //$NON-NLS-1$ - ImportDeclaration importDeclaration = (ImportDeclaration) imports.get(0); - IBinding binding = importDeclaration.resolveBinding(); - assertNotNull("no binding", binding); //$NON-NLS-1$ - assertEquals("Not a type binding", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=22939 - */ - public void test0376() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0376", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull(node); - assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - List fragments = variableDeclarationStatement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23050 - */ - public void test0377() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0377", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull(node); - assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - List fragments = variableDeclarationStatement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding = variableDeclarationFragment.resolveBinding(); - assertNotNull("No variable binding", variableBinding); //$NON-NLS-1$ - assertEquals("Wrong modifier", IModifierConstants.ACC_FINAL, variableBinding.getModifiers()); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=22161 - */ - public void test0378() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0378", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertNotNull(node); - assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - SimpleName name = typeDeclaration.getName(); - checkSourceRange(name, "B", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=22161 - */ - public void test0379() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0379", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - assertTrue("Not a class instance creation", expression.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation2 = (ClassInstanceCreation) expression; - Type type = classInstanceCreation2.getType(); - checkSourceRange(type, "Object", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=22054 - */ - public void test0380() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0380", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull(node); - assertTrue("Not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node; - Expression expression = returnStatement.getExpression(); - assertTrue("Not a super method invocation", expression.getNodeType() == ASTNode.SUPER_METHOD_INVOCATION); //$NON-NLS-1$ - SuperMethodInvocation superMethodInvocation = (SuperMethodInvocation) expression; - ITypeBinding typeBinding = superMethodInvocation.resolveTypeBinding(); - assertNotNull("no type binding", typeBinding); //$NON-NLS-1$ - assertEquals("wrong declaring class", typeBinding.getSuperclass().getName(), "Object"); //$NON-NLS-1$ //$NON-NLS-2$ - SimpleName simpleName = superMethodInvocation.getName(); - IBinding binding = simpleName.resolveBinding(); - assertNotNull("no binding", binding); //$NON-NLS-1$ - assertEquals("Wrong type", IBinding.METHOD, binding.getKind()); //$NON-NLS-1$ - IFunctionBinding methodBinding = (IFunctionBinding) binding; - assertEquals("Wrong declaring class", methodBinding.getDeclaringClass().getName(), "Object"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23054 - */ - public void test0381() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0381", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0); - assertNotNull(node); - assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - JSdoc javadoc = typeDeclaration.getJavadoc(); - assertNull("Javadoc not null", javadoc); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=22154 - */ - public void test0382() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0382", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0); - assertNotNull(node); - assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertEquals("Wrong fully qualified name", typeBinding.getQualifiedName(), "test0382.A"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=22154 - */ - public void test0383() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0383", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertNotNull(node); - assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertEquals("Wrong fully qualified name", typeBinding.getQualifiedName(), "test0383.A.B"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=22154 - */ - public void test0384() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0384", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull(node); - assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertEquals("Wrong fully qualified name", typeBinding.getQualifiedName(), "test0384.A.B.D"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23117 - */ - public void test0385() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0385", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 1, compilationUnit.getMessages().length); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23259 - */ - public void test0386() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0386", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull(node); - assertTrue("Not a switch statement", node.getNodeType() == ASTNode.SWITCH_STATEMENT); //$NON-NLS-1$ - SwitchStatement switchStatement = (SwitchStatement) node; - List statements = switchStatement.statements(); - assertEquals("Wrong size", 5, statements.size()); //$NON-NLS-1$ - Statement statement = (Statement) statements.get(0); - assertTrue("Not a case statement", statement.getNodeType() == ASTNode.SWITCH_CASE); //$NON-NLS-1$ - checkSourceRange(statement, "case 1:", source); //$NON-NLS-1$ - statement = (Statement) statements.get(3); - assertTrue("Not a default case statement", statement.getNodeType() == ASTNode.SWITCH_CASE); //$NON-NLS-1$ - checkSourceRange(statement, "default :", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=22939 - */ - public void test0387() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0387", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull(node); - assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - List fragments = variableDeclarationStatement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=22154 - */ - public void test0388() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0388", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0); - assertNotNull(node); - assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong qualified name", "test0388.A", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=22154 - */ - public void test0389() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0389", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertNotNull(node); - assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong qualified name", "test0389.A.B", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=22154 - */ - public void test0390() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0390", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertNotNull(node); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - Type type = methodDeclaration.getReturnType2(); - ITypeBinding typeBinding = type.resolveBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong qualified name", "int", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=22154 - */ - public void test0391() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0391", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertNotNull(node); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - Type type = methodDeclaration.getReturnType2(); - ITypeBinding typeBinding = type.resolveBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong qualified name", "int[]", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=22154 - */ - public void test0392() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0392", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertNotNull(node); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - Type type = methodDeclaration.getReturnType2(); - ITypeBinding typeBinding = type.resolveBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong qualified name", "java.lang.String[]", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23284 - */ - public void test0393() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0393", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertNotNull(node); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - Type type = methodDeclaration.getReturnType2(); - checkSourceRange(type, "String", source); //$NON-NLS-1$ - ITypeBinding typeBinding = type.resolveBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong dimension", 0, typeBinding.getDimensions()); //$NON-NLS-1$ - assertEquals("Wrong qualified name", "java.lang.String", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Wrong dimension", 1, methodDeclaration.getExtraDimensions()); //$NON-NLS-1$ - IFunctionBinding methodBinding = methodDeclaration.resolveBinding(); - assertNotNull("No method binding", methodBinding); //$NON-NLS-1$ - ITypeBinding typeBinding2 = methodBinding.getReturnType(); - assertNotNull("No type binding", typeBinding2); //$NON-NLS-1$ - assertEquals("Wrong qualified name", "java.lang.String[]", typeBinding2.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Wrong dimension", 1, typeBinding2.getDimensions()); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23284 - */ - public void test0394() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0394", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertNotNull(node); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - Type type = methodDeclaration.getReturnType2(); - checkSourceRange(type, "String", source); //$NON-NLS-1$ - ITypeBinding typeBinding = type.resolveBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong qualified name", "java.lang.String", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Wrong dimension", 0, methodDeclaration.getExtraDimensions()); //$NON-NLS-1$ - } - - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23284 - */ - public void test0395() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0395", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertNotNull(node); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - Type type = methodDeclaration.getReturnType2(); - checkSourceRange(type, "String[]", source); //$NON-NLS-1$ - ITypeBinding typeBinding = type.resolveBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong dimension", 1, typeBinding.getDimensions()); //$NON-NLS-1$ - assertEquals("Wrong qualified name", "java.lang.String[]", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Wrong dimension", 1, methodDeclaration.getExtraDimensions()); //$NON-NLS-1$ - IFunctionBinding methodBinding = methodDeclaration.resolveBinding(); - assertNotNull("No method binding", methodBinding); //$NON-NLS-1$ - ITypeBinding typeBinding2 = methodBinding.getReturnType(); - assertNotNull("No type binding", typeBinding2); //$NON-NLS-1$ - assertEquals("Wrong qualified name", "java.lang.String[][]", typeBinding2.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Wrong dimension", 2, typeBinding2.getDimensions()); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23284 - */ - public void test0396() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0396", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull(node); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration method = (FunctionDeclaration) node; - SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) method.parameters().get(0); - assertNotNull("Expression should not be null", singleVariableDeclaration); //$NON-NLS-1$ - checkSourceRange(singleVariableDeclaration, "final String s[]", source); //$NON-NLS-1$ - Type type = singleVariableDeclaration.getType(); - checkSourceRange(type, "String", source); //$NON-NLS-1$ - assertEquals("Wrong dimension", 1, singleVariableDeclaration.getExtraDimensions()); //$NON-NLS-1$ - ITypeBinding typeBinding = type.resolveBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertTrue("An array binding", !typeBinding.isArray()); //$NON-NLS-1$ - assertEquals("Wrong dimension", 0, typeBinding.getDimensions()); //$NON-NLS-1$ - assertEquals("wrong fully qualified name", "java.lang.String", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$ - IVariableBinding variableBinding = singleVariableDeclaration.resolveBinding(); - assertNotNull("No variable binding", variableBinding); //$NON-NLS-1$ - assertTrue("Is a parameter", variableBinding.isParameter()); - ITypeBinding typeBinding2 = variableBinding.getType(); - assertNotNull("No type binding", typeBinding2); //$NON-NLS-1$ - assertTrue("Not an array binding", typeBinding2.isArray()); //$NON-NLS-1$ - assertEquals("Wrong dimension", 1, typeBinding2.getDimensions()); //$NON-NLS-1$ - assertEquals("wrong fully qualified name", "java.lang.String[]", typeBinding2.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23284 - */ - public void test0397() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0397", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull(node); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration method = (FunctionDeclaration) node; - SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) method.parameters().get(0); - assertNotNull("Expression should not be null", singleVariableDeclaration); //$NON-NLS-1$ - checkSourceRange(singleVariableDeclaration, "final String[] \\u0073\\u005B][]", source); //$NON-NLS-1$ - Type type = singleVariableDeclaration.getType(); - checkSourceRange(type, "String[]", source); //$NON-NLS-1$ - assertEquals("Wrong dimension", 2, singleVariableDeclaration.getExtraDimensions()); //$NON-NLS-1$ - ITypeBinding typeBinding = type.resolveBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertTrue("Not an array binding", typeBinding.isArray()); //$NON-NLS-1$ - assertEquals("Wrong dimension", 1, typeBinding.getDimensions()); //$NON-NLS-1$ - assertEquals("wrong fully qualified name", "java.lang.String[]", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$ - IVariableBinding variableBinding = singleVariableDeclaration.resolveBinding(); - assertNotNull("No variable binding", variableBinding); //$NON-NLS-1$ - assertTrue("Is a parameter", variableBinding.isParameter()); - ITypeBinding typeBinding2 = variableBinding.getType(); - assertNotNull("No type binding", typeBinding2); //$NON-NLS-1$ - assertTrue("Not an array binding", typeBinding2.isArray()); //$NON-NLS-1$ - assertEquals("Wrong dimension", 3, typeBinding2.getDimensions()); //$NON-NLS-1$ - assertEquals("wrong fully qualified name", "java.lang.String[][][]", typeBinding2.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23362 - */ - public void test0398() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0398", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull(node); - assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - List fragments = variableDeclarationStatement.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - assertTrue("Not an infix expression", expression.getNodeType() == ASTNode.INFIX_EXPRESSION); //$NON-NLS-1$ - InfixExpression infixExpression = (InfixExpression) expression; - checkSourceRange(infixExpression, "(1 + 2) * 3", source); //$NON-NLS-1$ - Expression expression2 = infixExpression.getLeftOperand(); - assertTrue("Not an parenthesis expression", expression2.getNodeType() == ASTNode.PARENTHESIZED_EXPRESSION); //$NON-NLS-1$ - ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression2; - Expression expression3 = parenthesizedExpression.getExpression(); - assertTrue("Not an infix expression", expression3.getNodeType() == ASTNode.INFIX_EXPRESSION); //$NON-NLS-1$ - checkSourceRange(expression3, "1 + 2", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=22306 - */ - public void test0399() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0399", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull(node); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertTrue("Not a constructor", methodDeclaration.isConstructor()); //$NON-NLS-1$ - Block block = methodDeclaration.getBody(); - List statements = block.statements(); - assertEquals("wrong size", 2, statements.size()); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=22306 - */ - public void test0400() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0400", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull(node); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertTrue("Not a constructor", methodDeclaration.isConstructor()); //$NON-NLS-1$ - Block block = methodDeclaration.getBody(); - List statements = block.statements(); - assertEquals("wrong size", 3, statements.size()); //$NON-NLS-1$ - Statement statement = (Statement) statements.get(0); - assertTrue("Not an superconstructorinvocation", statement.getNodeType() == ASTNode.SUPER_CONSTRUCTOR_INVOCATION); //$NON-NLS-1$ - checkSourceRange(statement, "super();", source); //$NON-NLS-1$ - } -} - diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterBindingsTest.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterBindingsTest.java deleted file mode 100644 index efa3e8f..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterBindingsTest.java +++ /dev/null @@ -1,506 +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.util.ArrayList; -import java.util.List; - -import junit.framework.Test; - -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.JavaScriptModelException; -import org.eclipse.wst.jsdt.core.dom.AST; -import org.eclipse.wst.jsdt.core.dom.ASTNode; -import org.eclipse.wst.jsdt.core.dom.ASTVisitor; -import org.eclipse.wst.jsdt.core.dom.AbstractTypeDeclaration; -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.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.ConstructorInvocation; -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.IBinding; -import org.eclipse.wst.jsdt.core.dom.IFunctionBinding; -import org.eclipse.wst.jsdt.core.dom.IPackageBinding; -import org.eclipse.wst.jsdt.core.dom.ITypeBinding; -import org.eclipse.wst.jsdt.core.dom.IVariableBinding; -import org.eclipse.wst.jsdt.core.dom.ImportDeclaration; -import org.eclipse.wst.jsdt.core.dom.InfixExpression; -import org.eclipse.wst.jsdt.core.dom.InstanceofExpression; -import org.eclipse.wst.jsdt.core.dom.JavaScriptUnit; -import org.eclipse.wst.jsdt.core.dom.ListExpression; -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.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.ThisExpression; -import org.eclipse.wst.jsdt.core.dom.TypeDeclaration; -import org.eclipse.wst.jsdt.core.dom.TypeLiteral; -import org.eclipse.wst.jsdt.core.dom.VariableDeclarationExpression; -import org.eclipse.wst.jsdt.core.dom.VariableDeclarationFragment; - -public class ASTConverterBindingsTest extends ConverterTestSetup { - private static final boolean DEBUG = false; - - static class BindingsCollector extends ASTVisitor { - - public ArrayList arrayList; - - BindingsCollector() { - // visit Javadoc.tags() as well - super(true); - this.arrayList = new ArrayList(); - } - - private void collectBindings( - ASTNode node, - IBinding binding) { - - if (binding != null) { - arrayList.add(binding); - } - } - - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(AnonymousClassDeclaration) - */ - public void endVisit(AnonymousClassDeclaration node) { - ITypeBinding typeBinding = node.resolveBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(ArrayAccess) - */ - public void endVisit(ArrayAccess node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(ArrayCreation) - */ - public void endVisit(ArrayCreation node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(ArrayInitializer) - */ - public void endVisit(ArrayInitializer node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(ArrayType) - */ - public void endVisit(ArrayType node) { - ITypeBinding typeBinding = node.resolveBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(Assignment) - */ - public void endVisit(Assignment node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(BooleanLiteral) - */ - public void endVisit(BooleanLiteral node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(CharacterLiteral) - */ - public void endVisit(CharacterLiteral node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(ClassInstanceCreation) - */ - public void endVisit(ClassInstanceCreation node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(ConditionalExpression) - */ - public void endVisit(ConditionalExpression node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(ConstructorInvocation) - */ - public void endVisit(ConstructorInvocation node) { - IFunctionBinding methodBinding = node.resolveConstructorBinding(); - collectBindings(node, methodBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(FieldAccess) - */ - public void endVisit(FieldAccess node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(ImportDeclaration) - */ - public void endVisit(ImportDeclaration node) { - IBinding binding = node.resolveBinding(); - collectBindings(node, binding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(InfixExpression) - */ - public void endVisit(InfixExpression node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(InstanceofExpression) - */ - public void endVisit(InstanceofExpression node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - public void endVisit(ListExpression node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see ASTVisitor#endVisit(MemberRef) - * @since 3.0 - */ - public void endVisit(MemberRef node) { - IBinding binding = node.resolveBinding(); - collectBindings(node, binding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(FunctionDeclaration) - */ - public void endVisit(FunctionDeclaration node) { - IFunctionBinding methodBinding = node.resolveBinding(); - collectBindings(node, methodBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(FunctionInvocation) - */ - public void endVisit(FunctionInvocation node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see ASTVisitor#endVisit(FunctionRef ) - * @since 3.0 - */ - public void endVisit(FunctionRef node) { - IBinding binding = node.resolveBinding(); - collectBindings(node, binding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(NullLiteral) - */ - public void endVisit(NullLiteral node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(NumberLiteral) - */ - public void endVisit(NumberLiteral node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(PackageDeclaration) - */ - public void endVisit(PackageDeclaration node) { - IPackageBinding packageBinding = node.resolveBinding(); - collectBindings(node, packageBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(ParenthesizedExpression) - */ - public void endVisit(ParenthesizedExpression node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(PostfixExpression) - */ - public void endVisit(PostfixExpression node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(PrefixExpression) - */ - public void endVisit(PrefixExpression node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(PrimitiveType) - */ - public void endVisit(PrimitiveType node) { - ITypeBinding typeBinding = node.resolveBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(QualifiedName) - */ - public void endVisit(QualifiedName node) { - IBinding binding = node.resolveBinding(); - collectBindings(node, binding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(SimpleName) - */ - public void endVisit(SimpleName node) { - IBinding binding = node.resolveBinding(); - collectBindings(node, binding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(SimpleType) - */ - public void endVisit(SimpleType node) { - ITypeBinding typeBinding = node.resolveBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(SingleVariableDeclaration) - */ - public void endVisit(SingleVariableDeclaration node) { - IVariableBinding variableBinding = node.resolveBinding(); - collectBindings(node, variableBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(StringLiteral) - */ - public void endVisit(StringLiteral node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(SuperConstructorInvocation) - */ - public void endVisit(SuperConstructorInvocation node) { - IFunctionBinding methodBinding = node.resolveConstructorBinding(); - collectBindings(node, methodBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(SuperFieldAccess) - */ - public void endVisit(SuperFieldAccess node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(SuperMethodInvocation) - */ - public void endVisit(SuperMethodInvocation node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(ThisExpression) - */ - public void endVisit(ThisExpression node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(TypeDeclaration) - */ - public void endVisit(TypeDeclaration node) { - ITypeBinding typeBinding = node.resolveBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(TypeLiteral) - */ - public void endVisit(TypeLiteral node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(VariableDeclarationExpression) - */ - public void endVisit(VariableDeclarationExpression node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(VariableDeclarationFragment) - */ - public void endVisit(VariableDeclarationFragment node) { - IVariableBinding variableBinding = node.resolveBinding(); - collectBindings(node, variableBinding); - } - - public List getBindings() { - return arrayList; - } - - } - - - public void setUpSuite() throws Exception { - super.setUpSuite(); - this.ast = AST.newAST(AST.JLS3); - } - - public ASTConverterBindingsTest(String name) { - super(name); - } - - public static Test suite() { - return buildModelTestSuite(ASTConverterBindingsTest.class); - } - - public void test0001() throws JavaScriptModelException { - checkBindingEqualityForProject("Converter"); - checkBindingEqualityForProject("Converter15"); - } - - /** - * @throws JavaScriptModelException - */ - private void checkBindingEqualityForProject(String projectName) throws JavaScriptModelException { - IJavaScriptProject javaProject = getJavaProject(projectName); - IPackageFragment[] packageFragments = javaProject.getPackageFragments(); - ArrayList compilationUnitscollector = new ArrayList(); - for (int j = 0, max2 = packageFragments.length; j < max2; j++) { - IJavaScriptUnit[] units = packageFragments[j].getJavaScriptUnits(); - if (units != null) { - for (int k = 0, max3 = units.length; k < max3; k++) { - compilationUnitscollector.add(units[k]); - } - } - } - final int length = compilationUnitscollector.size(); - IJavaScriptUnit[] units = new IJavaScriptUnit[length]; - compilationUnitscollector.toArray(units); - long totalTime = 0; - for (int j = 0; j < length; j++) { - IJavaScriptUnit currentUnit = units[j]; - ASTNode result = runConversion(AST.JLS3, currentUnit, true); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) result; - result = runConversion(AST.JLS3, currentUnit, true); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); - if (DEBUG) { - if (unit.types().size() > 0 ) { - AbstractTypeDeclaration typeDeclaration = (AbstractTypeDeclaration) unit.types().get(0); - StringBuffer buffer = new StringBuffer(); - PackageDeclaration packageDeclaration = unit.getPackage(); - if (packageDeclaration != null) { - buffer.append(unit.getPackage().getName()).append(".").append(typeDeclaration.getName()); - } else { - buffer.append(typeDeclaration.getName()); - } - System.out.println(String.valueOf(buffer)); - } else { - System.out.println(currentUnit.getElementName()); - } - } - JavaScriptUnit unit2 = (JavaScriptUnit) result; - BindingsCollector collector = new BindingsCollector(); - unit.accept(collector); - List bindings1 = collector.getBindings(); - BindingsCollector collector2 = new BindingsCollector(); - unit2.accept(collector2); - List bindings2 = collector2.getBindings(); - assertEquals("Wrong size", bindings1.size(), bindings2.size()); - long time = System.currentTimeMillis(); - for (int i = 0, max = bindings1.size(); i < max; i++) { - final Object object = bindings1.get(i); - assertTrue("not a binding", object instanceof IBinding); - final IBinding binding = (IBinding) object; - final Object object2 = bindings2.get(i); - assertTrue("not a binding", object2 instanceof IBinding); - final IBinding binding2 = (IBinding) object2; - final boolean equalTo = binding.isEqualTo(binding2); - assertTrue("not equals", equalTo); - } - totalTime += (System.currentTimeMillis() - time); - } - if (DEBUG) { - System.out.println("Total time = " + totalTime + "ms"); - } - } -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterJavadocTest.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterJavadocTest.java deleted file mode 100644 index c7900f6..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterJavadocTest.java +++ /dev/null @@ -1,3405 +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.File; -import java.io.IOException; -import java.lang.reflect.Method; -import java.text.NumberFormat; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.core.runtime.CoreException; -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.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.ArrayType; -import org.eclipse.wst.jsdt.core.dom.Block; -import org.eclipse.wst.jsdt.core.dom.Comment; -import org.eclipse.wst.jsdt.core.dom.Expression; -import org.eclipse.wst.jsdt.core.dom.ExpressionStatement; -import org.eclipse.wst.jsdt.core.dom.FieldDeclaration; -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.FunctionRefParameter; -import org.eclipse.wst.jsdt.core.dom.IBinding; -import org.eclipse.wst.jsdt.core.dom.ITypeBinding; -import org.eclipse.wst.jsdt.core.dom.IfStatement; -import org.eclipse.wst.jsdt.core.dom.JSdoc; -import org.eclipse.wst.jsdt.core.dom.JavaScriptUnit; -import org.eclipse.wst.jsdt.core.dom.MemberRef; -import org.eclipse.wst.jsdt.core.dom.Name; -import org.eclipse.wst.jsdt.core.dom.PackageDeclaration; -import org.eclipse.wst.jsdt.core.dom.PrimitiveType; -import org.eclipse.wst.jsdt.core.dom.QualifiedName; -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.Statement; -import org.eclipse.wst.jsdt.core.dom.TagElement; -import org.eclipse.wst.jsdt.core.dom.TextElement; -import org.eclipse.wst.jsdt.core.dom.Type; -import org.eclipse.wst.jsdt.core.dom.TypeDeclaration; -import org.eclipse.wst.jsdt.core.dom.TypeDeclarationStatement; -import org.eclipse.wst.jsdt.core.dom.VariableDeclarationFragment; -import org.eclipse.wst.jsdt.core.dom.VariableDeclarationStatement; -import org.eclipse.wst.jsdt.internal.compiler.parser.ScannerHelper; - -public class ASTConverterJavadocTest extends ConverterTestSetup { - - // Flag to know whether Converter directory should be copied from org.eclipse.wst.jsdt.core.tests.model project - static protected boolean COPY_DIR = true; - - // Test counters - protected static int[] TEST_COUNTERS = { 0, 0, 0, 0 }; - // Unicode tests - protected static boolean UNICODE = false; - // Unix tests - final boolean unix; - static final String UNIX_SUPPORT = System.getProperty("unix"); - // Doc Comment support - static final String DOC_COMMENT_SUPPORT = System.getProperty("doc.support"); - final String docCommentSupport; - - // List of comments read from source of test - private final int LINE_COMMENT = 100; - private final int BLOCK_COMMENT =200; - private final int DOC_COMMENT = 300; - List comments = new ArrayList(); - private String chars; - // List of tags contained in each comment read from test source. - List allTags = new ArrayList(); - // Current compilation unit - protected IJavaScriptUnit sourceUnit; - // Test package binding - protected boolean resolveBinding = true; - protected boolean packageBinding = true; - // AST Level - /** @deprecated using deprecated code */ - protected int astLevel = AST.JLS2; - protected int savedLevel; - // Debug - protected String prefix = ""; - protected boolean debug = false; - protected StringBuffer problems; - protected String compilerOption = JavaScriptCore.IGNORE; - protected List failures; - protected boolean stopOnFailure = true; - // Project - protected IJavaScriptProject currentProject; - Map savedOptions = null; - - /** - * @param name - * @param support - */ - public ASTConverterJavadocTest(String name, String support, String unix) { - super(name); - this.docCommentSupport = support; - this.unix = "true".equals(unix); - } - /** - * @param name - */ - public ASTConverterJavadocTest(String name) { - this(name, JavaScriptCore.ENABLED, UNIX_SUPPORT); - } - - public static Test suite() { - TestSuite suite = new Suite(ASTConverterJavadocTest.class.getName()); -// String param = System.getProperty("unicode"); -// if ("true".equals(param)) { -// unicode = true; -// } -// String param = System.getProperty("unix"); -// if ("true".equals(param)) { -// unix = true; -// } - if (true) { - if (DOC_COMMENT_SUPPORT == null) { - buildSuite(suite, JavaScriptCore.ENABLED); - buildSuite(suite, JavaScriptCore.DISABLED); - } else { - String support = DOC_COMMENT_SUPPORT==null ? JavaScriptCore.DISABLED : (DOC_COMMENT_SUPPORT.equals(JavaScriptCore.DISABLED)?JavaScriptCore.DISABLED:JavaScriptCore.ENABLED); - buildSuite(suite, support); - } - return suite; - } - - // Run test cases subset - COPY_DIR = false; - System.err.println("WARNING: only subset of tests will be executed!!!"); - suite.addTest(new ASTConverterJavadocTest("testBug165525")); - return suite; - } - - public static void buildSuite(TestSuite suite, String support) { - Class c = ASTConverterJavadocTest.class; - Method[] methods = c.getMethods(); - for (int i = 0, max = methods.length; i < max; i++) { - if (methods[i].getName().startsWith("test")) { //$NON-NLS-1$ - suite.addTest(new ASTConverterJavadocTest(methods[i].getName(), support, UNIX_SUPPORT)); - } - } - // when unix support not specified, also run using unix format - if (UNIX_SUPPORT == null && JavaScriptCore.ENABLED.equals(support)) { - for (int i = 0, max = methods.length; i < max; i++) { - if (methods[i].getName().startsWith("test")) { //$NON-NLS-1$ - suite.addTest(new ASTConverterJavadocTest(methods[i].getName(), support, "true")); - } - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.wst.jsdt.core.tests.model.AbstractJavaModelTests#copyDirectory(java.io.File, java.io.File) - */ - protected void copyDirectory(File sourceDir, File targetDir) throws IOException { - if (COPY_DIR) { - super.copyDirectory(sourceDir, targetDir); - } else { - targetDir.mkdirs(); - File sourceFile = new File(sourceDir, ".project"); - File targetFile = new File(targetDir, ".project"); - targetFile.createNewFile(); - copy(sourceFile, targetFile); - sourceFile = new File(sourceDir, ".classpath"); - targetFile = new File(targetDir, ".classpath"); - targetFile.createNewFile(); - copy(sourceFile, targetFile); - } - } - /* (non-Javadoc) - * @see junit.framework.TestCase#getName() - */ - public String getName() { - String strUnix = unix ? " - Unix" : ""; - return "Doc "+docCommentSupport+strUnix+" - "+super.getName(); - } - /* (non-Javadoc) - * @see junit.framework.TestCase#setUp() - */ - protected void setUp() throws Exception { - super.setUp(); - TEST_COUNTERS[0]++; - failures = new ArrayList(); - problems = new StringBuffer(); - workingCopies = null; - savedLevel = astLevel; - } - /* (non-Javadoc) - * @see junit.framework.TestCase#tearDown() - */ - protected void tearDown() throws Exception { - int size = failures.size(); - String title = size+" positions/bindings were incorrect in "+getName(); - if (size == 0) { - TEST_COUNTERS[1]++; - } else if (problems.length() > 0) { - if (debug) { - System.out.println("Compilation warnings/errors occured:"); - System.out.println(problems.toString()); - } - TEST_COUNTERS[2]++; - } else { - TEST_COUNTERS[3]++; - System.out.println(title+":"); - for (int i=0; i 0); -// } - super.tearDown(); - - // Restore saved ast level - astLevel = savedLevel; - } - - /* (non-Javadoc) - * @see junit.framework.TestCase#tearDown() - */ - public void tearDownSuite() throws Exception { - // put default options on project - if (currentProject != null && savedOptions != null) { - currentProject.setOptions(savedOptions); - } - super.tearDownSuite(); - if (TEST_COUNTERS[0] != TEST_COUNTERS[1]) { - NumberFormat intFormat = NumberFormat.getInstance(); - intFormat.setMinimumIntegerDigits(3); - intFormat.setMaximumIntegerDigits(3); - System.out.println("====================================="); - System.out.println(intFormat.format(TEST_COUNTERS[0])+" tests have been executed:"); - System.out.println(" - "+intFormat.format(TEST_COUNTERS[1])+" tests have been actually executed."); - System.out.println(" - "+intFormat.format(TEST_COUNTERS[2])+" tests were skipped due to compilation errors."); - System.out.println(" - "+intFormat.format(TEST_COUNTERS[3])+" tests failed."); - } - } - - public ASTNode runConversion(char[] source, String unitName, IJavaScriptProject project) { - ASTParser parser = ASTParser.newParser(astLevel); - parser.setSource(source); - parser.setUnitName(unitName); - parser.setProject(project); - parser.setResolveBindings(resolveBinding); - return parser.createAST(null); - } - - public ASTNode runConversion(char[] source, String unitName, IJavaScriptProject project, Map options) { - if (project == null) { - ASTParser parser = ASTParser.newParser(astLevel); - parser.setSource(source); - parser.setUnitName(unitName); - parser.setCompilerOptions(options); - parser.setResolveBindings(resolveBinding); - return parser.createAST(null); - } - return runConversion(source, unitName, project); - } - -// NOT USED -// class ASTConverterJavadocFlattener extends ASTVisitor { -// -// /** -// * The string buffer into which the serialized representation of the AST is -// * written. -// */ -// private StringBuffer buffer; -// -// private String comment; -// -// /** -// * Creates a new AST printer. -// */ -// ASTConverterJavadocFlattener(String comment) { -// buffer = new StringBuffer(); -// comment = comment; -// } -// -// /** -// * Returns the string accumulated in the visit. -// * -// * @return the serialized -// */ -// public String getResult() { -// return buffer.toString(); -// } -// -// /** -// * Resets this printer so that it can be used again. -// */ -// public void reset() { -// buffer.setLength(0); -// } -// -// /* -// * @see ASTVisitor#visit(ArrayType) -// */ -// public boolean visit(ArrayType node) { -// node.getComponentType().accept(this); -// buffer.append("[]");//$NON-NLS-1$ -// return false; -// } -// -// /* -// * @see ASTVisitor#visit(BlockComment) -// * @since 3.0 -// */ -// public boolean visit(BlockComment node) { -// buffer.append(comment); -// return false; -// } -// -// /* -// * @see ASTVisitor#visit(Javadoc) -// */ -// public boolean visit(Javadoc node) { -// -// // ignore deprecated node.getComment() -// buffer.append("/**");//$NON-NLS-1$ -// ASTNode e = null; -// int start = 3; -// for (Iterator it = node.tags().iterator(); it.hasNext(); ) { -// e = (ASTNode) it.next(); -// try { -// buffer.append(comment.substring(start, e.getStartPosition()-node.getStartPosition())); -// start = e.getStartPosition()-node.getStartPosition(); -// } catch (IndexOutOfBoundsException ex) { -// // do nothing -// } -// e.accept(this); -// start += e.getLength(); -// } -// buffer.append(comment.substring(start, node.getLength())); -// return false; -// } -// -// /* -// * @see ASTVisitor#visit(LineComment) -// * @since 3.0 -// */ -// public boolean visit(LineComment node) { -// buffer.append(comment); -// return false; -// } -// -// /* -// * @see ASTVisitor#visit(MemberRef) -// * @since 3.0 -// */ -// public boolean visit(MemberRef node) { -// if (node.getQualifier() != null) { -// node.getQualifier().accept(this); -// } -// buffer.append("#");//$NON-NLS-1$ -// node.getName().accept(this); -// return true; -// } -// -// /* -// * @see ASTVisitor#visit(FunctionRef) -// * @since 3.0 -// */ -// public boolean visit(FunctionRef node) { -// if (node.getQualifier() != null) { -// node.getQualifier().accept(this); -// } -// buffer.append("#");//$NON-NLS-1$ -// node.getName().accept(this); -// buffer.append("(");//$NON-NLS-1$ -// for (Iterator it = node.parameters().iterator(); it.hasNext(); ) { -// FunctionRefParameter e = (FunctionRefParameter) it.next(); -// e.accept(this); -// if (it.hasNext()) { -// buffer.append(",");//$NON-NLS-1$ -// } -// } -// buffer.append(")");//$NON-NLS-1$ -// return true; -// } -// -// /* -// * @see ASTVisitor#visit(FunctionRefParameter) -// * @since 3.0 -// */ -// public boolean visit(FunctionRefParameter node) { -// node.getType().accept(this); -// if (node.getName() != null) { -// buffer.append(" ");//$NON-NLS-1$ -// node.getName().accept(this); -// } -// return true; -// } -// -// /* -// * @see ASTVisitor#visit(TagElement) -// * @since 3.0 -// */ -// public boolean visit(TagElement node) { -// Javadoc javadoc = null; -// int start = 0; -// if (node.isNested()) { -// // nested tags are always enclosed in braces -// buffer.append("{");//$NON-NLS-1$ -// javadoc = (Javadoc) node.getParent().getParent(); -// start++; -// } else { -// javadoc = (Javadoc) node.getParent(); -// } -// start += node.getStartPosition()-javadoc.getStartPosition(); -// if (node.getTagName() != null) { -// buffer.append(node.getTagName()); -// start += node.getTagName().length(); -// } -// for (Iterator it = node.fragments().iterator(); it.hasNext(); ) { -// ASTNode e = (ASTNode) it.next(); -// try { -// buffer.append(comment.substring(start, e.getStartPosition()-javadoc.getStartPosition())); -// start = e.getStartPosition()-javadoc.getStartPosition(); -// } catch (IndexOutOfBoundsException ex) { -// // do nothing -// } -// start += e.getLength(); -// e.accept(this); -// } -// if (node.isNested()) { -// buffer.append("}");//$NON-NLS-1$ -// } -// return true; -// } -// -// /* -// * @see ASTVisitor#visit(TextElement) -// * @since 3.0 -// */ -// public boolean visit(TextElement node) { -// buffer.append(node.getText()); -// return false; -// } -// -// /* -// * @see ASTVisitor#visit(PrimitiveType) -// */ -// public boolean visit(PrimitiveType node) { -// buffer.append(node.getPrimitiveTypeCode().toString()); -// return false; -// } -// -// /* -// * @see ASTVisitor#visit(QualifiedName) -// */ -// public boolean visit(QualifiedName node) { -// node.getQualifier().accept(this); -// buffer.append(".");//$NON-NLS-1$ -// node.getName().accept(this); -// return false; -// } -// -// /* -// * @see ASTVisitor#visit(SimpleName) -// */ -// public boolean visit(SimpleName node) { -// buffer.append(node.getIdentifier()); -// return false; -// } -// -// /* -// * @see ASTVisitor#visit(SimpleName) -// */ -// public boolean visit(SimpleType node) { -// node.getName().accept(this); -// return false; -// } -// } - - private char getNextChar(char[] source, int idx) { - // get next char - char ch = source[idx]; - int charLength = 1; - int pos = idx; - chars = null; - if (ch == '\\' && source[idx+1] == 'u') { - //-------------unicode traitement ------------ - int c1, c2, c3, c4; - charLength++; - while (source[idx+charLength] == 'u') charLength++; - if (((c1 = ScannerHelper.getNumericValue(source[idx+charLength++])) > 15 - || c1 < 0) - || ((c2 = ScannerHelper.getNumericValue(source[idx+charLength++])) > 15 || c2 < 0) - || ((c3 = ScannerHelper.getNumericValue(source[idx+charLength++])) > 15 || c3 < 0) - || ((c4 = ScannerHelper.getNumericValue(source[idx+charLength++])) > 15 || c4 < 0)) { - return ch; - } - ch = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4); - chars = new String(source, pos, charLength); - } - return ch; - } - /* - * Convert Javadoc source to match Javadoc.toString(). - * Store converted comments and their corresponding tags respectively - * in comments and allTags fields - */ - protected void setSourceComment(char[] source) throws ArrayIndexOutOfBoundsException { - comments = new ArrayList(); - allTags = new ArrayList(); - StringBuffer buffer = null; - int comment = 0; - boolean end = false, lineStarted = false; - String tag = null; - List tags = new ArrayList(); - int length = source.length; - char previousChar=0, currentChar=0; - for (int i=0; i= 'a' && currentChar <= 'z') { - tag += currentChar; - } else { - tags.add(tag); - tag = null; - } - } - switch (currentChar) { - case '@': - if (!lineStarted || previousChar == '{') { - tag = ""; - lineStarted = true; - } - break; - case '\r': - case '\n': - lineStarted = false; - break; - case '*': - break; - default: - if (!Character.isWhitespace(currentChar)) { - lineStarted = true; - } - } - case BLOCK_COMMENT: - if (chars == null) buffer.append(currentChar); - else buffer.append(chars); - if (end && currentChar == '/') { - comment = 0; - lineStarted = false; - comments.add(buffer.toString()); - allTags.add(tags); - tags = new ArrayList(); - } - end = currentChar == '*'; - break; - case LINE_COMMENT: - if (currentChar == '\r' || currentChar == '\n') { - /* - if (currentChar == '\r' && source[i+1] == '\n') { - buffer.append(source[++i]); - } - */ - comment = 0; - comments.add(buffer.toString()); - allTags.add(tags); - } else { - if (chars == null) buffer.append(currentChar); - else buffer.append(chars); - } - break; - default: - // do nothing - break; - } - } - } - - /* - * Convert Javadoc source to match Javadoc.toString(). - * Store converted comments and their corresponding tags respectively - * in comments and allTags fields - */ - char[] getUnicodeSource(char[] source) { - int length = source.length; - int unicodeLength = length*6; - char[] unicodeSource = new char[unicodeLength]; - int u=0; - for (int i=0; i 15 - || c1 < 0) - || ((c2 = ScannerHelper.getNumericValue(source[i+2])) > 15 || c2 < 0) - || ((c3 = ScannerHelper.getNumericValue(source[i+3])) > 15 || c3 < 0) - || ((c4 = ScannerHelper.getNumericValue(source[i+4])) > 15 || c4 < 0)) { - throw new RuntimeException("Invalid unicode in source at "+i); - } - for (int j=0; j<4; j++) unicodeSource[u++] = source[++i]; - } else { - unicodeSource[u++] = '\\'; - unicodeSource[u++] = 'u'; - unicodeSource[u++] = '0'; - unicodeSource[u++] = '0'; - int val = source[i]/16; - unicodeSource[u++] = (char) (val<10 ? val+ 0x30 : val-10+0x61); - val = source[i]%16; - unicodeSource[u++] = (char) (val<10 ? val+ 0x30 : val-10+0x61); - } - } - // Return one well sized array - if (u != unicodeLength) { - char[] result = new char[u]; - System.arraycopy(unicodeSource, 0, result, 0, u); - return result; - } - return unicodeSource; - } - - /* - * Convert Javadoc source to match Javadoc.toString(). - * Store converted comments and their corresponding tags respectively - * in comments and allTags fields - */ - char[] getUnixSource(char[] source) { - int length = source.length; - int unixLength = length; - char[] unixSource = new char[unixLength]; - int u=0; - for (int i=0; i actual:<"+actual+'>'); - if (stopOnFailure) assertEquals(msg, expected, actual); - } - - /* - * Verify positions of tags in source - */ - private void verifyPositions(JSdoc docComment, char[] source) { - boolean stop = stopOnFailure; -// stopOnFailure = false; - // Verify javadoc start and end position - int start = docComment.getStartPosition(); - int end = start+docComment.getLength()-1; - assumeTrue(prefix+"Misplaced javadoc start at <"+start+">: "+docComment, source[start++] == '/' && source[start++] == '*' && source[start++] == '*'); - // Get first meaningful character - int tagStart = start; - // Verify tags - Iterator tags = docComment.tags().listIterator(); - while (tags.hasNext()) { - while (source[tagStart] == '*' || Character.isWhitespace(source[tagStart])) { - tagStart++; // purge non-stored characters - } - TagElement tagElement = (TagElement) tags.next(); - int teStart = tagElement.getStartPosition(); - assumeEquals(prefix+"Wrong start position <"+teStart+"> for tag element: "+tagElement, tagStart, teStart); - verifyPositions(tagElement, source); - tagStart += tagElement.getLength(); - } - while (source[tagStart] == '*' || Character.isWhitespace(source[tagStart])) { - tagStart++; // purge non-stored characters - } - assumeTrue(prefix+"Misplaced javadoc end at <"+tagStart+'>', source[tagStart-1] == '*' && source[tagStart] == '/'); - assumeEquals(prefix+"Wrong javadoc length at <"+end+">: ", tagStart, end); - stopOnFailure = stop; - assertTrue(!stop || failures.size()==0); - } - - /** - * Verify positions of fragments in source - * @deprecated using deprecated code - */ - private void verifyPositions(TagElement tagElement, char[] source) { - String text = null; - // Verify tag name - String tagName = tagElement.getTagName(); - int tagStart = tagElement.getStartPosition(); - if (tagElement.isNested()) { - assumeEquals(prefix+"Wrong start position <"+tagStart+"> for "+tagElement, '{', source[tagStart++]); - } - if (tagName != null) { - text= new String(source, tagStart, tagName.length()); - assumeEquals(prefix+"Misplaced tag name at <"+tagStart+">: ", tagName, text); - tagStart += tagName.length(); - } - // Verify each fragment - ASTNode previousFragment = null; - Iterator elements = tagElement.fragments().listIterator(); - while (elements.hasNext()) { - ASTNode fragment = (ASTNode) elements.next(); - if (fragment.getNodeType() == ASTNode.TEXT_ELEMENT) { - if (previousFragment == null && TagElement.TAG_PARAM.equals(tagName) && ((TextElement)fragment).getText().equals("<")) { // special case here for @param syntax - int start = tagStart; - // verify '<' - while (source[start] == ' ' || Character.isWhitespace(source[start])) { - start++; // purge white characters - } - text = new String(source, start, fragment.getLength()); - assumeEquals(prefix+"Misplaced text element at <"+fragment.getStartPosition()+">: ", text, ((TextElement) fragment).getText()); - start += fragment.getLength(); - // verify simple name - assumeTrue(prefix+"Unexpected fragment end for "+tagElement, elements.hasNext()); - fragment = (ASTNode) elements.next(); - while (source[start] == ' ' || Character.isWhitespace(source[start])) { - start++; // purge white characters - } - assumeEquals(prefix+"Unexpected node type for tag element "+tagElement, ASTNode.SIMPLE_NAME, fragment.getNodeType()); - Name name = (Name) fragment; - verifyNamePositions(start, name, source); - start += fragment.getLength(); - // verify simple name - assumeTrue(prefix+"Unexpected fragment end for "+tagElement, elements.hasNext()); - fragment = (ASTNode) elements.next(); - while (source[start] == ' ' || Character.isWhitespace(source[start])) { - start++; // purge white characters - } - text = new String(source, start, fragment.getLength()); - assumeEquals(prefix+"Misplaced text element at <"+fragment.getStartPosition()+">: ", text, ((TextElement) fragment).getText()); - start += fragment.getLength(); - // reset fragment as simple name to avoid issue with next text element - fragment = name; - tagStart += (start- tagStart) - name.getLength(); - } else { - if (previousFragment == null) { - if (tagName != null && (source[tagStart] == '\r' || source[tagStart] == '\n')) { - while (source[tagStart] == '*' || Character.isWhitespace(source[tagStart])) { - tagStart++; // purge non-stored characters - } - } - } else { - if (previousFragment.getNodeType() == ASTNode.TEXT_ELEMENT) { - assumeTrue(prefix+"Wrong length at <"+previousFragment.getStartPosition()+"> for text element "+previousFragment, (source[tagStart] == '\r' /* && source[tagStart+1] == '\n' */ || source[tagStart] == '\n')); - while (source[tagStart] == '*' || Character.isWhitespace(source[tagStart])) { - tagStart++; // purge non-stored characters - } - } else if (TagElement.TAG_PARAM.equals(tagName) && previousFragment.getNodeType() == ASTNode.SIMPLE_NAME && ((TextElement)fragment).getText().equals(">")) { - while (source[tagStart] == ' ' || Character.isWhitespace(source[tagStart])) { - tagStart++; // purge white characters - } - } else { - int start = tagStart; - boolean newLine = false; - while (source[start] == '*' || Character.isWhitespace(source[start])) { - start++; // purge non-stored characters - if (source[tagStart] == '\r' || source[tagStart] == '\n') { - newLine = true; - } - } - if (newLine) tagStart = start; - } - } - text = new String(source, tagStart, fragment.getLength()); - assumeEquals(prefix+"Misplaced text element at <"+fragment.getStartPosition()+">: ", text, ((TextElement) fragment).getText()); - } - } else { - while (source[tagStart] == '*' || Character.isWhitespace(source[tagStart])) { - tagStart++; // purge non-stored characters - } - if (fragment.getNodeType() == ASTNode.SIMPLE_NAME || fragment.getNodeType() == ASTNode.QUALIFIED_NAME) { - verifyNamePositions(tagStart, (Name) fragment, source); - } else if (fragment.getNodeType() == ASTNode.TAG_ELEMENT) { - TagElement inlineTag = (TagElement) fragment; - assumeEquals(prefix+"Tag element <"+inlineTag+"> has wrong start position", tagStart, inlineTag.getStartPosition()); - verifyPositions(inlineTag, source); - } else if (fragment.getNodeType() == ASTNode.MEMBER_REF) { - MemberRef memberRef = (MemberRef) fragment; - // Store start position - int start = tagStart; - // Verify qualifier position - Name qualifier = memberRef.getQualifier(); - if (qualifier != null) { - verifyNamePositions(start, qualifier, source); - start += qualifier.getLength(); - while (source[start] == '*' || Character.isWhitespace(source[start])) { - start++; // purge non-stored characters - } - } - // Verify member separator position - assumeEquals(prefix+"Misplaced # separator at <"+start+"> for member ref "+memberRef, '#', source[start]); - start++; - while (source[start] == '*' || Character.isWhitespace(source[start])) { - start++; // purge non-stored characters - } - // Verify member name position - Name name = memberRef.getName(); - text = new String(source, start, name.getLength()); - assumeEquals(prefix+"Misplaced member ref at <"+start+">: ", text, name.toString()); - verifyNamePositions(start, name, source); - } else if (fragment.getNodeType() == ASTNode.FUNCTION_REF) { - FunctionRef methodRef = (FunctionRef) fragment; - // Store start position - int start = tagStart; - // Verify qualifier position - Name qualifier = methodRef.getQualifier(); - if (qualifier != null) { - verifyNamePositions(start, qualifier, source); - start += qualifier.getLength(); - while (source[start] == '*' || Character.isWhitespace(source[start])) { - start++; // purge non-stored characters - } - } - // Verify member separator position - assumeEquals(prefix+"Misplaced # separator at <"+start+"> for method ref: "+methodRef, '#', source[start]); - start++; - while (source[start] == '*' || Character.isWhitespace(source[start])) { - start++; // purge non-stored characters - } - // Verify member name position - Name name = methodRef.getName(); - int nameLength = name.getLength(); - text = new String(source, start, nameLength); - if (!text.equals(name.toString())) { // may have qualified constructor reference for inner classes - if (methodRef.getQualifier().isQualifiedName()) { - text = new String(source, start, methodRef.getQualifier().getLength()); - assumeEquals(prefix+"Misplaced method ref name at <"+start+">: ", text, methodRef.getQualifier().toString()); - while (source[start] != '.' || Character.isWhitespace(source[start])) { - start++; // purge non-stored characters - } - start++; - } else { - while (source[start] != '.' || Character.isWhitespace(source[start])) { - start++; // purge non-stored characters - } - start++; - text = new String(source, start, nameLength); - assumeEquals(prefix+"Misplaced method ref name at <"+start+">: ", text, name.toString()); - } - } - verifyNamePositions(start, name, source); - start += nameLength; - // Verify arguments starting open parenthesis - while (source[start] == '*' || Character.isWhitespace(source[start])) { - start++; // purge non-stored characters - } -// assumeEquals(prefix+"Misplaced ( at <"+start+"> for method ref: "+methodRef, '(', source[start]); - if (source[start] == '(') { // now method reference may have no parenthesis... - start++; - // Verify parameters - Iterator parameters = methodRef.parameters().listIterator(); - while (parameters.hasNext()) { - FunctionRefParameter param = (FunctionRefParameter) parameters.next(); - boolean lastParam = !parameters.hasNext(); - // Verify parameter type positions - while (source[start] == '*' || Character.isWhitespace(source[start])) { - start++; // purge non-stored characters - } - Type type = param.getType(); - if (type.isSimpleType()) { - verifyNamePositions(start, ((SimpleType)type).getName(), source); - } else if (type.isPrimitiveType()) { - text = new String(source, start, type.getLength()); - assumeEquals(prefix+"Misplaced method ref parameter type at <"+start+"> for method ref: "+methodRef, text, type.toString()); - } else if (type.isArrayType()) { - Type elementType = ((ArrayType) param.getType()).getElementType(); - if (elementType.isSimpleType()) { - verifyNamePositions(start, ((SimpleType)elementType).getName(), source); - } else if (elementType.isPrimitiveType()) { - text = new String(source, start, elementType.getLength()); - assumeEquals(prefix+"Misplaced method ref parameter type at <"+start+"> for method ref: "+methodRef, text, elementType.toString()); - } - } - start += type.getLength(); - // if last param then perhaps a varargs - while (Character.isWhitespace(source[start])) { // do NOT accept '*' in parameter declaration - start++; // purge non-stored characters - } - if (lastParam && this.astLevel != AST.JLS2 && param.isVarargs()) { - for (int p=0;p<3;p++) { - assumeTrue(prefix+"Missing ellipsis for vararg method ref parameter at <"+start+"> for method ref: "+methodRef, source[start++]=='.'); - } - } - // Verify parameter name positions - while (Character.isWhitespace(source[start])) { // do NOT accept '*' in parameter declaration - start++; // purge non-stored characters - } - name = param.getName(); - if (name != null) { - text = new String(source, start, name.getLength()); - assumeEquals(prefix+"Misplaced method ref parameter name at <"+start+"> for method ref: "+methodRef, text, name.toString()); - start += name.getLength(); - } - // Verify end parameter declaration - while (source[start] == '*' || Character.isWhitespace(source[start])) { - start++; - } - assumeTrue(prefix+"Misplaced parameter end at <"+start+"> for method ref: "+methodRef, source[start] == ',' || source[start] == ')'); - start++; - if (source[start] == ')') { - break; - } - } - } - } - } - tagStart += fragment.getLength(); - previousFragment = fragment; - } - if (tagElement.isNested()) { - assumeEquals(prefix+"Wrong end character at <"+tagStart+"> for "+tagElement, '}', source[tagStart++]); - } - } - - /* - * Verify each name component positions. - */ - private void verifyNamePositions(int nameStart, Name name, char[] source) { - if (name.isQualifiedName()) { - QualifiedName qualified = (QualifiedName) name; - int start = qualified.getName().getStartPosition(); - String str = new String(source, start, qualified.getName().getLength()); - assumeEquals(prefix+"Misplaced or wrong name for qualified name: "+name, str, qualified.getName().toString()); - verifyNamePositions(nameStart, ((QualifiedName) name).getQualifier(), source); - } - String str = new String(source, nameStart, name.getLength()); - if (str.indexOf('\n') < 0) { // cannot compare if text contains new line - assumeEquals(prefix+"Misplaced name for qualified name: ", str, name.toString()); - } else if (debug) { - System.out.println(prefix+"Name contains new line for qualified name: "+name); - } - } - - /* - * Verify that bindings of Javadoc comment structure are resolved or not. - * For expected unresolved binding, verify that following text starts with 'Unknown' - */ - private void verifyBindings(JSdoc docComment) { - boolean stop = stopOnFailure; -// stopOnFailure = false; - // Verify tags - Iterator tags = docComment.tags().listIterator(); - while (tags.hasNext()) { - verifyBindings((TagElement) tags.next()); - } - stopOnFailure = stop; - assertTrue(!stop || failures.size()==0); - } - - /* - * Verify that bindings of Javadoc tag structure are resolved or not. - * For expected unresolved binding, verify that following text starts with 'Unknown' - */ - private void verifyBindings(TagElement tagElement) { - // Verify each fragment - Iterator elements = tagElement.fragments().listIterator(); - IBinding previousBinding = null; - ASTNode previousFragment = null; - boolean resolvedBinding = false; - while (elements.hasNext()) { - ASTNode fragment = (ASTNode) elements.next(); - if (fragment.getNodeType() == ASTNode.TEXT_ELEMENT) { - TextElement text = (TextElement) fragment; - if (resolvedBinding) { - if (previousBinding == null) { - assumeTrue(prefix+"Reference '"+previousFragment+"' should be bound!", text.getText().trim().indexOf("Unknown")>=0); - } else { - assumeTrue(prefix+"Unknown reference '"+previousFragment+"' should NOT be bound!", text.getText().trim().indexOf("Unknown")<0); - } - } - previousBinding = null; - resolvedBinding = false; - } else if (fragment.getNodeType() == ASTNode.TAG_ELEMENT) { - verifyBindings((TagElement) fragment); - previousBinding = null; - resolvedBinding = false; - } else { - resolvedBinding = true; - if (fragment.getNodeType() == ASTNode.SIMPLE_NAME) { - previousBinding = ((Name)fragment).resolveBinding(); - } else if (fragment.getNodeType() == ASTNode.QUALIFIED_NAME) { - QualifiedName name = (QualifiedName) fragment; - previousBinding = name.resolveBinding(); - verifyNameBindings(name); - } else if (fragment.getNodeType() == ASTNode.MEMBER_REF) { - MemberRef memberRef = (MemberRef) fragment; - previousBinding = memberRef.resolveBinding(); - if (previousBinding != null) { - SimpleName name = memberRef.getName(); - assumeNotNull(prefix+""+name+" binding was not foundfound in "+fragment, name.resolveBinding()); - verifyNameBindings(memberRef.getQualifier()); - } - } else if (fragment.getNodeType() == ASTNode.FUNCTION_REF) { - FunctionRef methodRef = (FunctionRef) fragment; - previousBinding = methodRef.resolveBinding(); - if (previousBinding != null) { - SimpleName methodName = methodRef.getName(); - IBinding methNameBinding = methodName.resolveBinding(); - Name methodQualifier = methodRef.getQualifier(); - // TODO (frederic) Replace the two following lines by commented block when bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=62650 will be fixed - assumeNotNull(prefix+""+methodName+" binding was not found in "+fragment, methNameBinding); - verifyNameBindings(methodQualifier); - /* - if (methodQualifier == null) { - if (methNameBinding == null) { - char firstChar = methodName.getIdentifier().charAt(0); - if (Character.isUpperCase(firstChar)) { - // assume that selector starting with uppercase is for constructor => signal that binding is null - System.out.println(prefix+"Binding for selector of '"+methodRef+"' is null."); - } - } else { - if (methNameBinding.getName().equals(methodName.getIdentifier())) { // binding is not null only for constructor - assumeNotNull(prefix+""+methodName+" binding was not found!",methNameBinding); - } else { - assumeNull(prefix+""+methodName+" binding should be null!", methNameBinding); - } - } - } else { - SimpleName methodSimpleType = null; - if (methodQualifier.isQualifiedName()) { - methodSimpleType = ((QualifiedName)methodQualifier).getName(); - } else { - methodSimpleType = (SimpleName) methodQualifier; - } - if (methodSimpleType.getIdentifier().equals(methodName.getIdentifier())) { // binding is not null only for constructor - assumeNotNull(prefix+""+methodName+" binding was not found!",methNameBinding); - } else { - assumeNull(prefix+""+methodName+" binding should be null!", methNameBinding); - } - verifyNameBindings(methodRef.getQualifier()); - } - */ - Iterator parameters = methodRef.parameters().listIterator(); - while (parameters.hasNext()) { - FunctionRefParameter param = (FunctionRefParameter) parameters.next(); - Type type = param.getType(); - assumeNotNull(prefix+""+type+" binding was not found in "+fragment, type.resolveBinding()); - if (type.isSimpleType()) { - verifyNameBindings(((SimpleType)type).getName()); - } else if (type.isArrayType()) { - Type elementType = ((ArrayType) param.getType()).getElementType(); - assumeNotNull(prefix+""+elementType+" binding was not found in "+fragment, elementType.resolveBinding()); - if (elementType.isSimpleType()) { - verifyNameBindings(((SimpleType)elementType).getName()); - } - } - // Do not verify parameter name as no binding is expected for them - } - } - } - } - previousFragment = fragment; - } - assumeTrue(prefix+"Reference '"+(previousFragment==null?tagElement:previousFragment)+"' should be bound!", (!resolvedBinding || previousBinding != null)); - } - - /* - * Verify each name component binding. - */ - private void verifyNameBindings(Name name) { - if (name != null) { - IBinding binding = name.resolveBinding(); - if (name.toString().indexOf("Unknown") > 0) { - assumeNull(prefix+name+" binding should be null!", binding); - } else { - assumeNotNull(prefix+name+" binding was not found!", binding); - } - SimpleName simpleName = null; - int index = 0; - while (name.isQualifiedName()) { - simpleName = ((QualifiedName) name).getName(); - binding = simpleName.resolveBinding(); - if (simpleName.getIdentifier().equalsIgnoreCase("Unknown")) { - assumeNull(prefix+simpleName+" binding should be null!", binding); - } else { - assumeNotNull(prefix+simpleName+" binding was not found!", binding); - } - if (index > 0 && packageBinding) { - assumeEquals(prefix+"Wrong binding type!", IBinding.PACKAGE, binding.getKind()); - } - index++; - name = ((QualifiedName) name).getQualifier(); - binding = name.resolveBinding(); - if (name.toString().indexOf("Unknown") > 0) { - assumeNull(prefix+name+" binding should be null!", binding); - } else { - assumeNotNull(prefix+name+" binding was not found!", binding); - } - if (packageBinding) { - assumeEquals(prefix+"Wrong binding type!", IBinding.PACKAGE, binding.getKind()); - } - } - } - } - - /* (non-Javadoc) - * @see junit.framework.TestCase#setUp() - */ - protected void verifyComments(String test) throws JavaScriptModelException { - IJavaScriptUnit[] units = getCompilationUnits("Converter" , "src", "javadoc."+test); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - for (int i=0; i0); - for (int i=0; i 0) { - problems.append(" - "+prefix+length+" problems:"); //$NON-NLS-1$ - for (int i = 0; i < problemsList.length; i++) { - problems.append(" + "); - problems.append(problemsList[i]); - problems.append("\n"); - } - } - } - unitComments = compilUnit.getCommentList(); - assumeNotNull(prefix+"Unexpected problems", unitComments); - - // Basic comments verification - int size = unitComments.size(); - assumeEquals(prefix+"Wrong number of comments!", comments.size(), size); - - // Verify comments positions and bindings - for (int i=0; i=0) { - Comment comment = (Comment) compilUnit.getCommentList().get(indexes[0]); - commentStart = comment.getStartPosition(); - } - int startPosition = compilUnit.getExtendedStartPosition(method); - assumeEquals("Method "+node+" does not start at the right position", commentStart, startPosition); - int methodEnd = startPosition + compilUnit.getExtendedLength(method) - 1; - int commentEnd = method.getStartPosition() + method.getLength() - 1; - if (indexes[1]>=0) { - Comment comment = (Comment) compilUnit.getCommentList().get(indexes[1]); - commentEnd = comment.getStartPosition() + comment.getLength() - 1; - } - assumeEquals("Method "+node+" does not have the correct length", commentEnd, methodEnd); - // Verify second method existence - node = getASTNode((JavaScriptUnit) result, 0, 1); - assumeNotNull("We should get a non-null ast node", node); - assumeTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - method = (FunctionDeclaration) node; - // Verify second method extended positions - commentStart = method.getStartPosition(); - if (indexes[2]>=0) { - Comment comment = (Comment) compilUnit.getCommentList().get(indexes[2]); - commentStart = comment.getStartPosition(); - } - startPosition = compilUnit.getExtendedStartPosition(method); - assumeEquals("Method "+node+" does not start at the right position", commentStart, startPosition); - methodEnd = startPosition + compilUnit.getExtendedLength(method) - 1; - commentEnd = method.getStartPosition() + method.getLength() - 1; - if (indexes[3]>=0) { - Comment comment = (Comment) compilUnit.getCommentList().get(indexes[3]); - commentEnd = comment.getStartPosition() + comment.getLength() - 1; - } - assumeEquals("Method "+node+" does not have the correct length", commentEnd, methodEnd); - } - } - - /** - * Verify DefaultCommentMapper heuristic to get leading and trailing comments - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=53445" - */ - public void test100() throws JavaScriptModelException { - verifyMapper("test100", 16, new int[] {2,7,8,15}); - } - public void test101() throws JavaScriptModelException { - verifyMapper("test101", 8, new int[] {1,3,4,7}); - } - public void test102() throws JavaScriptModelException { - verifyMapper("test102", 16, new int[] {4,9,10,13}); - } - public void test103() throws JavaScriptModelException { - verifyMapper("test103", 8, new int[] {2,4,5,6}); - } - public void test104() throws JavaScriptModelException { - verifyMapper("test104", 16, new int[] {2,7,8,15}); - } - public void test105() throws JavaScriptModelException { - verifyMapper("test105", 16, new int[] {-1,11,-1,15}); - } - public void test106() throws JavaScriptModelException { - verifyMapper("test106", 8, new int[] {-1,5,-1,7}); - } - public void test107() throws JavaScriptModelException { - verifyMapper("test107", 16, new int[] {2,7,8,-1}); - } - public void test108() throws JavaScriptModelException { - verifyMapper("test108", 8, new int[] {1,3,4,-1}); - } - - /** - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=54776" - */ - public void testBug54776() throws JavaScriptModelException { - sourceUnit = getCompilationUnit("Converter" , "src", "javadoc.testBug54776", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, false); - final JavaScriptUnit compilUnit = (JavaScriptUnit) result; - assumeEquals(prefix+"Wrong number of problems", 0, compilUnit.getProblems().length); //$NON-NLS-1$ - assumeEquals(prefix+"Wrong number of comments", 2, compilUnit.getCommentList().size()); - // get comments range - Comment comment = (Comment) compilUnit.getCommentList().get(0); - int commentStart = comment.getStartPosition(); - int extendedLength = ((Comment) compilUnit.getCommentList().get(1)).getStartPosition()-commentStart+comment.getLength(); - // get method invocation in field initializer - ASTNode node = getASTNode((JavaScriptUnit) result, 0); - assumeNotNull("We should get a non-null ast node", node); - assumeTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$ - TypeDeclaration typeDecl = (TypeDeclaration) node; - FieldDeclaration[] fields = typeDecl.getFields(); - assumeEquals("We should have a field declaration", 1, fields.length); - List fragments = fields[0].fragments(); - assumeEquals("We should have a variable fragment", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assumeTrue("We should get an expression", expression instanceof FunctionInvocation); - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - // verify that methodinvocation extended range includes leading and trailing comment - int methodStart = compilUnit.getExtendedStartPosition(methodInvocation); - assumeEquals("Method invocation "+methodInvocation+" does not start at the right position", commentStart, methodStart); - int methodLength = compilUnit.getExtendedLength(methodInvocation); - assumeEquals("Method invocation "+methodInvocation+" does not have the correct length", extendedLength, methodLength); - } - - /** - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=55221" - */ - public void testBug55221a() throws JavaScriptModelException { - sourceUnit = getCompilationUnit("Converter" , "src", "javadoc.testBug55221.a", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, false); - final JavaScriptUnit compilUnit = (JavaScriptUnit) result; - assumeEquals(prefix+"Wrong number of problems", 0, compilUnit.getProblems().length); //$NON-NLS-1$ - assumeEquals(prefix+"Wrong number of comments", 1, compilUnit.getCommentList().size()); - // Get comment range - Comment comment = (Comment) compilUnit.getCommentList().get(0); - int commentStart = comment.getStartPosition(); - // get first method - ASTNode node = getASTNode(compilUnit, 0, 0); - assumeNotNull("We should get a non-null ast node", node); - assumeTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration method = (FunctionDeclaration) node; - // verify that first method does not include comment - int methodStart = compilUnit.getExtendedStartPosition(method); - assumeEquals("Method "+method+" does not start at the right position", method.getStartPosition(), methodStart); - int methodLength = compilUnit.getExtendedLength(method); - assumeEquals("Method declaration "+method+" does not end at the right position",method.getLength(), methodLength); - // get method body - node = method.getBody(); - assumeNotNull("We should get a non-null ast node", node); - assumeTrue("Not a block", node.getNodeType() == ASTNode.BLOCK); //$NON-NLS-1$ - Block block = (Block) node; - // verify that body does not include following comment - int blockStart = compilUnit.getExtendedStartPosition(block); - assumeEquals("Body block "+block+" does not start at the right position", block.getStartPosition(), blockStart); - int blockLength = compilUnit.getExtendedLength(block); - assumeEquals("Body block "+block+" does not have the correct length", block.getLength(), blockLength); - // get second method - node = getASTNode(compilUnit, 0, 1); - assumeNotNull("We should get a non-null ast node", node); - assumeTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - method = (FunctionDeclaration) node; - // verify that second method start includes comment - assumeEquals("Method declaration "+method+" does not start at the right position", commentStart, method.getStartPosition()); - } - public void testBug55221b() throws JavaScriptModelException { - sourceUnit = getCompilationUnit("Converter" , "src", "javadoc.testBug55221.b", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, false); - final JavaScriptUnit compilUnit = (JavaScriptUnit) result; - assumeEquals(prefix+"Wrong number of problems", 0, compilUnit.getProblems().length); //$NON-NLS-1$ - assumeEquals(prefix+"Wrong number of comments", 1, compilUnit.getCommentList().size()); - // Get comment range - Comment comment = (Comment) compilUnit.getCommentList().get(0); - int commentStart = comment.getStartPosition(); - // get first method - ASTNode node = getASTNode(compilUnit, 0, 0); - assumeNotNull("We should get a non-null ast node", node); - assumeTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration method = (FunctionDeclaration) node; - // verify that first method does not include comment - int methodStart = compilUnit.getExtendedStartPosition(method); - assumeEquals("Method "+method+" does not start at the right position", method.getStartPosition(), methodStart); - int methodLength = compilUnit.getExtendedLength(method); - assumeEquals("Method declaration "+method+" does not end at the right position",method.getLength(), methodLength); - // get method body - node = method.getBody(); - assumeNotNull("We should get a non-null ast node", node); - assumeTrue("Not a block", node.getNodeType() == ASTNode.BLOCK); //$NON-NLS-1$ - Block block = (Block) node; - // verify that body does not include following comment - int blockStart = compilUnit.getExtendedStartPosition(block); - assumeEquals("Body block "+block+" does not start at the right position", block.getStartPosition(), blockStart); - int blockLength = compilUnit.getExtendedLength(block); - assumeEquals("Body block "+block+" does not have the correct length", block.getLength(), blockLength); - // get second method - node = getASTNode(compilUnit, 0, 1); - assumeNotNull("We should get a non-null ast node", node); - assumeTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - method = (FunctionDeclaration) node; - // verify that second method start includes comment - assumeEquals("Method declaration "+method+" does not start at the right position", commentStart, method.getStartPosition()); - } - public void testBug55221c() throws JavaScriptModelException { - sourceUnit = getCompilationUnit("Converter" , "src", "javadoc.testBug55221.c", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, false); - final JavaScriptUnit compilUnit = (JavaScriptUnit) result; - assumeEquals(prefix+"Wrong number of problems", 0, compilUnit.getProblems().length); //$NON-NLS-1$ - assumeEquals(prefix+"Wrong number of comments", 1, compilUnit.getCommentList().size()); - // Get comment range - Comment comment = (Comment) compilUnit.getCommentList().get(0); - int commentStart = comment.getStartPosition(); - int commentEnd = commentStart+comment.getLength()-1; - // get first method - ASTNode node = getASTNode(compilUnit, 0, 0); - assumeNotNull("We should get a non-null ast node", node); - assumeTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration method = (FunctionDeclaration) node; - // verify that first method includes comment - int methodStart = compilUnit.getExtendedStartPosition(method); - assumeEquals("Method "+method+" does not start at the right position", method.getStartPosition(), methodStart); - int methodLength = compilUnit.getExtendedLength(method); - assumeEquals("Method "+method+" does not end at the right position", commentEnd, methodStart+methodLength-1); - // get method body - node = method.getBody(); - assumeNotNull("We should get a non-null ast node", node); - assumeTrue("Not a block", node.getNodeType() == ASTNode.BLOCK); //$NON-NLS-1$ - Block block = (Block) node; - // verify that body includes following comment - int blockStart = compilUnit.getExtendedStartPosition(block); - assumeEquals("Body block "+block+" does not start at the right position", block.getStartPosition(), blockStart); - int blockLength = compilUnit.getExtendedLength(block); - assumeEquals("Body block "+block+" does not end at the right position", commentEnd, blockStart+blockLength-1); - // get second method - node = getASTNode(compilUnit, 0, 1); - assumeNotNull("We should get a non-null ast node", node); - assumeTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - method = (FunctionDeclaration) node; - // verify that second method does not include comment - methodStart = compilUnit.getExtendedStartPosition(method); - assumeEquals("Method "+method+" does not start at the right position", method.getStartPosition(), methodStart); - methodLength = compilUnit.getExtendedLength(method); - assumeEquals("Method declaration "+method+" does not end at the right position",method.getLength(), methodLength); - } - /** @deprecated using deprecated code */ - public void testBug55221d() throws JavaScriptModelException { - sourceUnit = getCompilationUnit("Converter" , "src", "javadoc.testBug55221.d", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, false); - final JavaScriptUnit compilUnit = (JavaScriptUnit) result; - assumeEquals(prefix+"Wrong number of problems", 0, compilUnit.getProblems().length); //$NON-NLS-1$ - assumeEquals(prefix+"Wrong number of comments", 2, compilUnit.getCommentList().size()); - // get first method - ASTNode node = getASTNode(compilUnit, 0, 0); - assumeNotNull("We should get a non-null ast node", node); - assumeTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration method = (FunctionDeclaration) node; - // verify that first method includes comment - int methodStart = compilUnit.getExtendedStartPosition(method); - assumeEquals("Method "+method+" does not start at the right position", method.getStartPosition(), methodStart); - int methodLength = compilUnit.getExtendedLength(method); - assumeEquals("Method "+method+" does not have the right length", methodLength, method.getLength()); - // get return type - node = method.getReturnType(); - assumeNotNull("We should get a non-null ast node", node); - assumeTrue("Not return type", node.getNodeType() == ASTNode.PRIMITIVE_TYPE); //$NON-NLS-1$ - PrimitiveType returnType = (PrimitiveType) node; - // verify that return type includes following comment - int returnStart = compilUnit.getExtendedStartPosition(returnType); - assumeEquals("Return type "+returnType+" does not start at the right position", returnType.getStartPosition(), returnStart); - int returnLength = compilUnit.getExtendedLength(returnType); - assumeEquals("Return type "+returnType+" does not have the right length", returnType.getLength(), returnLength); - } - public void testBug55223a() throws JavaScriptModelException { -// stopOnFailure = false; - sourceUnit = getCompilationUnit("Converter" , "src", "javadoc.testBug55223", "TestA.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, false); - final JavaScriptUnit compilUnit = (JavaScriptUnit) result; - assumeEquals(prefix+"Wrong number of problems", 0, compilUnit.getProblems().length); //$NON-NLS-1$ - assumeEquals(prefix+"Wrong number of comments", 2, compilUnit.getCommentList().size()); - // get method - ASTNode node = getASTNode(compilUnit, 0, 0); - assumeNotNull("We should get a non-null ast node", node); - assumeEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType()); //$NON-NLS-1$ - FunctionDeclaration method = (FunctionDeclaration) node; - // get method body - node = method.getBody(); - assumeNotNull("We should get a non-null ast node", node); - assumeEquals("Not a block", ASTNode.BLOCK, node.getNodeType()); //$NON-NLS-1$ - Block block = (Block) node; - // verify block statements start/end positions - Iterator statements = block.statements().iterator(); - int idx = 0; - while (statements.hasNext()) { - node = (ExpressionStatement) statements.next(); - assumeEquals("Not a block", ASTNode.EXPRESSION_STATEMENT, node.getNodeType()); //$NON-NLS-1$ - ExpressionStatement statement = (ExpressionStatement) node; - int statementStart = statement.getStartPosition(); - int statementEnd = statementStart + statement.getLength() - 1; - if (idx < 2) { - // Get comment range - Comment comment = (Comment) compilUnit.getCommentList().get(idx); - int commentStart = comment.getStartPosition(); - statementEnd = commentStart+comment.getLength()-1; - } - int extendedStart = compilUnit.getExtendedStartPosition(statement); - assumeEquals("Statement "+statement+" does not start at the right position", statementStart, extendedStart); - int extendedEnd = extendedStart + compilUnit.getExtendedLength(statement) - 1; - assumeEquals("Statement "+statement+" does not end at the right position", statementEnd, extendedEnd); - idx++; - } - } - /** @deprecated using deprecated code */ - public void testBug55223b() throws JavaScriptModelException { - sourceUnit = getCompilationUnit("Converter" , "src", "javadoc.testBug55223", "TestB.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, false); - final JavaScriptUnit compilUnit = (JavaScriptUnit) result; - assumeEquals(prefix+"Wrong number of problems", 0, compilUnit.getProblems().length); //$NON-NLS-1$ - assumeEquals(prefix+"Wrong number of comments", 2, compilUnit.getCommentList().size()); - // Get comment range - Comment comment = (Comment) compilUnit.getCommentList().get(1); - int commentStart = comment.getStartPosition(); - // get method - ASTNode node = getASTNode(compilUnit, 0, 0); - assumeNotNull("We should get a non-null ast node", node); - assumeEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType()); //$NON-NLS-1$ - FunctionDeclaration method = (FunctionDeclaration) node; - // get return type - node = method.getReturnType(); - assumeNotNull("We should get a non-null ast node", node); - assumeTrue("Not return type", node.getNodeType() == ASTNode.SIMPLE_TYPE); //$NON-NLS-1$ - SimpleType returnType = (SimpleType) node; - // verify that return type includes following comment - int returnStart = compilUnit.getExtendedStartPosition(returnType); - assumeEquals("Return type "+returnType+" does not start at the right position", commentStart, returnStart); - int returnEnd = returnStart + compilUnit.getExtendedLength(returnType) - 1; - assumeEquals("Return type "+returnType+" does not end at the right length", returnType.getStartPosition()+returnType.getLength()-1, returnEnd); - } - /* - * End DefaultCommentMapper verifications - */ - - /** - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=48489" - */ - public void testBug48489() throws JavaScriptModelException { - verifyComments("testBug48489"); - } - - /** - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=50898" - */ - public void testBug50898() throws JavaScriptModelException { - IJavaScriptUnit unit = getCompilationUnit("Converter" , "src", "javadoc.testBug50898", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - packageBinding = false; - verifyComments(unit); - } - - /** - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=51226" - */ - public void testBug51226() throws JavaScriptModelException { - IJavaScriptUnit[] units = getCompilationUnits("Converter" , "src", "javadoc.testBug51226"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - for (int i=0; if); - String failure = (String) failures.get(f); - String expected = "Reference '"+unbound[i]+"' should be bound!"; - if (expected.equals(failure.substring(failure.indexOf(' ')+1))) { - failures.remove(f); - } else { - f++; // skip offending failure - i--; // stay on expected string - } - } - } - stopOnFailure = true; - } - public void testBug54424() throws JavaScriptModelException { - stopOnFailure = false; - String [] unbound = { "tho", - "from", - "A#getList(int,long,boolean)", - "#getList(Object,java.util.AbstractList)", - "from", - "#getList(int from,long tho)", - "to" - }; - verifyComments("testBug54424"); - if (docCommentSupport.equals(JavaScriptCore.ENABLED)) { - int size = unbound.length; - for (int i=0, f=0; if); - String failure = (String) failures.get(f); - String expected = "Reference '"+unbound[i]+"' should be bound!"; - if (expected.equals(failure.substring(failure.indexOf(' ')+1))) { - failures.remove(f); - } else { - f++; // skip offending failure - i--; // stay on expected string - } - } - } - stopOnFailure = true; - } - - /** - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=63044" - */ - public void testBug63044() throws JavaScriptModelException { - verifyComments("testBug63044"); - } - - /** - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=51660" - */ - public void testBug51660() throws JavaScriptModelException { - stopOnFailure = false; - IJavaScriptUnit unit = getCompilationUnit("Converter" , "src", "javadoc.testBug51660", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit compilUnit = verifyComments(unit); - if (docCommentSupport.equals(JavaScriptCore.ENABLED)) { - String[] tagNames = { - "@ejb", - "@ejb", - "@ejb", - "@ejb", - "@ejb", - "@ejb", - "@ejb(bean", - "@ejb)bean", - "@ejb", - "@ejb+bean", - "@ejb,bean", - "@ejb-bean", - "@ejb.bean", - "@ejb/bean", - "@ejb", - "@ejb;bean", - "@ejb", - "@ejb=bean", - "@ejb", - "@ejb?bean", - "@ejb@bean", - "@ejb[bean", - "@ejb\\bean", - "@ejb]bean", - "@ejb^bean", - "@ejb`bean", - "@ejb{bean", - "@ejb|bean", - "@ejb", - "@ejb~bean", - "@unknown" - }; - String[] tagTexts = { - "!bean test non-java id character '!' (val=33) in tag name", - "\"bean test non-java id character '\"' (val=34) in tag name", - "#bean test non-java id character '#' (val=35) in tag name", - "%bean test non-java id character '%' (val=37) in tag name", - "&bean test non-java id character '&' (val=38) in tag name", - "'bean test non-java id character ''' (val=39) in tag name", - " test non-java id character '(' (val=40) in tag name", - " test non-java id character ')' (val=41) in tag name", - "*bean test non-java id character '*' (val=42) in tag name", - " test non-java id character '+' (val=43) in tag name", - " test non-java id character ',' (val=44) in tag name", - " test non-java id character '-' (val=45) in tag name", - " test non-java id character '.' (val=46) in tag name", - " test non-java id character '/' (val=47) in tag name", - ":bean test non-java id character ':' (val=58) in tag name", - " test non-java id character ';' (val=59) in tag name", - "' (val=62) in tag name", - " test non-java id character '?' (val=63) in tag name", - " test non-java id character '@' (val=64) in tag name", - " test non-java id character '[' (val=91) in tag name", - " test non-java id character '\\' (val=92) in tag name", - " test non-java id character ']' (val=93) in tag name", - " test non-java id character '^' (val=94) in tag name", - " test non-java id character '`' (val=96) in tag name", - " test non-java id character '{' (val=123) in tag name", - " test non-java id character '|' (val=124) in tag name", - "}bean test non-java id character '}' (val=125) in tag name", - " test non-java id character '~' (val=126) in tag name", - " test java id" - }; - Comment comment = (Comment) compilUnit.getCommentList().get(0); - assumeTrue(prefix+"Comment should be a javadoc comment ", comment.isDocComment()); - JSdoc docComment = (JSdoc) comment; - int size = docComment.tags().size(); - for (int i=0; i Class type parameter\n" + - " * @see Object\n" + - " */\n" + - "public class Test {\n" + - " /**\n" + - " * @param t\n" + - " * @param Method type parameter\n" + - " */\n" + - " void foo(T t) {}\n" + - "}\n"); - verifyWorkingCopiesComments(); - } - public void testBug79809b() throws JavaScriptModelException { - workingCopies = new IJavaScriptUnit[1]; - astLevel = AST.JLS3; - workingCopies[0] = getWorkingCopy("/Converter/src/javadoc/b79809/Test.js", - "package javadoc.b79809;\n" + - "\n" + - "/**\n" + - " * New tags for 5.0\n" + - " * - literal: {@literal ac}\n" + - " * - code: {@code abc}\n" + - " * - value: {@value System#out}\n" + - " */\n" + - "public class Test {\n" + - "\n" + - "}\n"); - verifyWorkingCopiesComments(); - } - - /** - * Bug 79904: [1.5][dom][javadoc] TagElement range not complete for type parameter tags - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=79904" - */ - public void testBug79904() throws JavaScriptModelException { - workingCopies = new IJavaScriptUnit[1]; - astLevel = AST.JLS3; - workingCopies[0] = getWorkingCopy("/Converter/src/javadoc/b79904/Test.js", - "package javadoc.b79904;\n" + - "/**\n" + - " * @param \n" + - " * @see Object\n" + - " */\n" + - "public class Test {\n" + - " /**\n" + - " * @param t\n" + - " * @param \n" + - " */\n" + - " void foo(T t) {}\n" + - "}\n"); - verifyWorkingCopiesComments(); - } - - /** - * Bug 80221: [1.5][dom][javadoc] Need better support for type parameter Javadoc tags - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=80221" - */ - public void testBug80221() throws JavaScriptModelException { - workingCopies = new IJavaScriptUnit[1]; - astLevel = AST.JLS3; - workingCopies[0] = getWorkingCopy("/Converter/src/javadoc/b80221/Test.js", - "package javadoc.b80221;\n" + - "public class Test {\n" + - " /**\n" + - " * @see Object Unknown: ref is not resolved due to compile error...\n" + - " */\n" + - " public foo() {\n" + - " return 1;\n" + - " }\n" + - "}\n" - ); - verifyWorkingCopiesComments(); - } - - /** - * Bug 80257: [1.5][javadoc][dom] Type references in javadocs should have generic binding, not raw - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=80257" - */ - public void testBug80257() throws JavaScriptModelException { - workingCopies = new IJavaScriptUnit[1]; - astLevel = AST.JLS3; - workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b80257/Test.js", - "package javadoc.b80257;\n" + - "import java.util.*;\n" + - "public class Test {\n" + - " /**\n" + - " * @see ArrayList\n" + - " * @return {@link java.util.List}\n" + - " */\n" + - " List getList() {\n" + - " return new ArrayList();\n" + - " }\n" + - "}\n" - ); - JavaScriptUnit compilUnit = verifyComments(workingCopies[0]); - if (docCommentSupport.equals(JavaScriptCore.ENABLED)) { - // Do not need to verify following statement as we know it's ok as verifyComments did not fail - JSdoc docComment = (JSdoc) compilUnit.getCommentList().get(0); // get javadoc comment - TagElement firstTag = (TagElement) docComment.tags().get(0); // get first tag - TagElement secondTag = (TagElement) docComment.tags().get(1); // get second tag - TagElement inlineTag = (TagElement) secondTag.fragments().get(1); // get inline tag - // Get tag simple name reference in first tag - assertEquals("Invalid number of fragments for tag element: "+firstTag, 1, firstTag.fragments().size()); - ASTNode node = (ASTNode) firstTag.fragments().get(0); - assertEquals("Invalid kind of name reference for tag element: "+firstTag, ASTNode.SIMPLE_NAME, node.getNodeType()); - SimpleName seeRef = (SimpleName) node; - // Verify binding for simple name - IBinding binding = seeRef.resolveBinding(); - assertTrue("Wrong kind of binding", binding instanceof ITypeBinding); - // Get inline tag simple name reference in second tag - assertEquals("Invalid number of fragments for inline tag element: "+inlineTag, 1, inlineTag.fragments().size()); - node = (ASTNode) inlineTag.fragments().get(0); - assertEquals("Invalid kind of name reference for tag element: "+inlineTag, ASTNode.QUALIFIED_NAME, node.getNodeType()); - QualifiedName linkRef = (QualifiedName) node; - // Verify binding for qualified name - binding = linkRef.resolveBinding(); - assertTrue("Wrong kind of binding", binding instanceof ITypeBinding); - } - } - - /** - * Bug 83804: [1.5][javadoc] Missing Javadoc node for package declaration - * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=83804" - */ - public void testBug83804() throws CoreException, JavaScriptModelException { - astLevel = AST.JLS3; - workingCopies = new IJavaScriptUnit[2]; - workingCopies[0] = getCompilationUnit("Converter15", "src", "javadoc.b83804", "package-info.js"); - workingCopies[1] = getCompilationUnit("Converter15", "src", "javadoc.b83804", "Test.js"); - verifyWorkingCopiesComments(); - } - public void testBug83804a() throws CoreException, JavaScriptModelException { - astLevel = AST.JLS3; - workingCopies = new IJavaScriptUnit[2]; - workingCopies[0] = getCompilationUnit("Converter15", "src", "javadoc.b83804a", "package-info.js"); - workingCopies[1] = getCompilationUnit("Converter15", "src", "javadoc.b83804a", "Test.js"); - verifyWorkingCopiesComments(); - } - - /** - * Bug 84049: [javadoc][dom] Extended ranges wrong for method name without return type - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=84049" - */ - public void testBug84049() throws JavaScriptModelException { - workingCopies = new IJavaScriptUnit[1]; - astLevel = AST.JLS3; - workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b84049/Test.js", - "package javadoc.b84049;\n" + - "public class Test {\n" + - " /**\n" + - " * @see Object\n" + - " */\n" + - " foo() {\n" + - " }\n" + - "}\n" - ); - JavaScriptUnit compilUnit = (JavaScriptUnit) runConversion(workingCopies[0], true); - if (docCommentSupport.equals(JavaScriptCore.ENABLED)) { - ASTNode node = getASTNode(compilUnit, 0, 0); - assertEquals("Invalid type for node: "+node, ASTNode.FUNCTION_DECLARATION, node.getNodeType()); - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - JSdoc methodJavadoc = methodDeclaration.getJavadoc(); - assertNotNull("FunctionDeclaration have a javadoc comment", methodJavadoc); - int javadocStart = methodJavadoc.getStartPosition(); - assertEquals("Method declaration should include javadoc comment", methodDeclaration.getStartPosition(), javadocStart); - SimpleName methodName = methodDeclaration.getName(); - int nameStart = methodName.getStartPosition(); - assertTrue("Method simple name should not include javadoc comment", nameStart > javadocStart+methodJavadoc.getLength()); - int extendedStart = compilUnit.getExtendedStartPosition(methodName); - assertEquals("Method simple name start position should not be extended!", nameStart, extendedStart); - int extendedLength = compilUnit.getExtendedLength(methodName); - assertEquals("Method simple name length should not be extended!", methodName.getLength(), extendedLength); - } - } - - /** - * Bug 87845: [1.5][javadoc][dom] Type references in javadocs should have generic binding, not raw - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=87845" - */ - public void testBug87845() throws JavaScriptModelException { - workingCopies = new IJavaScriptUnit[1]; - astLevel = AST.JLS3; - workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b87845/Test.js", - "package javadoc.b87845;\n" + - "public class Test {\n" + - " public void foo(int a, int b) {} \n" + - " public void foo(int a, int... args) {}\n" + - " public void foo(String... args) {}\n" + - " public void foo(Exception str, boolean... args) {}\n" + - " /**\n" + - " * @see Test#foo(int, int)\n" + - " * @see Test#foo(int, int[])\n" + - " * @see Test#foo(int, int...)\n" + - " * @see Test#foo(String[])\n" + - " * @see Test#foo(String...)\n" + - " * @see Test#foo(Exception, boolean[])\n" + - " * @see Test#foo(Exception, boolean...)\n" + - " */\n" + - " public void valid() {}\n" + - " /**\n" + - " * @see Test#foo(int)\n" + - " * @see Test#foo(int, int, int)\n" + - " * @see Test#foo()\n" + - " * @see Test#foo(String)\n" + - " * @see Test#foo(String, String)\n" + - " * @see Test#foo(Exception)\n" + - " * @see Test#foo(Exception, boolean)\n" + - " * @see Test#foo(Exception, boolean, boolean)\n" + - " */\n" + - " public void invalid() {}\n" + - "}\n" - ); - JavaScriptUnit compilUnit = verifyComments(workingCopies[0]); - if (docCommentSupport.equals(JavaScriptCore.ENABLED)) { - // Do not need to verify following statement as we know it's ok as verifyComments did not fail - JSdoc docComment = (JSdoc) compilUnit.getCommentList().get(0); // get first javadoc comment - // Verify last parameter for all methods reference in javadoc comment - List tags = docComment.tags(); - int size = tags.size(); - for (int i=0; i comment.getStartPosition()+comment.getLength()); - } - } - public void testBug93880_14a() throws JavaScriptModelException { - workingCopies = new IJavaScriptUnit[1]; - astLevel = AST.JLS3; - workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b93880/Test.js", - "/**\n" + - " * Javadoc\n" + - " */\n" + - "package javadoc.b93880;\n" + - "public class Test {\n" + - "}\n" - ); - JavaScriptUnit compilUnit = verifyComments(workingCopies[0]); - if (docCommentSupport.equals(JavaScriptCore.ENABLED)) { - // Get package declaration declaration and javadoc - PackageDeclaration packDecl = compilUnit.getPackage(); - JSdoc docComment = (JSdoc) compilUnit.getCommentList().get(0); // Do not need to verify following statement as we know it's ok as verifyComments did not fail - - // Verify package declaration declaration source start - assertEquals("Source range of PackageDeclaration should include Javadoc child", docComment.getStartPosition(), packDecl.getStartPosition()); - } - } - public void testBug93880_14b() throws JavaScriptModelException { - workingCopies = new IJavaScriptUnit[1]; - astLevel = AST.JLS3; - workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b93880/package-info.js", - "/**\n" + - " * Javadoc for all package\n" + - " */\n" + - "package javadoc.b93880;" - ); - JavaScriptUnit compilUnit = verifyComments(workingCopies[0]); - if (docCommentSupport.equals(JavaScriptCore.ENABLED)) { - // Get package declaration declaration and javadoc - PackageDeclaration packDecl = compilUnit.getPackage(); - JSdoc docComment = (JSdoc) compilUnit.getCommentList().get(0); // Do not need to verify following statement as we know it's ok as verifyComments did not fail - - // Verify package declaration declaration source start - assertEquals("Source range of PackageDeclaration should include Javadoc child", docComment.getStartPosition(), packDecl.getStartPosition()); - } - } - public void testBug93880_14c() throws JavaScriptModelException { - workingCopies = new IJavaScriptUnit[1]; - astLevel = AST.JLS3; - workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b93880/package-info.js", - "/**\n" + - " * Javadoc for all package\n" + - " */\n" + - "private package javadoc.b93880;" - ); - JavaScriptUnit compilUnit = verifyComments(workingCopies[0]); - if (docCommentSupport.equals(JavaScriptCore.ENABLED)) { - // Get package declaration declaration and javadoc - PackageDeclaration packDecl = compilUnit.getPackage(); - JSdoc docComment = (JSdoc) compilUnit.getCommentList().get(0); // Do not need to verify following statement as we know it's ok as verifyComments did not fail - - // Verify package declaration declaration source start - assertEquals("Source range of PackageDeclaration should include Javadoc child", docComment.getStartPosition(), packDecl.getStartPosition()); - } - } - public void testBug93880_14d() throws JavaScriptModelException { - workingCopies = new IJavaScriptUnit[1]; - astLevel = AST.JLS3; - workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b93880/package-info.js", - "/**\n" + - " * Javadoc for all package\n" + - " */\n" + - "@Deprecated\n" + - "package javadoc.b93880;" - ); - JavaScriptUnit compilUnit = verifyComments(workingCopies[0]); - if (docCommentSupport.equals(JavaScriptCore.ENABLED)) { - // Get package declaration declaration and javadoc - PackageDeclaration packDecl = compilUnit.getPackage(); - assertNotNull("Compilation unit should have a package declaration", packDecl); - JSdoc docComment = (JSdoc) compilUnit.getCommentList().get(0); // Do not need to verify following statement as we know it's ok as verifyComments did not fail - - // Verify package declaration declaration source start - assertEquals("Source range of PackageDeclaration should include Javadoc child", docComment.getStartPosition(), packDecl.getStartPosition()); - } - } - public void testBug93880_14e() throws JavaScriptModelException { - workingCopies = new IJavaScriptUnit[1]; - astLevel = AST.JLS3; - workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b93880/package-info.js", - "/* (non-javadoc)\n" + - " * No comment\n" + - " */\n" + - "package javadoc.b93880;" - ); - JavaScriptUnit compilUnit = verifyComments(workingCopies[0]); - if (docCommentSupport.equals(JavaScriptCore.ENABLED)) { - // Get package declaration declaration and javadoc - PackageDeclaration packDecl = compilUnit.getPackage(); - List unitComments = compilUnit.getCommentList(); - assertEquals("Wrong number of comments", 1, unitComments.size()); - Comment comment = (Comment) unitComments.get(0); - - // Verify package declaration declaration source start - assertTrue("Source range of PackageDeclaration should NOT not include Javadoc child", packDecl.getStartPosition() > comment.getStartPosition()+comment.getLength()); - } - } - - - /** - * Bug 99507: [javadoc] Infinit loop in DocCommentParser - * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=99507" - */ - public void testBug99507() throws JavaScriptModelException { - workingCopies = new IJavaScriptUnit[1]; - workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b99507/X.js", - "package javadoc.b99507;\n" + - "public class X {\n" + - "}\n" + - "/** @param test*/" - ); - verifyComments(workingCopies[0]); - } - public void testBug99507b() throws JavaScriptModelException { - String source = "/**\n@param country*/"; - ASTParser parser = ASTParser.newParser(AST.JLS3); - parser.setKind(ASTParser.K_COMPILATION_UNIT); - parser.setSource(source.toCharArray()); - parser.createAST(null); - } - - /** - * Bug 100041: [javadoc] Infinit loop in DocCommentParser - * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=100041" - */ - public void testBug100041() throws JavaScriptModelException { - workingCopies = new IJavaScriptUnit[1]; - workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b100041/X.js", - "package javadoc.b100041;\n" + - "class X {\n" + - " static Object object;\n" + - " static void foo() {\n" + - " /**\n" + - " * javadoc comment.\n" + - " */\n" + - " if (object instanceof String) {\n" + - " final String clr = null;\n" + - " }\n" + - " }\n" + - "}" - ); - JavaScriptUnit compilUnit = verifyComments(workingCopies[0]); - if (docCommentSupport.equals(JavaScriptCore.ENABLED)) { - // Get comment - List unitComments = compilUnit.getCommentList(); - assertEquals("Wrong number of comments", 1, unitComments.size()); - Comment comment = (Comment) unitComments.get(0); - int commentStart = comment.getStartPosition(); - int commentEnd = commentStart+comment.getLength(); - - // Get local variable declaration - ASTNode node = getASTNode(compilUnit, 0, 1, 0); - assertEquals("Expected if statement for node: "+node, ASTNode.IF_STATEMENT, node.getNodeType()); - IfStatement ifStatement = (IfStatement) node; - assertTrue("Invalid start position for IfStatement: "+ifStatement, ifStatement.getStartPosition() > commentEnd); - Statement statement = ifStatement.getThenStatement(); - assertEquals("Expected block for node: "+statement, ASTNode.BLOCK, statement.getNodeType()); - Block block = (Block) statement; - assertTrue("Invalid start position for Block: "+block, block.getStartPosition() > commentEnd); - List statements = block.statements(); - assertEquals("Invalid number of statements for block: "+block, 1, statements.size()); - statement = (Statement) statements.get(0); - assertEquals("Expected variable declaration statement for node: "+statement, ASTNode.VARIABLE_DECLARATION_STATEMENT, statement.getNodeType()); - VariableDeclarationStatement varDecl = (VariableDeclarationStatement) statement; - assertTrue("Invalid start position for : VariableDeclarationStatement"+varDecl, varDecl.getStartPosition() > commentEnd); - } - } - public void testBug100041b() throws JavaScriptModelException { - workingCopies = new IJavaScriptUnit[1]; - workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b100041/X.js", - "package javadoc.b100041;\n" + - "class X {\n" + - " static Object object;\n" + - " static void foo() {\n" + - " /**\n" + - " * javadoc comment.\n" + - " */\n" + - " if (object instanceof String)\n" + - " return;\n" + - " }\n" + - "}" - ); - JavaScriptUnit compilUnit = verifyComments(workingCopies[0]); - if (docCommentSupport.equals(JavaScriptCore.ENABLED)) { - // Get comment - List unitComments = compilUnit.getCommentList(); - assertEquals("Wrong number of comments", 1, unitComments.size()); - Comment comment = (Comment) unitComments.get(0); - int commentStart = comment.getStartPosition(); - int commentEnd = commentStart+comment.getLength(); - - // Get local variable declaration - ASTNode node = getASTNode(compilUnit, 0, 1, 0); - assertEquals("Expected if statement for node: "+node, ASTNode.IF_STATEMENT, node.getNodeType()); - IfStatement ifStatement = (IfStatement) node; - assertTrue("Invalid start position for IfStatement: "+ifStatement, ifStatement.getStartPosition() > commentEnd); - Statement statement = ifStatement.getThenStatement(); - assertEquals("Expected block for node: "+statement, ASTNode.RETURN_STATEMENT, statement.getNodeType()); - ReturnStatement returnStatement = (ReturnStatement) statement; - assertTrue("Invalid start position for Block: "+returnStatement, returnStatement.getStartPosition() > commentEnd); - } - } - public void testBug100041c() throws JavaScriptModelException { - workingCopies = new IJavaScriptUnit[1]; - workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b100041/Z.js", - "package javadoc.b100041;\n" + - "public class Z {\n" + - " /** C1 */\n" + - " class Z1 {}\n" + - " /** C2 */\n" + - " Z1 z1;\n" + - " /** C3 */\n" + - " public static void foo(Object object) {\n" + - " /** C4 */\n" + - " class ZZ {\n" + - " /** C5 */\n" + - " ZZ zz;\n" + - " /** C6 */\n" + - " public void bar() {}\n" + - " }\n" + - " }\n" + - "}\n" - ); - JavaScriptUnit compilUnit = verifyComments(workingCopies[0]); - if (docCommentSupport.equals(JavaScriptCore.ENABLED)) { - // Get comments - List unitComments = compilUnit.getCommentList(); - int size = unitComments.size(); - assertEquals("Wrong number of comments", 6, size); - JSdoc[] javadocs = new JSdoc[size]; - Iterator iterator = unitComments.iterator(); - for (int i=0; i ClassInstanceCreation - * @deprecated using deprecated code - */ - public void test0002() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0002", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = this.ast.newClassInstanceCreation(); - classInstanceCreation.setMember(this.ast.newSimpleName("Object")); //$NON-NLS-1$ - assertTrue("Both AST trees should be identical", classInstanceCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "new Object()", source); //$NON-NLS-1$ - } - - /** - * Test allocation expression: new java.lang.Object() ==> ClassInstanceCreation - * @deprecated using deprecated code - */ - public void test0003() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0003", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = this.ast.newClassInstanceCreation(); - - FieldAccess expr = this.ast.newFieldAccess(); - expr.setName(this.ast.newSimpleName("Object")); - - FieldAccess expr2 = this.ast.newFieldAccess(); - expr2.setName(this.ast.newSimpleName("lang")); - expr2.setExpression(this.ast.newSimpleName("java")); - - expr.setExpression(expr2); - - classInstanceCreation.setMember(expr); - assertTrue("Both AST trees should be identical", classInstanceCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "new java.lang.Object()", source); //$NON-NLS-1$ - } - - /** - * Test allocation expression: new java.lang.Exception("ERROR") ==> ClassInstanceCreation - * @deprecated using deprecated code - */ - public void test0004() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0004", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = this.ast.newClassInstanceCreation(); - - FieldAccess expr = this.ast.newFieldAccess(); - expr.setName(this.ast.newSimpleName("Exception")); - - FieldAccess expr2 = this.ast.newFieldAccess(); - expr2.setName(this.ast.newSimpleName("lang")); - expr2.setExpression(this.ast.newSimpleName("java")); - - expr.setExpression(expr2); - - classInstanceCreation.setMember(expr); - StringLiteral literal = this.ast.newStringLiteral(); - literal.setLiteralValue("ERROR"); //$NON-NLS-1$ - classInstanceCreation.arguments().add(literal); - assertTrue("Both AST trees should be identical", classInstanceCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "new java.lang.Exception(\"ERROR\")", source); //$NON-NLS-1$ - } - - public void test0005() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0005", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ExpressionStatement statement = (ExpressionStatement) getASTNode((JavaScriptUnit) result, 0, 0, 0); - ASTNode expression=statement.getExpression(); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - - FunctionInvocation methodInvocation = this.ast.newFunctionInvocation(); - ArrayAccess arrayAccess = this.ast.newArrayAccess(); - arrayAccess.setArray(this.ast.newSimpleName("args")); - arrayAccess.setIndex(this.ast.newNumberLiteral("5")); - methodInvocation.setExpression(arrayAccess); - - NumberLiteral literal = this.ast.newNumberLiteral("1"); - methodInvocation.arguments().add(literal); - - - assertTrue("Both AST trees should be identical", methodInvocation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "args[5](1)", source); //$NON-NLS-1$ - } - - -// /** -// * Test allocation expression: new java.lang.Runnable() { public void run() {}} ==> ClassInstanceCreation -// * @deprecated using deprecated code -// */ -// public void test0006() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0006", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); -// assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ -// ClassInstanceCreation classInstanceCreation = this.ast.newClassInstanceCreation(); -// QualifiedName name = -// this.ast.newQualifiedName( -// this.ast.newQualifiedName( -// this.ast.newSimpleName("java"), //$NON-NLS-1$ -// this.ast.newSimpleName("lang")), //$NON-NLS-1$ -// this.ast.newSimpleName("Runnable"));//$NON-NLS-1$ -// classInstanceCreation.setName(name); -// FunctionDeclaration methodDeclaration = this.ast.newMethodDeclaration(); -// methodDeclaration.setBody(this.ast.newBlock()); -// methodDeclaration.setConstructor(false); -// methodDeclaration.setModifiers(Modifier.PUBLIC); -// methodDeclaration.setName(this.ast.newSimpleName("run"));//$NON-NLS-1$ -// methodDeclaration.setReturnType(this.ast.newPrimitiveType(PrimitiveType.VOID)); -// AnonymousClassDeclaration anonymousClassDeclaration = this.ast.newAnonymousClassDeclaration(); -// anonymousClassDeclaration.bodyDeclarations().add(methodDeclaration); -// classInstanceCreation.setAnonymousClassDeclaration(anonymousClassDeclaration); -// assertTrue("Both AST trees should be identical", classInstanceCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ -// checkSourceRange(expression, "new java.lang.Runnable() { public void run() {}}", source); //$NON-NLS-1$ -// } -// -// /** -// * Test allocation expression: new Test().new D() ==> ClassInstanceCreation -// * @deprecated using deprecated code -// */ -// public void test0007() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0007", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); -// assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ -// ExpressionStatement expressionStatement = (ExpressionStatement) node; -// ASTNode expression = (ASTNode) ((FunctionInvocation) expressionStatement.getExpression()).arguments().get(0); -// assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ -// ClassInstanceCreation classInstanceCreation = this.ast.newClassInstanceCreation(); -// classInstanceCreation.setName(this.ast.newSimpleName("D")); //$NON-NLS-1$ -// ClassInstanceCreation classInstanceCreationExpression = this.ast.newClassInstanceCreation(); -// classInstanceCreationExpression.setName(this.ast.newSimpleName("Test")); //$NON-NLS-1$ -// classInstanceCreation.setExpression(classInstanceCreationExpression); -// assertTrue("Both AST trees should be identical", classInstanceCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ -// checkSourceRange(expression, "new Test().new D()", source); //$NON-NLS-1$ -// } - - /** - * Test allocation expression: new int[] {1, 2, 3, 4} ==> ArrayCreation - */ - public void test0008() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0008", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - ArrayInitializer arrayInitializer = this.ast.newArrayInitializer(); - arrayInitializer.expressions().add(this.ast.newNumberLiteral("1"));//$NON-NLS-1$ - arrayInitializer.expressions().add(this.ast.newNumberLiteral("2"));//$NON-NLS-1$ - arrayInitializer.expressions().add(this.ast.newNumberLiteral("3"));//$NON-NLS-1$ - arrayInitializer.expressions().add(this.ast.newNumberLiteral("4"));//$NON-NLS-1$ - assertTrue("Both AST trees should be identical", arrayInitializer.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "[1, 2, 3, 4]", source); //$NON-NLS-1$ - } - - /** - * Test allocation expression: new int[][] {{1}, {2}} ==> ArrayCreation - */ - public void test0009() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0009", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - ArrayInitializer arrayInitializer = this.ast.newArrayInitializer(); - ArrayInitializer innerArrayInitializer = this.ast.newArrayInitializer(); - innerArrayInitializer.expressions().add(this.ast.newNumberLiteral("1"));//$NON-NLS-1$ - arrayInitializer.expressions().add(innerArrayInitializer); - innerArrayInitializer = this.ast.newArrayInitializer(); - innerArrayInitializer.expressions().add(this.ast.newNumberLiteral("2"));//$NON-NLS-1$ - arrayInitializer.expressions().add(innerArrayInitializer); - assertTrue("Both AST trees should be identical", arrayInitializer.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "[[1], [2]]", source); //$NON-NLS-1$ - } - -// /** -// * Test allocation expression: new int[3] ==> ArrayCreation -// */ -// public void test0010() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0010", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); -// assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ -// ArrayCreation arrayCreation = this.ast.newArrayCreation(); -// arrayCreation.setType(this.ast.newArrayType(this.ast.newPrimitiveType(PrimitiveType.INT), 1)); -// arrayCreation.dimensions().add(this.ast.newNumberLiteral("3")); //$NON-NLS-1$ -// assertTrue("Both AST trees should be identical", arrayCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ -// checkSourceRange(expression, "new int[3]", source); //$NON-NLS-1$ -// } -// -// /** -// * Test allocation expression: new int[3][] ==> ArrayCreation -// */ -// public void test0011() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0011", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); -// assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ -// ArrayCreation arrayCreation = this.ast.newArrayCreation(); -// arrayCreation.setType(this.ast.newArrayType(this.ast.newPrimitiveType(PrimitiveType.INT), 2)); -// arrayCreation.dimensions().add(this.ast.newNumberLiteral("3")); //$NON-NLS-1$ -// assertTrue("Both AST trees should be identical", arrayCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ -// checkSourceRange(expression, "new int[3][]", source); //$NON-NLS-1$ -// } -// -// /** -// * Test allocation expression: new int[][] {{},{}} ==> ArrayCreation -// */ -// public void test0012() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0012", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); -// assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ -// ArrayCreation arrayCreation = this.ast.newArrayCreation(); -// arrayCreation.setType(this.ast.newArrayType(this.ast.newPrimitiveType(PrimitiveType.INT), 2)); -// ArrayInitializer arrayInitializer = this.ast.newArrayInitializer(); -// ArrayInitializer innerArrayInitializer = this.ast.newArrayInitializer(); -// arrayInitializer.expressions().add(innerArrayInitializer); -// innerArrayInitializer = this.ast.newArrayInitializer(); -// arrayInitializer.expressions().add(innerArrayInitializer); -// arrayCreation.setInitializer(arrayInitializer); -// assertTrue("Both AST trees should be identical", arrayCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ -// checkSourceRange(expression, "new int[][] {{}, {}}", source); //$NON-NLS-1$ -// } - - /** - * int i; ==> VariableDeclarationFragment - * @deprecated using deprecated code - */ - public void test0013() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0013", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$ - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "var i;", source); //$NON-NLS-1$ - } - - /** - * int i = 0; ==> VariableDeclarationFragment - * @deprecated using deprecated code - */ - public void test0014() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0014", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$ - variableDeclarationFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$ - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "var i = 0;", source); //$NON-NLS-1$ - } - - /** - * i = 1; ==> ExpressionStatement(Assignment) - */ - public void test0015() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0015", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - Assignment assignment = this.ast.newAssignment(); - assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$ - assignment.setRightHandSide(this.ast.newNumberLiteral("1")); //$NON-NLS-1$ - assignment.setOperator(Assignment.Operator.ASSIGN); - ExpressionStatement statement = this.ast.newExpressionStatement(assignment); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "i = 1;", source); //$NON-NLS-1$ - } - - /** - * i += 2; ==> ExpressionStatement(Assignment) - */ - public void test0016() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0016", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - Assignment assignment = this.ast.newAssignment(); - assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$ - assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$ - assignment.setOperator(Assignment.Operator.PLUS_ASSIGN); - ExpressionStatement statement = this.ast.newExpressionStatement(assignment); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "i += 2;", source); //$NON-NLS-1$ - } - - /** - * i -= 2; ==> ExpressionStatement(Assignment) - */ - public void test0017() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0017", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - Assignment assignment = this.ast.newAssignment(); - assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$ - assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$ - assignment.setOperator(Assignment.Operator.MINUS_ASSIGN); - ExpressionStatement statement = this.ast.newExpressionStatement(assignment); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "i -= 2;", source); //$NON-NLS-1$ - } - - /** - * i *= 2; ==> ExpressionStatement(Assignment) - */ - public void test0018() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0018", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - Assignment assignment = this.ast.newAssignment(); - assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$ - assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$ - assignment.setOperator(Assignment.Operator.TIMES_ASSIGN); - ExpressionStatement statement = this.ast.newExpressionStatement(assignment); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "i *= 2;", source); //$NON-NLS-1$ - } - - /** - * i /= 2; ==> ExpressionStatement(Assignment) - */ - public void test0019() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0019", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - Assignment assignment = this.ast.newAssignment(); - assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$ - assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$ - assignment.setOperator(Assignment.Operator.DIVIDE_ASSIGN); - ExpressionStatement statement = this.ast.newExpressionStatement(assignment); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "i /= 2;", source); //$NON-NLS-1$ - } - - /** - * i &= 2 ==> ExpressionStatement(Assignment) - */ - public void test0020() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0020", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - Assignment assignment = this.ast.newAssignment(); - assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$ - assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$ - assignment.setOperator(Assignment.Operator.BIT_AND_ASSIGN); - ExpressionStatement statement = this.ast.newExpressionStatement(assignment); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "i &= 2;", source); //$NON-NLS-1$ - } - - /** - * i |= 2; ==> ExpressionStatement(Assignment) - */ - public void test0021() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0021", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - Assignment assignment = this.ast.newAssignment(); - assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$ - assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$ - assignment.setOperator(Assignment.Operator.BIT_OR_ASSIGN); - ExpressionStatement statement = this.ast.newExpressionStatement(assignment); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "i |= 2;", source); //$NON-NLS-1$ - } - - /** - * i ^= 2; ==> ExpressionStatement(Assignment) - */ - public void test0022() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0022", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - Assignment assignment = this.ast.newAssignment(); - assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$ - assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$ - assignment.setOperator(Assignment.Operator.BIT_XOR_ASSIGN); - ExpressionStatement statement = this.ast.newExpressionStatement(assignment); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "i ^= 2;", source); //$NON-NLS-1$ - } - - /** - * i %= 2; ==> ExpressionStatement(Assignment) - */ - public void test0023() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0023", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - Assignment assignment = this.ast.newAssignment(); - assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$ - assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$ - assignment.setOperator(Assignment.Operator.REMAINDER_ASSIGN); - ExpressionStatement statement = this.ast.newExpressionStatement(assignment); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "i %= 2;", source); //$NON-NLS-1$ - } - - /** - * i <<= 2; ==> ExpressionStatement(Assignment) - */ - public void test0024() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0024", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - Assignment assignment = this.ast.newAssignment(); - assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$ - assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$ - assignment.setOperator(Assignment.Operator.LEFT_SHIFT_ASSIGN); - ExpressionStatement statement = this.ast.newExpressionStatement(assignment); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "i <<= 2;", source); //$NON-NLS-1$ - } - - /** - * i >>= 2; ==> ExpressionStatement(Assignment) - */ - public void test0025() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0025", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - Assignment assignment = this.ast.newAssignment(); - assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$ - assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$ - assignment.setOperator(Assignment.Operator.RIGHT_SHIFT_SIGNED_ASSIGN); - ExpressionStatement statement = this.ast.newExpressionStatement(assignment); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "i >>= 2;", source); //$NON-NLS-1$ - } - - /** - * i >>>= 2; ==> ExpressionStatement(Assignment) - */ - public void test0026() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0026", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - Assignment assignment = this.ast.newAssignment(); - assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$ - assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$ - assignment.setOperator(Assignment.Operator.RIGHT_SHIFT_UNSIGNED_ASSIGN); - ExpressionStatement statement = this.ast.newExpressionStatement(assignment); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "i >>>= 2;", source); //$NON-NLS-1$ - } - - /** - * --i; ==> ExpressionStatement(PrefixExpression) - */ - public void test0027() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0027", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - PrefixExpression prefixExpression = this.ast.newPrefixExpression(); - prefixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$ - prefixExpression.setOperator(PrefixExpression.Operator.DECREMENT);//$NON-NLS-1$ - ExpressionStatement statement = this.ast.newExpressionStatement(prefixExpression); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "--i;", source); //$NON-NLS-1$ - } - - /** - * --i; ==> ExpressionStatement(PrefixExpression) - */ - public void test0028() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0028", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - PrefixExpression prefixExpression = this.ast.newPrefixExpression(); - prefixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$ - prefixExpression.setOperator(PrefixExpression.Operator.INCREMENT);//$NON-NLS-1$ - ExpressionStatement statement = this.ast.newExpressionStatement(prefixExpression); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "++i;", source); //$NON-NLS-1$ - } - - /** - * i--; ==> ExpressionStatement(PostfixExpression) - */ - public void test0029() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0029", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - PostfixExpression postfixExpression = this.ast.newPostfixExpression(); - postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$ - postfixExpression.setOperator(PostfixExpression.Operator.DECREMENT);//$NON-NLS-1$ - ExpressionStatement statement = this.ast.newExpressionStatement(postfixExpression); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "i--;", source); //$NON-NLS-1$ - } - - /** - * i++; ==> ExpressionStatement(PostfixExpression) - */ - public void test0030() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0030", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - PostfixExpression postfixExpression = this.ast.newPostfixExpression(); - postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$ - postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);//$NON-NLS-1$ - ExpressionStatement statement = this.ast.newExpressionStatement(postfixExpression); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "i++;", source); //$NON-NLS-1$ - } - -// /** -// * (String) o; ==> ExpressionStatement(CastExpression) -// * @deprecated using deprecated code -// */ -// public void test0031() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0031", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); -// variableDeclarationFragment.setName(this.ast.newSimpleName("s")); //$NON-NLS-1$ -// CastExpression castExpression = this.ast.newCastExpression(); -// castExpression.setExpression(this.ast.newSimpleName("o"));//$NON-NLS-1$ -// castExpression.setType(this.ast.newSimpleType(this.ast.newSimpleName("String")));//$NON-NLS-1$ -// variableDeclarationFragment.setInitializer(castExpression); -// VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); -// statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newSimpleType(this.ast.newSimpleName("String")));//$NON-NLS-1$ -// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ -// checkSourceRange(node, "String s = (String) o;", source); //$NON-NLS-1$ -// } -// -// /** -// * (int) d; ==> ExpressionStatement(CastExpression) -// * @deprecated using deprecated code -// */ -// public void test0032() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0032", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); -// variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$ -// CastExpression castExpression = this.ast.newCastExpression(); -// castExpression.setExpression(this.ast.newSimpleName("d"));//$NON-NLS-1$ -// castExpression.setType(this.ast.newPrimitiveType(PrimitiveType.INT));//$NON-NLS-1$ -// variableDeclarationFragment.setInitializer(castExpression); -// VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); -// statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));//$NON-NLS-1$ -// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ -// checkSourceRange(node, "int i = (int) d;", source); //$NON-NLS-1$ -// } -// -// /** -// * (float) d; ==> ExpressionStatement(CastExpression) -// * @deprecated using deprecated code -// */ -// public void test0033() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0033", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// -// VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); -// variableDeclarationFragment.setName(this.ast.newSimpleName("f")); //$NON-NLS-1$ -// CastExpression castExpression = this.ast.newCastExpression(); -// castExpression.setExpression(this.ast.newSimpleName("d"));//$NON-NLS-1$ -// castExpression.setType(this.ast.newPrimitiveType(PrimitiveType.FLOAT));//$NON-NLS-1$ -// variableDeclarationFragment.setInitializer(castExpression); -// VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); -// statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.FLOAT));//$NON-NLS-1$ -// -// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ -// checkSourceRange(node, "float f = (float) d;", source); //$NON-NLS-1$ -// } -// -// /** -// * (byte) d; ==> ExpressionStatement(CastExpression) -// * @deprecated using deprecated code -// */ -// public void test0034() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0034", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// -// VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); -// variableDeclarationFragment.setName(this.ast.newSimpleName("b")); //$NON-NLS-1$ -// CastExpression castExpression = this.ast.newCastExpression(); -// castExpression.setExpression(this.ast.newSimpleName("d"));//$NON-NLS-1$ -// castExpression.setType(this.ast.newPrimitiveType(PrimitiveType.BYTE));//$NON-NLS-1$ -// variableDeclarationFragment.setInitializer(castExpression); -// VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); -// statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.BYTE));//$NON-NLS-1$ -// -// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ -// checkSourceRange(node, "byte b = (byte) d;", source); //$NON-NLS-1$ -// } -// -// /** -// * (short) d; ==> ExpressionStatement(CastExpression) -// * @deprecated using deprecated code -// */ -// public void test0035() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0035", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// -// VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); -// variableDeclarationFragment.setName(this.ast.newSimpleName("s")); //$NON-NLS-1$ -// CastExpression castExpression = this.ast.newCastExpression(); -// castExpression.setExpression(this.ast.newSimpleName("d"));//$NON-NLS-1$ -// castExpression.setType(this.ast.newPrimitiveType(PrimitiveType.SHORT));//$NON-NLS-1$ -// variableDeclarationFragment.setInitializer(castExpression); -// VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); -// statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.SHORT));//$NON-NLS-1$ -// -// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ -// checkSourceRange(node, "short s = (short) d;", source); //$NON-NLS-1$ -// } -// -// /** -// * (long) d; ==> ExpressionStatement(CastExpression) -// * @deprecated using deprecated code -// */ -// public void test0036() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0036", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// -// VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); -// variableDeclarationFragment.setName(this.ast.newSimpleName("l")); //$NON-NLS-1$ -// CastExpression castExpression = this.ast.newCastExpression(); -// castExpression.setExpression(this.ast.newSimpleName("d"));//$NON-NLS-1$ -// castExpression.setType(this.ast.newPrimitiveType(PrimitiveType.LONG));//$NON-NLS-1$ -// variableDeclarationFragment.setInitializer(castExpression); -// VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); -// statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.LONG));//$NON-NLS-1$ -// -// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ -// checkSourceRange(node, "long l = (long) d;", source); //$NON-NLS-1$ -// } -// -// /** -// * (char) i; ==> ExpressionStatement(CastExpression) -// * @deprecated using deprecated code -// */ -// public void test0037() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0037", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// -// VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); -// variableDeclarationFragment.setName(this.ast.newSimpleName("c")); //$NON-NLS-1$ -// CastExpression castExpression = this.ast.newCastExpression(); -// castExpression.setExpression(this.ast.newSimpleName("i"));//$NON-NLS-1$ -// castExpression.setType(this.ast.newPrimitiveType(PrimitiveType.CHAR));//$NON-NLS-1$ -// variableDeclarationFragment.setInitializer(castExpression); -// VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); -// statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.CHAR));//$NON-NLS-1$ -// -// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ -// checkSourceRange(node, "char c = (char) i;", source); //$NON-NLS-1$ -// } -// -// /** -// * int.class; ==> ExpressionStatement(TypeLiteral) -// * @deprecated using deprecated code -// */ -// public void test0038() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0038", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// -// VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); -// variableDeclarationFragment.setName(this.ast.newSimpleName("c")); //$NON-NLS-1$ -// TypeLiteral typeLiteral = this.ast.newTypeLiteral(); -// typeLiteral.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); -// variableDeclarationFragment.setInitializer(typeLiteral); -// VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); -// statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newSimpleType(this.ast.newSimpleName("Class")));//$NON-NLS-1$ -// -// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ -// checkSourceRange(((VariableDeclarationFragment)((VariableDeclarationStatement)node).fragments().get(0)).getInitializer(), "int.class", source); //$NON-NLS-1$ -// } -// -// /** -// * void.class; ==> ExpressionStatement(TypeLiteral) -// * @deprecated using deprecated code -// */ -// public void test0039() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0039", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// -// VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); -// variableDeclarationFragment.setName(this.ast.newSimpleName("c")); //$NON-NLS-1$ -// TypeLiteral typeLiteral = this.ast.newTypeLiteral(); -// typeLiteral.setType(this.ast.newPrimitiveType(PrimitiveType.VOID)); -// variableDeclarationFragment.setInitializer(typeLiteral); -// VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); -// statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newSimpleType(this.ast.newSimpleName("Class")));//$NON-NLS-1$ -// -// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ -// checkSourceRange(((VariableDeclarationFragment)((VariableDeclarationStatement)node).fragments().get(0)).getInitializer(), "void.class", source); //$NON-NLS-1$ -// } -// -// /** -// * double.class; ==> ExpressionStatement(TypeLiteral) -// * @deprecated using deprecated code -// */ -// public void test0040() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0040", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// -// VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); -// variableDeclarationFragment.setName(this.ast.newSimpleName("c")); //$NON-NLS-1$ -// TypeLiteral typeLiteral = this.ast.newTypeLiteral(); -// typeLiteral.setType(this.ast.newPrimitiveType(PrimitiveType.DOUBLE)); -// variableDeclarationFragment.setInitializer(typeLiteral); -// VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); -// statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newSimpleType(this.ast.newSimpleName("Class")));//$NON-NLS-1$ -// -// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ -// checkSourceRange(((VariableDeclarationFragment)((VariableDeclarationStatement)node).fragments().get(0)).getInitializer(), "double.class", source); //$NON-NLS-1$ -// } -// -// /** -// * long.class; ==> ExpressionStatement(TypeLiteral) -// * @deprecated using deprecated code -// */ -// public void test0041() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0041", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// -// VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); -// variableDeclarationFragment.setName(this.ast.newSimpleName("c")); //$NON-NLS-1$ -// TypeLiteral typeLiteral = this.ast.newTypeLiteral(); -// typeLiteral.setType(this.ast.newPrimitiveType(PrimitiveType.LONG)); -// variableDeclarationFragment.setInitializer(typeLiteral); -// VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); -// statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newSimpleType(this.ast.newSimpleName("Class")));//$NON-NLS-1$ -// -// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ -// checkSourceRange(((VariableDeclarationFragment)((VariableDeclarationStatement)node).fragments().get(0)).getInitializer(), "long.class", source); //$NON-NLS-1$ -// } - - /** - * false ==> BooleanLiteral - */ - public void test0042() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0042", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - BooleanLiteral literal = this.ast.newBooleanLiteral(false); - assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "false", source); //$NON-NLS-1$ - } - - /** - * true ==> BooleanLiteral - */ - public void test0043() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0043", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - BooleanLiteral literal = this.ast.newBooleanLiteral(true); - assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "true", source); //$NON-NLS-1$ - } - - /** - * null ==> NullLiteral - */ - public void test0044() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0044", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - NullLiteral literal = this.ast.newNullLiteral(); - assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "null", source); //$NON-NLS-1$ - } - - /** - * CharLiteral ==> CharacterLiteral - */ - public void test0045() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0045", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - CharacterLiteral literal = this.ast.newCharacterLiteral(); - literal.setEscapedValue("'c'"); //$NON-NLS-1$ - assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "'c'", source); //$NON-NLS-1$ - } - - /** - * DoubleLiteral ==> NumberLiteral - */ - public void test0046() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0046", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - NumberLiteral literal = this.ast.newNumberLiteral("1.00001");//$NON-NLS-1$ - assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "1.00001", source); //$NON-NLS-1$ - } - - /** - * FloatLiteral ==> NumberLiteral - */ - public void test0047() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0047", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - NumberLiteral literal = this.ast.newNumberLiteral("1.00001f");//$NON-NLS-1$ - assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "1.00001f", source); //$NON-NLS-1$ - } - - /** - * IntLiteral ==> NumberLiteral - */ - public void test0048() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0048", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - NumberLiteral literal = this.ast.newNumberLiteral("30000");//$NON-NLS-1$ - assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "30000", source); //$NON-NLS-1$ - } - - /** - * IntLiteralMinValue ==> NumberLiteral - */ - public void test0049() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0049", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - NumberLiteral literal = this.ast.newNumberLiteral("-2147483648");//$NON-NLS-1$ - assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "-2147483648", source); //$NON-NLS-1$ - } - - /** - * LongLiteral ==> NumberLiteral - */ - public void test0050() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0050", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - NumberLiteral literal = this.ast.newNumberLiteral("2147483648L");//$NON-NLS-1$ - assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "2147483648L", source); //$NON-NLS-1$ - } - - /** - * LongLiteral ==> NumberLiteral (negative value) - */ - public void test0051() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0051", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - NumberLiteral literal = this.ast.newNumberLiteral("2147483648L");//$NON-NLS-1$ - PrefixExpression prefixExpression = this.ast.newPrefixExpression(); - prefixExpression.setOperand(literal); - prefixExpression.setOperator(PrefixExpression.Operator.MINUS); - assertTrue("Both AST trees should be identical", prefixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "-2147483648L", source); //$NON-NLS-1$ - } - - /** - * LongLiteralMinValue ==> NumberLiteral - */ - public void test0052() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0052", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - NumberLiteral literal = this.ast.newNumberLiteral("-9223372036854775808L");//$NON-NLS-1$ - assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "-9223372036854775808L", source); //$NON-NLS-1$ - } - - /** - * ExtendedStringLiteral ==> StringLiteral - */ - public void test0053() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0053", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - /* - StringLiteral literal = this.ast.newStringLiteral();//$NON-NLS-1$ - literal.setLiteralValue("Hello World");*/ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setOperator(InfixExpression.Operator.PLUS); - StringLiteral literal = this.ast.newStringLiteral(); - literal.setLiteralValue("Hello");//$NON-NLS-1$ - infixExpression.setLeftOperand(literal); - literal = this.ast.newStringLiteral(); - literal.setLiteralValue(" World");//$NON-NLS-1$ - infixExpression.setRightOperand(literal);//$NON-NLS-1$ - - assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "\"Hello\" + \" World\"", source); //$NON-NLS-1$ - } - - /** - * AND_AND_Expression ==> InfixExpression - * @deprecated using deprecated code - */ - public void test0054() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0054", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("b3")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$ - infixExpression.setRightOperand(this.ast.newSimpleName("b2")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.CONDITIONAL_AND); - variableDeclarationFragment.setInitializer(infixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "var b3 = b && b2;", source); //$NON-NLS-1$ - } - - /** - * OR_OR_Expression ==> InfixExpression - * @deprecated using deprecated code - */ - public void test0055() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0055", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("b3")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$ - infixExpression.setRightOperand(this.ast.newSimpleName("b2")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.CONDITIONAL_OR); - variableDeclarationFragment.setInitializer(infixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "var b3 = b || b2;", source); //$NON-NLS-1$ - } - - /** - * EqualExpression ==> InfixExpression - * @deprecated using deprecated code - */ - public void test0056() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0056", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("b3")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$ - infixExpression.setRightOperand(this.ast.newSimpleName("b2")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.EQUALS); - variableDeclarationFragment.setInitializer(infixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "var b3 = b == b2;", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression (+) ==> InfixExpression - * @deprecated using deprecated code - */ - public void test0057() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0057", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$ - infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.PLUS); - variableDeclarationFragment.setInitializer(infixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "var n = i + j;", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression (-) ==> InfixExpression - * @deprecated using deprecated code - */ - public void test0058() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0058", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$ - infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.MINUS); - variableDeclarationFragment.setInitializer(infixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "var n = i - j;", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression (*) ==> InfixExpression - * @deprecated using deprecated code - */ - public void test0059() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0059", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$ - infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.TIMES); - variableDeclarationFragment.setInitializer(infixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "var n = i * j;", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression (/) ==> InfixExpression - * @deprecated using deprecated code - */ - public void test0060() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0060", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$ - infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.DIVIDE); - variableDeclarationFragment.setInitializer(infixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "var n = i / j;", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression (%) ==> InfixExpression - * @deprecated using deprecated code - */ - public void test0061() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0061", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$ - infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.REMAINDER); - variableDeclarationFragment.setInitializer(infixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "var n = i % j;", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression (^) ==> InfixExpression - * @deprecated using deprecated code - */ - public void test0062() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0062", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$ - infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.XOR); - variableDeclarationFragment.setInitializer(infixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "var n = i ^ j;", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression (&) ==> InfixExpression - * @deprecated using deprecated code - */ - public void test0063() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0063", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$ - infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.AND); - variableDeclarationFragment.setInitializer(infixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "var n = i & j;", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression (|) ==> InfixExpression - * @deprecated using deprecated code - */ - public void test0064() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0064", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$ - infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.OR); - variableDeclarationFragment.setInitializer(infixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "var n = i | j;", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression (<) ==> InfixExpression - * @deprecated using deprecated code - */ - public void test0065() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0065", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("b2")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$ - infixExpression.setRightOperand(this.ast.newSimpleName("b1")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.LESS); - variableDeclarationFragment.setInitializer(infixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "var b2 = b < b1;", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression (<=) ==> InfixExpression - * @deprecated using deprecated code - */ - public void test0066() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0066", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("b2")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$ - infixExpression.setRightOperand(this.ast.newSimpleName("b1")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.LESS_EQUALS); - variableDeclarationFragment.setInitializer(infixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "var b2 = b <= b1;", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression (>) ==> InfixExpression - * @deprecated using deprecated code - */ - public void test0067() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0067", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("b2")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$ - infixExpression.setRightOperand(this.ast.newSimpleName("b1")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.GREATER); - variableDeclarationFragment.setInitializer(infixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "var b2 = b > b1;", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression (>=) ==> InfixExpression - * @deprecated using deprecated code - */ - public void test0068() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0068", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("b2")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$ - infixExpression.setRightOperand(this.ast.newSimpleName("b1")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.GREATER_EQUALS); - variableDeclarationFragment.setInitializer(infixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "var b2 = b >= b1;", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression (!=) ==> InfixExpression - * @deprecated using deprecated code - */ - public void test0069() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0069", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("b2")); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$ - infixExpression.setRightOperand(this.ast.newSimpleName("b1")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.NOT_EQUALS); - variableDeclarationFragment.setInitializer(infixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "var b2 = b != b1;", source); //$NON-NLS-1$ - } - - /** - * InstanceofExpression ==> InfixExpression - * @deprecated using deprecated code - */ - public void test0070() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0070", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("b")); //$NON-NLS-1$ - InfixExpression instanceOfExpression = this.ast.newInfixExpression(); - instanceOfExpression.setLeftOperand(this.ast.newSimpleName("o"));//$NON-NLS-1$ - instanceOfExpression.setOperator(InfixExpression.Operator.INSTANCEOF); -// SimpleType simpleType = this.ast.newSimpleType(this.ast.newSimpleName("Integer"));//$NON-NLS-1$ - instanceOfExpression.setRightOperand(this.ast.newSimpleName("Number")); - variableDeclarationFragment.setInitializer(instanceOfExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "var b = o instanceof Number;", source); //$NON-NLS-1$ - } - -// /** -// * InstanceofExpression ==> InfixExpression -// * @deprecated using deprecated code -// */ -// public void test0071() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0071", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// -// VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); -// variableDeclarationFragment.setName(this.ast.newSimpleName("b")); //$NON-NLS-1$ -// InstanceofExpression instanceOfExpression = this.ast.newInstanceofExpression(); -// instanceOfExpression.setLeftOperand(this.ast.newSimpleName("o")); //$NON-NLS-1$ -// QualifiedName name = -// this.ast.newQualifiedName( -// this.ast.newQualifiedName( -// this.ast.newSimpleName("java"), //$NON-NLS-1$ -// this.ast.newSimpleName("lang")), //$NON-NLS-1$ -// this.ast.newSimpleName("Integer")); //$NON-NLS-1$ -// Type type = ast.newSimpleType(name); -// instanceOfExpression.setRightOperand(type); -// variableDeclarationFragment.setInitializer(instanceOfExpression); -// VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); -// statement.setModifiers(Modifier.NONE); -//// statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN)); -// -// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ -// checkSourceRange(node, "var b = o instanceof java.lang.Integer;", source); //$NON-NLS-1$ -// } - - /** - * UnaryExpression (!) ==> PrefixExpression - * @deprecated using deprecated code - */ - public void test0072() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0072", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("b1")); //$NON-NLS-1$ - PrefixExpression prefixExpression = this.ast.newPrefixExpression(); - prefixExpression.setOperator(PrefixExpression.Operator.NOT); - prefixExpression.setOperand(this.ast.newSimpleName("b"));//$NON-NLS-1$ - variableDeclarationFragment.setInitializer(prefixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "var b1 = !b;", source); //$NON-NLS-1$ - } - - /** - * UnaryExpression (~) ==> PrefixExpression - * @deprecated using deprecated code - */ - public void test0073() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0073", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$ - PrefixExpression prefixExpression = this.ast.newPrefixExpression(); - prefixExpression.setOperator(PrefixExpression.Operator.COMPLEMENT); - prefixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$ - variableDeclarationFragment.setInitializer(prefixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "var n = ~i;", source); //$NON-NLS-1$ - } - - /** - * UnaryExpression (+) ==> PrefixExpression - * @deprecated using deprecated code - */ - public void test0074() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0074", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$ - PrefixExpression prefixExpression = this.ast.newPrefixExpression(); - prefixExpression.setOperator(PrefixExpression.Operator.PLUS); - prefixExpression.setOperand(this.ast.newNumberLiteral("2"));//$NON-NLS-1$ - variableDeclarationFragment.setInitializer(prefixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "var i = +2;", source); //$NON-NLS-1$ - } - - /** - * UnaryExpression (-) ==> PrefixExpression - * @deprecated using deprecated code - */ - public void test0075() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0075", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$ - PrefixExpression prefixExpression = this.ast.newPrefixExpression(); - prefixExpression.setOperator(PrefixExpression.Operator.MINUS); - prefixExpression.setOperand(this.ast.newNumberLiteral("2"));//$NON-NLS-1$ - variableDeclarationFragment.setInitializer(prefixExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "var i = -2;", source); //$NON-NLS-1$ - } - - /** - * ConditionalExpression ==> ConditionalExpression - * @deprecated using deprecated code - */ - public void test0076() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0076", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("b")); //$NON-NLS-1$ - ConditionalExpression conditionalExpression = this.ast.newConditionalExpression(); - InfixExpression condition = this.ast.newInfixExpression(); - condition.setLeftOperand(this.ast.newSimpleName("args")); //$NON-NLS-1$ - condition.setRightOperand(this.ast.newNullLiteral()); //$NON-NLS-1$ - condition.setOperator(InfixExpression.Operator.NOT_EQUALS); - conditionalExpression.setExpression(condition); - conditionalExpression.setThenExpression(this.ast.newBooleanLiteral(true)); - conditionalExpression.setElseExpression(this.ast.newBooleanLiteral(false)); - variableDeclarationFragment.setInitializer(conditionalExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN)); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "var b = args != null ? true : false;", source); //$NON-NLS-1$ - } - - /** - * ConditionalExpression ==> ConditionalExpression - * @deprecated using deprecated code - */ - public void test0077() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0077", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$ - ConditionalExpression conditionalExpression = this.ast.newConditionalExpression(); - conditionalExpression.setExpression(this.ast.newBooleanLiteral(true)); -// QualifiedName name = -// this.ast.newQualifiedName( -// this.ast.newSimpleName("args"), //$NON-NLS-1$ -// this.ast.newSimpleName("length")); //$NON-NLS-1$ -// conditionalExpression.setThenExpression(name); - FieldAccess fieldAccess=this.ast.newFieldAccess(); - fieldAccess.setExpression(this.ast.newSimpleName("args")); - fieldAccess.setName(this.ast.newSimpleName("length")); - conditionalExpression.setThenExpression(fieldAccess); - conditionalExpression.setElseExpression(this.ast.newNumberLiteral("0"));//$NON-NLS-1$ - variableDeclarationFragment.setInitializer(conditionalExpression); - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); - statement.setModifiers(Modifier.NONE); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "var i = true ? args.length: 0;", source); //$NON-NLS-1$ - } -// -// /** -// * MessageSend ==> SuperMethodInvocation -// */ -// public void test0078() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0078", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// SuperMethodInvocation superMethodInvocation = this.ast.newSuperMethodInvocation(); -// superMethodInvocation.setName(this.ast.newSimpleName("bar")); //$NON-NLS-1$ -// ExpressionStatement statement = this.ast.newExpressionStatement(superMethodInvocation); -// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ -// checkSourceRange(node, "super.bar();", source); //$NON-NLS-1$ -// } -// -// /** -// * MessageSend ==> SuperMethodInvocation -// */ -// public void test0079() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0079", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// SuperMethodInvocation superMethodInvocation = this.ast.newSuperMethodInvocation(); -// superMethodInvocation.setName(this.ast.newSimpleName("bar")); //$NON-NLS-1$ -// superMethodInvocation.arguments().add(this.ast.newNumberLiteral("4"));//$NON-NLS-1$ -// ExpressionStatement statement = this.ast.newExpressionStatement(superMethodInvocation); -// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ -// checkSourceRange(node, "super.bar(4);", source); //$NON-NLS-1$ -// } - - /** - * MessageSend ==> FunctionInvocation - */ - public void test0080() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0080", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - FunctionInvocation methodInvocation = this.ast.newFunctionInvocation(); - methodInvocation.setName(this.ast.newSimpleName("bar")); //$NON-NLS-1$ - methodInvocation.arguments().add(this.ast.newNumberLiteral("4"));//$NON-NLS-1$ - ExpressionStatement statement = this.ast.newExpressionStatement(methodInvocation); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "bar(4);", source); //$NON-NLS-1$ - } - - /** - * MessageSend ==> FunctionInvocation - */ - public void test0081() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0081", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - FunctionInvocation methodInvocation = this.ast.newFunctionInvocation(); - methodInvocation.setName(this.ast.newSimpleName("bar")); //$NON-NLS-1$ - methodInvocation.setExpression(this.ast.newThisExpression()); - methodInvocation.arguments().add(this.ast.newNumberLiteral("4"));//$NON-NLS-1$ - ExpressionStatement statement = this.ast.newExpressionStatement(methodInvocation); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "this.bar(4);", source); //$NON-NLS-1$ - } - - /** - * ForStatement ==> ForStatement - */ - public void test0082() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0082", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - ForStatement forStatement = this.ast.newForStatement(); - forStatement.setBody(this.ast.newEmptyStatement()); - assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "for (;;);", source); //$NON-NLS-1$ - } - - /** - * ForStatement ==> ForStatement - * @deprecated using deprecated code - */ - public void test0083() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0083", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - ForStatement forStatement = this.ast.newForStatement(); - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$ - variableDeclarationFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$ - VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(variableDeclarationFragment); - variableDeclarationExpression.setModifiers(Modifier.NONE); -// variableDeclarationExpression.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - forStatement.initializers().add(variableDeclarationExpression); - PostfixExpression postfixExpression = this.ast.newPostfixExpression(); - postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$ - postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT); - forStatement.updaters().add(postfixExpression); - forStatement.setBody(this.ast.newBlock()); - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.LESS); - infixExpression.setRightOperand(this.ast.newNumberLiteral("10")); //$NON-NLS-1$ - forStatement.setExpression(infixExpression); - assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "for (var i = 0; i < 10; i++) {}", source); //$NON-NLS-1$ - } - - /** - * ForStatement ==> ForStatement - * @deprecated using deprecated code - */ - public void test0084() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0084", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - ForStatement forStatement = this.ast.newForStatement(); - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$ - variableDeclarationFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$ - - VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(variableDeclarationFragment); - variableDeclarationExpression.setModifiers(Modifier.NONE); -// variableDeclarationExpression.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - - forStatement.initializers().add(variableDeclarationExpression); - PostfixExpression postfixExpression = this.ast.newPostfixExpression(); - postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$ - postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT); - forStatement.updaters().add(postfixExpression); - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.LESS); - infixExpression.setRightOperand(this.ast.newNumberLiteral("10")); //$NON-NLS-1$ - forStatement.setExpression(infixExpression); - forStatement.setBody(this.ast.newEmptyStatement()); - assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "for (var i = 0; i < 10; i++);", source); //$NON-NLS-1$ - } - - /** - * ForStatement ==> ForStatement - * @deprecated using deprecated code - */ - public void test0085() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0085", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - ForStatement forStatement = this.ast.newForStatement(); - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$ - variableDeclarationFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$ - - VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(variableDeclarationFragment); - variableDeclarationExpression.setModifiers(Modifier.NONE); -// variableDeclarationExpression.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - - forStatement.initializers().add(variableDeclarationExpression); - PostfixExpression postfixExpression = this.ast.newPostfixExpression(); - postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$ - postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT); - forStatement.updaters().add(postfixExpression); - forStatement.setBody(this.ast.newEmptyStatement()); - assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "for (var i = 0;; i++);", source); //$NON-NLS-1$ - } - - /** - * ForStatement ==> ForStatement - */ - public void test0086() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0086", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - ForStatement forStatement = this.ast.newForStatement(); - PostfixExpression postfixExpression = this.ast.newPostfixExpression(); - postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$ - postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT); - forStatement.updaters().add(postfixExpression); - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.LESS); - infixExpression.setRightOperand(this.ast.newNumberLiteral("10")); //$NON-NLS-1$ - forStatement.setExpression(infixExpression); - forStatement.setBody(this.ast.newEmptyStatement()); - assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "for (; i < 10; i++);", source); //$NON-NLS-1$ - } - - /** - * ForStatement ==> ForStatement - */ - public void test0087() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0087", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - ForStatement forStatement = this.ast.newForStatement(); - PostfixExpression postfixExpression = this.ast.newPostfixExpression(); - postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$ - postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT); - forStatement.updaters().add(postfixExpression); - forStatement.setBody(this.ast.newEmptyStatement()); - assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "for (;;i++);", source); //$NON-NLS-1$ - } - - /** - * LocalDeclaration ==> VariableDeclarationStatement - * @deprecated using deprecated code - */ - public void test0088() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0088", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$ - - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - statement.setModifiers(Modifier.NONE); - - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "var i;", source); //$NON-NLS-1$ - } - -// /** -// * LocalDeclaration ==> VariableDeclarationStatement -// * @deprecated using deprecated code -// */ -// public void test0089() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0089", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// -// VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); -// variableDeclarationFragment.setName(this.ast.newSimpleName("s")); //$NON-NLS-1$ -// -// VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); -// QualifiedName name = -// this.ast.newQualifiedName( -// this.ast.newQualifiedName( -// this.ast.newSimpleName("java"),//$NON-NLS-1$ -// this.ast.newSimpleName("lang")//$NON-NLS-1$ -// ), -// this.ast.newSimpleName("String") //$NON-NLS-1$ -// ); -// statement.setType(this.ast.newSimpleType(name)); -// statement.setModifiers(Modifier.NONE); -// -// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ -// checkSourceRange(node, "java.lang.String s;", source); //$NON-NLS-1$ -// } - - /** - * LocalDeclaration ==> VariableDeclarationStatement - * @deprecated using deprecated code - */ - public void test0090() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0090", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - ArrayInitializer initializer = this.ast.newArrayInitializer(); - initializer.expressions().add(this.ast.newNumberLiteral("1"));//$NON-NLS-1$ - initializer.expressions().add(this.ast.newNumberLiteral("2"));//$NON-NLS-1$ - variableDeclarationFragment.setInitializer(initializer); - variableDeclarationFragment.setName(this.ast.newSimpleName("tab")); //$NON-NLS-1$ - - VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment); -// statement.setType(this.ast.newArrayType(this.ast.newPrimitiveType(PrimitiveType.INT), 1)); - statement.setModifiers(Modifier.NONE); - assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "var tab = [1, 2];", source); //$NON-NLS-1$ - } - - /** - * Argument ==> SingleVariableDeclaration - * @deprecated using deprecated code - */ - public void test0091() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0091", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - FunctionDeclaration method = (FunctionDeclaration) ((JavaScriptUnit) result).statements().get(0); - SingleVariableDeclaration node = (SingleVariableDeclaration) method.parameters().get(0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - SingleVariableDeclaration variableDeclaration = this.ast.newSingleVariableDeclaration(); - variableDeclaration.setModifiers(Modifier.NONE); -// variableDeclaration.setType(this.ast.newSimpleType(this.ast.newSimpleName("String")));//$NON-NLS-1$ - variableDeclaration.setName(this.ast.newSimpleName("s")); //$NON-NLS-1$ - assertTrue("Both AST trees should be identical", variableDeclaration.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "s", source); //$NON-NLS-1$ - } - - /** - * Argument ==> SingleVariableDeclaration - * @deprecated using deprecated code - */ -// public void test0092() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0092", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// FunctionDeclaration method = (FunctionDeclaration)((TypeDeclaration) ((JavaScriptUnit) result).types().get(0)).bodyDeclarations().get(0); -// SingleVariableDeclaration node = (SingleVariableDeclaration) method.parameters().get(0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// SingleVariableDeclaration variableDeclaration = this.ast.newSingleVariableDeclaration(); -// variableDeclaration.setModifiers(Modifier.FINAL); -// variableDeclaration.setType(this.ast.newSimpleType(this.ast.newSimpleName("String")));//$NON-NLS-1$ -// variableDeclaration.setName(this.ast.newSimpleName("s")); //$NON-NLS-1$ -// assertTrue("Both AST trees should be identical", variableDeclaration.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ -// checkSourceRange(node, "final String s", source); //$NON-NLS-1$ -// assertEquals("Wrong dimension", 0, node.getExtraDimensions()); //$NON-NLS-1$ -// } - - /** - * Break ==> BreakStatement - */ - public void test0093() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0093", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - ForStatement forStatement = (ForStatement) node; - BreakStatement statement = (BreakStatement) ((Block) forStatement.getBody()).statements().get(0); - assertNotNull("Expression should not be null", statement); //$NON-NLS-1$ - BreakStatement breakStatement = this.ast.newBreakStatement(); - assertTrue("Both AST trees should be identical", breakStatement.subtreeMatch(new ASTMatcher(), statement)); //$NON-NLS-1$ - checkSourceRange(statement, "break;", source); //$NON-NLS-1$ - } - - /** - * Continue ==> ContinueStatement - */ - public void test0094() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0094", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - ForStatement forStatement = (ForStatement) node; - ContinueStatement statement = (ContinueStatement) ((Block) forStatement.getBody()).statements().get(0); - assertNotNull("Expression should not be null", statement); //$NON-NLS-1$ - ContinueStatement continueStatement = this.ast.newContinueStatement(); - assertTrue("Both AST trees should be identical", continueStatement.subtreeMatch(new ASTMatcher(), statement)); //$NON-NLS-1$ - checkSourceRange(statement, "continue;", source); //$NON-NLS-1$ - } - - /** - * Continue with Label ==> ContinueStatement - */ - public void test0095() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0095", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - LabeledStatement labeledStatement = (LabeledStatement) getASTNode((JavaScriptUnit) result, 0, 0, 0); - ForStatement forStatement = (ForStatement) labeledStatement.getBody(); - ContinueStatement statement = (ContinueStatement) ((Block) forStatement.getBody()).statements().get(0); - assertNotNull("Expression should not be null", statement); //$NON-NLS-1$ - ContinueStatement continueStatement = this.ast.newContinueStatement(); - continueStatement.setLabel(this.ast.newSimpleName("label")); //$NON-NLS-1$ - assertTrue("Both AST trees should be identical", continueStatement.subtreeMatch(new ASTMatcher(), statement)); //$NON-NLS-1$ - checkSourceRange(statement, "continue label;", source); //$NON-NLS-1$ - } - - /** - * Break + label ==> BreakStatement - */ - public void test0096() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0096", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - LabeledStatement labeledStatement = (LabeledStatement) getASTNode((JavaScriptUnit) result, 0, 0, 0); - ForStatement forStatement = (ForStatement) labeledStatement.getBody(); - BreakStatement statement = (BreakStatement) ((Block) forStatement.getBody()).statements().get(0); - assertNotNull("Expression should not be null", statement); //$NON-NLS-1$ - BreakStatement breakStatement = this.ast.newBreakStatement(); - breakStatement.setLabel(this.ast.newSimpleName("label")); //$NON-NLS-1$ - assertTrue("Both AST trees should be identical", breakStatement.subtreeMatch(new ASTMatcher(), statement)); //$NON-NLS-1$ - checkSourceRange(statement, "break label;", source); //$NON-NLS-1$ - } - - /** - * SwitchStatement ==> SwitchStatement - */ - public void test0097() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0097", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - SwitchStatement switchStatement = this.ast.newSwitchStatement(); - switchStatement.setExpression(this.ast.newSimpleName("i"));//$NON-NLS-1$ - SwitchCase _case = this.ast.newSwitchCase(); - _case.setExpression(this.ast.newNumberLiteral("1"));//$NON-NLS-1$ - switchStatement.statements().add(_case); - switchStatement.statements().add(this.ast.newBreakStatement()); - _case = this.ast.newSwitchCase(); - _case.setExpression(this.ast.newNumberLiteral("2"));//$NON-NLS-1$ - switchStatement.statements().add(_case); - FunctionInvocation methodInvocation = this.ast.newFunctionInvocation(); -// QualifiedName name = -// this.ast.newQualifiedName( -// this.ast.newSimpleName("System"),//$NON-NLS-1$ -// this.ast.newSimpleName("out"));//$NON-NLS-1$ -// methodInvocation.setExpression(name); - FieldAccess fieldAccess = this.ast.newFieldAccess(); - fieldAccess.setExpression(this.ast.newSimpleName("System")); - fieldAccess.setName(this.ast.newSimpleName("out")); - methodInvocation.setExpression(fieldAccess); - methodInvocation.setName(this.ast.newSimpleName("println")); //$NON-NLS-1$ - methodInvocation.arguments().add(this.ast.newNumberLiteral("2"));//$NON-NLS-1$ - ExpressionStatement expressionStatement = this.ast.newExpressionStatement(methodInvocation); - switchStatement.statements().add(expressionStatement); - switchStatement.statements().add(this.ast.newBreakStatement()); - _case = this.ast.newSwitchCase(); - _case.setExpression(null); - switchStatement.statements().add(_case); - methodInvocation = this.ast.newFunctionInvocation(); -// name = -// this.ast.newQualifiedName( -// this.ast.newSimpleName("System"),//$NON-NLS-1$ -// this.ast.newSimpleName("out"));//$NON-NLS-1$ -// methodInvocation.setExpression(name); - fieldAccess = this.ast.newFieldAccess(); - fieldAccess.setExpression(this.ast.newSimpleName("System")); - fieldAccess.setName(this.ast.newSimpleName("out")); - methodInvocation.setExpression(fieldAccess); - methodInvocation.setName(this.ast.newSimpleName("println")); //$NON-NLS-1$ - StringLiteral literal = this.ast.newStringLiteral(); - literal.setLiteralValue("default"); //$NON-NLS-1$ - methodInvocation.arguments().add(literal); - expressionStatement = this.ast.newExpressionStatement(methodInvocation); - switchStatement.statements().add(expressionStatement); - assertTrue("Both AST trees should be identical", switchStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - String expectedSource = "switch(i) {\n" +//$NON-NLS-1$ - " case 1: \n" +//$NON-NLS-1$ - " break;\n" +//$NON-NLS-1$ - " case 2:\n" +//$NON-NLS-1$ - " System.out.println(2);\n" +//$NON-NLS-1$ - " break;\n" +//$NON-NLS-1$ - " default:\n" +//$NON-NLS-1$ - " System.out.println(\"default\");\n" +//$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(node, expectedSource, source); - SwitchStatement switchStatement2 = (SwitchStatement) node; - List statements = switchStatement2.statements(); - assertEquals("wrong size", 7, statements.size()); //$NON-NLS-1$ - Statement stmt = (Statement) statements.get(5); - assertTrue("Not a case statement", stmt instanceof SwitchCase); //$NON-NLS-1$ - SwitchCase switchCase = (SwitchCase) stmt; - assertTrue("Not the default case", switchCase.isDefault()); //$NON-NLS-1$ - } - - /** - * EmptyStatement ==> EmptyStatement - */ - public void test0098() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0098", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - EmptyStatement emptyStatement = this.ast.newEmptyStatement(); - assertTrue("Both AST trees should be identical", emptyStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, ";", source); //$NON-NLS-1$ - } - - /** - * DoStatement ==> DoStatement - */ - public void test0099() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0099", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - DoStatement doStatement = this.ast.newDoStatement(); - Block block = this.ast.newBlock(); - block.statements().add(this.ast.newEmptyStatement()); - doStatement.setBody(block); - doStatement.setExpression(this.ast.newBooleanLiteral(true)); - assertTrue("Both AST trees should be identical", doStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - String expectedSource = "do {;\n" +//$NON-NLS-1$ - " } while(true);";//$NON-NLS-1$ - checkSourceRange(node, expectedSource, source); - } - - /** - * WhileStatement ==> WhileStatement - */ - public void test0100() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0100", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - WhileStatement whileStatement = this.ast.newWhileStatement(); - whileStatement.setExpression(this.ast.newBooleanLiteral(true)); - whileStatement.setBody(this.ast.newEmptyStatement()); - assertTrue("Both AST trees should be identical", whileStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "while(true);", source);//$NON-NLS-1$ - } - - /** - * WhileStatement ==> WhileStatement - */ - public void test0101() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0101", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - WhileStatement whileStatement = this.ast.newWhileStatement(); - whileStatement.setExpression(this.ast.newBooleanLiteral(true)); - whileStatement.setBody(this.ast.newBlock()); - assertTrue("Both AST trees should be identical", whileStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "while(true) {}", source);//$NON-NLS-1$ - } - - /** - * ExtendedStringLiteral ==> StringLiteral - */ - public void test0102() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0102", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setOperator(InfixExpression.Operator.PLUS); - StringLiteral literal = this.ast.newStringLiteral();//$NON-NLS-1$ - literal.setLiteralValue("Hello"); //$NON-NLS-1$ - infixExpression.setLeftOperand(literal); - literal = this.ast.newStringLiteral();//$NON-NLS-1$ - literal.setLiteralValue(" World"); //$NON-NLS-1$ - infixExpression.setRightOperand(literal); - literal = this.ast.newStringLiteral();//$NON-NLS-1$ - literal.setLiteralValue("!"); //$NON-NLS-1$ - infixExpression.extendedOperands().add(literal); - assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "\"Hello\" + \" World\" + \"!\"", source);//$NON-NLS-1$ - } - - /** - * ExtendedStringLiteral ==> StringLiteral - */ - public void test0103() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0103", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setOperator(InfixExpression.Operator.PLUS); - StringLiteral literal = this.ast.newStringLiteral();//$NON-NLS-1$ - literal.setLiteralValue("Hello"); //$NON-NLS-1$ - infixExpression.setLeftOperand(literal); - literal = this.ast.newStringLiteral();//$NON-NLS-1$ - literal.setLiteralValue(" World"); //$NON-NLS-1$ - infixExpression.setRightOperand(literal); - literal = this.ast.newStringLiteral();//$NON-NLS-1$ - literal.setLiteralValue("!"); //$NON-NLS-1$ - infixExpression.extendedOperands().add(literal); - literal = this.ast.newStringLiteral();//$NON-NLS-1$ - literal.setLiteralValue("!"); //$NON-NLS-1$ - infixExpression.extendedOperands().add(literal); - assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "\"Hello\" + \" World\" + \"!\" + \"!\"", source);//$NON-NLS-1$ - } - - /** - * ExtendedStringLiteral ==> StringLiteral - */ - public void test0104() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0104", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setOperator(InfixExpression.Operator.PLUS); - StringLiteral literal = this.ast.newStringLiteral();//$NON-NLS-1$ - literal.setLiteralValue("Hello"); //$NON-NLS-1$ - infixExpression.setLeftOperand(literal); - literal = this.ast.newStringLiteral();//$NON-NLS-1$ - literal.setLiteralValue(" World"); //$NON-NLS-1$ - infixExpression.setRightOperand(literal); - literal = this.ast.newStringLiteral();//$NON-NLS-1$ - literal.setLiteralValue("!"); //$NON-NLS-1$ - infixExpression.extendedOperands().add(literal); - NumberLiteral numberLiteral = this.ast.newNumberLiteral();//$NON-NLS-1$ - numberLiteral.setToken("4"); //$NON-NLS-1$ - infixExpression.extendedOperands().add(numberLiteral); - assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "\"Hello\" + \" World\" + \"!\" + 4", source);//$NON-NLS-1$ - } - - /** - * NumberLiteral ==> InfixExpression - */ - public void test0105() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0105", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setOperator(InfixExpression.Operator.PLUS); - NumberLiteral literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("4"); //$NON-NLS-1$ - infixExpression.setLeftOperand(literal); - literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("5"); //$NON-NLS-1$ - infixExpression.setRightOperand(literal); - literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("6"); //$NON-NLS-1$ - infixExpression.extendedOperands().add(literal); - literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("4"); //$NON-NLS-1$ - infixExpression.extendedOperands().add(literal); - assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "4 + 5 + 6 + 4", source);//$NON-NLS-1$ - } - - /** - * NumberLiteral ==> InfixExpression - */ - public void test0106() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0106", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setOperator(InfixExpression.Operator.MINUS); - NumberLiteral literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("4"); //$NON-NLS-1$ - infixExpression.setLeftOperand(literal); - literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("5"); //$NON-NLS-1$ - infixExpression.setRightOperand(literal); - - InfixExpression infixExpression2 = this.ast.newInfixExpression(); - infixExpression2.setOperator(InfixExpression.Operator.PLUS); - infixExpression2.setLeftOperand(infixExpression); - literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("6"); //$NON-NLS-1$ - infixExpression2.setRightOperand(literal); - - InfixExpression infixExpression3 = this.ast.newInfixExpression(); - infixExpression3.setOperator(InfixExpression.Operator.PLUS); - infixExpression3.setLeftOperand(infixExpression2); - literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("4"); //$NON-NLS-1$ - infixExpression3.setRightOperand(literal); - - assertTrue("Both AST trees should be identical", infixExpression3.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "4 - 5 + 6 + 4", source);//$NON-NLS-1$ - } - - /** - * NumberLiteral ==> InfixExpression - */ - public void test0107() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0107", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setOperator(InfixExpression.Operator.MINUS); - NumberLiteral literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("4"); //$NON-NLS-1$ - infixExpression.setLeftOperand(literal); - literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("5"); //$NON-NLS-1$ - infixExpression.setRightOperand(literal); - literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("6"); //$NON-NLS-1$ - infixExpression.extendedOperands().add(literal); - literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("4"); //$NON-NLS-1$ - infixExpression.extendedOperands().add(literal); - assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "4 - 5 - 6 - 4", source);//$NON-NLS-1$ - } - - /** - * NumberLiteral ==> InfixExpression - */ - public void test0108() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0108", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setOperator(InfixExpression.Operator.PLUS); - StringLiteral stringLiteral = this.ast.newStringLiteral();//$NON-NLS-1$ - stringLiteral.setLiteralValue("4"); //$NON-NLS-1$ - infixExpression.setLeftOperand(stringLiteral); - NumberLiteral literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("5"); //$NON-NLS-1$ - infixExpression.setRightOperand(literal); - literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("6"); //$NON-NLS-1$ - infixExpression.extendedOperands().add(literal); - literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("4"); //$NON-NLS-1$ - infixExpression.extendedOperands().add(literal); - assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "\"4\" + 5 + 6 + 4", source);//$NON-NLS-1$ - } - - /** - * NumberLiteral ==> InfixExpression - */ - public void test0109() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0109", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); - assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setOperator(InfixExpression.Operator.MINUS); - StringLiteral stringLiteral = this.ast.newStringLiteral();//$NON-NLS-1$ - stringLiteral.setLiteralValue("4"); //$NON-NLS-1$ - infixExpression.setLeftOperand(stringLiteral); - NumberLiteral literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("5"); //$NON-NLS-1$ - infixExpression.setRightOperand(literal); - - InfixExpression infixExpression2 = this.ast.newInfixExpression(); - infixExpression2.setOperator(InfixExpression.Operator.PLUS); - infixExpression2.setLeftOperand(infixExpression); - literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("6"); //$NON-NLS-1$ - infixExpression2.setRightOperand(literal); - - InfixExpression infixExpression3 = this.ast.newInfixExpression(); - infixExpression3.setOperator(InfixExpression.Operator.PLUS); - infixExpression3.setLeftOperand(infixExpression2); - literal = this.ast.newNumberLiteral();//$NON-NLS-1$ - literal.setToken("4"); //$NON-NLS-1$ - infixExpression3.setRightOperand(literal); - - assertTrue("Both AST trees should be identical", infixExpression3.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$ - checkSourceRange(expression, "\"4\" - 5 + 6 + 4", source);//$NON-NLS-1$ - } - - /** - * ReturnStatement ==> ReturnStatement - */ - public void test0110() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0110", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - ReturnStatement returnStatement = this.ast.newReturnStatement(); - NumberLiteral literal = this.ast.newNumberLiteral(); - literal.setToken("2");//$NON-NLS-1$ - returnStatement.setExpression(literal); - assertTrue("Both AST trees should be identical", returnStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "return 2;", source);//$NON-NLS-1$ - } - - /** - * ReturnStatement ==> ReturnStatement - */ - public void test0111() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0111", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - ReturnStatement returnStatement = this.ast.newReturnStatement(); - NumberLiteral literal = this.ast.newNumberLiteral(); - literal.setToken("2");//$NON-NLS-1$ - returnStatement.setExpression(literal); - assertTrue("Both AST trees should be identical", returnStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "return 2\\u003B", source);//$NON-NLS-1$ - } - -// /** -// * SynchronizedStatement ==> SynchronizedStatement -// */ -// public void test0112() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0112", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// SynchronizedStatement synchronizedStatement = this.ast.newSynchronizedStatement(); -// synchronizedStatement.setExpression(this.ast.newThisExpression()); -// synchronizedStatement.setBody(this.ast.newBlock()); -// assertTrue("Both AST trees should be identical", synchronizedStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ -// String expectedSource = "synchronized(this) {\n" +//$NON-NLS-1$ -// " }"; //$NON-NLS-1$ -// checkSourceRange(node, expectedSource, source); -// } - - /** - * TryStatement ==> TryStatement - * @deprecated using deprecated code - */ - public void test0113() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0113", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - TryStatement tryStatement = this.ast.newTryStatement(); - tryStatement.setBody(this.ast.newBlock()); - tryStatement.setFinally(this.ast.newBlock()); - CatchClause catchBlock = this.ast.newCatchClause(); - catchBlock.setBody(this.ast.newBlock()); - SingleVariableDeclaration exceptionVariable = this.ast.newSingleVariableDeclaration(); - exceptionVariable.setModifiers(Modifier.NONE); - exceptionVariable.setName(this.ast.newSimpleName("e"));//$NON-NLS-1$ -// exceptionVariable.setType(this.ast.newSimpleType(this.ast.newSimpleName("Exception")));//$NON-NLS-1$ - catchBlock.setException(exceptionVariable); - tryStatement.catchClauses().add(catchBlock); - assertTrue("Both AST trees should be identical", tryStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - String expectedSource = "try {\n" +//$NON-NLS-1$ - " } catch( e) {\n" +//$NON-NLS-1$ - " } finally {\n" +//$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(node, expectedSource, source); - } - - /** - * TryStatement ==> TryStatement - * @deprecated using deprecated code - */ - public void test0114() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0114", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - TryStatement tryStatement = this.ast.newTryStatement(); - tryStatement.setBody(this.ast.newBlock()); - CatchClause catchBlock = this.ast.newCatchClause(); - catchBlock.setBody(this.ast.newBlock()); - SingleVariableDeclaration exceptionVariable = this.ast.newSingleVariableDeclaration(); - exceptionVariable.setModifiers(Modifier.NONE); - exceptionVariable.setName(this.ast.newSimpleName("e"));//$NON-NLS-1$ -// exceptionVariable.setType(this.ast.newSimpleType(this.ast.newSimpleName("Exception")));//$NON-NLS-1$ - catchBlock.setException(exceptionVariable); - tryStatement.catchClauses().add(catchBlock); - assertTrue("Both AST trees should be identical", tryStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - String expectedSource = "try {\n" +//$NON-NLS-1$ - " } catch(e) {\n" +//$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(node, expectedSource, source); - } - - /** - * TryStatement ==> TryStatement - * @deprecated using deprecated code - */ - public void test0115() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0115", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - TryStatement tryStatement = this.ast.newTryStatement(); - Block block = this.ast.newBlock(); - ReturnStatement returnStatement = this.ast.newReturnStatement(); - NumberLiteral literal = this.ast.newNumberLiteral(); - literal.setToken("2");//$NON-NLS-1$ - returnStatement.setExpression(literal); - block.statements().add(returnStatement); - tryStatement.setBody(block); - CatchClause catchBlock = this.ast.newCatchClause(); - catchBlock.setBody(this.ast.newBlock()); - SingleVariableDeclaration exceptionVariable = this.ast.newSingleVariableDeclaration(); - exceptionVariable.setModifiers(Modifier.NONE); - exceptionVariable.setName(this.ast.newSimpleName("e"));//$NON-NLS-1$ -// exceptionVariable.setType(this.ast.newSimpleType(this.ast.newSimpleName("Exception")));//$NON-NLS-1$ - catchBlock.setException(exceptionVariable); - tryStatement.catchClauses().add(catchBlock); - assertTrue("Both AST trees should be identical", tryStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - String expectedSource = "try {\n" +//$NON-NLS-1$ - " return 2;\n" +//$NON-NLS-1$ - " } catch(e) {\n" +//$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(node, expectedSource, source); - } - - /** - * ThrowStatement ==> ThrowStatement - */ - public void test0116() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0116", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - ThrowStatement throwStatement = this.ast.newThrowStatement(); - throwStatement.setExpression(this.ast.newSimpleName("e")); //$NON-NLS-1$ - assertTrue("Both AST trees should be identical", throwStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "throw e \\u003B", source);//$NON-NLS-1$ - } - - /** - * ThrowStatement ==> ThrowStatement - */ - public void test0117() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0117", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - ThrowStatement throwStatement = this.ast.newThrowStatement(); - throwStatement.setExpression(this.ast.newSimpleName("e")); //$NON-NLS-1$ - assertTrue("Both AST trees should be identical", throwStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "throw e /* comment in the middle of a throw */ \\u003B", source);//$NON-NLS-1$ - } - - /** - * ThrowStatement ==> ThrowStatement - */ - public void test0118() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0118", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - ThrowStatement throwStatement = this.ast.newThrowStatement(); - throwStatement.setExpression(this.ast.newSimpleName("e")); //$NON-NLS-1$ - assertTrue("Both AST trees should be identical", throwStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "throw e /* comment in the middle of a throw */ \\u003B", source);//$NON-NLS-1$ - } - - /** - * IfStatement ==> IfStatement - */ - public void test0119() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0119", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - IfStatement ifStatement = this.ast.newIfStatement(); - ifStatement.setExpression(this.ast.newBooleanLiteral(true)); - ifStatement.setThenStatement(this.ast.newEmptyStatement()); - assertTrue("Both AST trees should be identical", ifStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "if (true)\\u003B", source);//$NON-NLS-1$ - } - - /** - * IfStatement ==> IfStatement - */ - public void test0120() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0120", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - IfStatement ifStatement = this.ast.newIfStatement(); - ifStatement.setExpression(this.ast.newBooleanLiteral(true)); - ifStatement.setThenStatement(this.ast.newEmptyStatement()); - ifStatement.setElseStatement(this.ast.newEmptyStatement()); - assertTrue("Both AST trees should be identical", ifStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - String expectedSource = "if (true)\\u003B\n" +//$NON-NLS-1$ - "\t\telse ;"; //$NON-NLS-1$ - checkSourceRange(node, expectedSource, source); - } - - /** - * IfStatement ==> IfStatement - */ - public void test0121() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0121", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - IfStatement ifStatement = this.ast.newIfStatement(); - ifStatement.setExpression(this.ast.newBooleanLiteral(true)); - ifStatement.setThenStatement(this.ast.newBlock()); - ifStatement.setElseStatement(this.ast.newEmptyStatement()); - assertTrue("Both AST trees should be identical", ifStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - String expectedSource = "if (true) {}\n" +//$NON-NLS-1$ - " else ;"; //$NON-NLS-1$ - checkSourceRange(node, expectedSource, source); - } - - /** - * IfStatement ==> IfStatement - */ - public void test0122() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0122", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - IfStatement ifStatement = this.ast.newIfStatement(); - ifStatement.setExpression(this.ast.newBooleanLiteral(true)); - ReturnStatement returnStatement = this.ast.newReturnStatement(); - NumberLiteral literal = this.ast.newNumberLiteral(); - literal.setToken("2");//$NON-NLS-1$ - returnStatement.setExpression(literal); - ifStatement.setThenStatement(returnStatement); - assertTrue("Both AST trees should be identical", ifStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "if (true) return 2\\u003B", source);//$NON-NLS-1$ - } - - /** - * IfStatement ==> IfStatement - */ - public void test0123() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0123", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - IfStatement ifStatement = this.ast.newIfStatement(); - ifStatement.setExpression(this.ast.newBooleanLiteral(true)); - ReturnStatement returnStatement = this.ast.newReturnStatement(); - NumberLiteral literal = this.ast.newNumberLiteral(); - literal.setToken("2");//$NON-NLS-1$ - returnStatement.setExpression(literal); - ifStatement.setThenStatement(returnStatement); - returnStatement = this.ast.newReturnStatement(); - literal = this.ast.newNumberLiteral(); - literal.setToken("3");//$NON-NLS-1$ - returnStatement.setExpression(literal); - ifStatement.setElseStatement(returnStatement); - assertTrue("Both AST trees should be identical", ifStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - String expectedSource = "if (true) return 2;\n" +//$NON-NLS-1$ - " else return 3;"; //$NON-NLS-1$ - checkSourceRange(node, expectedSource, source); - } - - /** - * Multiple local declaration => VariabledeclarationStatement - * @deprecated using deprecated code - */ -// public void test0124() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0124", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// VariableDeclarationFragment fragment = this.ast.newVariableDeclarationFragment(); -// fragment.setName(this.ast.newSimpleName("x"));//$NON-NLS-1$ -// NumberLiteral literal = this.ast.newNumberLiteral(); -// literal.setToken("10");//$NON-NLS-1$ -// fragment.setInitializer(literal); -// fragment.setExtraDimensions(0); -// VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(fragment); -// fragment = this.ast.newVariableDeclarationFragment(); -// fragment.setName(this.ast.newSimpleName("z"));//$NON-NLS-1$ -// fragment.setInitializer(this.ast.newNullLiteral()); -// fragment.setExtraDimensions(1); -// statement.fragments().add(fragment); -// fragment = this.ast.newVariableDeclarationFragment(); -// fragment.setName(this.ast.newSimpleName("i"));//$NON-NLS-1$ -// fragment.setExtraDimensions(0); -// statement.fragments().add(fragment); -// fragment = this.ast.newVariableDeclarationFragment(); -// fragment.setName(this.ast.newSimpleName("j"));//$NON-NLS-1$ -// fragment.setExtraDimensions(2); -// statement.fragments().add(fragment); -// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); -// statement.setModifiers(Modifier.NONE); -// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ -// VariableDeclarationFragment[] fragments = (VariableDeclarationFragment[])((VariableDeclarationStatement) node).fragments().toArray(new VariableDeclarationFragment[4]); -// assertTrue("fragments.length != 4", fragments.length == 4); //$NON-NLS-1$ -// checkSourceRange(fragments[0], "x= 10", source);//$NON-NLS-1$ -// checkSourceRange(fragments[1], "z[] = null", source);//$NON-NLS-1$ -// checkSourceRange(fragments[2], "i", source);//$NON-NLS-1$ -// checkSourceRange(fragments[3], "j[][]", source);//$NON-NLS-1$ -// checkSourceRange(node, "int x= 10, z[] = null, i, j[][];", source);//$NON-NLS-1$ -// } -// -// /** -// * Multiple local declaration => VariabledeclarationStatement -// * @deprecated using deprecated code -// */ -// public void test0125() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0125", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// VariableDeclarationFragment fragment = this.ast.newVariableDeclarationFragment(); -// fragment.setName(this.ast.newSimpleName("x"));//$NON-NLS-1$ -// NumberLiteral literal = this.ast.newNumberLiteral(); -// literal.setToken("10");//$NON-NLS-1$ -// fragment.setInitializer(literal); -// fragment.setExtraDimensions(0); -// VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(fragment); -// fragment = this.ast.newVariableDeclarationFragment(); -// fragment.setName(this.ast.newSimpleName("z"));//$NON-NLS-1$ -// fragment.setInitializer(this.ast.newNullLiteral()); -// fragment.setExtraDimensions(1); -// statement.fragments().add(fragment); -// fragment = this.ast.newVariableDeclarationFragment(); -// fragment.setName(this.ast.newSimpleName("i"));//$NON-NLS-1$ -// fragment.setExtraDimensions(0); -// statement.fragments().add(fragment); -// fragment = this.ast.newVariableDeclarationFragment(); -// fragment.setName(this.ast.newSimpleName("j"));//$NON-NLS-1$ -// fragment.setExtraDimensions(2); -// statement.fragments().add(fragment); -// statement.setType(this.ast.newArrayType(this.ast.newPrimitiveType(PrimitiveType.INT), 1)); -// statement.setModifiers(Modifier.NONE); -// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ -// checkSourceRange(node, "int[] x= 10, z[] = null, i, j[][];", source); //$NON-NLS-1$ -// VariableDeclarationFragment[] fragments = (VariableDeclarationFragment[])((VariableDeclarationStatement) node).fragments().toArray(new VariableDeclarationFragment[4]); -// assertTrue("fragments.length != 4", fragments.length == 4); //$NON-NLS-1$ -// checkSourceRange(fragments[0], "x= 10", source);//$NON-NLS-1$ -// checkSourceRange(fragments[1], "z[] = null", source);//$NON-NLS-1$ -// checkSourceRange(fragments[2], "i", source);//$NON-NLS-1$ -// checkSourceRange(fragments[3], "j[][]", source);//$NON-NLS-1$ -// } -// -// /** -// * ForStatement -// * @deprecated using deprecated code -// */ -// public void test0126() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0126", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// ForStatement forStatement = this.ast.newForStatement(); -// VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); -// variableDeclarationFragment.setName(this.ast.newSimpleName("tab")); //$NON-NLS-1$ -// variableDeclarationFragment.setInitializer(this.ast.newNullLiteral());//$NON-NLS-1$ -// variableDeclarationFragment.setExtraDimensions(1); -// VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(variableDeclarationFragment); -// variableDeclarationExpression.setModifiers(Modifier.NONE); -// variableDeclarationExpression.setType(this.ast.newArrayType(this.ast.newSimpleType(this.ast.newSimpleName("String")), 1));//$NON-NLS-1$ -// forStatement.initializers().add(variableDeclarationExpression); -// PrefixExpression prefixExpression = this.ast.newPrefixExpression(); -// prefixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$ -// prefixExpression.setOperator(PrefixExpression.Operator.INCREMENT); -// forStatement.updaters().add(prefixExpression); -// forStatement.setBody(this.ast.newBlock()); -// assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ -// checkSourceRange(node, "for (String[] tab[] = null;; ++i) {}", source); //$NON-NLS-1$ -// checkSourceRange((ASTNode) ((ForStatement) node).updaters().get(0), "++i", source); //$NON-NLS-1$ -// checkSourceRange((ASTNode) ((ForStatement) node).initializers().get(0), "String[] tab[] = null", source); //$NON-NLS-1$ -// } -// -// /** -// * ForStatement -// * @deprecated using deprecated code -// */ -// public void test0127() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0127", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// ForStatement forStatement = this.ast.newForStatement(); -// VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); -// variableDeclarationFragment.setName(this.ast.newSimpleName("tab")); //$NON-NLS-1$ -// variableDeclarationFragment.setInitializer(this.ast.newNullLiteral());//$NON-NLS-1$ -// variableDeclarationFragment.setExtraDimensions(1); -// VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(variableDeclarationFragment); -// variableDeclarationExpression.setModifiers(Modifier.NONE); -// variableDeclarationExpression.setType(this.ast.newSimpleType(this.ast.newSimpleName("String")));//$NON-NLS-1$ -// forStatement.initializers().add(variableDeclarationExpression); -// PrefixExpression prefixExpression = this.ast.newPrefixExpression(); -// prefixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$ -// prefixExpression.setOperator(PrefixExpression.Operator.INCREMENT); -// forStatement.updaters().add(prefixExpression); -// forStatement.setBody(this.ast.newBlock()); -// assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ -// checkSourceRange(node, "for (String tab[] = null;; ++i) {}", source); //$NON-NLS-1$ -// checkSourceRange((ASTNode) ((ForStatement) node).updaters().get(0), "++i", source); //$NON-NLS-1$ -// checkSourceRange((ASTNode) ((ForStatement) node).initializers().get(0), "String tab[] = null", source); //$NON-NLS-1$ -// } -// - /** - * ForStatement - * @deprecated using deprecated code - */ - public void test0128() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0128", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - ForStatement forStatement = this.ast.newForStatement(); - VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment(); - variableDeclarationFragment.setName(this.ast.newSimpleName("tab")); //$NON-NLS-1$ - variableDeclarationFragment.setInitializer(this.ast.newNullLiteral());//$NON-NLS-1$ -// variableDeclarationFragment.setExtraDimensions(1); - VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(variableDeclarationFragment); - variableDeclarationExpression.setModifiers(Modifier.NONE); -// variableDeclarationExpression.setType(this.ast.newSimpleType(this.ast.newSimpleName("String")));//$NON-NLS-1$ - forStatement.initializers().add(variableDeclarationExpression); - PostfixExpression postfixExpression = this.ast.newPostfixExpression(); - postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$ - postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT); - forStatement.updaters().add(postfixExpression); - forStatement.setBody(this.ast.newBlock()); - assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "for (var tab = null;; i++/**/) {}", source); //$NON-NLS-1$ - checkSourceRange((ASTNode) ((ForStatement) node).updaters().get(0), "i++", source); //$NON-NLS-1$ - checkSourceRange((ASTNode) ((ForStatement) node).initializers().get(0), "var tab = null", source); //$NON-NLS-1$ - } - - /** - * VariableDeclarationStatement - * @deprecated using deprecated code - */ - public void test0129() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0129", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationFragment frag = (VariableDeclarationFragment) ((VariableDeclarationStatement) node).fragments().get(0); - assertTrue("Not a declaration", frag.getName().isDeclaration()); //$NON-NLS-1$ - - VariableDeclarationFragment fragment = this.ast.newVariableDeclarationFragment(); - fragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$ - - - VariableDeclarationStatement var = this.ast.newVariableDeclarationStatement(fragment); -// fragment.setExtraDimensions(0); -// VariableDeclarationStatement fieldDeclaration = this.ast.newVariableDeclarationStatement(fragment); -// fieldDeclaration.setModifiers(Modifier.NONE); -// fieldDeclaration.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - assertTrue("Both AST trees should be identical", var.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "var i;", source); //$NON-NLS-1$ - } - - /** - * VariableDeclarationStatement - * @deprecated using deprecated code - */ - public void test0130() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0130", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationFragment fragment = this.ast.newVariableDeclarationFragment(); - fragment.setName(this.ast.newSimpleName("x")); //$NON-NLS-1$ - NumberLiteral literal = this.ast.newNumberLiteral(); - literal.setToken("10"); //$NON-NLS-1$ - fragment.setInitializer(literal); -// fragment.setExtraDimensions(0); - VariableDeclarationStatement variableDeclaration = this.ast.newVariableDeclarationStatement(fragment); -// variableDeclaration.setModifiers(Modifier.PUBLIC); -// fieldDeclaration.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - fragment = this.ast.newVariableDeclarationFragment(); - fragment.setName(this.ast.newSimpleName("y"));//$NON-NLS-1$ -// fragment.setExtraDimensions(1); - fragment.setInitializer(this.ast.newNullLiteral()); - variableDeclaration.fragments().add(fragment); - fragment = this.ast.newVariableDeclarationFragment(); - fragment.setName(this.ast.newSimpleName("i"));//$NON-NLS-1$ -// fragment.setExtraDimensions(0); - variableDeclaration.fragments().add(fragment); - fragment = this.ast.newVariableDeclarationFragment(); - fragment.setName(this.ast.newSimpleName("j"));//$NON-NLS-1$ -// fragment.setExtraDimensions(2); - variableDeclaration.fragments().add(fragment); - assertTrue("Both AST trees should be identical", variableDeclaration.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "var x= 10, y = null, i, j;", source); //$NON-NLS-1$ - VariableDeclarationFragment[] fragments = (VariableDeclarationFragment[])((VariableDeclarationStatement) node).fragments().toArray(new VariableDeclarationFragment[4]); - assertTrue("fragments.length != 4", fragments.length == 4); //$NON-NLS-1$ - checkSourceRange(fragments[0], "x= 10", source);//$NON-NLS-1$ - checkSourceRange(fragments[1], "y = null", source);//$NON-NLS-1$ - checkSourceRange(fragments[2], "i", source);//$NON-NLS-1$ - checkSourceRange(fragments[3], "j", source);//$NON-NLS-1$ - } - -// /** -// * Argument with final modifier -// * @deprecated using deprecated code -// */ -// public void test0131() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0131", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// assertTrue("The node is not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ -// assertTrue("Not a declaration", ((FunctionDeclaration) node).getName().isDeclaration()); //$NON-NLS-1$ -// List parameters = ((FunctionDeclaration) node).parameters(); -// assertTrue("Parameters.length != 1", parameters.size() == 1); //$NON-NLS-1$ -// SingleVariableDeclaration arg = (SingleVariableDeclaration) ((FunctionDeclaration) node).parameters().get(0); -// SingleVariableDeclaration singleVariableDeclaration = this.ast.newSingleVariableDeclaration(); -// singleVariableDeclaration.setModifiers(Modifier.FINAL); -// singleVariableDeclaration.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$ -// singleVariableDeclaration.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); -// assertTrue("Both AST trees should be identical", singleVariableDeclaration.subtreeMatch(new ASTMatcher(), arg)); //$NON-NLS-1$ -// checkSourceRange(node, "void foo(final int i) {}", source); //$NON-NLS-1$ -// checkSourceRange(arg, "final int i", source); //$NON-NLS-1$ -// } - - /** - * Check javadoc for FunctionDeclaration - * @deprecated marking deprecated since using deprecated code - */ - public void test0132() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0132", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - JSdoc actualJavadoc = ((FunctionDeclaration) node).getJavadoc(); - JSdoc javadoc = this.ast.newJSdoc(); - javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/ - assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$ - checkSourceRange(node, "/** JavaDoc Comment*/\n function foo(i) {}", source); //$NON-NLS-1$ - checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$ - } - - /** - * Check javadoc for FunctionDeclaration - */ - public void test0133() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0133", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - JSdoc actualJavadoc = ((FunctionDeclaration) node).getJavadoc(); - assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ - checkSourceRange(node, "function foo(i) {}", source); //$NON-NLS-1$ - } - - /** - * Check javadoc for FunctionDeclaration - */ - public void test0134() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0134", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - JSdoc actualJavadoc = ((FunctionDeclaration) node).getJavadoc(); - assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ - checkSourceRange(node, "function foo( i) {}", source); //$NON-NLS-1$ - } - - /** - * Check javadoc for VariableDeclarationStatement - * @deprecated marking deprecated since using deprecated code - */ - public void test0135() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0135", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - JSdoc actualJavadoc = ((VariableDeclarationStatement) node).getJavadoc(); - JSdoc javadoc = this.ast.newJSdoc(); - javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/ - assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$ - checkSourceRange(node, "/** JavaDoc Comment*/\n var i;", source); //$NON-NLS-1$ - } - - /** - * Check javadoc for VariableDeclarationStatement - */ - public void test0136() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0136", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - JSdoc actualJavadoc = ((VariableDeclarationStatement) node).getJavadoc(); - assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ - checkSourceRange(node, "var i;", source); //$NON-NLS-1$ - } - - /** - * Check javadoc for VariableDeclarationStatement - */ - public void test0137() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0137", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - JSdoc actualJavadoc = ((VariableDeclarationStatement) node).getJavadoc(); - assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ - checkSourceRange(node, "var i;", source); //$NON-NLS-1$ - } - -// /** -// * Check javadoc for TypeDeclaration -// */ -// public void test0138() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0138", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ -// Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc(); -// assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ -// String expectedContents = "public class Test {\n" +//$NON-NLS-1$ -// " int i;\n" +//$NON-NLS-1$ -// "}";//$NON-NLS-1$ -// checkSourceRange(node, expectedContents, source); //$NON-NLS-1$ -// } -// -// /** -// * Check javadoc for TypeDeclaration -// */ -// public void test0139() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0139", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ -// Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc(); -// assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ -// String expectedContents = "public class Test {\n" +//$NON-NLS-1$ -// " int i;\n" +//$NON-NLS-1$ -// "}";//$NON-NLS-1$ -// checkSourceRange(node, expectedContents, source); //$NON-NLS-1$ -// } -// -// /** -// * Check javadoc for TypeDeclaration -// * @deprecated marking deprecated since using deprecated code -// */ -// public void test0140() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0140", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ -// Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc(); -// Javadoc javadoc = this.ast.newJavadoc(); -// javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/ -// assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$ -// String expectedContents = -// "/** JavaDoc Comment*/\n" + //$NON-NLS-1$ -// "public class Test {\n" +//$NON-NLS-1$ -// " int i;\n" +//$NON-NLS-1$ -// "}";//$NON-NLS-1$ -// checkSourceRange(node, expectedContents, source); //$NON-NLS-1$ -// checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$ -// } - -// /** -// * Check javadoc for MemberTypeDeclaration -// * @deprecated marking deprecated since using deprecated code -// */ -// public void test0141() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0141", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ -// Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc(); -// Javadoc javadoc = this.ast.newJavadoc(); -// javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/ -// assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$ -// String expectedContents = -// "/** JavaDoc Comment*/\n" + //$NON-NLS-1$ -// " class B {}";//$NON-NLS-1$ -// checkSourceRange(node, expectedContents, source); //$NON-NLS-1$ -// checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$ -// } -// -// /** -// * Check javadoc for MemberTypeDeclaration -// */ -// public void test0142() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0142", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ -// Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc(); -// assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ -// checkSourceRange(node, "class B {}", source); //$NON-NLS-1$ -// } -// -// /** -// * Check javadoc for MemberTypeDeclaration -// */ -// public void test0143() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0143", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ -// Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc(); -// assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ -// checkSourceRange(node, "public static class B {}", source); //$NON-NLS-1$ -// } -// -// /** -// * Check javadoc for MemberTypeDeclaration -// */ -// public void test0144() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0144", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ -// Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc(); -// assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ -// checkSourceRange(node, "public static class B {}", source); //$NON-NLS-1$ -// } - -// /** -// * Checking initializers -// */ -// public void test0145() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0145", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// checkSourceRange(node, "{}", source); //$NON-NLS-1$ -// } -// -// /** -// * Checking initializers -// */ -// public void test0146() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0146", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// checkSourceRange(node, "static {}", source); //$NON-NLS-1$ -// } -// -// /** -// * Checking initializers -// * @deprecated marking deprecated since using deprecated code -// */ -// public void test0147() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0147", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// Javadoc actualJavadoc = ((Initializer) node).getJavadoc(); -// assertNotNull("Javadoc comment should no be null", actualJavadoc); //$NON-NLS-1$ -// Javadoc javadoc = this.ast.newJavadoc(); -// javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/ -// assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$ -// String expectedContents = -// "/** JavaDoc Comment*/\n" + //$NON-NLS-1$ -// " static {}";//$NON-NLS-1$ -// checkSourceRange(node, expectedContents, source); //$NON-NLS-1$ -// checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$ -// -// } -// -// /** -// * Checking initializers -// * @deprecated marking deprecated since using deprecated code -// */ -// public void test0148() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0148", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// Javadoc actualJavadoc = ((Initializer) node).getJavadoc(); -// assertNotNull("Javadoc comment should not be null", actualJavadoc); //$NON-NLS-1$ -// Javadoc javadoc = this.ast.newJavadoc(); -// javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/ -// assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$ -// String expectedContents = -// "/** JavaDoc Comment*/\n" + //$NON-NLS-1$ -// " {}";//$NON-NLS-1$ -// checkSourceRange(node, expectedContents, source); //$NON-NLS-1$ -// checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$ -// -// } -// -// /** -// * Checking initializers -// */ -// public void test0149() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0149", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// Javadoc actualJavadoc = ((Initializer) node).getJavadoc(); -// assertNull("Javadoc comment should be null", actualJavadoc); //$NON-NLS-1$ -// checkSourceRange(node, "{}", source); //$NON-NLS-1$ -// } - - /** - * Checking syntax error - */ - public void test0150() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0150", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, false); - assertNotNull("Expression should not be null", result); //$NON-NLS-1$ - assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertTrue("The compilation unit is malformed", !isMalformed(unit)); //$NON-NLS-1$ -// assertTrue("The package declaration is not malformed", isMalformed(unit.getPackage())); //$NON-NLS-1$ -// List imports = unit.imports(); -// assertTrue("The imports list size is not one", imports.size() == 1); //$NON-NLS-1$ -// assertTrue("The first import is malformed", !isMalformed((ASTNode) imports.get(0))); //$NON-NLS-1$ - } - -// /** -// * Checking syntax error -// */ -// public void test0151() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0151", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, false); -// assertNotNull("Expression should not be null", result); //$NON-NLS-1$ -// assertTrue("The compilation unit is malformed", !isMalformed(result)); //$NON-NLS-1$ -// } - - /** - * Checking syntax error - */ - public void test0152() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0152", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, false); - assertNotNull("Expression should not be null", result); //$NON-NLS-1$ - assertTrue("The compilation unit is malformed", !isMalformed(result)); //$NON-NLS-1$ -// ASTNode node = getASTNode((JavaScriptUnit) result, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// assertTrue("The type is malformed", !isMalformed(node)); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// assertTrue("The field is not malformed", isMalformed(node)); //$NON-NLS-1$ -// node = getASTNode((JavaScriptUnit) result, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The method is not malformed", isMalformed(node)); //$NON-NLS-1$ - } - - /** - * Checking syntax error - */ - public void test0153() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0153", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, false); - assertNotNull("Expression should not be null", result); //$NON-NLS-1$ - assertTrue("The compilation unit is malformed", !isMalformed(result)); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The method is not original", isOriginal(node)); //$NON-NLS-1$ - assertTrue("The method is not malformed", isMalformed(node)); //$NON-NLS-1$ - } -// -// /** -// * Checking binding of package declaration -// */ -// public void test0154() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0154", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("Expression should not be null", result); //$NON-NLS-1$ -// assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// JavaScriptUnit compilationUnit = (JavaScriptUnit) result; -// IBinding binding = compilationUnit.getPackage().getName().resolveBinding(); -// assertNotNull("The package binding is null", binding); //$NON-NLS-1$ -// assertTrue("The binding is not a package binding", binding instanceof IPackageBinding); //$NON-NLS-1$ -// IPackageBinding packageBinding = (IPackageBinding) binding; -// assertEquals("The package name is incorrect", "test0154", packageBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// IBinding binding2 = compilationUnit.getPackage().getName().resolveBinding(); -// assertTrue("The package binding is not canonical", binding == binding2); //$NON-NLS-1$ -// } - - /** - * Checking arguments positions - */ - public void test0155() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0155", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("Expression should not be null", result); //$NON-NLS-1$ - assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("The result is not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - FunctionDeclaration methodDecl = (FunctionDeclaration) node; - List parameters = methodDecl.parameters(); - assertTrue("The parameters size is different from 2", parameters.size() == 2); //$NON-NLS-1$ - Object parameter = parameters.get(0); - assertTrue("The parameter is not a SingleVariableDeclaration", parameter instanceof SingleVariableDeclaration); //$NON-NLS-1$ - checkSourceRange((ASTNode) parameter, "i", source); //$NON-NLS-1$ - parameter = parameters.get(1); - assertTrue("The parameter is not a SingleVariableDeclaration", parameter instanceof SingleVariableDeclaration); //$NON-NLS-1$ - checkSourceRange((ASTNode) parameter, "b", source); //$NON-NLS-1$ - } - - /** - * Checking arguments positions - */ - public void test0156() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0156", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("Expression should not be null", result); //$NON-NLS-1$ - assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("The result is not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - FunctionDeclaration methodDecl = (FunctionDeclaration) node; - List parameters = methodDecl.parameters(); - assertTrue("The parameters size is different from 1", parameters.size() == 1); //$NON-NLS-1$ - Object parameter = parameters.get(0); - assertTrue("The parameter is not a SingleVariableDeclaration", parameter instanceof SingleVariableDeclaration); //$NON-NLS-1$ - checkSourceRange((ASTNode) parameter, "i", source); //$NON-NLS-1$ - Block block = methodDecl.getBody(); - List statements = block.statements(); - assertTrue("The statements size is different from 2", statements.size() == 2); //$NON-NLS-1$ - ASTNode statement = (ASTNode) statements.get(0); - assertTrue("The statements[0] is a postfixExpression statement", statement instanceof ExpressionStatement); //$NON-NLS-1$ - } - - /** - * Check canonic binding for fields - */ - public void test0157() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "", "Test0157.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("Expression should not be null", result); //$NON-NLS-1$ - assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - List statements = compilationUnit.statements(); - assertTrue("The types list is empty", statements.size() != 0); //$NON-NLS-1$ -// TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0); -// ITypeBinding typeBinding = typeDeclaration.resolveBinding(); -// assertNotNull("Type binding is null", typeBinding); //$NON-NLS-1$ -// assertTrue("The type binding is canonical", typeBinding == typeDeclaration.resolveBinding()); //$NON-NLS-1$ -// List bodyDeclarations = typeDeclaration.bodyDeclarations(); -// assertTrue("The body declaration list is empty", bodyDeclarations.size() != 0); //$NON-NLS-1$ - Statement bodyDeclaration = (Statement) statements.get(0); - assertTrue("This is not a field", bodyDeclaration instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) bodyDeclaration; - List variableFragments = fieldDeclaration.fragments(); - assertTrue("The fragment list is empty", variableFragments.size() != 0); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableFragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - assertNotNull("the field binding is null", variableBinding); //$NON-NLS-1$ - assertTrue("The field binding is not canonical", variableBinding == fragment.resolveBinding()); //$NON-NLS-1$ - ITypeBinding typeBinding = variableBinding.getType(); -// assertTrue("The type is not an array type", typeBinding.isArray()); //$NON-NLS-1$ - assertTrue("The type binding for the field is not canonical", typeBinding == variableBinding.getType()); //$NON-NLS-1$ - SimpleName name = fragment.getName(); - assertTrue("is a declaration", name.isDeclaration()); //$NON-NLS-1$ - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertEquals("wrong type", IBinding.VARIABLE, binding.getKind()); //$NON-NLS-1$ - assertTrue("is a field", !((IVariableBinding) binding).isField()); //$NON-NLS-1$ - } - - /** - * Check canonic bindings for fields - */ - public void test0158() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "", "Test0158.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("Expression should not be null", result); //$NON-NLS-1$ - assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - List statements = compilationUnit.statements(); - assertTrue("The types list is empty", statements.size() != 0); //$NON-NLS-1$ -// TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0); -// ITypeBinding typeBinding = typeDeclaration.resolveBinding(); -// assertNotNull("Type binding is null", typeBinding); //$NON-NLS-1$ -// assertTrue("The type binding is canonical", typeBinding == typeDeclaration.resolveBinding()); //$NON-NLS-1$ -// SimpleName simpleName = typeDeclaration.getName(); -// assertTrue("is a declaration", simpleName.isDeclaration()); //$NON-NLS-1$ -// IBinding binding = simpleName.resolveBinding(); -// assertNotNull("No binding", binding); //$NON-NLS-1$ -// assertEquals("wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$ -// assertEquals("wrong name", simpleName.getIdentifier(), binding.getName()); //$NON-NLS-1$ -// List bodyDeclarations = typeDeclaration.bodyDeclarations(); -// assertTrue("The body declaration list is empty", bodyDeclarations.size() != 0); //$NON-NLS-1$ - Statement bodyDeclaration = (Statement) statements.get(0); - assertTrue("This is not a field", bodyDeclaration instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) bodyDeclaration; - List variableFragments = fieldDeclaration.fragments(); - assertTrue("The fragment list is empty", variableFragments.size() != 0); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableFragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - assertNotNull("the field binding is null", variableBinding); //$NON-NLS-1$ - assertTrue("The field binding is not canonical", variableBinding == fragment.resolveBinding()); //$NON-NLS-1$ - ITypeBinding typeBinding2 = variableBinding.getType(); -// assertTrue("The type is not an array type", typeBinding2.isArray()); //$NON-NLS-1$ - assertTrue("The type binding for the field is not canonical", typeBinding2 == variableBinding.getType()); //$NON-NLS-1$ -// assertTrue("The type binding for the field is not canonical with the declaration type binding", typeBinding == typeBinding2.getElementType()); //$NON-NLS-1$ - } - -// /** -// * Define an anonymous type -// */ -// public void test0159() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0159", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("Expression should not be null", result); //$NON-NLS-1$ -// assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// } - - /** - * Check bindings for multiple field declarations - */ - public void test0160() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0160", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("Expression should not be null", result); //$NON-NLS-1$ - assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - List statements = compilationUnit.statements(); - assertTrue("The statements list is empty", statements.size() != 0); //$NON-NLS-1$ -// TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0); -// ITypeBinding typeBinding = typeDeclaration.resolveBinding(); -// assertNotNull("Type binding is null", typeBinding); //$NON-NLS-1$ -// assertTrue("The type binding is canonical", typeBinding == typeDeclaration.resolveBinding()); //$NON-NLS-1$ -// List bodyDeclarations = typeDeclaration.bodyDeclarations(); -// assertTrue("The body declaration list is empty", bodyDeclarations.size() != 0); //$NON-NLS-1$ - Statement bodyDeclaration = (Statement) statements.get(0); - assertTrue("This is not a field", bodyDeclaration instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) bodyDeclaration; - List variableFragments = fieldDeclaration.fragments(); - assertTrue("The fragment list size is not 2", variableFragments.size() == 2); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableFragments.get(0); - IVariableBinding variableBinding1 = fragment.resolveBinding(); - assertNotNull("the field binding is null", variableBinding1); //$NON-NLS-1$ - assertTrue("The field binding is not canonical", variableBinding1 == fragment.resolveBinding()); //$NON-NLS-1$ - ITypeBinding type1 = variableBinding1.getType(); - assertNotNull("The type is null", type1); //$NON-NLS-1$ - assertTrue("The field type is canonical", type1 == variableBinding1.getType()); //$NON-NLS-1$ -// assertTrue("The type is not an array type",type1.isArray()); //$NON-NLS-1$ -// assertTrue("The type dimension is 1", type1.getDimensions() == 1); //$NON-NLS-1$ - fragment = (VariableDeclarationFragment) variableFragments.get(1); - IVariableBinding variableBinding2 = fragment.resolveBinding(); - assertNotNull("the field binding is null", variableBinding2); //$NON-NLS-1$ - assertTrue("The field binding is not canonical", variableBinding2 == fragment.resolveBinding()); //$NON-NLS-1$ - ITypeBinding type2 = variableBinding2.getType(); - type2 = variableBinding2.getType(); - assertNotNull("The type is null", type2); //$NON-NLS-1$ - assertTrue("The field type is canonical", type2 == variableBinding2.getType()); //$NON-NLS-1$ -// assertTrue("The type is not an array type",type2.isArray()); //$NON-NLS-1$ -// assertTrue("The type dimension is 2", type2.getDimensions() == 2); //$NON-NLS-1$ -// assertTrue("Element type is canonical", type1.getElementType() == type2.getElementType()); //$NON-NLS-1$ - assertTrue("type1.id < type2.id", variableBinding1.getVariableId() < variableBinding2.getVariableId()); //$NON-NLS-1$ - - } -// -// /** -// * Check ITypeBinding APIs: -// * - getModifiers() -// * - getElementType() when it is not an array type -// * - getDimensions() when it is not an array type -// * - getDeclaringClass() -// * - getDeclaringName() -// * - getName() -// * - isNested() -// * - isAnonymous() -// * - isLocal() -// * - isMember() -// * - isArray() -// * - getDeclaredMethods() => returns binding for default constructor -// * - isPrimitive() -// * - isTopLevel() -// * - getSuperclass() -// */ -// public void test0161() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0161", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("Expression should not be null", result); //$NON-NLS-1$ -// assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// JavaScriptUnit compilationUnit = (JavaScriptUnit) result; -// List types = compilationUnit.types(); -// assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$ -// TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0); -// ITypeBinding typeBinding = typeDeclaration.resolveBinding(); -// assertNotNull("The type binding should not be null", typeBinding); //$NON-NLS-1$ -// assertEquals("The modifier is PUBLIC", Modifier.PUBLIC, typeBinding.getModifiers()); //$NON-NLS-1$ -// assertNull("There is no element type", typeBinding.getElementType()); //$NON-NLS-1$ -// assertEquals("There is no dimension", 0, typeBinding.getDimensions()); //$NON-NLS-1$ -// assertNull("This is not a member type", typeBinding.getDeclaringClass()); //$NON-NLS-1$ -// IFunctionBinding[] methods = typeBinding.getDeclaredMethods(); -// assertEquals("Contains the default constructor", 1, methods.length); //$NON-NLS-1$ -// assertEquals("The name is not Test", "Test", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// assertTrue("An anonymous class", !typeBinding.isAnonymous()); //$NON-NLS-1$ -// assertTrue("A local class", !typeBinding.isLocal()); //$NON-NLS-1$ -// assertTrue("A nested class", !typeBinding.isNested()); //$NON-NLS-1$ -// assertTrue("A member class", !typeBinding.isMember()); //$NON-NLS-1$ -// assertTrue("An array", !typeBinding.isArray()); //$NON-NLS-1$ -// assertTrue("Not a class", typeBinding.isClass()); //$NON-NLS-1$ -// assertTrue("An interface", !typeBinding.isInterface()); //$NON-NLS-1$ -// assertTrue("Not from source", typeBinding.isFromSource()); //$NON-NLS-1$ -// assertTrue("Is nested", typeBinding.isTopLevel()); //$NON-NLS-1$ -// assertTrue("A primitive type", !typeBinding.isPrimitive()); //$NON-NLS-1$ -// ITypeBinding superclass = typeBinding.getSuperclass(); -// assertNotNull("No superclass", superclass); //$NON-NLS-1$ -// assertTrue("From source", !superclass.isFromSource()); //$NON-NLS-1$ -// ITypeBinding supersuperclass = superclass.getSuperclass(); -// assertNull("No superclass for java.lang.Object", supersuperclass); //$NON-NLS-1$ -// ITypeBinding[] interfaces = typeBinding.getInterfaces(); -// assertNotNull("No interfaces", interfaces); //$NON-NLS-1$ -// assertEquals("More then one super interface", 1, interfaces.length); //$NON-NLS-1$ -// assertTrue("is not an interface", interfaces[0].isInterface()); //$NON-NLS-1$ -// assertTrue("From source", !interfaces[0].isFromSource()); //$NON-NLS-1$ -// assertEquals("Has fields", 0, typeBinding.getDeclaredFields().length); //$NON-NLS-1$ -// } -// -// /** -// * Check ITypeBinding APIs: -// * - getModifiers() -// * - getElementType() when it is not an array type -// * - getDimensions() when it is not an array type -// * - getDeclaringClass() -// * - getDeclaringName() -// * - getName() -// * - isNested() -// * - isAnonymous() -// * - isLocal() -// * - isMember() -// * - isArray() -// * - getDeclaredMethods() => returns binding for default constructor -// * - isPrimitive() -// * - isTopLevel() -// * - getSuperclass() -// */ -// public void test0162() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0162", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("Expression should not be null", result); //$NON-NLS-1$ -// assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// JavaScriptUnit compilationUnit = (JavaScriptUnit) result; -// List types = compilationUnit.types(); -// assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$ -// TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0); -// ITypeBinding typeBinding = typeDeclaration.resolveBinding(); -// assertNotNull("The type binding should not be null", typeBinding); //$NON-NLS-1$ -// assertEquals("The modifier is PUBLIC", Modifier.PUBLIC, typeBinding.getModifiers()); //$NON-NLS-1$ -// assertNull("There is no element type", typeBinding.getElementType()); //$NON-NLS-1$ -// assertEquals("There is no dimension", 0, typeBinding.getDimensions()); //$NON-NLS-1$ -// assertNull("This is not a member type", typeBinding.getDeclaringClass()); //$NON-NLS-1$ -// IFunctionBinding[] methods = typeBinding.getDeclaredMethods(); -// assertEquals("Contains no methos", 0, methods.length); //$NON-NLS-1$ -// assertEquals("The name is not Test", "Test", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// assertTrue("An anonymous class", !typeBinding.isAnonymous()); //$NON-NLS-1$ -// assertTrue("A local class", !typeBinding.isLocal()); //$NON-NLS-1$ -// assertTrue("A nested class", !typeBinding.isNested()); //$NON-NLS-1$ -// assertTrue("A member class", !typeBinding.isMember()); //$NON-NLS-1$ -// assertTrue("An array", !typeBinding.isArray()); //$NON-NLS-1$ -// assertTrue("A class", !typeBinding.isClass()); //$NON-NLS-1$ -// assertTrue("Not an interface", typeBinding.isInterface()); //$NON-NLS-1$ -// assertTrue("Not from source", typeBinding.isFromSource()); //$NON-NLS-1$ -// assertTrue("Is nested", typeBinding.isTopLevel()); //$NON-NLS-1$ -// assertTrue("A primitive type", !typeBinding.isPrimitive()); //$NON-NLS-1$ -// ITypeBinding superclass = typeBinding.getSuperclass(); -// assertNull("No superclass", superclass); //$NON-NLS-1$ -// assertEquals("Has fields", 0, typeBinding.getDeclaredFields().length); //$NON-NLS-1$ -// } -// -// /** -// * Test binding for anonymous declaration: new java.lang.Object() {} -// */ -// public void test0163() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0163", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result); -// assertNotNull("Expression should not be null", expression); //$NON-NLS-1$ -// assertTrue("Not an anonymous type declaration", expression instanceof ClassInstanceCreation); //$NON-NLS-1$ -// ClassInstanceCreation anonymousClass = (ClassInstanceCreation) expression; -// ITypeBinding typeBinding = anonymousClass.resolveTypeBinding(); -// assertNotNull("No binding", typeBinding); //$NON-NLS-1$ -// assertTrue("Not an anonymous class", typeBinding.isAnonymous()); //$NON-NLS-1$ -// assertEquals("The modifier is not default", Modifier.NONE, typeBinding.getModifiers()); //$NON-NLS-1$ -// assertNull("There is no element type", typeBinding.getElementType()); //$NON-NLS-1$ -// assertEquals("There is no dimension", 0, typeBinding.getDimensions()); //$NON-NLS-1$ -// assertNotNull("This is a member type", typeBinding.getDeclaringClass()); //$NON-NLS-1$ -// assertEquals("The name is not empty", "", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// IFunctionBinding[] methods = typeBinding.getDeclaredMethods(); -// assertEquals("Contains the default constructor", 1, methods.length); //$NON-NLS-1$ -// assertTrue("Not a local class", typeBinding.isLocal()); //$NON-NLS-1$ -// assertTrue("Not a nested class", typeBinding.isNested()); //$NON-NLS-1$ -// assertTrue("A member class", !typeBinding.isMember()); //$NON-NLS-1$ -// assertTrue("An array", !typeBinding.isArray()); //$NON-NLS-1$ -// assertTrue("Not a class", typeBinding.isClass()); //$NON-NLS-1$ -// assertTrue("An interface", !typeBinding.isInterface()); //$NON-NLS-1$ -// assertTrue("Not from source", typeBinding.isFromSource()); //$NON-NLS-1$ -// assertTrue("Is a top level", !typeBinding.isTopLevel()); //$NON-NLS-1$ -// assertTrue("A primitive type", !typeBinding.isPrimitive()); //$NON-NLS-1$ -// assertEquals("wrong qualified name", "", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$ -// ITypeBinding superclass = typeBinding.getSuperclass(); -// assertNotNull("No superclass", superclass); //$NON-NLS-1$ -// assertEquals("Has fields", 0, typeBinding.getDeclaredFields().length); //$NON-NLS-1$ -// } -// -// /** -// * Test binding for member type declaration -// */ -// public void test0164() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0164", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// assertTrue("Not an type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$ -// TypeDeclaration typeDeclaration = (TypeDeclaration) node; -// ITypeBinding typeBinding = typeDeclaration.resolveBinding(); -// assertNotNull("No binding", typeBinding); //$NON-NLS-1$ -// assertTrue("An anonymous class", !typeBinding.isAnonymous()); //$NON-NLS-1$ -// assertEquals("The modifier is not default", Modifier.PRIVATE, typeBinding.getModifiers()); //$NON-NLS-1$ -// assertNull("There is no element type", typeBinding.getElementType()); //$NON-NLS-1$ -// assertEquals("There is no dimension", 0, typeBinding.getDimensions()); //$NON-NLS-1$ -// assertNotNull("This is not a member type", typeBinding.getDeclaringClass()); //$NON-NLS-1$ -// assertEquals("The name is not 'B'", "B", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// IFunctionBinding[] methods = typeBinding.getDeclaredMethods(); -// assertEquals("Contains the default constructor", 1, methods.length); //$NON-NLS-1$ -// assertTrue("A local class", !typeBinding.isLocal()); //$NON-NLS-1$ -// assertTrue("Not a nested class", typeBinding.isNested()); //$NON-NLS-1$ -// assertTrue("Not a member class", typeBinding.isMember()); //$NON-NLS-1$ -// assertTrue("An array", !typeBinding.isArray()); //$NON-NLS-1$ -// assertTrue("Not a class", typeBinding.isClass()); //$NON-NLS-1$ -// assertTrue("An interface", !typeBinding.isInterface()); //$NON-NLS-1$ -// assertTrue("Not from source", typeBinding.isFromSource()); //$NON-NLS-1$ -// assertTrue("Is a top level", !typeBinding.isTopLevel()); //$NON-NLS-1$ -// assertTrue("A primitive type", !typeBinding.isPrimitive()); //$NON-NLS-1$ -// ITypeBinding superclass = typeBinding.getSuperclass(); -// assertNotNull("No superclass", superclass); //$NON-NLS-1$ -// assertEquals("Has fields", 0, typeBinding.getDeclaredFields().length); //$NON-NLS-1$ -// } -// -// /** -// * Test binding for local type declaration -// * @deprecated using deprecated code -// */ -// public void test0165() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0165", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// assertTrue("Not an type declaration", node instanceof TypeDeclarationStatement); //$NON-NLS-1$ -// TypeDeclarationStatement statement = (TypeDeclarationStatement) node; -// TypeDeclaration typeDeclaration = statement.getTypeDeclaration(); -// ITypeBinding typeBinding = typeDeclaration.resolveBinding(); -// assertNotNull("No binding", typeBinding); //$NON-NLS-1$ -// assertTrue("An anonymous class", !typeBinding.isAnonymous()); //$NON-NLS-1$ -// assertEquals("The modifier is not default", Modifier.NONE, typeBinding.getModifiers()); //$NON-NLS-1$ -// assertNull("There is no element type", typeBinding.getElementType()); //$NON-NLS-1$ -// assertEquals("There is no dimension", 0, typeBinding.getDimensions()); //$NON-NLS-1$ -// assertNotNull("This is not a member type", typeBinding.getDeclaringClass()); //$NON-NLS-1$ -// assertEquals("The name is not 'C'", "C", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// IFunctionBinding[] methods = typeBinding.getDeclaredMethods(); -// assertEquals("Contains the default constructor", 1, methods.length); //$NON-NLS-1$ -// assertTrue("Not a local class", typeBinding.isLocal()); //$NON-NLS-1$ -// assertTrue("Not a nested class", typeBinding.isNested()); //$NON-NLS-1$ -// assertTrue("A member class", !typeBinding.isMember()); //$NON-NLS-1$ -// assertTrue("An array", !typeBinding.isArray()); //$NON-NLS-1$ -// assertTrue("Not a class", typeBinding.isClass()); //$NON-NLS-1$ -// assertTrue("An interface", !typeBinding.isInterface()); //$NON-NLS-1$ -// assertTrue("Not from source", typeBinding.isFromSource()); //$NON-NLS-1$ -// assertTrue("Is a top level", !typeBinding.isTopLevel()); //$NON-NLS-1$ -// assertTrue("A primitive type", !typeBinding.isPrimitive()); //$NON-NLS-1$ -// assertEquals("wrong qualified name", "", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$ -// ITypeBinding superclass = typeBinding.getSuperclass(); -// assertNotNull("No superclass", superclass); //$NON-NLS-1$ -// assertEquals("Has fields", 0, typeBinding.getDeclaredFields().length); //$NON-NLS-1$ -// } - - /** - * Multiple local declaration => VariabledeclarationStatement - */ - public void test0166() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0166", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - List fragments = variableDeclarationStatement.fragments(); - assertTrue("Fragment list is not 4 ", fragments.size() == 4); //$NON-NLS-1$ - VariableDeclarationFragment fragment1 = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding binding1 = fragment1.resolveBinding(); - assertNotNull("Binding is null", binding1); //$NON-NLS-1$ - assertEquals("wrong name for binding1", "x", binding1.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("wrong modifier for binding1", 0, binding1.getModifiers()); //$NON-NLS-1$ - assertTrue("a field", !binding1.isField()); //$NON-NLS-1$ -// assertNull("declaring class is not null", binding1.getDeclaringClass()); //$NON-NLS-1$ - ITypeBinding typeBinding1 = binding1.getType(); - assertNotNull("typeBinding1 is null", typeBinding1); //$NON-NLS-1$ -// assertTrue("typeBinding1 is not a primitive type", typeBinding1.isPrimitive()); //$NON-NLS-1$ -// assertTrue("typeBinding1 is not canonical", typeBinding1 == binding1.getType()); //$NON-NLS-1$ - VariableDeclarationFragment fragment2 = (VariableDeclarationFragment) fragments.get(1); - IVariableBinding binding2 = fragment2.resolveBinding(); - assertNotNull("Binding is null", binding2); //$NON-NLS-1$ - assertEquals("wrong name for binding2", "z", binding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("wrong modifier for binding2", 0, binding2.getModifiers()); //$NON-NLS-1$ - assertTrue("a field", !binding2.isField()); //$NON-NLS-1$ -// assertNull("declaring class is not null", binding2.getDeclaringClass()); //$NON-NLS-1$ - ITypeBinding typeBinding2 = binding2.getType(); - assertNotNull("typeBinding2 is null", typeBinding2); //$NON-NLS-1$ -// assertTrue("typeBinding2 is not an array type", typeBinding2.isArray()); //$NON-NLS-1$ -// assertTrue("typeBinding2 is not canonical", typeBinding2 == binding2.getType()); //$NON-NLS-1$ -// assertTrue("primitive type is not canonical", typeBinding1 == typeBinding2.getElementType()); //$NON-NLS-1$ -// assertEquals("dimension is 1", 1, typeBinding2.getDimensions()); //$NON-NLS-1$ -// assertEquals("it is not int[]", "int[]", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - VariableDeclarationFragment fragment3 = (VariableDeclarationFragment) fragments.get(2); - IVariableBinding binding3 = fragment3.resolveBinding(); - assertNotNull("Binding is null", binding3); //$NON-NLS-1$ - assertEquals("wrong name for binding3", "i", binding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("wrong modifier for binding3", 0, binding3.getModifiers()); //$NON-NLS-1$ - assertTrue("a field", !binding3.isField()); //$NON-NLS-1$ -// assertNull("declaring class is not null", binding3.getDeclaringClass()); //$NON-NLS-1$ - ITypeBinding typeBinding3 = binding3.getType(); - assertNotNull("typeBinding3 is null", typeBinding3); //$NON-NLS-1$ -// assertTrue("typeBinding3 is not an primitive type", typeBinding3.isPrimitive()); //$NON-NLS-1$ -// assertTrue("typeBinding3 is not canonical", typeBinding3 == binding3.getType()); //$NON-NLS-1$ -// assertTrue("primitive type is not canonical", typeBinding1 == typeBinding3); //$NON-NLS-1$ - assertEquals("dimension is 0", 0, typeBinding3.getDimensions()); //$NON-NLS-1$ - assertEquals("it is not the primitive type any", "any", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - VariableDeclarationFragment fragment4 = (VariableDeclarationFragment) fragments.get(3); - IVariableBinding binding4 = fragment4.resolveBinding(); - assertNotNull("Binding is null", binding4); //$NON-NLS-1$ - assertEquals("wrong name for binding4", "j", binding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("wrong modifier for binding4", 0, binding4.getModifiers()); //$NON-NLS-1$ - assertTrue("a field", !binding4.isField()); //$NON-NLS-1$ - assertNull("declaring class is not null", binding4.getDeclaringClass()); //$NON-NLS-1$ - ITypeBinding typeBinding4 = binding4.getType(); - assertNotNull("typeBinding4 is null", typeBinding4); //$NON-NLS-1$ -// assertTrue("typeBinding4 is not an array type", typeBinding4.isArray()); //$NON-NLS-1$ -// assertTrue("typeBinding4 is not canonical", typeBinding4 == binding4.getType()); //$NON-NLS-1$ -// assertTrue("primitive type is not canonical", typeBinding1 == typeBinding4.getElementType()); //$NON-NLS-1$ -// assertEquals("dimension is 2", 2, typeBinding4.getDimensions()); //$NON-NLS-1$ -// assertEquals("it is not int[][]", "int[][]", typeBinding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue("ids in the wrong order", binding1.getVariableId() < binding2.getVariableId()); //$NON-NLS-1$ - assertTrue("ids in the wrong order", binding2.getVariableId() < binding3.getVariableId()); //$NON-NLS-1$ - assertTrue("ids in the wrong order", binding3.getVariableId() < binding4.getVariableId()); //$NON-NLS-1$ - } -// -// /** -// * Check source position for new Test[1+2].length. -// */ -// public void test0167() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0167", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// assertTrue("Instance of VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ -// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; -// List fragments = variableDeclarationStatement.fragments(); -// assertTrue("fragment list size is not 1", fragments.size() == 1); //$NON-NLS-1$ -// VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); -// Expression initialization = fragment.getInitializer(); -// assertNotNull("No initialization", initialization); //$NON-NLS-1$ -// assertTrue("Not a FieldAccess", initialization instanceof FieldAccess); //$NON-NLS-1$ -// checkSourceRange(initialization, "new Test[1+2].length", source); //$NON-NLS-1$ -// } -// -// /** -// * Check package binding: test0168.test -// */ -// public void test0168() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0168.test1", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("Expression should not be null", result); //$NON-NLS-1$ -// assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// JavaScriptUnit compilationUnit = (JavaScriptUnit) result; -// List types = compilationUnit.types(); -// assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$ -// TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0); -// ITypeBinding typeBinding = typeDeclaration.resolveBinding(); -// assertNotNull("Binding not null", typeBinding); //$NON-NLS-1$ -// IPackageBinding packageBinding = typeBinding.getPackage(); -// assertNotNull("No package binding", packageBinding); //$NON-NLS-1$ -// assertEquals("wrong name", "test0168.test1", packageBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// String[] components = packageBinding.getNameComponents(); -// assertNotNull("no components", components); //$NON-NLS-1$ -// assertTrue("components size != 2", components.length == 2); //$NON-NLS-1$ -// assertEquals("wrong component name", "test0168", components[0]); //$NON-NLS-1$ //$NON-NLS-2$ -// assertEquals("wrong component name", "test1", components[1]); //$NON-NLS-1$ //$NON-NLS-2$ -// assertEquals("wrong type", IBinding.PACKAGE, packageBinding.getKind()); //$NON-NLS-1$ -// assertTrue("Unnamed package", !packageBinding.isUnnamed()); //$NON-NLS-1$ -// assertTrue("Package binding is not canonical", packageBinding == typeBinding.getPackage()); //$NON-NLS-1$ -// } - -// /** -// * Check package binding: test0169 -// */ -// public void test0169() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0169", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("Expression should not be null", result); //$NON-NLS-1$ -// assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// JavaScriptUnit compilationUnit = (JavaScriptUnit) result; -// List types = compilationUnit.types(); -// assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$ -// TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0); -// ITypeBinding typeBinding = typeDeclaration.resolveBinding(); -// assertNotNull("Binding not null", typeBinding); //$NON-NLS-1$ -// IPackageBinding packageBinding = typeBinding.getPackage(); -// assertNotNull("No package binding", packageBinding); //$NON-NLS-1$ -// assertEquals("wrong name", "test0169", packageBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// String[] components = packageBinding.getNameComponents(); -// assertNotNull("no components", components); //$NON-NLS-1$ -// assertTrue("components size != 1", components.length == 1); //$NON-NLS-1$ -// assertEquals("wrong component name", "test0169", components[0]); //$NON-NLS-1$ //$NON-NLS-2$ -// assertEquals("wrong type", IBinding.PACKAGE, packageBinding.getKind()); //$NON-NLS-1$ -// assertTrue("Unnamed package", !packageBinding.isUnnamed()); //$NON-NLS-1$ -// assertTrue("Package binding is not canonical", packageBinding == typeBinding.getPackage()); //$NON-NLS-1$ -// } - -// /** -// * Check package binding: test0170 -// */ -// public void test0170() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "", "Test0170.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("Expression should not be null", result); //$NON-NLS-1$ -// assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// JavaScriptUnit compilationUnit = (JavaScriptUnit) result; -// List types = compilationUnit.types(); -// assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$ -// TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0); -// ITypeBinding typeBinding = typeDeclaration.resolveBinding(); -// assertNotNull("Binding not null", typeBinding); //$NON-NLS-1$ -// IPackageBinding packageBinding = typeBinding.getPackage(); -// assertNotNull("No package binding", packageBinding); //$NON-NLS-1$ -// assertEquals("wrong name", "", packageBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// String[] components = packageBinding.getNameComponents(); -// assertNotNull("no components", components); //$NON-NLS-1$ -// assertTrue("components size != 0", components.length == 0); //$NON-NLS-1$ -// assertEquals("wrong type", IBinding.PACKAGE, packageBinding.getKind()); //$NON-NLS-1$ -// assertTrue("Not an unnamed package", packageBinding.isUnnamed()); //$NON-NLS-1$ -// assertTrue("Package binding is not canonical", packageBinding == typeBinding.getPackage()); //$NON-NLS-1$ -// } -// -// /** -// * Check package binding: test0171 -// */ -// public void test0171() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0171", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("Expression should not be null", result); //$NON-NLS-1$ -// assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// JavaScriptUnit compilationUnit = (JavaScriptUnit) result; -// List types = compilationUnit.types(); -// assertTrue("The types list is empty", types.size() == 2); //$NON-NLS-1$ -// TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0); -// ITypeBinding typeBinding = typeDeclaration.resolveBinding(); -// assertNotNull("Binding not null", typeBinding); //$NON-NLS-1$ -// IPackageBinding packageBinding = typeBinding.getPackage(); -// assertNotNull("No package binding", packageBinding); //$NON-NLS-1$ -// assertEquals("wrong name", "test0171", packageBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// String[] components = packageBinding.getNameComponents(); -// assertNotNull("no components", components); //$NON-NLS-1$ -// assertTrue("components size != 1", components.length == 1); //$NON-NLS-1$ -// assertEquals("wrong component name", "test0171", components[0]); //$NON-NLS-1$ //$NON-NLS-2$ -// assertEquals("wrong type", IBinding.PACKAGE, packageBinding.getKind()); //$NON-NLS-1$ -// assertTrue("Unnamed package", !packageBinding.isUnnamed()); //$NON-NLS-1$ -// assertTrue("Package binding is not canonical", packageBinding == typeBinding.getPackage()); //$NON-NLS-1$ -// -// typeDeclaration = (TypeDeclaration) types.get(1); -// typeBinding = typeDeclaration.resolveBinding(); -// assertNotNull("Binding not null", typeBinding); //$NON-NLS-1$ -// IPackageBinding packageBinding2 = typeBinding.getPackage(); -// assertNotNull("No package binding", packageBinding); //$NON-NLS-1$ -// assertTrue("Package binding is not canonical", packageBinding == packageBinding2); //$NON-NLS-1$ -// } - - /** - * Check method binding - */ - public void test0172() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0172", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("Expression should not be null", result); //$NON-NLS-1$ - assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - List statements = compilationUnit.statements(); - assertTrue("The statements list is empty", statements.size() != 0); //$NON-NLS-1$ -// TypeDeclaration typeDeclaration = (TypeDeclaration) statements.get(0); -// ITypeBinding typeBinding = typeDeclaration.resolveBinding(); -// assertNotNull("Binding not null", typeBinding); //$NON-NLS-1$ -// IFunctionBinding[] methods = null;// typeBinding.getDeclaredMethods(); -// assertNotNull("No methods", methods); -// assertEquals("methods.length != 4", 4, methods.length); //$NON-NLS-1$ -// List bodyDeclarations = typeDeclaration.bodyDeclarations(); - assertEquals("statements size != 3", 3, statements.size()); //$NON-NLS-1$ - FunctionDeclaration method1 = (FunctionDeclaration) statements.get(0); - IFunctionBinding methodBinding1 = method1.resolveBinding(); - assertNotNull("No method binding for foo", methodBinding1); //$NON-NLS-1$ - SimpleName simpleName = method1.getName(); - assertTrue("not a declaration", simpleName.isDeclaration()); //$NON-NLS-1$ - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertEquals("wrong name", binding.getName(), simpleName.getIdentifier()); //$NON-NLS-1$ - // search method foo -// IFunctionBinding methodBinding = null; -// loop: for (int i = 0, max = methods.length; i < max; i++) { -// IFunctionBinding currentMethod = methods[i]; -// if ("foo".equals(currentMethod.getName())) { -// methodBinding = currentMethod; -// break loop; -// } -// } -// assertNotNull("Cannot be null", methodBinding); -// assertTrue("Canonical method binding", methodBinding1 == methodBinding); //$NON-NLS-1$ -// assertTrue("declaring class is canonical", typeBinding == methodBinding1.getDeclaringClass()); //$NON-NLS-1$ -// ITypeBinding[] exceptionTypes = methodBinding1.getExceptionTypes(); -// assertNotNull("No exception types", exceptionTypes); //$NON-NLS-1$ -// assertEquals("One exception", 1, exceptionTypes.length); //$NON-NLS-1$ -// assertEquals("wrong name for exception", "IOException", exceptionTypes[0].getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("wrong modifier", Modifier.PUBLIC, methodBinding1.getModifiers()); //$NON-NLS-1$ - assertEquals("wrong name for method", "foo", methodBinding1.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - ITypeBinding[] parameters = methodBinding1.getParameterTypes(); - assertNotNull("No parameters", parameters); //$NON-NLS-1$ - assertEquals("wrong size", 1, parameters.length); //$NON-NLS-1$ -// assertEquals("wrong type", "int[]", parameters[0].getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("wrong return type", "void", methodBinding1.getReturnType().getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// assertTrue("A constructor", !methodBinding1.isConstructor()); //$NON-NLS-1$ - - FunctionDeclaration method2 = (FunctionDeclaration) statements.get(1); - IFunctionBinding methodBinding2 = method2.resolveBinding(); - assertNotNull("No method binding for main", methodBinding2); //$NON-NLS-1$ -// methodBinding = null; -// loop: for (int i = 0, max = methods.length; i < max; i++) { -// IFunctionBinding currentMethod = methods[i]; -// if ("main".equals(currentMethod.getName())) { -// methodBinding = currentMethod; -// break loop; -// } -// } -// assertNotNull("Cannot be null", methodBinding); -// assertTrue("Canonical method binding", methodBinding2 == methodBinding); //$NON-NLS-1$ -// assertTrue("declaring class is canonical", typeBinding == methodBinding2.getDeclaringClass()); //$NON-NLS-1$ -// ITypeBinding[] exceptionTypes2 = methodBinding2.getExceptionTypes(); -// assertNotNull("No exception types", exceptionTypes2); //$NON-NLS-1$ -// assertEquals("No exception", 0, exceptionTypes2.length); //$NON-NLS-1$ -// assertEquals("wrong modifier", Modifier.PUBLIC | Modifier.STATIC, methodBinding2.getModifiers()); //$NON-NLS-1$ - assertEquals("wrong name for method", "main", methodBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - ITypeBinding[] parameters2 = methodBinding2.getParameterTypes(); - assertNotNull("No parameters", parameters2); //$NON-NLS-1$ - assertEquals("wrong size", 1, parameters2.length); //$NON-NLS-1$ -// assertEquals("wrong type for parameter2[0]", "String[]", parameters2[0].getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("wrong return type", "void", methodBinding2.getReturnType().getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// assertTrue("A constructor", !methodBinding2.isConstructor()); //$NON-NLS-1$ - - FunctionDeclaration method3 = (FunctionDeclaration) statements.get(2); - IFunctionBinding methodBinding3 = method3.resolveBinding(); - assertNotNull("No method binding for main", methodBinding3); //$NON-NLS-1$ -// methodBinding = null; -// loop: for (int i = 0, max = methods.length; i < max; i++) { -// IFunctionBinding currentMethod = methods[i]; -// if ("bar".equals(currentMethod.getName())) { -// methodBinding = currentMethod; -// break loop; -// } -// } -// assertNotNull("Cannot be null", methodBinding); -// assertTrue("Canonical method binding", methodBinding3 == methodBinding); //$NON-NLS-1$ -// assertTrue("declaring class is canonical", typeBinding == methodBinding3.getDeclaringClass()); //$NON-NLS-1$ -// ITypeBinding[] exceptionTypes3 = methodBinding3.getExceptionTypes(); -// assertNotNull("No exception types", exceptionTypes3); //$NON-NLS-1$ -// assertEquals("No exception", 1, exceptionTypes3.length); //$NON-NLS-1$ -// assertEquals("wrong modifier", Modifier.PRIVATE, methodBinding3.getModifiers()); //$NON-NLS-1$ - assertEquals("wrong name for method", "bar", methodBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - ITypeBinding[] parameters3 = methodBinding3.getParameterTypes(); - assertNotNull("No parameters", parameters3); //$NON-NLS-1$ - assertEquals("wrong size", 1, parameters3.length); //$NON-NLS-1$ - assertEquals("wrong type", "any", parameters3[0].getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("wrong return type", "any", methodBinding3.getReturnType().getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// assertTrue("A constructor", !methodBinding3.isConstructor()); //$NON-NLS-1$ - assertTrue("The binding is not canonical", parameters3[0] == methodBinding3.getReturnType()); //$NON-NLS-1$ - } - - /** - * i++; IVariableBinding - */ - public void test0173() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0173", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("Not an expressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression ex = expressionStatement.getExpression(); - assertTrue("Not a postfixexpression", ex instanceof PostfixExpression); //$NON-NLS-1$ - PostfixExpression postfixExpression = (PostfixExpression) ex; - Expression expr = postfixExpression.getOperand(); - assertTrue("Not a simpleName", expr instanceof SimpleName); //$NON-NLS-1$ - SimpleName name = (SimpleName) expr; - assertTrue("a declaration", !name.isDeclaration()); //$NON-NLS-1$ - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2; - List fragments = variableDeclarationStatement.fragments(); - assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - assertTrue(variableBinding == binding); - } - - /** - * i++; IVariableBinding (field) - */ - public void test0174() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0174", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 1, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("Not an expressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression ex = expressionStatement.getExpression(); - assertTrue("Not a postfixexpression", ex instanceof PostfixExpression); //$NON-NLS-1$ - PostfixExpression postfixExpression = (PostfixExpression) ex; - Expression expr = postfixExpression.getOperand(); - assertTrue("Not a simpleName", expr instanceof SimpleName); //$NON-NLS-1$ - SimpleName name = (SimpleName) expr; - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node2; - List fragments = fieldDeclaration.fragments(); - assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - assertTrue(variableBinding == binding); - } - - /** - * int i = 0; Test IntBinding for the field declaration and the 0 literal - */ - public void test0175() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0175", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node2; - List fragments = fieldDeclaration.fragments(); - assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - ITypeBinding typeBinding = fragment.getInitializer().resolveTypeBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertEquals("Not Number", "Number", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * i++; IVariableBinding - */ - public void test0177() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0177", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 1, 1); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("Not an expressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression ex = expressionStatement.getExpression(); - assertTrue("Not a postfixexpression", ex instanceof PostfixExpression); //$NON-NLS-1$ - PostfixExpression postfixExpression = (PostfixExpression) ex; - Expression expr = postfixExpression.getOperand(); - assertTrue("Not a simpleName", expr instanceof SimpleName); //$NON-NLS-1$ - SimpleName name = (SimpleName) expr; - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 1, 0); - assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2; - List fragments = variableDeclarationStatement.fragments(); - assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - assertEquals("return type is not Number", "Number", variableBinding.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue(variableBinding == binding); - } -// -// /** -// * SuperReference -// */ -// public void test0178() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0178", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// ASTNode node2 = getASTNode((JavaScriptUnit) result, 1, 0, 0); -// assertTrue("Return statement", node2 instanceof ReturnStatement); //$NON-NLS-1$ -// ReturnStatement returnStatement = (ReturnStatement) node2; -// Expression expr = returnStatement.getExpression(); -// assertTrue("Not a field access", expr instanceof SuperFieldAccess); //$NON-NLS-1$ -// SuperFieldAccess fieldAccess = (SuperFieldAccess) expr; -// ITypeBinding typeBinding = fieldAccess.resolveTypeBinding(); -// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ -// assertTrue("Not a primitive type", typeBinding.isPrimitive()); //$NON-NLS-1$ -// assertEquals("Not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// } - - /** - * Allocation expression - */ - public void test0179() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0179", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2; - List fragments = variableDeclarationStatement.fragments(); - assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - Expression initialization = fragment.getInitializer(); - ITypeBinding typeBinding = initialization.resolveTypeBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertTrue(variableBinding.getType() == typeBinding); - } - -// /** -// * Allocation expression -// */ -// public void test0180() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0180", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0); -// assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$ -// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2; -// List fragments = variableDeclarationStatement.fragments(); -// assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$ -// VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); -// IVariableBinding variableBinding = fragment.resolveBinding(); -// Expression initialization = fragment.getInitializer(); -// assertTrue("No an array creation", initialization instanceof ArrayCreation); //$NON-NLS-1$ -// ITypeBinding typeBinding = initialization.resolveTypeBinding(); -// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ -// assertTrue("Not an array", typeBinding.isArray()); //$NON-NLS-1$ -// assertTrue(variableBinding.getType() == typeBinding); -// } -// -// /** -// * Allocation expression -// */ -// public void test0181() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0181", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0); -// assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$ -// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2; -// List fragments = variableDeclarationStatement.fragments(); -// assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$ -// VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); -// IVariableBinding variableBinding = fragment.resolveBinding(); -// Expression initialization = fragment.getInitializer(); -// ITypeBinding typeBinding = initialization.resolveTypeBinding(); -// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ -// assertTrue("Not an array", typeBinding.isArray()); //$NON-NLS-1$ -// assertTrue(variableBinding.getType() == typeBinding); -// } - - /** - * BinaryExpression - */ - public void test0182() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0182", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertTrue("IfStatement", node2 instanceof IfStatement); //$NON-NLS-1$ - IfStatement ifStatement = (IfStatement) node2; - Expression expr = ifStatement.getExpression(); - assertNotNull("No condition", expr); //$NON-NLS-1$ - ITypeBinding typeBinding = expr.resolveTypeBinding(); - assertNotNull("No binding", typeBinding); //$NON-NLS-1$ - assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - checkSourceRange(expr, "i < 10", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression - */ - public void test0183() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0183", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertTrue("IfStatement", node2 instanceof IfStatement); //$NON-NLS-1$ - IfStatement ifStatement = (IfStatement) node2; - Expression expr = ifStatement.getExpression(); - assertNotNull("No condition", expr); //$NON-NLS-1$ - ITypeBinding typeBinding = expr.resolveTypeBinding(); - assertNotNull("No binding", typeBinding); //$NON-NLS-1$ - assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - checkSourceRange(expr, "i < 10 && i < 20", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression - */ - public void test0184() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0184", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertTrue("IfStatement", node2 instanceof IfStatement); //$NON-NLS-1$ - IfStatement ifStatement = (IfStatement) node2; - Expression expr = ifStatement.getExpression(); - assertNotNull("No condition", expr); //$NON-NLS-1$ - ITypeBinding typeBinding = expr.resolveTypeBinding(); - assertNotNull("No binding", typeBinding); //$NON-NLS-1$ - assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - checkSourceRange(expr, "i < 10 || i < 20", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression - */ - public void test0185() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0185", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertTrue("IfStatement", node2 instanceof IfStatement); //$NON-NLS-1$ - IfStatement ifStatement = (IfStatement) node2; - Expression expr = ifStatement.getExpression(); - assertNotNull("No condition", expr); //$NON-NLS-1$ - ITypeBinding typeBinding = expr.resolveTypeBinding(); - assertNotNull("No binding", typeBinding); //$NON-NLS-1$ - assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - checkSourceRange(expr, "i == 10", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression - */ - public void test0186() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0186", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertTrue("IfStatement", node2 instanceof IfStatement); //$NON-NLS-1$ - IfStatement ifStatement = (IfStatement) node2; - Expression expr = ifStatement.getExpression(); - assertNotNull("No condition", expr); //$NON-NLS-1$ - ITypeBinding typeBinding = expr.resolveTypeBinding(); - assertNotNull("No binding", typeBinding); //$NON-NLS-1$ - assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - checkSourceRange(expr, "o == o", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression - */ - public void test0187() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0187", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertTrue("IfStatement", node2 instanceof WhileStatement); //$NON-NLS-1$ - WhileStatement whileStatement = (WhileStatement) node2; - Expression expr = whileStatement.getExpression(); - assertNotNull("No condition", expr); //$NON-NLS-1$ - ITypeBinding typeBinding = expr.resolveTypeBinding(); - assertNotNull("No binding", typeBinding); //$NON-NLS-1$ - assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - checkSourceRange(expr, "i <= 10", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression - */ - public void test0188() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0188", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 2); - assertTrue("DoStatement", node2 instanceof DoStatement); //$NON-NLS-1$ - DoStatement statement = (DoStatement) node2; - Expression expr = statement.getExpression(); - assertNotNull("No condition", expr); //$NON-NLS-1$ - ITypeBinding typeBinding = expr.resolveTypeBinding(); - assertNotNull("No binding", typeBinding); //$NON-NLS-1$ - assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - checkSourceRange(expr, "i <= 10", source); //$NON-NLS-1$ - } - - /** - * BinaryExpression - */ - public void test0189() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0189", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("ForStatement", node2 instanceof ForStatement); //$NON-NLS-1$ - ForStatement statement = (ForStatement) node2; - Expression expr = statement.getExpression(); - assertNotNull("No condition", expr); //$NON-NLS-1$ - ITypeBinding typeBinding = expr.resolveTypeBinding(); - assertNotNull("No binding", typeBinding); //$NON-NLS-1$ - assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - checkSourceRange(expr, "i < 10", source); //$NON-NLS-1$ - } -// -// /** -// * BinaryExpression -// */ -// public void test0190() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0190", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 2, 1); -// assertTrue("IfStatement", node2 instanceof IfStatement); //$NON-NLS-1$ -// IfStatement statement = (IfStatement) node2; -// Expression expr = statement.getExpression(); -// assertNotNull("No condition", expr); //$NON-NLS-1$ -// ITypeBinding typeBinding = expr.resolveTypeBinding(); -// assertNotNull("No binding", typeBinding); //$NON-NLS-1$ -// assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// checkSourceRange(expr, "scanner.x < selection.start && selection.start < scanner.y", source); //$NON-NLS-1$ -// } - - /** - * BinaryExpression - */ - public void test0191() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0191", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node2; - Expression ex = expressionStatement.getExpression(); - assertTrue("Assignment", ex instanceof Assignment); //$NON-NLS-1$ - Assignment statement = (Assignment) ex; - Expression rightExpr = statement.getRightHandSide(); - assertTrue("Not an infix expression", rightExpr instanceof InfixExpression); //$NON-NLS-1$ - InfixExpression infixExpression = (InfixExpression) rightExpr; - Expression expr = infixExpression.getRightOperand(); - assertNotNull("No right hand side expression", expr); //$NON-NLS-1$ - ITypeBinding typeBinding = expr.resolveTypeBinding(); - assertNotNull("No binding", typeBinding); //$NON-NLS-1$ - assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - checkSourceRange(expr, "2 < 20", source); //$NON-NLS-1$ - } - - /** - * Initializer - */ - public void test0192() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0192", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2; - List fragments = variableDeclarationStatement.fragments(); - assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - Expression initialization = fragment.getInitializer(); - ITypeBinding typeBinding = initialization.resolveTypeBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertTrue(variableBinding.getType() == typeBinding); - checkSourceRange(initialization, "0", source); //$NON-NLS-1$ - } - -// /** -// * Initializer -// */ -// public void test0193() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0193", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 1, 0); -// assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$ -// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2; -// List fragments = variableDeclarationStatement.fragments(); -// assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$ -// VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); -// IVariableBinding variableBinding = fragment.resolveBinding(); -// Expression initialization = fragment.getInitializer(); -// ITypeBinding typeBinding = initialization.resolveTypeBinding(); -// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ -// assertTrue(variableBinding.getType() == typeBinding); -// checkSourceRange(initialization, "new Inner()", source); //$NON-NLS-1$ -// assertEquals("Wrong type", "Inner", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// } -// -// /** -// * Initializer -// */ -// public void test0194() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0194", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 1, 0); -// assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$ -// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2; -// List fragments = variableDeclarationStatement.fragments(); -// assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$ -// VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); -// IVariableBinding variableBinding = fragment.resolveBinding(); -// Expression initialization = fragment.getInitializer(); -// ITypeBinding typeBinding = initialization.resolveTypeBinding(); -// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ -// assertTrue(variableBinding.getType() == typeBinding); -// checkSourceRange(initialization, "new Inner[10]", source); //$NON-NLS-1$ -// assertTrue("Not an array", typeBinding.isArray()); //$NON-NLS-1$ -// assertEquals("Wrong type", "Inner[]", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// } - -// /** -// * Initializer -// */ -// public void test0195() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0195", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// ASTNode node2 = getASTNode((JavaScriptUnit) result, 1, 0, 1); -// assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$ -// ExpressionStatement expressionStatement = (ExpressionStatement) node2; -// Expression ex = expressionStatement.getExpression(); -// assertTrue("FunctionInvocation", ex instanceof FunctionInvocation); //$NON-NLS-1$ -// FunctionInvocation methodInvocation = (FunctionInvocation) ex; -// checkSourceRange(methodInvocation, "a.useFile(/*]*/a.getFile()/*[*/)", source); //$NON-NLS-1$ -// List list = methodInvocation.arguments(); -// assertTrue("Parameter list not empty", list.size() == 1); //$NON-NLS-1$ -// Expression parameter = (Expression) list.get(0); -// assertTrue("Not a method invocation", parameter instanceof FunctionInvocation); //$NON-NLS-1$ -// ITypeBinding typeBinding = parameter.resolveTypeBinding(); -// assertNotNull("No binding", typeBinding); //$NON-NLS-1$ -// assertEquals("Not a boolean", "File", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// checkSourceRange(parameter, "a.getFile()", source); //$NON-NLS-1$ -// } - -// /** -// * Initializer -// */ -// public void test0196() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0196", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 1, 2); -// assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$ -// ExpressionStatement expressionStatement = (ExpressionStatement) node2; -// Expression ex = expressionStatement.getExpression(); -// assertTrue("Assignment", ex instanceof Assignment); //$NON-NLS-1$ -// Assignment statement = (Assignment) ex; -// Expression rightExpr = statement.getRightHandSide(); -// assertTrue("Not an instanceof expression", rightExpr instanceof InstanceofExpression); //$NON-NLS-1$ -// ITypeBinding typeBinding = rightExpr.resolveTypeBinding(); -// assertNotNull("No binding", typeBinding); //$NON-NLS-1$ -// assertEquals("wrong type", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// checkSourceRange(rightExpr, "inner instanceof Inner", source); //$NON-NLS-1$ -// } -// -// /** -// * Initializer -// */ -// public void test0197() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0197", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); -// JavaScriptUnit unit = (JavaScriptUnit) result; -// assertProblemsSize(unit, 0); -// ASTNode node2 = getASTNode(unit, 1, 0, 1); -// assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$ -// ExpressionStatement expressionStatement = (ExpressionStatement) node2; -// Expression ex = expressionStatement.getExpression(); -// assertTrue("FunctionInvocation", ex instanceof FunctionInvocation); //$NON-NLS-1$ -// FunctionInvocation methodInvocation = (FunctionInvocation) ex; -// checkSourceRange(methodInvocation, "a.getFile()/*[*/.getName()", source); //$NON-NLS-1$ -// Expression receiver = methodInvocation.getExpression(); -// assertTrue("Not a method invocation", receiver instanceof FunctionInvocation); //$NON-NLS-1$ -// FunctionInvocation methodInvocation2 = (FunctionInvocation) receiver; -// ITypeBinding typeBinding = methodInvocation2.resolveTypeBinding(); -// assertNotNull("No binding", typeBinding); //$NON-NLS-1$ -// assertEquals("Wrong name", "File", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// checkSourceRange(methodInvocation2, "a.getFile()", source); //$NON-NLS-1$ -// } - - /** - * Initializer - */ - public void test0198() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0198", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("ReturnStatement", node2 instanceof ReturnStatement); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node2; - Expression expr = returnStatement.getExpression(); - assertTrue("Not an infixExpression", expr instanceof InfixExpression); //$NON-NLS-1$ - InfixExpression infixExpression = (InfixExpression) expr; - Expression left = infixExpression.getLeftOperand(); - assertTrue("Not an InfixExpression", left instanceof InfixExpression); //$NON-NLS-1$ - InfixExpression infixExpression2 = (InfixExpression) left; - Expression right = infixExpression2.getRightOperand(); - assertTrue("Not an InfixExpression", right instanceof InfixExpression); //$NON-NLS-1$ - InfixExpression infixExpression3 = (InfixExpression) right; - assertEquals("A multiplication", InfixExpression.Operator.TIMES, infixExpression3.getOperator()); //$NON-NLS-1$ - ITypeBinding typeBinding = infixExpression3.resolveTypeBinding(); - assertNotNull("No binding", typeBinding); //$NON-NLS-1$ - assertEquals("Not Number", "Number", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - checkSourceRange(infixExpression3, "20 * 30", source); //$NON-NLS-1$ - } - - /** - * Initializer - */ - public void test0199() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0199", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2; - List fragments = variableDeclarationStatement.fragments(); - assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression initialization = fragment.getInitializer(); - assertTrue("Not an infixExpression", initialization instanceof InfixExpression); //$NON-NLS-1$ - InfixExpression infixExpression = (InfixExpression) initialization; - Expression left = infixExpression.getLeftOperand(); - assertTrue("Not an InfixExpression", left instanceof InfixExpression); //$NON-NLS-1$ - InfixExpression infixExpression2 = (InfixExpression) left; - Expression right = infixExpression2.getRightOperand(); - assertTrue("Not an InfixExpression", right instanceof InfixExpression); //$NON-NLS-1$ - InfixExpression infixExpression3 = (InfixExpression) right; - assertEquals("A multiplication", InfixExpression.Operator.TIMES, infixExpression3.getOperator()); //$NON-NLS-1$ - ITypeBinding typeBinding = infixExpression3.resolveTypeBinding(); - assertNotNull("No binding", typeBinding); //$NON-NLS-1$ - assertEquals("Not Number", "Number", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - checkSourceRange(infixExpression3, "10 * 30", source); //$NON-NLS-1$ - } -// -// /** -// * Initializer -// */ -// public void test0200() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0200", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// ASTNode node2 = getASTNode((JavaScriptUnit) result, 1, 0, 0); -// assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$ -// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2; -// List fragments = variableDeclarationStatement.fragments(); -// assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$ -// VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); -// Expression initialization = fragment.getInitializer(); -// assertTrue("Not an infixExpression", initialization instanceof FieldAccess); //$NON-NLS-1$ -// FieldAccess fieldAccess = (FieldAccess) initialization; -// Expression receiver = fieldAccess.getExpression(); -// assertTrue("ArrayCreation", receiver instanceof ArrayCreation); //$NON-NLS-1$ -// ArrayCreation arrayCreation = (ArrayCreation) receiver; -// List dimensions = arrayCreation.dimensions(); -// assertEquals("Wrong dimension", 1, dimensions.size()); //$NON-NLS-1$ -// Expression dim = (Expression) dimensions.get(0); -// assertTrue("InfixExpression", dim instanceof InfixExpression); //$NON-NLS-1$ -// InfixExpression infixExpression = (InfixExpression) dim; -// ITypeBinding typeBinding = infixExpression.resolveTypeBinding(); -// assertNotNull("No binding", typeBinding); //$NON-NLS-1$ -// assertEquals("Not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// checkSourceRange(infixExpression, "1 + 2", source); //$NON-NLS-1$ -// } - - /** - * Position inside for statement: PR 3300 - */ - public void test0201() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0201", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertTrue("ForStatement", node2 instanceof ForStatement); //$NON-NLS-1$ - ForStatement forStatement = (ForStatement) node2; - List initializers = forStatement.initializers(); - assertTrue("wrong size", initializers.size() == 1); //$NON-NLS-1$ - Expression init = (Expression) initializers.get(0); - checkSourceRange(init, "var i= 0", source); //$NON-NLS-1$ - } - - /** - * PR 7386 - */ - public void test0202() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0202", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node2; - checkSourceRange(fieldDeclaration, "var f= (2);", source); //$NON-NLS-1$ - List fragments = fieldDeclaration.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression initialization = fragment.getInitializer(); - assertTrue("Not a parenthesized expression", initialization instanceof ParenthesizedExpression); //$NON-NLS-1$ - checkSourceRange(initialization, "(2)", source); //$NON-NLS-1$ - ITypeBinding typeBinding = initialization.resolveTypeBinding(); - assertNotNull("no binding", typeBinding); //$NON-NLS-1$ - assertEquals("not Number", "Number", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * PR 7386 - */ - public void test0203() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0203", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node2; - checkSourceRange(fieldDeclaration, "var f= (2);", source); //$NON-NLS-1$ - List fragments = fieldDeclaration.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression initialization = fragment.getInitializer(); - assertTrue("Not a parenthesized expression", initialization instanceof ParenthesizedExpression); //$NON-NLS-1$ - ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) initialization; - checkSourceRange(parenthesizedExpression, "(2)", source); //$NON-NLS-1$ - Expression expr = parenthesizedExpression.getExpression(); - checkSourceRange(expr, "2", source); //$NON-NLS-1$ - ITypeBinding typeBinding = expr.resolveTypeBinding(); - assertNotNull("no binding", typeBinding); //$NON-NLS-1$ - assertEquals("not Number", "Number", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// assertTrue("type binding is canonical", typeBinding == parenthesizedExpression.resolveTypeBinding()); //$NON-NLS-1$ - } - - /** - * PR 7386 - */ - public void test0204() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0204", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node2; - checkSourceRange(fieldDeclaration, "var f= ((2));", source); //$NON-NLS-1$ - List fragments = fieldDeclaration.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression initialization = fragment.getInitializer(); - assertTrue("Not a parenthesized expression", initialization instanceof ParenthesizedExpression); //$NON-NLS-1$ - ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) initialization; - checkSourceRange(parenthesizedExpression, "((2))", source); //$NON-NLS-1$ - Expression expr = parenthesizedExpression.getExpression(); - assertTrue("Not a parenthesized expression", expr instanceof ParenthesizedExpression); //$NON-NLS-1$ - ParenthesizedExpression parenthesizedExpression2 = (ParenthesizedExpression) expr; - checkSourceRange(parenthesizedExpression2, "(2)", source); //$NON-NLS-1$ - expr = parenthesizedExpression2.getExpression(); - checkSourceRange(expr, "2", source); //$NON-NLS-1$ - ITypeBinding typeBinding = expr.resolveTypeBinding(); - assertNotNull("no binding", typeBinding); //$NON-NLS-1$ - assertEquals("not Number", "Number", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - typeBinding = parenthesizedExpression.resolveTypeBinding(); - assertNotNull("no binding", typeBinding); //$NON-NLS-1$ - assertEquals("not Number", "Number", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// assertTrue("type binding is canonical", typeBinding == parenthesizedExpression2.resolveTypeBinding()); //$NON-NLS-1$ - } - - -// /** -// * Local class end position when trailing comment -// * @deprecated using deprecated code -// */ -// public void test0205() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0205", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0); -// assertTrue("TypeDeclarationStatement", node2 instanceof TypeDeclarationStatement); //$NON-NLS-1$ -// TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) node2; -// TypeDeclaration typeDeclaration = typeDeclarationStatement.getTypeDeclaration(); -// assertEquals("wrong name", "AA", typeDeclaration.getName().getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$ -// checkSourceRange(typeDeclaration, "class AA extends Test {}", source); //$NON-NLS-1$ -// } - -// /** -// * QualifiedName -// */ -// public void test0206() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0206", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 5, 0); -// assertTrue("ReturnStatement", node2 instanceof ReturnStatement); //$NON-NLS-1$ -// ReturnStatement returnStatement = (ReturnStatement) node2; -// Expression expr = returnStatement.getExpression(); -// assertTrue("Not a qualifiedName", expr instanceof QualifiedName); //$NON-NLS-1$ -// QualifiedName qualifiedName = (QualifiedName) expr; -// ITypeBinding typeBinding = expr.resolveTypeBinding(); -// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ -// assertEquals("Not an int (typeBinding)", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// checkSourceRange(qualifiedName, "field1.field2.field3.field4.i", source); //$NON-NLS-1$ -// assertTrue("Not a simple name", qualifiedName.getName().isSimpleName()); //$NON-NLS-1$ -// SimpleName simpleName = qualifiedName.getName(); -// assertTrue("a declaration", !simpleName.isDeclaration()); //$NON-NLS-1$ -// checkSourceRange(simpleName, "i", source); //$NON-NLS-1$ -// ITypeBinding typeBinding2 = simpleName.resolveTypeBinding(); -// assertNotNull("No typebinding2", typeBinding2); //$NON-NLS-1$ -// assertEquals("Not an int (typeBinding2)", "int", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// IBinding binding = simpleName.resolveBinding(); -// assertNotNull("No binding", binding); //$NON-NLS-1$ -// assertTrue("VariableBinding", binding instanceof IVariableBinding); //$NON-NLS-1$ -// IVariableBinding variableBinding = (IVariableBinding) binding; -// assertEquals("Not Test", "Test", variableBinding.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// assertEquals("Not default", Modifier.PUBLIC, variableBinding.getModifiers()); //$NON-NLS-1$ -// Name qualifierName = qualifiedName.getQualifier(); -// assertTrue("Not a qualified name", qualifierName.isQualifiedName()); //$NON-NLS-1$ -// checkSourceRange(qualifierName, "field1.field2.field3.field4", source); //$NON-NLS-1$ -// ITypeBinding typeBinding5 = qualifierName.resolveTypeBinding(); -// assertNotNull("No binding5", typeBinding5); //$NON-NLS-1$ -// assertEquals("Not Test", "Test", typeBinding5.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// -// qualifiedName = (QualifiedName) qualifierName; -// simpleName = qualifiedName.getName(); -// checkSourceRange(simpleName, "field4", source); //$NON-NLS-1$ -// ITypeBinding typeBinding6 = simpleName.resolveTypeBinding(); -// assertNotNull("No binding6", typeBinding6); //$NON-NLS-1$ -// assertEquals("Not Test", "Test", typeBinding6.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// -// qualifierName = qualifiedName.getQualifier(); -// assertTrue("Not a qualified name", qualifierName.isQualifiedName()); //$NON-NLS-1$ -// checkSourceRange(qualifierName, "field1.field2.field3", source); //$NON-NLS-1$ -// ITypeBinding typeBinding7 = qualifierName.resolveTypeBinding(); -// assertNotNull("No binding7", typeBinding7); //$NON-NLS-1$ -// assertEquals("Not Test", "Test", typeBinding7.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// -// qualifiedName = (QualifiedName) qualifierName; -// simpleName = qualifiedName.getName(); -// checkSourceRange(simpleName, "field3", source); //$NON-NLS-1$ -// qualifierName = qualifiedName.getQualifier(); -// assertTrue("Not a qualified name", qualifierName.isQualifiedName()); //$NON-NLS-1$ -// checkSourceRange(qualifierName, "field1.field2", source); //$NON-NLS-1$ -// ITypeBinding typeBinding3 = qualifierName.resolveTypeBinding(); -// assertNotNull("No binding3", typeBinding3); //$NON-NLS-1$ -// assertEquals("Not Test", "Test", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// qualifiedName = (QualifiedName) qualifierName; -// simpleName = qualifiedName.getName(); -// checkSourceRange(simpleName, "field2", source); //$NON-NLS-1$ -// qualifierName = qualifiedName.getQualifier(); -// assertTrue("Not a simple name", qualifierName.isSimpleName()); //$NON-NLS-1$ -// assertTrue("a declaration", !((SimpleName)qualifierName).isDeclaration()); //$NON-NLS-1$ -// checkSourceRange(qualifierName, "field1", source); //$NON-NLS-1$ -// ITypeBinding typeBinding4 = qualifierName.resolveTypeBinding(); -// assertNotNull("No binding4", typeBinding4); //$NON-NLS-1$ -// assertEquals("Not Test", "Test", typeBinding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// } -// - /** - * Check javadoc for FunctionDeclaration - * @deprecated marking deprecated since using deprecated code - */ - public void test0207() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0207", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - JSdoc actualJavadoc = ((FunctionDeclaration) node).getJavadoc(); - JSdoc javadoc = this.ast.newJSdoc(); - javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/ - assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$ - checkSourceRange(node, "/** JavaDoc Comment*/\n function foo( i) {}", source); //$NON-NLS-1$ - checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$ - } - - /** - * Check javadoc for FunctionDeclaration - */ - public void test0208() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0208", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - JSdoc actualJavadoc = ((FunctionDeclaration) node).getJavadoc(); - assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ - checkSourceRange(node, "function foo( i) {}", source); //$NON-NLS-1$ - } - - /** - * Check javadoc for FunctionDeclaration - */ - public void test0209() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0209", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - JSdoc actualJavadoc = ((FunctionDeclaration) node).getJavadoc(); - assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ - checkSourceRange(node, "function foo( i) {}", source); //$NON-NLS-1$ - } - - /** - * Check javadoc for VariableDeclarationStatement - * @deprecated marking deprecated since using deprecated code - */ - public void test0210() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0210", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - JSdoc actualJavadoc = ((VariableDeclarationStatement) node).getJavadoc(); - JSdoc javadoc = this.ast.newJSdoc(); - javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/ - assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$ - checkSourceRange(node, "/** JavaDoc Comment*/\n var i;", source); //$NON-NLS-1$ - } - - /** - * Check javadoc for VariableDeclarationStatement - */ - public void test0211() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0211", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - JSdoc actualJavadoc = ((VariableDeclarationStatement) node).getJavadoc(); - assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ - checkSourceRange(node, "var i;", source); //$NON-NLS-1$ - } - - /** - * Check javadoc for VariableDeclarationStatement - */ - public void test0212() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0212", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - JSdoc actualJavadoc = ((VariableDeclarationStatement) node).getJavadoc(); - assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ - checkSourceRange(node, "var i;", source); //$NON-NLS-1$ - } - - /** - * Check javadoc for TypeDeclaration - */ - public void test0213() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0213", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0,0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - assertTrue("The node is not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - JSdoc actualJavadoc = ((VariableDeclarationStatement) node).getJavadoc(); - assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ - String expectedContents = "" +//$NON-NLS-1$ - "var i;" +//$NON-NLS-1$ - "";//$NON-NLS-1$ - checkSourceRange(node, expectedContents, source); //$NON-NLS-1$ } - } - -// /** -// * Check javadoc for TypeDeclaration -// */ -// public void test0214() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0214", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ -// Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc(); -// assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ -// String expectedContents = "public class Test {\n" +//$NON-NLS-1$ -// " int i;\n" +//$NON-NLS-1$ -// "}";//$NON-NLS-1$ -// checkSourceRange(node, expectedContents, source); //$NON-NLS-1$ -// } -// -// /** -// * Check javadoc for TypeDeclaration -// * @deprecated marking deprecated since using deprecated code -// */ -// public void test0215() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0215", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ -// Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc(); -// Javadoc javadoc = this.ast.newJavadoc(); -// javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/ -// assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$ -// String expectedContents = -// "/** JavaDoc Comment*/\n" + //$NON-NLS-1$ -// "public class Test {\n" +//$NON-NLS-1$ -// " int i;\n" +//$NON-NLS-1$ -// "}";//$NON-NLS-1$ -// checkSourceRange(node, expectedContents, source); //$NON-NLS-1$ -// checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$ -// } - -// /** -// * Check javadoc for MemberTypeDeclaration -// * @deprecated marking deprecated since using deprecated code -// */ -// public void test0216() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0216", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ -// Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc(); -// Javadoc javadoc = this.ast.newJavadoc(); -// javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/ -// assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$ -// String expectedContents = -// "/** JavaDoc Comment*/\n" + //$NON-NLS-1$ -// " class B {}";//$NON-NLS-1$ -// checkSourceRange(node, expectedContents, source); //$NON-NLS-1$ -// checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$ -// } -// -// /** -// * Check javadoc for MemberTypeDeclaration -// */ -// public void test0217() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0217", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ -// Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc(); -// assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ -// checkSourceRange(node, "class B {}", source); //$NON-NLS-1$ -// } -// -// /** -// * Check javadoc for MemberTypeDeclaration -// */ -// public void test0218() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0218", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ -// Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc(); -// assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ -// checkSourceRange(node, "public static class B {}", source); //$NON-NLS-1$ -// } - -// /** -// * Check javadoc for MemberTypeDeclaration -// */ -// public void test0219() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0219", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ -// Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc(); -// assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$ -// checkSourceRange(node, "public static class B {}", source); //$NON-NLS-1$ -// } -// -// /** -// * Checking initializers -// */ -// public void test0220() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0220", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// checkSourceRange(node, "{}", source); //$NON-NLS-1$ -// } - -// /** -// * Checking initializers -// */ -// public void test0221() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0221", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// checkSourceRange(node, "static {}", source); //$NON-NLS-1$ -// } - -// /** -// * Checking initializers -// * @deprecated marking deprecated since using deprecated code -// */ -// public void test0222() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0222", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// Javadoc actualJavadoc = ((Initializer) node).getJavadoc(); -// assertNotNull("Javadoc comment should no be null", actualJavadoc); //$NON-NLS-1$ -// Javadoc javadoc = this.ast.newJavadoc(); -// javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/ -// assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$ -// String expectedContents = -// "/** JavaDoc Comment*/\n" + //$NON-NLS-1$ -// " static {}";//$NON-NLS-1$ -// checkSourceRange(node, expectedContents, source); //$NON-NLS-1$ -// checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$ -// -// } - -// /** -// * Checking initializers -// * @deprecated marking deprecated since using deprecated code -// */ -// public void test0223() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0223", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// Javadoc actualJavadoc = ((Initializer) node).getJavadoc(); -// assertNotNull("Javadoc comment should not be null", actualJavadoc); //$NON-NLS-1$ -// Javadoc javadoc = this.ast.newJavadoc(); -// javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/ -// assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$ -// String expectedContents = -// "/** JavaDoc Comment*/\n" + //$NON-NLS-1$ -// " {}";//$NON-NLS-1$ -// checkSourceRange(node, expectedContents, source); //$NON-NLS-1$ -// checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$ -// -// } - -// /** -// * Checking initializers -// */ -// public void test0224() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0224", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); -// assertNotNull("Expression should not be null", node); //$NON-NLS-1$ -// Javadoc actualJavadoc = ((Initializer) node).getJavadoc(); -// assertNull("Javadoc comment should be null", actualJavadoc); //$NON-NLS-1$ -// checkSourceRange(node, "{}", source); //$NON-NLS-1$ -// } - - /** - * Continue ==> ContinueStatement - */ - public void test0225() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0225", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - LabeledStatement labeledStatement = (LabeledStatement) getASTNode((JavaScriptUnit) result, 0, 0, 0); - checkSourceRange(labeledStatement.getLabel(), "label", source); //$NON-NLS-1$ - ForStatement forStatement = (ForStatement) labeledStatement.getBody(); - ContinueStatement statement = (ContinueStatement) ((Block) forStatement.getBody()).statements().get(0); - assertNotNull("Expression should not be null", statement); //$NON-NLS-1$ - ContinueStatement continueStatement = this.ast.newContinueStatement(); - continueStatement.setLabel(this.ast.newSimpleName("label")); //$NON-NLS-1$ - assertTrue("Both AST trees should be identical", continueStatement.subtreeMatch(new ASTMatcher(), statement)); //$NON-NLS-1$ - checkSourceRange(statement, "continue label;", source); //$NON-NLS-1$ - checkSourceRange(statement.getLabel(), "label", source); //$NON-NLS-1$ - } - - /** - * Break + label ==> BreakStatement - */ - public void test0226() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0226", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - LabeledStatement labeledStatement = (LabeledStatement) getASTNode((JavaScriptUnit) result, 0, 0, 0); - checkSourceRange(labeledStatement.getLabel(), "label", source); //$NON-NLS-1$ - ForStatement forStatement = (ForStatement) labeledStatement.getBody(); - BreakStatement statement = (BreakStatement) ((Block) forStatement.getBody()).statements().get(0); - assertNotNull("Expression should not be null", statement); //$NON-NLS-1$ - BreakStatement breakStatement = this.ast.newBreakStatement(); - breakStatement.setLabel(this.ast.newSimpleName("label")); //$NON-NLS-1$ - assertTrue("Both AST trees should be identical", breakStatement.subtreeMatch(new ASTMatcher(), statement)); //$NON-NLS-1$ - checkSourceRange(statement, "break label;", source); //$NON-NLS-1$ - checkSourceRange(statement.getLabel(), "label", source); //$NON-NLS-1$ - } - -// /** -// * QualifiedName -// */ -// public void test0227() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0227", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// ASTNode node2 = getASTNode((JavaScriptUnit) result, 3, 2, 0); -// assertTrue("ReturnStatement", node2 instanceof ReturnStatement); //$NON-NLS-1$ -// ReturnStatement returnStatement = (ReturnStatement) node2; -// Expression expr = returnStatement.getExpression(); -// assertTrue("Not a qualifiedName", expr instanceof QualifiedName); //$NON-NLS-1$ -// QualifiedName qualifiedName = (QualifiedName) expr; -// ITypeBinding typeBinding = expr.resolveTypeBinding(); -// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ -// assertEquals("Not an long (typeBinding)", "long", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// checkSourceRange(qualifiedName, "field.fB.fA.j", source); //$NON-NLS-1$ -// -// SimpleName simpleName = qualifiedName.getName(); -// checkSourceRange(simpleName, "j", source); //$NON-NLS-1$ -// ITypeBinding typeBinding2 = simpleName.resolveTypeBinding(); -// assertEquals("Not an long (typeBinding2)", "long", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// IBinding binding = simpleName.resolveBinding(); -// assertNotNull("No binding", binding); //$NON-NLS-1$ -// assertTrue("VariableBinding", binding instanceof IVariableBinding); //$NON-NLS-1$ -// IVariableBinding variableBinding = (IVariableBinding) binding; -// assertEquals("Not A", "A", variableBinding.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// assertEquals("Not default", Modifier.NONE, variableBinding.getModifiers()); //$NON-NLS-1$ -// assertEquals("wrong name", "j", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// -// Name qualifierName = qualifiedName.getQualifier(); -// assertTrue("Not a qualified name", qualifierName.isQualifiedName()); //$NON-NLS-1$ -// checkSourceRange(qualifierName, "field.fB.fA", source); //$NON-NLS-1$ -// qualifiedName = (QualifiedName) qualifierName; -// ITypeBinding typeBinding3 = qualifiedName.resolveTypeBinding(); -// assertNotNull("No type binding3", typeBinding3); //$NON-NLS-1$ -// assertEquals("Not an A", "A", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// simpleName = qualifiedName.getName(); -// checkSourceRange(simpleName, "fA", source); //$NON-NLS-1$ -// ITypeBinding typeBinding4 = simpleName.resolveTypeBinding(); -// assertNotNull("No typeBinding4", typeBinding4); //$NON-NLS-1$ -// assertEquals("Not an A", "A", typeBinding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// IBinding binding2 = qualifiedName.resolveBinding(); -// assertNotNull("No binding2", binding2); //$NON-NLS-1$ -// assertTrue("VariableBinding", binding2 instanceof IVariableBinding); //$NON-NLS-1$ -// IVariableBinding variableBinding2 = (IVariableBinding) binding2; -// assertEquals("Not B", "B", variableBinding2.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// assertEquals("Not default", Modifier.NONE, variableBinding2.getModifiers()); //$NON-NLS-1$ -// assertEquals("wrong name", "fA", variableBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// -// qualifierName = qualifiedName.getQualifier(); -// assertTrue("Not a qualified name", qualifierName.isQualifiedName()); //$NON-NLS-1$ -// checkSourceRange(qualifierName, "field.fB", source); //$NON-NLS-1$ -// qualifiedName = (QualifiedName) qualifierName; -// ITypeBinding typeBinding5 = qualifiedName.resolveTypeBinding(); -// assertNotNull("No typeBinding5", typeBinding5); //$NON-NLS-1$ -// assertEquals("Not a B", "B", typeBinding5.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// simpleName = qualifiedName.getName(); -// checkSourceRange(simpleName, "fB", source); //$NON-NLS-1$ -// ITypeBinding typeBinding6 = simpleName.resolveTypeBinding(); -// assertNotNull("No typebinding6", typeBinding6); //$NON-NLS-1$ -// assertEquals("not a B", "B", typeBinding6.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// IBinding binding3 = qualifiedName.resolveBinding(); -// assertNotNull("No binding2", binding3); //$NON-NLS-1$ -// assertTrue("VariableBinding", binding3 instanceof IVariableBinding); //$NON-NLS-1$ -// IVariableBinding variableBinding3 = (IVariableBinding) binding3; -// assertEquals("Not C", "C", variableBinding3.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// assertEquals("Not default", Modifier.NONE, variableBinding3.getModifiers()); //$NON-NLS-1$ -// assertEquals("wrong name", "fB", variableBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// -// qualifierName = qualifiedName.getQualifier(); -// assertTrue("Not a simple name", qualifierName.isSimpleName()); //$NON-NLS-1$ -// checkSourceRange(qualifierName, "field", source); //$NON-NLS-1$ -// simpleName = (SimpleName) qualifierName; -// ITypeBinding typeBinding7 = simpleName.resolveTypeBinding(); -// assertNotNull("No typeBinding7", typeBinding7); //$NON-NLS-1$ -// assertEquals("Not a C", "C", typeBinding7.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// IBinding binding4 = simpleName.resolveBinding(); -// assertNotNull("No binding4", binding4); //$NON-NLS-1$ -// assertTrue("VariableBinding", binding4 instanceof IVariableBinding); //$NON-NLS-1$ -// IVariableBinding variableBinding4 = (IVariableBinding) binding4; -// assertEquals("Not Test", "Test", variableBinding4.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// assertEquals("Not public", Modifier.PUBLIC, variableBinding4.getModifiers()); //$NON-NLS-1$ -// assertEquals("wrong name", "field", variableBinding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// assertEquals("wrong return type", "C", variableBinding4.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// } -// -// /** -// * QualifiedName as TypeReference -// */ -// public void test0228() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0228", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 1, 0); -// assertTrue("ReturnStatement", node2 instanceof ReturnStatement); //$NON-NLS-1$ -// ReturnStatement returnStatement = (ReturnStatement) node2; -// Expression expr = returnStatement.getExpression(); -// checkSourceRange(expr, "test0228.Test.foo()", source); //$NON-NLS-1$ -// assertTrue("FunctionInvocation", expr instanceof FunctionInvocation); //$NON-NLS-1$ -// FunctionInvocation methodInvocation = (FunctionInvocation) expr; -// Expression qualifier = methodInvocation.getExpression(); -// assertNotNull("no qualifier", qualifier); //$NON-NLS-1$ -// assertTrue("QualifiedName", qualifier instanceof QualifiedName); //$NON-NLS-1$ -// QualifiedName qualifiedName = (QualifiedName) qualifier; -// checkSourceRange(qualifiedName, "test0228.Test", source); //$NON-NLS-1$ -// ITypeBinding typeBinding = qualifiedName.resolveTypeBinding(); -// assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ -// assertEquals("Wrong type", "Test", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// IBinding binding = qualifiedName.resolveBinding(); -// assertNotNull("No binding", binding); //$NON-NLS-1$ -// assertEquals("Not a type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$ -// -// } - -// /** -// * FunctionInvocation -// */ -// public void test0229() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0229", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0); -// assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$ -// ExpressionStatement expressionStatement = (ExpressionStatement) node2; -// Expression expr = expressionStatement.getExpression(); -// assertTrue("FunctionInvocation", expr instanceof FunctionInvocation); //$NON-NLS-1$ -// checkSourceRange(expr, "System.err.println()", source); //$NON-NLS-1$ -// FunctionInvocation methodInvocation = (FunctionInvocation) expr; -// Expression qualifier = methodInvocation.getExpression(); -// assertTrue("QualifiedName", qualifier instanceof QualifiedName); //$NON-NLS-1$ -// QualifiedName qualifiedName = (QualifiedName) qualifier; -// ITypeBinding typeBinding = qualifier.resolveTypeBinding(); -// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ -// assertEquals("Wrong name", "PrintStream", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// IBinding binding = qualifiedName.resolveBinding(); -// assertNotNull("No binding", binding); //$NON-NLS-1$ -// assertTrue("VariableBinding", binding instanceof IVariableBinding); //$NON-NLS-1$ -// IVariableBinding variableBinding = (IVariableBinding) binding; -// assertEquals("wrong name", "err", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// SimpleName methodName = methodInvocation.getName(); -// IBinding binding2 = methodName.resolveBinding(); -// assertNotNull("No binding2", binding2); //$NON-NLS-1$ -// } - -// /** -// * FunctionInvocation -// */ -// public void test0230() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0230", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 1, 0); -// assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$ -// ExpressionStatement expressionStatement = (ExpressionStatement) node2; -// Expression expr = expressionStatement.getExpression(); -// assertTrue("FunctionInvocation", expr instanceof FunctionInvocation); //$NON-NLS-1$ -// checkSourceRange(expr, "err.println()", source); //$NON-NLS-1$ -// FunctionInvocation methodInvocation = (FunctionInvocation) expr; -// Expression qualifier = methodInvocation.getExpression(); -// assertTrue("SimpleName", qualifier instanceof SimpleName); //$NON-NLS-1$ -// SimpleName name = (SimpleName) qualifier; -// IBinding binding = name.resolveBinding(); -// assertNotNull("No binding", binding); //$NON-NLS-1$ -// assertEquals("Wrong name", "err", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// ITypeBinding typeBinding = name.resolveTypeBinding(); -// assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ -// assertEquals("Wron type name", "PrintStream", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// } - -// /** -// * FunctionInvocation -// */ -// public void test0231() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0231", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0); -// assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$ -// ExpressionStatement expressionStatement = (ExpressionStatement) node2; -// Expression expr = expressionStatement.getExpression(); -// assertTrue("FunctionInvocation", expr instanceof FunctionInvocation); //$NON-NLS-1$ -// checkSourceRange(expr, "System.err.println()", source); //$NON-NLS-1$ -// FunctionInvocation methodInvocation = (FunctionInvocation) expr; -// Expression qualifier = methodInvocation.getExpression(); -// assertTrue("QualifiedName", qualifier instanceof QualifiedName); //$NON-NLS-1$ -// QualifiedName qualifiedName = (QualifiedName) qualifier; -// ITypeBinding typeBinding = qualifier.resolveTypeBinding(); -// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ -// assertEquals("Wrong name", "PrintStream", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// IBinding binding = qualifiedName.resolveBinding(); -// assertNotNull("No binding", binding); //$NON-NLS-1$ -// assertTrue("VariableBinding", binding instanceof IVariableBinding); //$NON-NLS-1$ -// IVariableBinding variableBinding = (IVariableBinding) binding; -// assertEquals("wrong name", "err", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// SimpleName methodName = methodInvocation.getName(); -// IBinding binding2 = methodName.resolveBinding(); -// assertNotNull("No binding2", binding2); //$NON-NLS-1$ -// Name name = qualifiedName.getQualifier(); -// assertTrue("SimpleName", name.isSimpleName()); //$NON-NLS-1$ -// SimpleName simpleName = (SimpleName) name; -// ITypeBinding typeBinding2 = simpleName.resolveTypeBinding(); -// assertNotNull("No typeBinding2", typeBinding2); //$NON-NLS-1$ -// assertEquals("wrong type name", "System", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// } - -// /** -// * FunctionInvocation -// */ -// public void test0232() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0232", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0); -// assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$ -// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2; -// List fragments = variableDeclarationStatement.fragments(); -// assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ -// VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); -// Expression initialization = variableDeclarationFragment.getInitializer(); -// ITypeBinding typeBinding = initialization.resolveTypeBinding(); -// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ -// assertTrue("Not a primitive type", typeBinding.isPrimitive()); //$NON-NLS-1$ -// assertEquals("wrong name", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// assertTrue("QualifiedName", initialization instanceof QualifiedName); //$NON-NLS-1$ -// QualifiedName qualifiedName = (QualifiedName) initialization; -// SimpleName simpleName = qualifiedName.getName(); -// ITypeBinding typeBinding2 = simpleName.resolveTypeBinding(); -// assertNotNull("No type binding", typeBinding2); //$NON-NLS-1$ -// assertTrue("Not a primitive type", typeBinding2.isPrimitive()); //$NON-NLS-1$ -// assertEquals("wrong name", "int", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// IBinding binding = simpleName.resolveBinding(); -// assertNotNull("No binding", binding); //$NON-NLS-1$ -// assertTrue("IVariableBinding", binding instanceof IVariableBinding); //$NON-NLS-1$ -// IVariableBinding variableBinding = (IVariableBinding) binding; -// assertNull("No declaring class", variableBinding.getDeclaringClass()); //$NON-NLS-1$ -// } - -// /** -// * Checking that only syntax errors are reported for the MALFORMED tag -// */ -// public void test0233() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0233", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("Expression should not be null", result); //$NON-NLS-1$ -// assertTrue("The compilation unit is malformed", !isMalformed(result)); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// JavaScriptUnit unit = (JavaScriptUnit) result; -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); -// assertTrue("The fiels is not malformed", !isMalformed(node)); //$NON-NLS-1$ -// assertEquals("No problem found", 1, unit.getMessages().length); //$NON-NLS-1$ -// assertEquals("No problem found", 1, unit.getProblems().length); //$NON-NLS-1$ -// } -// -// /** -// * Checking that null is returned for a resolveBinding if the type is unknown -// */ -// public void test0234() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0234", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); -// assertTrue("The fiels is not malformed", !isMalformed(node)); //$NON-NLS-1$ -// JavaScriptUnit unit = (JavaScriptUnit) result; -// assertEquals("No problem found", 1, unit.getMessages().length); //$NON-NLS-1$ -// assertEquals("No problem found", 1, unit.getProblems().length); //$NON-NLS-1$ -// assertTrue("VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ -// VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node; -// List fragments = fieldDeclaration.fragments(); -// assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ -// VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); -// IVariableBinding variableBinding = fragment.resolveBinding(); -// assertNull("binding not null", variableBinding); //$NON-NLS-1$ -// } - - /** - * Checking that null is returned for a resolveBinding if the type is unknown - */ - public void test0235() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0235", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("The fiels is not malformed", !isMalformed(node)); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("problems found", 0, unit.getMessages().length); //$NON-NLS-1$ - assertEquals("problems found", 0, unit.getProblems().length); //$NON-NLS-1$ - assertTrue("VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node; - List fragments = fieldDeclaration.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); //$NON-NLS-1$ - } - - /** - * Test the removal of a IField inside a CU that has an initializer - */ - public void test0236() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0236", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// IType type = sourceUnit.getType("Test"); //$NON-NLS-1$ -// assertNotNull("No type", type); //$NON-NLS-1$ - IField field = sourceUnit.getField("i"); //$NON-NLS-1$ - assertNotNull("No field", field); //$NON-NLS-1$ - field.delete(true, null); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=9452 - */ - public void test0237() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "junit.framework", "TestCase.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - } - -// /** -// * Check ThisExpression -// * @deprecated using deprecated code -// */ -// public void test0238() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0238", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// char[] source = sourceUnit.getSource().toCharArray(); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); -// assertTrue("Not a type declaration statement", node instanceof TypeDeclarationStatement); //$NON-NLS-1$ -// TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) node; -// TypeDeclaration typeDecl = typeDeclarationStatement.getTypeDeclaration(); -// Object o = typeDecl.bodyDeclarations().get(0); -// assertTrue("Not a method", o instanceof FunctionDeclaration); //$NON-NLS-1$ -// FunctionDeclaration methodDecl = (FunctionDeclaration) o; -// Block block = methodDecl.getBody(); -// List statements = block.statements(); -// assertEquals("Not 1", 1, statements.size()); //$NON-NLS-1$ -// Statement stmt = (Statement) statements.get(0); -// assertTrue("Not a return statement", stmt instanceof ReturnStatement); //$NON-NLS-1$ -// ReturnStatement returnStatement = (ReturnStatement) stmt; -// Expression expr = returnStatement.getExpression(); -// assertTrue("Not a method invocation", expr instanceof FunctionInvocation); //$NON-NLS-1$ -// FunctionInvocation methodInvocation = (FunctionInvocation) expr; -// checkSourceRange(methodInvocation, "Test.this.bar()", source); //$NON-NLS-1$ -// Expression qualifier = methodInvocation.getExpression(); -// assertTrue("Not a ThisExpression", qualifier instanceof ThisExpression); //$NON-NLS-1$ -// ThisExpression thisExpression = (ThisExpression) qualifier; -// Name name = thisExpression.getQualifier(); -// IBinding binding = name.resolveBinding(); -// assertNotNull("No binding", binding); //$NON-NLS-1$ -// assertEquals("wrong name", "Test", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// } -// -// /** -// * Check ThisExpression -// * @deprecated using deprecated code -// */ -// public void test0239() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0239", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0, 0); -// assertTrue("Not a type declaration statement", node instanceof TypeDeclarationStatement); //$NON-NLS-1$ -// TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) node; -// TypeDeclaration typeDecl = typeDeclarationStatement.getTypeDeclaration(); -// Object o = typeDecl.bodyDeclarations().get(0); -// assertTrue("Not a method", o instanceof FunctionDeclaration); //$NON-NLS-1$ -// FunctionDeclaration methodDecl = (FunctionDeclaration) o; -// Block block = methodDecl.getBody(); -// List statements = block.statements(); -// assertEquals("Not 1", 1, statements.size()); //$NON-NLS-1$ -// Statement stmt = (Statement) statements.get(0); -// assertTrue("Not a return statement", stmt instanceof ReturnStatement); //$NON-NLS-1$ -// ReturnStatement returnStatement = (ReturnStatement) stmt; -// Expression expr = returnStatement.getExpression(); -// assertTrue("Not a SuperMethodInvocation", expr instanceof SuperMethodInvocation); //$NON-NLS-1$ -// SuperMethodInvocation superMethodInvocation = (SuperMethodInvocation) expr; -// Name name = superMethodInvocation.getQualifier(); -// IBinding binding = name.resolveBinding(); -// assertNotNull("No binding", binding); //$NON-NLS-1$ -// assertTrue("A type binding", binding instanceof ITypeBinding); //$NON-NLS-1$ -// assertEquals("Not Test", "Test", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// Name methodName = superMethodInvocation.getName(); -// IBinding binding2 = methodName.resolveBinding(); -// assertNotNull("No binding2", binding2); //$NON-NLS-1$ -// assertTrue("No an IFunctionBinding", binding2 instanceof IFunctionBinding); //$NON-NLS-1$ -// IFunctionBinding methodBinding = (IFunctionBinding) binding2; -// assertEquals("Not bar", "bar", methodBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// assertEquals("Not T", "T", methodBinding.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// } - -// /** -// * Check FieldAccess -// * @deprecated using deprecated code -// */ -// public void test0240() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0240", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); -// assertTrue("Not a type declaration statement", node instanceof TypeDeclarationStatement); //$NON-NLS-1$ -// TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) node; -// TypeDeclaration typeDecl = typeDeclarationStatement.getTypeDeclaration(); -// Object o = typeDecl.bodyDeclarations().get(0); -// assertTrue("Not a method", o instanceof FunctionDeclaration); //$NON-NLS-1$ -// FunctionDeclaration methodDecl = (FunctionDeclaration) o; -// Block block = methodDecl.getBody(); -// List statements = block.statements(); -// assertEquals("Not 1", 1, statements.size()); //$NON-NLS-1$ -// Statement stmt = (Statement) statements.get(0); -// assertTrue("Not a return statement", stmt instanceof ReturnStatement); //$NON-NLS-1$ -// ReturnStatement returnStatement = (ReturnStatement) stmt; -// Expression expr = returnStatement.getExpression(); -// assertTrue("Not a field access", expr instanceof FieldAccess); //$NON-NLS-1$ -// FieldAccess fieldAccess = (FieldAccess) expr; -// Expression qualifier = fieldAccess.getExpression(); -// assertTrue("Not a ThisExpression", qualifier instanceof ThisExpression); //$NON-NLS-1$ -// ThisExpression thisExpression = (ThisExpression) qualifier; -// Name name = thisExpression.getQualifier(); -// IBinding binding = name.resolveBinding(); -// assertNotNull("No binding", binding); //$NON-NLS-1$ -// assertEquals("Not Test", "Test", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// Name fieldName = fieldAccess.getName(); -// IBinding binding2 = fieldName.resolveBinding(); -// assertNotNull("No binding2", binding2); //$NON-NLS-1$ -// assertEquals("Wrong name", "f", binding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// assertEquals("Wrong modifier", Modifier.PUBLIC, binding2.getModifiers()); //$NON-NLS-1$ -// ITypeBinding typeBinding = fieldName.resolveTypeBinding(); -// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ -// assertEquals("Not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// } -// - /** - * Check order of body declarations - */ - public void test0241() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0241", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// ASTNode node = getASTNode((JavaScriptUnit) result, 0); -// assertTrue("Not a type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$ -// assertTrue("Not a declaration", ((TypeDeclaration) node).getName().isDeclaration()); //$NON-NLS-1$ -// assertEquals("Wrong size", 11, ((TypeDeclaration)node).bodyDeclarations().size()); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a field declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - node = getASTNode((JavaScriptUnit) result, 0, 1); - assertTrue("Not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ -// node = getASTNode((JavaScriptUnit) result, 0, 2); -// assertTrue("Not a Type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$ -// node = getASTNode((JavaScriptUnit) result, 0, 3); -// assertTrue("Not a Type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - node = getASTNode((JavaScriptUnit) result, 0, 2); - assertTrue("Not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - node = getASTNode((JavaScriptUnit) result, 0, 3); - assertTrue("Not a field declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - node = getASTNode((JavaScriptUnit) result, 0, 4); - assertTrue("Not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - node = getASTNode((JavaScriptUnit) result, 0, 5); - assertTrue("Not a field declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - node = getASTNode((JavaScriptUnit) result, 0, 6); - assertTrue("Not a field declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - node = getASTNode((JavaScriptUnit) result, 0, 7); - assertTrue("Not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ -// node = getASTNode((JavaScriptUnit) result, 0, 10); -// assertTrue("Not a Type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - } - -// /** -// * Check ThisExpression -// * @deprecated using deprecated code -// */ -// public void test0242() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0242", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0, 0); -// assertTrue("Not a type declaration statement", node instanceof TypeDeclarationStatement); //$NON-NLS-1$ -// TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) node; -// TypeDeclaration typeDecl = typeDeclarationStatement.getTypeDeclaration(); -// Object o = typeDecl.bodyDeclarations().get(0); -// assertTrue("Not a method", o instanceof FunctionDeclaration); //$NON-NLS-1$ -// FunctionDeclaration methodDecl = (FunctionDeclaration) o; -// Block block = methodDecl.getBody(); -// List statements = block.statements(); -// assertEquals("Not 1", 1, statements.size()); //$NON-NLS-1$ -// Statement stmt = (Statement) statements.get(0); -// assertTrue("Not a return statement", stmt instanceof ReturnStatement); //$NON-NLS-1$ -// ReturnStatement returnStatement = (ReturnStatement) stmt; -// Expression expr = returnStatement.getExpression(); -// assertTrue("Not a SuperFieldAccess", expr instanceof SuperFieldAccess); //$NON-NLS-1$ -// SuperFieldAccess superFieldAccess = (SuperFieldAccess) expr; -// Name name = superFieldAccess.getQualifier(); -// IBinding binding = name.resolveBinding(); -// assertNotNull("No binding", binding); //$NON-NLS-1$ -// assertTrue("A type binding", binding instanceof ITypeBinding); //$NON-NLS-1$ -// assertEquals("Not Test", "Test", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// Name fieldName = superFieldAccess.getName(); -// IBinding binding2 = fieldName.resolveBinding(); -// assertNotNull("No binding2", binding2); //$NON-NLS-1$ -// assertTrue("No an IVariableBinding", binding2 instanceof IVariableBinding); //$NON-NLS-1$ -// IVariableBinding variableBinding = (IVariableBinding) binding2; -// assertEquals("Not f", "f", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// assertEquals("Not T", "T", variableBinding.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// ITypeBinding typeBinding2 = fieldName.resolveTypeBinding(); -// assertNotNull("No type binding", typeBinding2); //$NON-NLS-1$ -// assertEquals("Not int", "int", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// } - - /** - * Check catch clause positions: - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10570 - */ - public void test0243() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0243", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("Not a try statement", node instanceof TryStatement); //$NON-NLS-1$ - TryStatement tryStatement = (TryStatement) node; - List catchClauses = tryStatement.catchClauses(); - assertEquals("wrong size", 1, catchClauses.size()); //$NON-NLS-1$ - CatchClause catchClause = (CatchClause) catchClauses.get(0); - checkSourceRange(catchClause, "catch (e){m();}", source); //$NON-NLS-1$ - } - - /** - * Check catch clause positions: - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10570 - */ - public void test0244() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0244", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("Not a try statement", node instanceof TryStatement); //$NON-NLS-1$ - TryStatement tryStatement = (TryStatement) node; - List catchClauses = tryStatement.catchClauses(); - assertEquals("wrong size", 1, catchClauses.size()); //$NON-NLS-1$ - CatchClause catchClause = (CatchClause) catchClauses.get(0); - checkSourceRange(catchClause, "catch (e){m();}", source); //$NON-NLS-1$ -// catchClause = (CatchClause) catchClauses.get(1); -// checkSourceRange(catchClause, "catch(e) {}", source); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=10587 - */ - public void test0245() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0245", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node; - Expression expr = returnStatement.getExpression(); - assertTrue("not a name", expr instanceof Name); //$NON-NLS-1$ - Name name = (Name) expr; - IBinding binding = name.resolveBinding(); - assertTrue("Not a variable binding", binding instanceof IVariableBinding); //$NON-NLS-1$ - IVariableBinding variableBinding = (IVariableBinding) binding; - assertEquals("Not i", "i", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Not Number", "Number", variableBinding.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - ASTNode declaringNode = unit.findDeclaringNode(variableBinding); - assertNotNull("No declaring node", declaringNode); //$NON-NLS-1$ - assertTrue("Not a VariableDeclarationFragment", declaringNode instanceof VariableDeclarationFragment); //$NON-NLS-1$ - } - -// /** -// * Test binding resolution for import declaration -// */ -// public void test0246() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0246", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// JavaScriptUnit unit = (JavaScriptUnit) result; -// List imports = unit.imports(); -// assertEquals("wrong imports size", 2, imports.size()); //$NON-NLS-1$ -// ImportDeclaration importDeclaration = (ImportDeclaration) imports.get(0); -// assertTrue("Not on demand", importDeclaration.isOnDemand()); //$NON-NLS-1$ -// checkSourceRange(importDeclaration, "import java.util.*;", source); //$NON-NLS-1$ -// IBinding binding = importDeclaration.resolveBinding(); -// assertNotNull("No binding", binding); //$NON-NLS-1$ -// assertEquals("Wrong type", IBinding.PACKAGE, binding.getKind()); //$NON-NLS-1$ -// assertEquals("Wrong name", "java.util", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// importDeclaration = (ImportDeclaration) imports.get(1); -// assertTrue("On demand", !importDeclaration.isOnDemand()); //$NON-NLS-1$ -// checkSourceRange(importDeclaration, "import java.io.IOException;", source); //$NON-NLS-1$ -// binding = importDeclaration.resolveBinding(); -// assertNotNull("No binding", binding); //$NON-NLS-1$ -// assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$ -// assertEquals("Wrong name", "IOException", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// } -// -// /** -// * Test binding resolution for import declaration -// */ -// public void test0247() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0247", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// JavaScriptUnit unit = (JavaScriptUnit) result; -// PackageDeclaration packageDeclaration = unit.getPackage(); -// checkSourceRange(packageDeclaration, "package test0247;", source); //$NON-NLS-1$ -// IPackageBinding binding = packageDeclaration.resolveBinding(); -// assertNotNull("No binding", binding); //$NON-NLS-1$ -// assertEquals("Wrong type", IBinding.PACKAGE, binding.getKind()); //$NON-NLS-1$ -// assertEquals("Wrong name", "test0247", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10592 - */ - public void test0248() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0248", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - List parameters = methodDeclaration.parameters(); - assertEquals("wrong size", 1, parameters.size()); //$NON-NLS-1$ - SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0); - Name name = singleVariableDeclaration.getName(); - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertTrue("Not a variable binding", binding instanceof IVariableBinding); //$NON-NLS-1$ - IVariableBinding variableBinding = (IVariableBinding) binding; - assertEquals("Wrong name", "i", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Wrong type", "any", variableBinding.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - -// /** -// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10592 -// */ -// public void test0249() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0249", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 2, 1); -// assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ -// ExpressionStatement expressionStatement = (ExpressionStatement) node; -// Expression expression = expressionStatement.getExpression(); -// assertTrue("Not an assignment", expression instanceof Assignment); //$NON-NLS-1$ -// Assignment assignment = (Assignment) expression; -// Expression leftHandSide = assignment.getLeftHandSide(); -// assertTrue("Not a qualified name", leftHandSide instanceof QualifiedName); //$NON-NLS-1$ -// QualifiedName qualifiedName = (QualifiedName) leftHandSide; -// Name simpleName = qualifiedName.getName(); -// IBinding binding = simpleName.resolveBinding(); -// assertNotNull("no binding", binding); //$NON-NLS-1$ -// assertTrue("Not a IVariableBinding", binding instanceof IVariableBinding); //$NON-NLS-1$ -// IVariableBinding variableBinding = (IVariableBinding) binding; -// assertEquals("Wrong name", "k", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// assertEquals("Wrong modifier", Modifier.STATIC, variableBinding.getModifiers()); //$NON-NLS-1$ -// assertEquals("Wrong type", "int", variableBinding.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// assertEquals("Wrong declaring class name", "j", variableBinding.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// } -// -// /** -// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10592 -// */ -// public void test0250() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0250", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); -// assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ -// FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; -// List parameters = methodDeclaration.parameters(); -// assertEquals("wrong size", 2, parameters.size()); //$NON-NLS-1$ -// SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0); -// Name name = singleVariableDeclaration.getName(); -// IBinding binding = name.resolveBinding(); -// assertNotNull("No binding", binding); //$NON-NLS-1$ -// assertTrue("Not a variable binding", binding instanceof IVariableBinding); //$NON-NLS-1$ -// IVariableBinding variableBinding = (IVariableBinding) binding; -// assertEquals("Wrong name", "i", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// assertEquals("Wrong type", "int", variableBinding.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// } -// -// /** -// * Check qualified name resolution for static fields -// */ -// public void test0251() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0251", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); -// assertTrue("Not a ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ -// ExpressionStatement expressionStatement = (ExpressionStatement) node; -// Expression expression = expressionStatement.getExpression(); -// assertTrue("Not a method invocation", expression instanceof FunctionInvocation); //$NON-NLS-1$ -// FunctionInvocation methodInvocation = (FunctionInvocation) expression; -// checkSourceRange(methodInvocation, "java.lang.System.out.println()", source); //$NON-NLS-1$ -// Expression qualifier = methodInvocation.getExpression(); -// assertTrue("Not a qualified name", qualifier instanceof QualifiedName); //$NON-NLS-1$ -// checkSourceRange(qualifier, "java.lang.System.out", source); //$NON-NLS-1$ -// QualifiedName qualifiedName = (QualifiedName) qualifier; -// Name typeName = qualifiedName.getQualifier(); -// assertTrue("Not a QualifiedName", typeName instanceof QualifiedName); //$NON-NLS-1$ -// QualifiedName qualifiedTypeName = (QualifiedName) typeName; -// IBinding binding = qualifiedTypeName.getName().resolveBinding(); -// assertNotNull("No binding", binding); //$NON-NLS-1$ -// assertEquals("Wrong name", "System", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// binding = qualifiedTypeName.getQualifier().resolveBinding(); -// assertNotNull("No binding2", binding); //$NON-NLS-1$ -// assertEquals("Wrong type binding", IBinding.PACKAGE, binding.getKind()); //$NON-NLS-1$ -// } -// -// /** -// * Check binding for anonymous class -// */ -// public void test0252() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0252", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); -// assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$ -// ReturnStatement returnStatement = (ReturnStatement) node; -// Expression expression = returnStatement.getExpression(); -// assertTrue("Not a classinstancecreation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$ -// ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression; -// IFunctionBinding methodBinding = classInstanceCreation.resolveConstructorBinding(); -// assertNotNull("No methodBinding", methodBinding); //$NON-NLS-1$ -// assertTrue("Not a constructor", methodBinding.isConstructor()); //$NON-NLS-1$ -// assertTrue("Not an anonymous class", methodBinding.getDeclaringClass().isAnonymous()); //$NON-NLS-1$ -// assertEquals("Not an anonymous class of java.lang.Object", "Object", methodBinding.getDeclaringClass().getSuperclass().getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// assertEquals("Not an anonymous class of java.lang.Object", "java.lang", methodBinding.getDeclaringClass().getSuperclass().getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// } - - /** - * Check binding for allocation expression - */ - public void test0253() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0253", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node; - Expression expression = returnStatement.getExpression(); - assertTrue("Not a classinstancecreation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression; - IFunctionBinding methodBinding = classInstanceCreation.resolveConstructorBinding(); - assertNotNull("No methodBinding", methodBinding); //$NON-NLS-1$ - assertTrue("Not a constructor", methodBinding.isConstructor()); //$NON-NLS-1$ -// assertEquals("Wrong size", 1, methodBinding.getParameterTypes().length); //$NON-NLS-1$ -// assertEquals("Wrong type", "String", methodBinding.getParameterTypes()[0].getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - -// /** -// * Check binding for allocation expression -// */ -// public void test0254() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0254", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 1, 0); -// assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$ -// ReturnStatement returnStatement = (ReturnStatement) node; -// Expression expression = returnStatement.getExpression(); -// assertTrue("Not a class instance creation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$ -// ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression; -// IFunctionBinding binding = classInstanceCreation.resolveConstructorBinding(); -// assertNotNull("No binding", binding); //$NON-NLS-1$ -// assertEquals("wrong type", "C", binding.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// } - - -// /** -// * Check binding for allocation expression -// */ -// public void test0255() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0255", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); -// assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ -// ExpressionStatement expressionStatement = (ExpressionStatement) node; -// Expression expression = expressionStatement.getExpression(); -// assertTrue("Not a FunctionInvocation", expression instanceof FunctionInvocation); //$NON-NLS-1$ -// FunctionInvocation methodInvocation = (FunctionInvocation) expression; -// List arguments = methodInvocation.arguments(); -// assertEquals("wrong size", 1, arguments.size()); //$NON-NLS-1$ -// Expression expression2 = (Expression) arguments.get(0); -// assertTrue("Not a CastExpression", expression2 instanceof CastExpression); //$NON-NLS-1$ -// CastExpression castExpression = (CastExpression) expression2; -// Type type = castExpression.getType(); -// ITypeBinding binding = type.resolveBinding(); -// assertNotNull("No binding", binding); //$NON-NLS-1$ -// assertTrue("Not an array type", binding.isArray()); //$NON-NLS-1$ -// } - -// /** -// * Check binding for allocation expression -// */ -// public void test0256() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0256", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); -// assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ -// ExpressionStatement expressionStatement = (ExpressionStatement) node; -// Expression expression = expressionStatement.getExpression(); -// assertTrue("Not a FunctionInvocation", expression instanceof FunctionInvocation); //$NON-NLS-1$ -// FunctionInvocation methodInvocation = (FunctionInvocation) expression; -// List arguments = methodInvocation.arguments(); -// assertEquals("wrong size", 1, arguments.size()); //$NON-NLS-1$ -// Expression expression2 = (Expression) arguments.get(0); -// assertTrue("Not a CastExpression", expression2 instanceof CastExpression); //$NON-NLS-1$ -// CastExpression castExpression = (CastExpression) expression2; -// Type type = castExpression.getType(); -// assertTrue("Not a simple type", type.isSimpleType()); //$NON-NLS-1$ -// SimpleType simpleType = (SimpleType) type; -// ITypeBinding binding = type.resolveBinding(); -// assertNotNull("No binding", binding); //$NON-NLS-1$ -// assertTrue("Not a class", binding.isClass()); //$NON-NLS-1$ -// Name name = simpleType.getName(); -// IBinding binding2 = name.resolveBinding(); -// assertNotNull("No binding2", binding2); //$NON-NLS-1$ -// assertEquals("Wrong type", "Object", binding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// } -// -// /** -// * Check binding for allocation expression -// */ -// public void test0257() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0257", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); -// assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ -// ExpressionStatement expressionStatement = (ExpressionStatement) node; -// Expression expression = expressionStatement.getExpression(); -// assertTrue("Not a FunctionInvocation", expression instanceof FunctionInvocation); //$NON-NLS-1$ -// FunctionInvocation methodInvocation = (FunctionInvocation) expression; -// List arguments = methodInvocation.arguments(); -// assertEquals("wrong size", 1, arguments.size()); //$NON-NLS-1$ -// Expression expression2 = (Expression) arguments.get(0); -// assertTrue("Not a CastExpression", expression2 instanceof CastExpression); //$NON-NLS-1$ -// CastExpression castExpression = (CastExpression) expression2; -// Type type = castExpression.getType(); -// assertTrue("Not a primitive type", type.isPrimitiveType()); //$NON-NLS-1$ -// PrimitiveType primitiveType = (PrimitiveType) type; -// assertEquals("Not int", PrimitiveType.INT, primitiveType.getPrimitiveTypeCode()); //$NON-NLS-1$ -// } - -// /** -// * Check binding for allocation expression -// */ -// public void test0258() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0258", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); -// assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ -// ExpressionStatement expressionStatement = (ExpressionStatement) node; -// Expression expression = expressionStatement.getExpression(); -// assertTrue("Not a FunctionInvocation", expression instanceof FunctionInvocation); //$NON-NLS-1$ -// FunctionInvocation methodInvocation = (FunctionInvocation) expression; -// List arguments = methodInvocation.arguments(); -// assertEquals("wrong size", 1, arguments.size()); //$NON-NLS-1$ -// Expression expression2 = (Expression) arguments.get(0); -// assertTrue("Not a CastExpression", expression2 instanceof CastExpression); //$NON-NLS-1$ -// CastExpression castExpression = (CastExpression) expression2; -// Type type = castExpression.getType(); -// assertTrue("Not a simple type", type.isSimpleType()); //$NON-NLS-1$ -// SimpleType simpleType = (SimpleType) type; -// ITypeBinding binding = type.resolveBinding(); -// assertNotNull("No binding", binding); //$NON-NLS-1$ -// assertTrue("Not a class", binding.isClass()); //$NON-NLS-1$ -// Name name = simpleType.getName(); -// IBinding binding2 = name.resolveBinding(); -// assertNotNull("No binding2", binding2); //$NON-NLS-1$ -// assertEquals("Wrong type", "Object", binding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10663 - */ - public void test0259() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0259", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - } -// -// /** -// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10592 -// */ -// public void test0260() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0260", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); -// assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ -// FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; -// List parameters = methodDeclaration.parameters(); -// assertEquals("wrong size", 2, parameters.size()); //$NON-NLS-1$ -// SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0); -// IBinding binding = singleVariableDeclaration.resolveBinding(); -// assertNotNull("No binding", binding); //$NON-NLS-1$ -// Name name = singleVariableDeclaration.getName(); -// assertTrue("Not a simple name", name instanceof SimpleName); //$NON-NLS-1$ -// SimpleName simpleName = (SimpleName) name; -// assertEquals("Wrong name", "i", simpleName.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$ -// IBinding binding2 = name.resolveBinding(); -// assertNotNull("No binding", binding2); //$NON-NLS-1$ -// assertTrue("binding == binding2", binding == binding2); //$NON-NLS-1$ -// assertTrue("Not a variable binding", binding2 instanceof IVariableBinding); //$NON-NLS-1$ -// IVariableBinding variableBinding = (IVariableBinding) binding2; -// assertEquals("Wrong name", "i", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// assertEquals("Wrong type", "int", variableBinding.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10676 - */ - public void test0262() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0262", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expr = expressionStatement.getExpression(); - assertTrue("Not a FunctionInvocation", expr instanceof FunctionInvocation); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expr; - List arguments = methodInvocation.arguments(); - assertEquals("Wrong argument list size", 1, arguments.size()); //$NON-NLS-1$ - Expression expr2 = (Expression) arguments.get(0); - assertTrue("Not a class instance creation", expr2 instanceof ClassInstanceCreation); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expr2; - arguments = classInstanceCreation.arguments(); - assertEquals("Wrong size", 1, arguments.size()); //$NON-NLS-1$ - Expression expression2 = (Expression) arguments.get(0); - assertTrue("Not a string literal", expression2 instanceof StringLiteral); //$NON-NLS-1$ - StringLiteral stringLiteral = (StringLiteral) expression2; - ITypeBinding typeBinding = stringLiteral.resolveTypeBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "String", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10700 - */ - public void test0263() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0263", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expr = expressionStatement.getExpression(); - assertTrue("Not a FunctionInvocation", expr instanceof FunctionInvocation); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expr; - List arguments = methodInvocation.arguments(); - assertEquals("Wrong argument list size", 1, arguments.size()); //$NON-NLS-1$ - Expression expr2 = (Expression) arguments.get(0); - assertTrue("Not a simple name", expr2 instanceof SimpleName); //$NON-NLS-1$ - SimpleName simpleName = (SimpleName) expr2; - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10699 - */ -// public void test0264() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0264", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// JavaScriptUnit compilationUnit = (JavaScriptUnit) result; -// ASTNode node = getASTNode(compilationUnit, 0, 0, 0); -// assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ -// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; -// List fragments = variableDeclarationStatement.fragments(); -// assertEquals("Wrong fragment size", 1, fragments.size()); //$NON-NLS-1$ -// VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); -// Expression expression = variableDeclarationFragment.getInitializer(); -// assertTrue("Not a classinstancecreation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$ -// ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression; -// AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration(); -// assertNotNull("No anonymousclassdeclaration", anonymousClassDeclaration); //$NON-NLS-1$ -// String expectedSourceRange = -// "{\n"+ //$NON-NLS-1$ -// " void m(int k){\n"+ //$NON-NLS-1$ -// " k= i;\n"+ //$NON-NLS-1$ -// " }\n"+ //$NON-NLS-1$ -// " }"; //$NON-NLS-1$ -// checkSourceRange(anonymousClassDeclaration, expectedSourceRange, source); -// List bodyDeclarations = anonymousClassDeclaration.bodyDeclarations(); -// assertEquals("Wrong size", 1, bodyDeclarations.size()); //$NON-NLS-1$ -// BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); -// assertTrue("Not a method declaration", bodyDeclaration instanceof FunctionDeclaration); //$NON-NLS-1$ -// FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration; -// assertEquals("Wrong name", "m", methodDeclaration.getName().getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$ -// } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10698 - */ - public void test0265() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0265", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - } - -// /** -// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10759 -// */ -// public void test0266() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0266", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// JavaScriptUnit compilationUnit = (JavaScriptUnit) result; -// ASTNode node = getASTNode(compilationUnit, 0, 1, 0); -// assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ -// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; -// Type type = variableDeclarationStatement.getType(); -// checkSourceRange(type, "Inner\\u005b]", source); //$NON-NLS-1$ -// assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$ -// ArrayType arrayType = (ArrayType) type; -// Type type2 = arrayType.getElementType(); -// assertTrue("Not a simple type", type2.isSimpleType()); //$NON-NLS-1$ -// SimpleType simpleType = (SimpleType) type2; -// checkSourceRange(simpleType, "Inner", source); //$NON-NLS-1$ -// Name name = simpleType.getName(); -// assertTrue("not a simple name", name.isSimpleName()); //$NON-NLS-1$ -// SimpleName simpleName = (SimpleName) name; -// checkSourceRange(simpleName, "Inner", source); //$NON-NLS-1$ -// } -// -// /** -// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10759 -// */ -// public void test0267() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0267", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// JavaScriptUnit compilationUnit = (JavaScriptUnit) result; -// ASTNode node = getASTNode(compilationUnit, 0, 1, 0); -// assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ -// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; -// Type type = variableDeclarationStatement.getType(); -// checkSourceRange(type, "Inner[]", source); //$NON-NLS-1$ -// assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$ -// ArrayType arrayType = (ArrayType) type; -// Type type2 = arrayType.getElementType(); -// assertTrue("Not a simple type", type2.isSimpleType()); //$NON-NLS-1$ -// SimpleType simpleType = (SimpleType) type2; -// checkSourceRange(simpleType, "Inner", source); //$NON-NLS-1$ -// Name name = simpleType.getName(); -// assertTrue("not a simple name", name.isSimpleName()); //$NON-NLS-1$ -// SimpleName simpleName = (SimpleName) name; -// checkSourceRange(simpleName, "Inner", source); //$NON-NLS-1$ -// } -// -// /** -// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10759 -// */ -// public void test0268() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0268", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// JavaScriptUnit compilationUnit = (JavaScriptUnit) result; -// ASTNode node = getASTNode(compilationUnit, 0, 1, 0); -// assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ -// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; -// Type type = variableDeclarationStatement.getType(); -// checkSourceRange(type, "test0268.Test.Inner[]", source); //$NON-NLS-1$ -// assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$ -// ArrayType arrayType = (ArrayType) type; -// Type type2 = arrayType.getElementType(); -// assertTrue("Not a simple type", type2.isSimpleType()); //$NON-NLS-1$ -// SimpleType simpleType = (SimpleType) type2; -// checkSourceRange(simpleType, "test0268.Test.Inner", source); //$NON-NLS-1$ -// Name name = simpleType.getName(); -// assertTrue("not a qualified name", name.isQualifiedName()); //$NON-NLS-1$ -// checkSourceRange(name, "test0268.Test.Inner", source); //$NON-NLS-1$ -// } -// -// /** -// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10759 -// */ -// public void test0269() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0269", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// JavaScriptUnit compilationUnit = (JavaScriptUnit) result; -// ASTNode node = getASTNode(compilationUnit, 0, 1, 0); -// assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ -// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; -// Type type = variableDeclarationStatement.getType(); -// checkSourceRange(type, "test0269.Test.Inner[/**/]", source); //$NON-NLS-1$ -// assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$ -// ArrayType arrayType = (ArrayType) type; -// Type type2 = arrayType.getElementType(); -// assertTrue("Not a simple type", type2.isSimpleType()); //$NON-NLS-1$ -// SimpleType simpleType = (SimpleType) type2; -// checkSourceRange(simpleType, "test0269.Test.Inner", source); //$NON-NLS-1$ -// Name name = simpleType.getName(); -// assertTrue("not a qualified name", name.isQualifiedName()); //$NON-NLS-1$ -// checkSourceRange(name, "test0269.Test.Inner", source); //$NON-NLS-1$ -// } -// -// /** -// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10759 -// */ -// public void test0270() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0270", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// JavaScriptUnit compilationUnit = (JavaScriptUnit) result; -// ASTNode node = getASTNode(compilationUnit, 0, 1, 0); -// assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ -// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; -// Type type = variableDeclarationStatement.getType(); -// checkSourceRange(type, "test0270.Test.Inner", source); //$NON-NLS-1$ -// assertTrue("Not a simple type", type.isSimpleType()); //$NON-NLS-1$ -// SimpleType simpleType = (SimpleType) type; -// Name name = simpleType.getName(); -// assertTrue("not a qualified name", name.isQualifiedName()); //$NON-NLS-1$ -// checkSourceRange(name, "test0270.Test.Inner", source); //$NON-NLS-1$ -// } -// -// /** -// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10759 -// */ -// public void test0271() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0271", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// JavaScriptUnit compilationUnit = (JavaScriptUnit) result; -// ASTNode node = getASTNode(compilationUnit, 0, 1, 0); -// assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ -// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; -// Type type = variableDeclarationStatement.getType(); -// checkSourceRange(type, "test0271.Test.Inner[]", source); //$NON-NLS-1$ -// assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$ -// ArrayType arrayType = (ArrayType) type; -// Type type2 = arrayType.getElementType(); -// assertTrue("Not a simple type", type2.isSimpleType()); //$NON-NLS-1$ -// SimpleType simpleType = (SimpleType) type2; -// checkSourceRange(simpleType, "test0271.Test.Inner", source); //$NON-NLS-1$ -// Name name = simpleType.getName(); -// assertTrue("not a qualified name", name.isQualifiedName()); //$NON-NLS-1$ -// checkSourceRange(name, "test0271.Test.Inner", source); //$NON-NLS-1$ -// } -// - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10843 - */ - public void test0272() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0272", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not a For statement", node instanceof ForStatement); //$NON-NLS-1$ - ForStatement forStatement = (ForStatement) node; - checkSourceRange(forStatement, "for (var i= 0; i < 10; i++) foo();", source); //$NON-NLS-1$ - Statement action = forStatement.getBody(); - checkSourceRange(action, "foo();", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10843 - */ - public void test0273() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0273", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not a For statement", node instanceof ForStatement); //$NON-NLS-1$ - ForStatement forStatement = (ForStatement) node; - checkSourceRange(forStatement, "for (var i= 0; i < 10; i++) { foo(); }", source); //$NON-NLS-1$ - Statement action = forStatement.getBody(); - checkSourceRange(action, "{ foo(); }", source); //$NON-NLS-1$ - assertTrue("Not a block", action instanceof Block); //$NON-NLS-1$ - Block block = (Block) action; - List statements = block.statements(); - assertEquals("Wrong size", 1, statements.size()); //$NON-NLS-1$ - Statement stmt = (Statement) statements.get(0); - checkSourceRange(stmt, "foo();", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10843 - */ - public void test0274() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0274", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 1); - assertTrue("Not a While statement", node instanceof WhileStatement); //$NON-NLS-1$ - WhileStatement whileStatement = (WhileStatement) node; - checkSourceRange(whileStatement, "while (i < 10) { foo(i++); }", source); //$NON-NLS-1$ - Statement action = whileStatement.getBody(); - checkSourceRange(action, "{ foo(i++); }", source); //$NON-NLS-1$ - assertTrue("Not a block", action instanceof Block); //$NON-NLS-1$ - Block block = (Block) action; - List statements = block.statements(); - assertEquals("Wrong size", 1, statements.size()); //$NON-NLS-1$ - Statement stmt = (Statement) statements.get(0); - checkSourceRange(stmt, "foo(i++);", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10843 - */ - public void test0275() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0275", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 1); - assertTrue("Not a While statement", node instanceof WhileStatement); //$NON-NLS-1$ - WhileStatement whileStatement = (WhileStatement) node; - checkSourceRange(whileStatement, "while (i < 10) foo(i++);", source); //$NON-NLS-1$ - Statement action = whileStatement.getBody(); - checkSourceRange(action, "foo(i++);", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10798 - */ - public void test0276() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0276", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - String expectedSource = - "function foo() {\n" + //$NON-NLS-1$ - " foo();\n" + //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(methodDeclaration, expectedSource, source); - expectedSource = - "{\n" + //$NON-NLS-1$ - " foo();\n" + //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(methodDeclaration.getBody(), expectedSource, source); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10798 - */ - public void test0277() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0277", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - String expectedSource = - "function foo() {\n" + //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(methodDeclaration, expectedSource, source); - expectedSource = - "{\n" + //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(methodDeclaration.getBody(), expectedSource, source); - } - -// /** -// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10861 -// */ -// public void test0278() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0278", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// JavaScriptUnit compilationUnit = (JavaScriptUnit) result; -// ASTNode node = getASTNode(compilationUnit, 0, 0); -// assertTrue("Not a Field declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ -// VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node; -// checkSourceRange(fieldDeclaration, "Class c = java.lang.String.class;", source); //$NON-NLS-1$ -// List fragments = fieldDeclaration.fragments(); -// assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ -// VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); -// Expression expression = variableDeclarationFragment.getInitializer(); -// assertTrue("Not a type literal", expression instanceof TypeLiteral); //$NON-NLS-1$ -// ITypeBinding typeBinding = expression.resolveTypeBinding(); -// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ -// assertEquals("Wrong name", "Class", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// } -// -// /** -// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10861 -// */ -// public void test0279() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0279", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// JavaScriptUnit compilationUnit = (JavaScriptUnit) result; -// ASTNode node = getASTNode(compilationUnit, 0, 0,0); -// assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ -// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; -// checkSourceRange(variableDeclarationStatement, "Class c = java.lang.String.class;", source); //$NON-NLS-1$ -// List fragments = variableDeclarationStatement.fragments(); -// assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ -// VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); -// Expression expression = variableDeclarationFragment.getInitializer(); -// assertTrue("Not a type literal", expression instanceof TypeLiteral); //$NON-NLS-1$ -// ITypeBinding typeBinding = expression.resolveTypeBinding(); -// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ -// assertEquals("Wrong name", "Class", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10865 - * Check well known types - */ - public void test0280() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0280", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - AST newAst = result.getAST(); - ITypeBinding typeBinding = newAst.resolveWellKnownType("Boolean"); //$NON-NLS-1$ - assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "Boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - typeBinding = newAst.resolveWellKnownType("String"); //$NON-NLS-1$ - assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "String", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - typeBinding = newAst.resolveWellKnownType("Number"); //$NON-NLS-1$ - assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "Number", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// typeBinding = newAst.resolveWellKnownType("short"); //$NON-NLS-1$ -// assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ -// assertEquals("Wrong name", "short", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// typeBinding = newAst.resolveWellKnownType("int"); //$NON-NLS-1$ -// assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ -// assertEquals("Wrong name", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// typeBinding = newAst.resolveWellKnownType("long"); //$NON-NLS-1$ -// assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ -// assertEquals("Wrong name", "long", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// typeBinding = newAst.resolveWellKnownType("float"); //$NON-NLS-1$ -// assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ -// assertEquals("Wrong name", "float", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// typeBinding = newAst.resolveWellKnownType("double"); //$NON-NLS-1$ -// assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ -// assertEquals("Wrong name", "double", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// typeBinding = newAst.resolveWellKnownType("void"); //$NON-NLS-1$ -// assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ -// assertEquals("Wrong name", "void", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// typeBinding = newAst.resolveWellKnownType("java.lang.Object"); //$NON-NLS-1$ -// assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ -// assertEquals("Wrong name", "Object", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// typeBinding = newAst.resolveWellKnownType("java.lang.String"); //$NON-NLS-1$ -// assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ -// assertEquals("Wrong name", "String", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// typeBinding = newAst.resolveWellKnownType("java.lang.StringBuffer"); //$NON-NLS-1$ -// assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ -// assertEquals("Wrong name", "StringBuffer", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// typeBinding = newAst.resolveWellKnownType("java.lang.Throwable"); //$NON-NLS-1$ -// assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ -// assertEquals("Wrong name", "Throwable", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// typeBinding = newAst.resolveWellKnownType("java.lang.Exception"); //$NON-NLS-1$ -// assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ -// assertEquals("Wrong name", "Exception", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// typeBinding = newAst.resolveWellKnownType("java.lang.RuntimeException"); //$NON-NLS-1$ -// assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ -// assertEquals("Wrong name", "RuntimeException", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// typeBinding = newAst.resolveWellKnownType("java.lang.Error"); //$NON-NLS-1$ -// assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ -// assertEquals("Wrong name", "Error", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// typeBinding = newAst.resolveWellKnownType("java.lang.Class"); //$NON-NLS-1$ -// assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$ -// assertEquals("Wrong name", "Class", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// typeBinding = newAst.resolveWellKnownType("java.lang.Runnable"); //$NON-NLS-1$ -// assertNull("typeBinding not null", typeBinding); //$NON-NLS-1$ -// typeBinding = newAst.resolveWellKnownType("java.lang.Cloneable"); //$NON-NLS-1$ -// assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$ -// typeBinding = newAst.resolveWellKnownType("java.io.Serializable"); //$NON-NLS-1$ -// assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$ -// typeBinding = newAst.resolveWellKnownType("java.lang.Boolean"); //$NON-NLS-1$ -// assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$ -// typeBinding = newAst.resolveWellKnownType("java.lang.Byte"); //$NON-NLS-1$ -// assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$ -// typeBinding = newAst.resolveWellKnownType("java.lang.Character"); //$NON-NLS-1$ -// assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$ -// typeBinding = newAst.resolveWellKnownType("java.lang.Double"); //$NON-NLS-1$ -// assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$ -// typeBinding = newAst.resolveWellKnownType("java.lang.Float"); //$NON-NLS-1$ -// assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$ -// typeBinding = newAst.resolveWellKnownType("java.lang.Integer"); //$NON-NLS-1$ -// assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$ -// typeBinding = newAst.resolveWellKnownType("java.lang.Long"); //$NON-NLS-1$ -// assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$ -// typeBinding = newAst.resolveWellKnownType("java.lang.Short"); //$NON-NLS-1$ -// assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$ -// typeBinding = newAst.resolveWellKnownType("java.lang.Void"); //$NON-NLS-1$ -// assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874 - */ - public void test0281() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0281", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a VariableDeclarationStatement declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node; - checkSourceRange(fieldDeclaration, "var o= /*]*/new Object()/*[*/;", source); //$NON-NLS-1$ - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - checkSourceRange(expression, "new Object()", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874 - */ - public void test0282() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0282", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a VariableDeclarationStatement declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node; - checkSourceRange(fieldDeclaration, "var b = /*]*/true/*[*/;", source); //$NON-NLS-1$ - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - checkSourceRange(expression, "true", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874 - */ - public void test0283() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0283", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a VariableDeclarationStatement declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node; - checkSourceRange(fieldDeclaration, "var c = /*]*/'c'/*[*/;", source); //$NON-NLS-1$ - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - checkSourceRange(expression, "'c'", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874 - */ - public void test0284() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0284", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a Field declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node; - checkSourceRange(fieldDeclaration, "var o = /*]*/null/*[*/;", source); //$NON-NLS-1$ - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - checkSourceRange(expression, "null", source); //$NON-NLS-1$ - } - -// /** -// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874 -// */ -// public void test0285() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0285", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// JavaScriptUnit compilationUnit = (JavaScriptUnit) result; -// ASTNode node = getASTNode(compilationUnit, 0, 0); -// assertTrue("Not a Field declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ -// VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node; -// checkSourceRange(fieldDeclaration, "var o = /*]*/Object.class/*[*/;", source); //$NON-NLS-1$ -// List fragments = fieldDeclaration.fragments(); -// assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ -// VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); -// Expression expression = variableDeclarationFragment.getInitializer(); -// checkSourceRange(expression, "Object.class", source); //$NON-NLS-1$ -// } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874 - */ - public void test0286() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0286", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a Field declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node; - checkSourceRange(fieldDeclaration, "var i = /**/(2)/**/;", source); //$NON-NLS-1$ - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - checkSourceRange(expression, "(2)", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874 - */ - public void test0287() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0287", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a VariableDeclarationStatement declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node; - checkSourceRange(fieldDeclaration, "var tab = /**/new String/**/;", source); //$NON-NLS-1$ - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - checkSourceRange(expression, "new String", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874 - */ - public void test0288() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0288", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a VariableDeclarationStatement declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node; - checkSourceRange(fieldDeclaration, "var tab = /**/[]/**/;", source); //$NON-NLS-1$ - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - checkSourceRange(expression, "[]", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874 - */ - public void test0289() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0289", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 1); - assertTrue("Not a VariableDeclarationStatement declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node; - checkSourceRange(fieldDeclaration, "var s = /**/tab1[0]/**/;", source); //$NON-NLS-1$ - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - checkSourceRange(expression, "tab1[0]", source); //$NON-NLS-1$ - } -// -// /** -// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874 -// */ -// public void test0290() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0290", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// JavaScriptUnit compilationUnit = (JavaScriptUnit) result; -// ASTNode node = getASTNode(compilationUnit, 0, 0); -// assertTrue("Not a Field declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ -// VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node; -// checkSourceRange(fieldDeclaration, "var o = /*]*/new java.lang.Object()/*[*/;", source); //$NON-NLS-1$ -// List fragments = fieldDeclaration.fragments(); -// assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ -// VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); -// Expression expression = variableDeclarationFragment.getInitializer(); -// checkSourceRange(expression, "new java.lang.Object()", source); //$NON-NLS-1$ -// } -// -// /** -// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10898 -// */ -// public void test0291() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0291", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// JavaScriptUnit unit = (JavaScriptUnit) result; -// assertEquals("no errors", 1, unit.getMessages().length); //$NON-NLS-1$ -// assertEquals("no errors", 1, unit.getProblems().length); //$NON-NLS-1$ -// } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10913 - */ - public void test0292() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0292", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node; - Expression expression = returnStatement.getExpression(); - assertTrue("Not a FieldAccess", expression instanceof FieldAccess); //$NON-NLS-1$ - FieldAccess fieldAccess = (FieldAccess) expression; - SimpleName simpleName = fieldAccess.getName(); - assertEquals("Wrong name", "x", simpleName.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$ - IBinding binding = simpleName.resolveBinding(); - assertNotNull("NO binding", binding); //$NON-NLS-1$ - assertTrue("Not a variable binding", binding instanceof IVariableBinding); //$NON-NLS-1$ - assertEquals("wrong name", "x", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - Expression expr = fieldAccess.getExpression(); - assertTrue("Not a simpleName", expr instanceof SimpleName); //$NON-NLS-1$ - SimpleName simpleName2 = (SimpleName) expr; - IBinding binding2 = simpleName2.resolveBinding(); - assertNotNull("No binding2", binding2); //$NON-NLS-1$ - assertTrue("Not a type binding", binding2 instanceof ITypeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "Test", binding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - -// /** -// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10933 -// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10935 -// */ -// public void test0293() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0293", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// JavaScriptUnit compilationUnit = (JavaScriptUnit) result; -// ASTNode node = getASTNode(compilationUnit, 0, 0, 0); -// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; -// List fragments = variableDeclarationStatement.fragments(); -// assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ -// VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); -// Expression expression = variableDeclarationFragment.getInitializer(); -// assertTrue("Not a class instance creation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$ -// ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression; -// AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration(); -// assertNotNull("No body", anonymousClassDeclaration); //$NON-NLS-1$ -// String expectedSource = -// "{\n" + //$NON-NLS-1$ -// " public void run() {\n" + //$NON-NLS-1$ -// " /*]*/foo();/*[*/\n" + //$NON-NLS-1$ -// " }\n" + //$NON-NLS-1$ -// " }"; //$NON-NLS-1$ -// checkSourceRange(anonymousClassDeclaration, expectedSource, source); -// expectedSource = -// "run= new Runnable() {\n" + //$NON-NLS-1$ -// " public void run() {\n" + //$NON-NLS-1$ -// " /*]*/foo();/*[*/\n" + //$NON-NLS-1$ -// " }\n" + //$NON-NLS-1$ -// " }"; //$NON-NLS-1$ -// checkSourceRange(variableDeclarationFragment, expectedSource, source); -// } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10984 - */ - public void test0294() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0294", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - String expectedSource = - "function fails() {\n" + //$NON-NLS-1$ - " foo()\n" + //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(methodDeclaration, expectedSource, source); - Block block = methodDeclaration.getBody(); - expectedSource = - "{\n" + //$NON-NLS-1$ - " foo()\n" + //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(block, expectedSource, source); - node = getASTNode(compilationUnit, 0, 1); - assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - methodDeclaration = (FunctionDeclaration) node; - block = methodDeclaration.getBody(); - List statements = block.statements(); - assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10986 - */ - public void test0295() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0295", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; -// assertEquals("Wrong size", 2, compilationUnit.getMessages().length); //$NON-NLS-1$ -// assertEquals("Wrong size", 2, compilationUnit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 1, 0); - assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertTrue("not a method invocation", expression instanceof FunctionInvocation); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - ITypeBinding typeBinding = methodInvocation.resolveTypeBinding(); - assertNotNull("type binding is null", typeBinding); //$NON-NLS-1$ - } - - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10984 - */ - public void test0296() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0296", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - String expectedSource = - "function fails() {\n" + //$NON-NLS-1$ - " foo()\n" + //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(methodDeclaration, expectedSource, source); - Block block = methodDeclaration.getBody(); - expectedSource = - "{\n" + //$NON-NLS-1$ - " foo()\n" + //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(block, expectedSource, source); - node = getASTNode(compilationUnit, 0, 1); - assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - methodDeclaration = (FunctionDeclaration) node; - block = methodDeclaration.getBody(); - List statements = block.statements(); - assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=11037 - */ - public void test0297() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0297", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - runConversion(sourceUnit, false); - } -// -// /** -// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10984 -// */ -// public void test0298() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0298", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, false); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// JavaScriptUnit compilationUnit = (JavaScriptUnit) result; -// ASTNode node = getASTNode(compilationUnit, 0, 0, 0); -// assertTrue("Not a ReturnStatement", node instanceof ReturnStatement); //$NON-NLS-1$ -// ReturnStatement returnStatement = (ReturnStatement) node; -// Expression expression = returnStatement.getExpression(); -// checkSourceRange(expression, "a().length != 3", source); //$NON-NLS-1$ -// } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874 - * http://dev.eclipse.org/bugs/show_bug.cgi?id=11104 - */ - public void test0299() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0299", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a Field declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node; - checkSourceRange(fieldDeclaration, "var i = (/**/2/**/);", source); //$NON-NLS-1$ - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - assertTrue("Not a parenthesized expression", expression instanceof ParenthesizedExpression); //$NON-NLS-1$ - ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression; - Expression expression2 = parenthesizedExpression.getExpression(); - checkSourceRange(expression2, "2", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874 - * http://dev.eclipse.org/bugs/show_bug.cgi?id=11104 - */ - public void test0300() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0300", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a Field declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node; - checkSourceRange(fieldDeclaration, "var b = /**/true/**/;", source); //$NON-NLS-1$ - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - checkSourceRange(expression, "true", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874 - * http://dev.eclipse.org/bugs/show_bug.cgi?id=11104 - */ - public void test0301() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0301", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a Field declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node; - checkSourceRange(fieldDeclaration, "var o = /**/null/**/;", source); //$NON-NLS-1$ - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - checkSourceRange(expression, "null", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=11106 - */ - public void test0302() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0302", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not a DoStatement", node instanceof DoStatement); //$NON-NLS-1$ - DoStatement doStatement = (DoStatement) node; - String expectedSource = - "do\n" + //$NON-NLS-1$ - " foo();\n" + //$NON-NLS-1$ - " while(1 < 10);"; //$NON-NLS-1$ - checkSourceRange(doStatement, expectedSource, source); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=11129 - */ - public void test0303() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0303", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 1); - assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression2 = expressionStatement.getExpression(); - assertTrue("Not an Assignement", expression2 instanceof Assignment); //$NON-NLS-1$ - Assignment assignment = (Assignment) expression2; - Expression expression = assignment.getRightHandSide(); -// assertTrue("Not a CastExpression", expression instanceof CastExpression); //$NON-NLS-1$ -// CastExpression castExpression = (CastExpression) expression; - ITypeBinding typeBinding = expression.resolveTypeBinding(); - assertNotNull("No binding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "Number", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// Type type = castExpression.getType(); -// ITypeBinding typeBinding2 = type.resolveBinding(); -// assertNotNull("No binding2", typeBinding2); //$NON-NLS-1$ -// assertEquals("Wrong name", "char", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=11151 - */ - public void test0304() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0304", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - checkSourceRange(node, "function foo(arg);", source); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - Block block = methodDeclaration.getBody(); - assertNull("Has a body", block); //$NON-NLS-1$ - } -// -// /** -// * http://dev.eclipse.org/bugs/show_bug.cgi?id=11125 -// */ -// public void test0305() { -// char[] source = -// ("" + //$NON-NLS-1$ -// " function foo(arg) {}\n" + //$NON-NLS-1$ -// "").toCharArray(); //$NON-NLS-1$ -// IJavaScriptProject project = getJavaProject("Converter"); //$NON-NLS-1$ -// ASTNode result = runConversion(source, "Test.js", project, true); //$NON-NLS-1$ -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// JavaScriptUnit compilationUnit = (JavaScriptUnit) result; -// ASTNode node = getASTNode(compilationUnit, 0); -// assertTrue("not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ -// TypeDeclaration typeDeclaration = (TypeDeclaration) node; -// ITypeBinding typeBinding = typeDeclaration.resolveBinding(); -// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ -//// assertEquals("Wrong name", "Test", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -//// assertEquals("Wrong package", "test0305", typeBinding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$ -//// assertTrue("Not an interface", typeBinding.isClass()); //$NON-NLS-1$ -// } - -// /** -// * http://dev.eclipse.org/bugs/show_bug.cgi?id=11125 -// */ -// public void test0306() { -// char[] source = -// ("" + //$NON-NLS-1$ -// " function foo(arg) {}\n" + //$NON-NLS-1$ -// "").toCharArray(); //$NON-NLS-1$ -// IJavaScriptProject project = getJavaProject("Converter"); //$NON-NLS-1$ -// ASTNode result = runConversion(source, "Object.js", project, true); //$NON-NLS-1$ -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// JavaScriptUnit compilationUnit = (JavaScriptUnit) result; -// ASTNode node = getASTNode(compilationUnit, 0); -// assertTrue("not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ -// TypeDeclaration typeDeclaration = (TypeDeclaration) node; -// ITypeBinding typeBinding = typeDeclaration.resolveBinding(); -// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ -//// assertEquals("Wrong name", "Object", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -//// assertEquals("Wrong package", "java.lang", typeBinding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$ -//// assertTrue("Not an interface", typeBinding.isClass()); //$NON-NLS-1$ -// assertEquals("Wrong size", 2, typeBinding.getDeclaredMethods().length); //$NON-NLS-1$ -// } -// -// /** -// * http://dev.eclipse.org/bugs/show_bug.cgi?id=11371 -// */ -// public void test0307() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0307", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// JavaScriptUnit compilationUnit = (JavaScriptUnit) result; -// ASTNode node = getASTNode(compilationUnit, 0, 1, 0); -// assertTrue("not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ -// FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; -// Block block = methodDeclaration.getBody(); -// assertNotNull("No body", block); //$NON-NLS-1$ -// List statements = block.statements(); -// assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$ -// Statement statement = (Statement) statements.get(0); -// assertTrue("Not a super constructor invocation", statement instanceof SuperConstructorInvocation); //$NON-NLS-1$ -// checkSourceRange(statement, "super(10);", source); -// } -// -// /** -// * http://dev.eclipse.org/bugs/show_bug.cgi?id=11371 -// */ -// public void test0308() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0308", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// JavaScriptUnit compilationUnit = (JavaScriptUnit) result; -// ASTNode node = getASTNode(compilationUnit, 0, 1, 0); -// assertTrue("not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ -// FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; -// Block block = methodDeclaration.getBody(); -// assertNotNull("No body", block); //$NON-NLS-1$ -// List statements = block.statements(); -// assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$ -// Statement statement = (Statement) statements.get(0); -// assertTrue("Not a super constructor invocation", statement instanceof SuperConstructorInvocation); //$NON-NLS-1$ -// SuperConstructorInvocation superConstructorInvocation = (SuperConstructorInvocation) statement; -// IFunctionBinding methodBinding = superConstructorInvocation.resolveConstructorBinding(); -// assertNotNull("No methodBinding", methodBinding); //$NON-NLS-1$ -// IFunctionBinding methodBinding2 = methodDeclaration.resolveBinding(); -// assertNotNull("No methodBinding2", methodBinding2); //$NON-NLS-1$ -// } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=11380 - */ - public void test0309() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0309", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - List fragments = variableDeclarationStatement.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - assertTrue("Not a conditional expression", expression instanceof ConditionalExpression); //$NON-NLS-1$ - ConditionalExpression conditionalExpression = (ConditionalExpression) expression; - ITypeBinding typeBinding = conditionalExpression.resolveTypeBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertEquals("wrong name", "Number", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=11380 - */ - public void test0310() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0310", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node; - List fragments = fieldDeclaration.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - assertTrue("Not a fieldAccess", expression instanceof FieldAccess); //$NON-NLS-1$ - FieldAccess fieldAccess = (FieldAccess) expression; - SimpleName qualifier = (SimpleName)fieldAccess.getExpression(); - IBinding binding = qualifier.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertEquals("wrong name", "I", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - -// /** -// * http://dev.eclipse.org/bugs/show_bug.cgi?id=11638 -// */ -// public void test0311() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0311", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// JavaScriptUnit compilationUnit = (JavaScriptUnit) result; -// ASTNode node = getASTNode(compilationUnit, 0, 0, 1); -// assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ -// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; -// List fragments = variableDeclarationStatement.fragments(); -// assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ -// VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); -// Expression expression = variableDeclarationFragment.getInitializer(); -// assertTrue("not a class instance creation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$ -// ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression; -// AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration(); -// assertNotNull("No body", anonymousClassDeclaration); //$NON-NLS-1$ -// List bodyDeclarations = anonymousClassDeclaration.bodyDeclarations(); -// assertEquals("wrong size for body declarations", 1, bodyDeclarations.size()); //$NON-NLS-1$ -// BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); -// assertTrue("Not a method declaration", bodyDeclaration instanceof FunctionDeclaration); //$NON-NLS-1$ -// FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration; -// Block block = methodDeclaration.getBody(); -// assertNotNull("no body", block); //$NON-NLS-1$ -// List statements = block.statements(); -// assertEquals("Wrong size for statements", 1, statements.size()); //$NON-NLS-1$ -// Statement statement = (Statement) statements.get(0); -// assertTrue("not a variable declaration statement", statement instanceof VariableDeclarationStatement); //$NON-NLS-1$ -// VariableDeclarationStatement variableDeclarationStatement2 = (VariableDeclarationStatement) statement; -// List fragments2 = variableDeclarationStatement2.fragments(); -// assertEquals("wrong size for fragments2", 1, fragments2.size()); //$NON-NLS-1$ -// VariableDeclarationFragment variableDeclarationFragment2 = (VariableDeclarationFragment) fragments2.get(0); -// Expression expression2 = variableDeclarationFragment2.getInitializer(); -// assertTrue("Not a name", expression2 instanceof Name); //$NON-NLS-1$ -// Name name = (Name) expression2; -// checkSourceRange(name, "j", source); //$NON-NLS-1$ -// IBinding binding = name.resolveBinding(); -// ASTNode declaringNode = compilationUnit.findDeclaringNode(binding); -// assertNotNull("No declaring node", declaringNode); //$NON-NLS-1$ -// checkSourceRange(declaringNode, "var j", source); //$NON-NLS-1$ -// assertTrue("Not a single variable declaration", declaringNode instanceof SingleVariableDeclaration); //$NON-NLS-1$ -// } - -// /** -// * http://dev.eclipse.org/bugs/show_bug.cgi?id=11638 -// * There is a error in this source. A is unresolved. Then there is no -// * declaring node. -// */ -// public void test0312() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0312", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// JavaScriptUnit compilationUnit = (JavaScriptUnit) result; -// ASTNode node = getASTNode(compilationUnit, 0, 0, 1); -// assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ -// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; -// List fragments = variableDeclarationStatement.fragments(); -// assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ -// VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); -// Expression expression = variableDeclarationFragment.getInitializer(); -// assertTrue("not a class instance creation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$ -// ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression; -// AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration(); -// assertNotNull("No body", anonymousClassDeclaration); //$NON-NLS-1$ -// List bodyDeclarations = anonymousClassDeclaration.bodyDeclarations(); -// assertEquals("wrong size for body declarations", 1, bodyDeclarations.size()); //$NON-NLS-1$ -// BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); -// assertTrue("Not a method declaration", bodyDeclaration instanceof FunctionDeclaration); //$NON-NLS-1$ -// FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration; -// Block block = methodDeclaration.getBody(); -// assertNotNull("no body", block); //$NON-NLS-1$ -// List statements = block.statements(); -// assertEquals("Wrong size for statements", 1, statements.size()); //$NON-NLS-1$ -// Statement statement = (Statement) statements.get(0); -// assertTrue("not a variable declaration statement", statement instanceof VariableDeclarationStatement); //$NON-NLS-1$ -// VariableDeclarationStatement variableDeclarationStatement2 = (VariableDeclarationStatement) statement; -// List fragments2 = variableDeclarationStatement2.fragments(); -// assertEquals("wrong size for fragments2", 1, fragments2.size()); //$NON-NLS-1$ -// VariableDeclarationFragment variableDeclarationFragment2 = (VariableDeclarationFragment) fragments2.get(0); -// Expression expression2 = variableDeclarationFragment2.getInitializer(); -// assertTrue("Not a name", expression2 instanceof Name); //$NON-NLS-1$ -// Name name = (Name) expression2; -// checkSourceRange(name, "j", source); //$NON-NLS-1$ -// IBinding binding = name.resolveBinding(); -// ASTNode declaringNode = compilationUnit.findDeclaringNode(binding); -// assertNull("No declaring node is available", declaringNode); //$NON-NLS-1$ -// } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=11659 - */ - public void test0313() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0313", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - List fragments = variableDeclarationStatement.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - assertTrue("Not an InfixExpression", expression instanceof InfixExpression); //$NON-NLS-1$ - InfixExpression infixExpression = (InfixExpression) expression; - checkSourceRange(infixExpression, "i+j", source); //$NON-NLS-1$ - Expression expression2 = infixExpression.getLeftOperand(); - checkSourceRange(expression2, "i", source); //$NON-NLS-1$ - assertTrue("Not a name", expression2 instanceof Name); //$NON-NLS-1$ - Name name = (Name) expression2; - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - ASTNode astNode = compilationUnit.findDeclaringNode(binding); - assertNotNull("No declaring node", astNode); //$NON-NLS-1$ - checkSourceRange(astNode, "i", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=12326 - */ - public void test0314() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0314", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - assertNotNull("No result", result); //$NON-NLS-1$ - assertTrue("Not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("Wrong line number", 1, compilationUnit.getLineNumber(0)); //$NON-NLS-1$ - // ensure that last character is on the last line - assertEquals("Wrong line number", 1, compilationUnit.getLineNumber(source.length - 1)); //$NON-NLS-1$ - // source.length is beyond the size of the compilation unit source - assertEquals("Wrong line number", -1, compilationUnit.getLineNumber(source.length)); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=12326 - */ - public void test0315() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0315", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not a Return statement", node instanceof ReturnStatement); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node; - Expression expression = returnStatement.getExpression(); - assertTrue("Not an InfixExpression expression", expression instanceof InfixExpression); //$NON-NLS-1$ - InfixExpression instanceOfExpression = (InfixExpression) expression; - Expression rightOperand = instanceOfExpression.getRightOperand(); - assertTrue("Not a SimpleName", rightOperand instanceof SimpleName); //$NON-NLS-1$ - SimpleName simpleType = (SimpleName) rightOperand; - assertTrue("wrong operator",instanceOfExpression.getOperator().equals(InfixExpression.Operator.INSTANCEOF)); -// Name n = simpleType.getName(); -// assertTrue("Not a qualified name", n instanceof QualifiedName); //$NON-NLS-1$ -// QualifiedName name = (QualifiedName) n; - checkSourceRange(simpleType, "String", source); //$NON-NLS-1$ - ITypeBinding typeBinding = simpleType.resolveTypeBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "String", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// Name qualifier = name.getQualifier(); -// assertTrue("Not a qualified name", qualifier instanceof QualifiedName); //$NON-NLS-1$ -// ITypeBinding typeBinding2 = qualifier.resolveTypeBinding(); -// assertNull("typebinding2 is not null", typeBinding2); //$NON-NLS-1$ -// IBinding binding = qualifier.resolveBinding(); -// assertNotNull("no binding", binding); //$NON-NLS-1$ -// assertEquals("Wrong type", IBinding.PACKAGE, binding.getKind()); //$NON-NLS-1$ -// IPackageBinding pBinding = (IPackageBinding) binding; -// assertEquals("Wrong name", "java.io", pBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - -// /** -// * http://dev.eclipse.org/bugs/show_bug.cgi?id=12454 -// */ -// public void test0316() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "", "Hello.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No result", result); //$NON-NLS-1$ -// assertTrue("Not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// JavaScriptUnit compilationUnit = (JavaScriptUnit) result; -// assertEquals("Wrong size", 1, compilationUnit.getMessages().length); //$NON-NLS-1$ -// assertEquals("Wrong size", 1, compilationUnit.getProblems().length); //$NON-NLS-1$ -// } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=12781 - */ - public void test0317() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0317", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node; - Expression expression = returnStatement.getExpression(); - assertTrue("not an InfixExpression expression", expression instanceof InfixExpression); //$NON-NLS-1$ - InfixExpression instanceOfExpression = (InfixExpression) expression; - assertTrue("wrong operator",instanceOfExpression.getOperator().equals(InfixExpression.Operator.INSTANCEOF)); - Expression left = instanceOfExpression.getLeftOperand(); - assertTrue("Not a Name", left instanceof Name); //$NON-NLS-1$ - Name name = (Name) left; - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertEquals("wrong name", "x", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - ITypeBinding typeBinding = name.resolveTypeBinding(); - assertNotNull("No typebinding", typeBinding); //$NON-NLS-1$ - assertEquals("wrong type", "any", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - Expression right = instanceOfExpression.getRightOperand(); - assertTrue("Not a simpleName", right instanceof SimpleName); //$NON-NLS-1$ - SimpleName simpleType = (SimpleName) right; - name = simpleType;//.getName(); - assertTrue("Not a simpleName", name instanceof SimpleName); //$NON-NLS-1$ - SimpleName simpleName = (SimpleName) name; - IBinding binding2 = simpleName.resolveBinding(); - assertNotNull("No binding2", binding2); //$NON-NLS-1$ - assertEquals("Wrong name", "Boolean", binding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - ITypeBinding typeBinding2 = simpleName.resolveTypeBinding(); - assertNotNull("No typeBinding2", typeBinding2); //$NON-NLS-1$ - assertEquals("Wrong name", "Boolean", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=13233 - */ - public void test0318() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0318", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("No error", 1, unit.getMessages().length); //$NON-NLS-1$ - assertEquals("No error", 1, unit.getProblems().length); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=13807 - */ - public void test0319() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0319", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - List fragments = variableDeclarationStatement.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - assertTrue("Not an array creation", expression instanceof ArrayInitializer); //$NON-NLS-1$ - ArrayInitializer arrayCreation = (ArrayInitializer) expression; - ITypeBinding typeBinding = arrayCreation.resolveTypeBinding(); - assertNotNull("no type binding", typeBinding); //$NON-NLS-1$ - assertEquals("wrong name", "any[]", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// ArrayType arrayType = arrayCreation.getType(); -// ITypeBinding typeBinding2 = arrayType.resolveBinding(); -// assertNotNull("no type binding2", typeBinding2); //$NON-NLS-1$ -// assertEquals("wrong name", "Object[]", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// Type type = arrayType.getElementType(); -// assertTrue("Not a simple type", type instanceof SimpleType); //$NON-NLS-1$ -// SimpleType simpleType = (SimpleType) type; -// ITypeBinding typeBinding3 = simpleType.resolveBinding(); -// assertNotNull("no type binding3", typeBinding3); //$NON-NLS-1$ -// assertEquals("wrong name", "Object", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=13807 - */ - public void test0320() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0320", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - - List fragments = variableDeclarationStatement.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - - - IVariableBinding binding = variableDeclarationFragment.resolveBinding(); - ITypeBinding typeBinding = binding.getType(); - assertNotNull("no type binding", typeBinding); //$NON-NLS-1$ - assertEquals("wrong name", "Number[]", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - -// Type type = variableDeclarationStatement.getType(); -// checkSourceRange(type, "int[]", source); //$NON-NLS-1$ -// assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$ -// ArrayType arrayType = (ArrayType) type; -// ITypeBinding typeBinding = arrayType.resolveBinding(); -// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ -// Type elementType = arrayType.getElementType(); -// assertTrue("Not a simple type", elementType.isPrimitiveType()); //$NON-NLS-1$ -// ITypeBinding typeBinding2 = elementType.resolveBinding(); -// assertNotNull("No type binding2", typeBinding2); //$NON-NLS-1$ - } - -// /** -// * http://dev.eclipse.org/bugs/show_bug.cgi?id=13807 -// */ -// public void test0321() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0321", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// char[] source = sourceUnit.getSource().toCharArray(); -// ASTNode result = runConversion(sourceUnit, true); -// assertNotNull("No compilation unit", result); //$NON-NLS-1$ -// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ -// JavaScriptUnit compilationUnit = (JavaScriptUnit) result; -// ASTNode node = getASTNode(compilationUnit, 0, 0, 0); -// assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ -// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; -// Type type = variableDeclarationStatement.getType(); -// assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$ -// ArrayType arrayType = (ArrayType) type; -// ITypeBinding typeBinding = arrayType.resolveBinding(); -// checkSourceRange(type, "java.lang.Object[][]", source); //$NON-NLS-1$ -// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ -// Type elementType = arrayType.getComponentType(); -// ITypeBinding typeBinding2 = elementType.resolveBinding(); -// assertNotNull("No type binding2", typeBinding2); //$NON-NLS-1$ -// assertEquals("wrong dimension", 1, typeBinding2.getDimensions()); //$NON-NLS-1$ -// assertEquals("wrong name", "Object[]", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// assertTrue("Not an array type", elementType.isArrayType()); //$NON-NLS-1$ -// Type elementType2 = ((ArrayType) elementType).getComponentType(); -// assertTrue("Not a simple type", elementType2.isSimpleType()); //$NON-NLS-1$ -// ITypeBinding typeBinding3 = elementType2.resolveBinding(); -// assertNotNull("No type binding3", typeBinding3); //$NON-NLS-1$ -// assertEquals("wrong dimension", 0, typeBinding3.getDimensions()); //$NON-NLS-1$ -// assertEquals("wrong name", "Object", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$ -// } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=13231 - */ - public void test0322() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0322", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node; - List fragments = fieldDeclaration.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - assertTrue("Not a null literal", expression instanceof NullLiteral); //$NON-NLS-1$ - NullLiteral nullLiteral = (NullLiteral) expression; - ITypeBinding typeBinding = nullLiteral.resolveTypeBinding(); - assertNotNull("no type binding", typeBinding); //$NON-NLS-1$ - assertTrue("Not the null type", typeBinding.isNullType()); //$NON-NLS-1$ - assertEquals("Wrong qualified name", typeBinding.getQualifiedName(), "null"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=14198 - */ - public void test0323() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0323", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 1); - assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression2 = expressionStatement.getExpression(); - assertTrue("Not an Assignement", expression2 instanceof Assignment); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=14217 - */ - public void test0326() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0326", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - char[] source = sourceUnit.getSource().toCharArray(); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 1, 0); - assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - checkSourceRange(expressionStatement.getExpression(), "a().f= a()", source); //$NON-NLS-1$ - checkSourceRange(expressionStatement, "a().f= a();", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=14322 - */ - public void test0331() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0331", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertTrue("Not an VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - List fragments = variableDeclarationStatement.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - assertTrue("Not a QualifiedName", expression instanceof QualifiedName); //$NON-NLS-1$ - QualifiedName qualifiedName = (QualifiedName) expression; - IBinding binding = qualifiedName.getName().resolveBinding(); - assertNotNull("no binding", binding); //$NON-NLS-1$ - assertEquals("Wrong type", IBinding.VARIABLE, binding.getKind()); //$NON-NLS-1$ - IVariableBinding variableBinding = (IVariableBinding) binding; - assertTrue("Not a field", variableBinding.isField()); //$NON-NLS-1$ - assertNull("Got a declaring class", variableBinding.getDeclaringClass()); //$NON-NLS-1$ - assertEquals("wrong name", "length", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=15061 - */ - public void test0339() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0339", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("No errors found", 3, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("not a Type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - List bodyDeclarations = typeDeclaration.bodyDeclarations(); - assertEquals("wrong size", 1, bodyDeclarations.size()); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclarations.get(0); - checkSourceRange(methodDeclaration, "function doQuery(boolean x);", source); //$NON-NLS-1$ - node = getASTNode(compilationUnit, 0, 1); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$ - String expectedSource = - "function setX( x) {\n" + //$NON-NLS-1$ - " {\n" + //$NON-NLS-1$ - " z\n" + //$NON-NLS-1$ - " }\n" + //$NON-NLS-1$ - "}"; //$NON-NLS-1$ - checkSourceRange(node, expectedSource, source); - int methodEndPosition = node.getStartPosition() + node.getLength(); - node = getASTNode(compilationUnit, 0); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - int typeEndPosition = node.getStartPosition() + node.getLength(); - assertEquals("different positions", methodEndPosition, typeEndPosition); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=14852 - */ - public void test0340() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "p3", "B.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertTrue("Not an method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - Expression expression2 = methodInvocation.getExpression(); - assertNotNull("No receiver", expression2); //$NON-NLS-1$ - ITypeBinding binding = expression2.resolveTypeBinding(); - assertNotNull("No type binding", binding); //$NON-NLS-1$ - assertEquals("wrong name", "A", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("wrong name", "p2", binding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue("Not a qualified name", expression2.getNodeType() == ASTNode.QUALIFIED_NAME); //$NON-NLS-1$ - QualifiedName qualifiedName = (QualifiedName) expression2; - SimpleName simpleName = qualifiedName.getName(); - assertEquals("wrong name", "A", simpleName.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$ - ITypeBinding typeBinding = simpleName.resolveTypeBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertEquals("wrong name", "A", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("wrong name", "p2", typeBinding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - Name name = qualifiedName.getQualifier(); - assertTrue("Not a simple name", name.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$ - SimpleName simpleName2 = (SimpleName) name; - assertEquals("wrong name", "p2", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$ - IBinding binding2 = simpleName2.resolveBinding(); - assertNotNull("No binding", binding2); //$NON-NLS-1$ - assertEquals("wrong type", IBinding.PACKAGE, binding2.getKind()); //$NON-NLS-1$ - assertEquals("wrong name", "p2", binding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - node = getASTNode(compilationUnit, 0, 1, 0); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement2 = (ExpressionStatement) node; - Expression expression3 = expressionStatement2.getExpression(); - assertTrue("Not an method invocation", expression3.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$ - FunctionInvocation methodInvocation2 = (FunctionInvocation) expression3; - Expression expression4 = methodInvocation2.getExpression(); - assertNotNull("No receiver", expression4); //$NON-NLS-1$ - ITypeBinding binding3 = expression4.resolveTypeBinding(); - assertNotNull("No type binding", binding3); //$NON-NLS-1$ - assertEquals("wrong name", "A", binding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("wrong name", "p1", binding3.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=15804 - */ - public void test0341() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0341", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 1, 0); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("Not an if statement", node.getNodeType() == ASTNode.IF_STATEMENT); //$NON-NLS-1$ - String expectedSource = - "if (field != null) {\n" + //$NON-NLS-1$ - " throw new IOException();\n" + //$NON-NLS-1$ - " } else if (field == null) {\n" + //$NON-NLS-1$ - " throw new MalformedURLException();\n" + //$NON-NLS-1$ - " } else if (field == null) {\n" + //$NON-NLS-1$ - " throw new InterruptedIOException();\n" + //$NON-NLS-1$ - " } else {\n" + //$NON-NLS-1$ - " throw new UnsupportedEncodingException();\n" + //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(node, expectedSource, source); - IfStatement ifStatement = (IfStatement) node; - Statement thenStatement = ifStatement.getThenStatement(); - expectedSource = - "{\n" + //$NON-NLS-1$ - " throw new IOException();\n" + //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(thenStatement, expectedSource, source); - Statement elseStatement = ifStatement.getElseStatement(); - expectedSource = - "if (field == null) {\n" + //$NON-NLS-1$ - " throw new MalformedURLException();\n" + //$NON-NLS-1$ - " } else if (field == null) {\n" + //$NON-NLS-1$ - " throw new InterruptedIOException();\n" + //$NON-NLS-1$ - " } else {\n" + //$NON-NLS-1$ - " throw new UnsupportedEncodingException();\n" + //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(elseStatement, expectedSource, source); - assertTrue("Not a if statement", elseStatement.getNodeType() == ASTNode.IF_STATEMENT); //$NON-NLS-1$ - ifStatement = (IfStatement) elseStatement; - thenStatement = ifStatement.getThenStatement(); - expectedSource = - "{\n" + //$NON-NLS-1$ - " throw new MalformedURLException();\n" + //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(thenStatement, expectedSource, source); - elseStatement = ifStatement.getElseStatement(); - expectedSource = - "if (field == null) {\n" + //$NON-NLS-1$ - " throw new InterruptedIOException();\n" + //$NON-NLS-1$ - " } else {\n" + //$NON-NLS-1$ - " throw new UnsupportedEncodingException();\n" + //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(elseStatement, expectedSource, source); - assertTrue("Not a if statement", elseStatement.getNodeType() == ASTNode.IF_STATEMENT); //$NON-NLS-1$ - ifStatement = (IfStatement) elseStatement; - thenStatement = ifStatement.getThenStatement(); - expectedSource = - "{\n" + //$NON-NLS-1$ - " throw new InterruptedIOException();\n" + //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(thenStatement, expectedSource, source); - elseStatement = ifStatement.getElseStatement(); - expectedSource = - "{\n" + //$NON-NLS-1$ - " throw new UnsupportedEncodingException();\n" + //$NON-NLS-1$ - " }"; //$NON-NLS-1$ - checkSourceRange(elseStatement, expectedSource, source); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=16051 - */ - public void test0343() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0343", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 1, 1); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("Not an if statement", node.getNodeType() == ASTNode.IF_STATEMENT); //$NON-NLS-1$ - String expectedSource = - "if (flag)\n" + //$NON-NLS-1$ - " i= 10;"; //$NON-NLS-1$ - checkSourceRange(node, expectedSource, source); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=17922 - */ - public void test0345() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0345", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("Not an field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$ - VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node; - List fragments = fieldDeclaration.fragments(); - assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - assertTrue("Not an ArrayCreation", expression.getNodeType() == ASTNode.ARRAY_CREATION); //$NON-NLS-1$ - ArrayCreation arrayCreation = (ArrayCreation) expression; - ArrayType arrayType = arrayCreation.getType(); - IBinding binding2 = arrayType.resolveBinding(); - assertNotNull("no binding2", binding2); //$NON-NLS-1$ - assertEquals("not a type", binding2.getKind(), IBinding.TYPE); //$NON-NLS-1$ - ITypeBinding typeBinding2 = (ITypeBinding) binding2; - assertTrue("Not an array type binding2", typeBinding2.isArray()); //$NON-NLS-1$ - Type type = arrayType.getElementType(); - assertTrue("Not a simple type", type.isSimpleType()); //$NON-NLS-1$ - SimpleType simpleType = (SimpleType) type; - Name name = simpleType.getName(); - assertTrue("QualifiedName", name.getNodeType() == ASTNode.QUALIFIED_NAME); //$NON-NLS-1$ - SimpleName simpleName = ((QualifiedName) name).getName(); - IBinding binding = simpleName.resolveBinding(); - assertNotNull("no binding", binding); //$NON-NLS-1$ - assertEquals("not a type", binding.getKind(), IBinding.TYPE); //$NON-NLS-1$ - ITypeBinding typeBinding = (ITypeBinding) binding; - assertTrue("An array type binding", !typeBinding.isArray()); //$NON-NLS-1$ - Type type2 = fieldDeclaration.getType(); - assertTrue("Not a array type", type2.isArrayType()); //$NON-NLS-1$ - ArrayType arrayType2 = (ArrayType) type2; - Type type3 = arrayType2.getElementType(); - assertTrue("Not a simple type", type3.isSimpleType()); //$NON-NLS-1$ - SimpleType simpleType2 = (SimpleType) type3; - Name name2 = simpleType2.getName(); - assertTrue("Not a qualified name", name2.getNodeType() == ASTNode.QUALIFIED_NAME); //$NON-NLS-1$ - SimpleName simpleName2 = ((QualifiedName) name2).getName(); - IBinding binding3 = simpleName2.resolveBinding(); - assertNotNull("no binding", binding3); //$NON-NLS-1$ - assertEquals("not a type", binding3.getKind(), IBinding.TYPE); //$NON-NLS-1$ - ITypeBinding typeBinding3 = (ITypeBinding) binding3; - assertTrue("An array type binding", !typeBinding3.isArray()); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=18138 - */ - public void test0346() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0346", "Test2.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("Not an variable declaration", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - Type type = variableDeclarationStatement.getType(); - checkSourceRange(type, "Vector", source); //$NON-NLS-1$ - assertTrue("not an array type", !type.isArrayType()); //$NON-NLS-1$ - assertTrue("Not a simple type", type.isSimpleType()); //$NON-NLS-1$ - SimpleType simpleType = (SimpleType) type; - Name name = simpleType.getName(); - assertTrue("Not a simpleName", name.isSimpleName()); //$NON-NLS-1$ - SimpleName simpleName = (SimpleName) name; - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$ - ITypeBinding typeBinding = (ITypeBinding) binding; - assertTrue("An array", !typeBinding.isArray()); //$NON-NLS-1$ - assertEquals("Wrong name", "Vector", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - ITypeBinding typeBinding2 = simpleType.resolveBinding(); - assertNotNull("No binding", typeBinding2); //$NON-NLS-1$ - assertEquals("Wrong type", IBinding.TYPE, typeBinding2.getKind()); //$NON-NLS-1$ - assertTrue("An array", !typeBinding2.isArray()); //$NON-NLS-1$ - assertEquals("Wrong name", "Vector", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=18138 - */ - public void test0347() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0347", "Test2.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("Not an variable declaration", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - Type type = variableDeclarationStatement.getType(); - checkSourceRange(type, "Vector[]", source); //$NON-NLS-1$ - assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$ - ArrayType arrayType = (ArrayType) type; - ITypeBinding binding = arrayType.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$ - assertTrue("Not an array type", binding.isArray()); //$NON-NLS-1$ - assertEquals("Wrong name", "Vector[]", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=18138 - */ - public void test0348() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0348", "Test2.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("Not an variable declaration", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - Type type = variableDeclarationStatement.getType(); - checkSourceRange(type, "Vector[][]", source); //$NON-NLS-1$ - assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$ - ArrayType arrayType = (ArrayType) type; - ITypeBinding binding = arrayType.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$ - assertTrue("Not an array type", binding.isArray()); //$NON-NLS-1$ - assertEquals("Wrong name", "Vector[][]", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=18138 - */ - public void test0349() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0349", "Test2.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("Not an field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$ - VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node; - Type type = fieldDeclaration.getType(); - checkSourceRange(type, "Vector[][]", source); //$NON-NLS-1$ - assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$ - ArrayType arrayType = (ArrayType) type; - ITypeBinding binding = arrayType.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$ - assertTrue("Not an array type", binding.isArray()); //$NON-NLS-1$ - assertEquals("Wrong name", "Vector[][]", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=18138 - */ - public void test0350() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0350", "Test2.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("Not an field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$ - VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node; - Type type = fieldDeclaration.getType(); - checkSourceRange(type, "Vector", source); //$NON-NLS-1$ - assertTrue("not a simple type", type.isSimpleType()); //$NON-NLS-1$ - SimpleType simpleType = (SimpleType) type; - ITypeBinding binding = simpleType.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$ - assertTrue("An array type", binding.isClass()); //$NON-NLS-1$ - assertEquals("Wrong name", "Vector", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=18169 - */ - public void test0351() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0351", "Test2.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("Not an method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - List parameters = methodDeclaration.parameters(); - assertEquals("wrong size", 2, parameters.size()); //$NON-NLS-1$ - SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0); - checkSourceRange(singleVariableDeclaration, "var a", source); //$NON-NLS-1$ - singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(1); - checkSourceRange(singleVariableDeclaration, "var b", source); //$NON-NLS-1$ - node = getASTNode(compilationUnit, 0, 1); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("Not an method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - methodDeclaration = (FunctionDeclaration) node; - parameters = methodDeclaration.parameters(); - assertEquals("wrong size", 2, parameters.size()); //$NON-NLS-1$ - singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0); - checkSourceRange(singleVariableDeclaration, "var a", source); //$NON-NLS-1$ - singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(1); - checkSourceRange(singleVariableDeclaration, "var b", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=18169 - */ - public void test0352() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0352", "Test2.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("Not an method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - List parameters = methodDeclaration.parameters(); - assertEquals("wrong size", 2, parameters.size()); //$NON-NLS-1$ - SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0); - checkSourceRange(singleVariableDeclaration, "var a", source); //$NON-NLS-1$ - singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(1); - checkSourceRange(singleVariableDeclaration, "var b", source); //$NON-NLS-1$ - node = getASTNode(compilationUnit, 0, 1); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("Not an method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - methodDeclaration = (FunctionDeclaration) node; - parameters = methodDeclaration.parameters(); - assertEquals("wrong size", 2, parameters.size()); //$NON-NLS-1$ - singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0); - checkSourceRange(singleVariableDeclaration, "vara", source); //$NON-NLS-1$ - singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(1); - checkSourceRange(singleVariableDeclaration, "var b", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=18042 - */ - public void test0353() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0353", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull("not null", node); //$NON-NLS-1$ - assertTrue("Not an variable declaration", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - Type type = variableDeclarationStatement.getType(); - checkSourceRange(type, "InputStream", source); //$NON-NLS-1$ - assertTrue("not a simple type", type.isSimpleType()); //$NON-NLS-1$ - ITypeBinding binding = type.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$ - assertTrue("Not a class", binding.isClass()); //$NON-NLS-1$ - assertEquals("Wrong name", "InputStream", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Wrong package", "java.io", binding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - SimpleType simpleType = (SimpleType) type; - Name name = simpleType.getName(); - IBinding binding2 = name.resolveBinding(); - assertNotNull("No binding", binding2); //$NON-NLS-1$ - assertEquals("Wrong type", IBinding.TYPE, binding2.getKind()); //$NON-NLS-1$ - ITypeBinding typeBinding = (ITypeBinding) binding2; - assertTrue("Not a class", typeBinding.isClass()); //$NON-NLS-1$ - assertEquals("Wrong name", "InputStream", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Wrong package", "java.io", typeBinding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=19851 - */ - public void test0354() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0354", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 2, compilationUnit.getMessages().length); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=20520 - */ - public void test0355() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0355", "Foo.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull(node); - assertTrue("Not an if statement", node.getNodeType() == ASTNode.IF_STATEMENT); //$NON-NLS-1$ - IfStatement ifStatement = (IfStatement) node; - Expression condition = ifStatement.getExpression(); - assertTrue("Not an infixExpression", condition.getNodeType() == ASTNode.INFIX_EXPRESSION); //$NON-NLS-1$ - InfixExpression infixExpression = (InfixExpression) condition; - Expression expression = infixExpression.getLeftOperand(); - assertTrue("Not a method invocation expression", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - Expression expression2 = methodInvocation.getExpression(); - assertTrue("Not a parenthesis expression", expression2.getNodeType() == ASTNode.PARENTHESIZED_EXPRESSION); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=20865 - */ - public void test0356() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0356", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 1, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull(node); - assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - Type type = variableDeclarationStatement.getType(); - ITypeBinding binding = type.resolveBinding(); - assertNotNull("Binding should NOT be null for type: "+type, binding); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=21757 - */ - public void test0357() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0357", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0); - assertNotNull(node); - assertTrue("Not a type declaration statement", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - SimpleName name = typeDeclaration.getName(); - checkSourceRange(name, "A", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=21768 - */ - public void test0358() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0358", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0,0); - assertNotNull(node); - assertTrue("Not a method declaration statement", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - SimpleName name = methodDeclaration.getName(); - checkSourceRange(name, "mdd", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=21768 - */ - public void test0359() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0359", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0,0); - assertNotNull(node); - assertTrue("Not a method declaration statement", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - SimpleName name = methodDeclaration.getName(); - checkSourceRange(name, "mdd", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=21916 - */ - public void test0360() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0360", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0,0, 0); - assertNotNull(node); - assertTrue("Not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$ - ForStatement forStatement = (ForStatement) node; - List initializers = forStatement.initializers(); - assertEquals("Wrong size", 1, initializers.size()); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=21916 - */ - public void test0361() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0361", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0,0, 0); - assertNotNull(node); - assertTrue("Not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$ - ForStatement forStatement = (ForStatement) node; - List initializers = forStatement.initializers(); - assertEquals("Wrong size", 1, initializers.size()); //$NON-NLS-1$ - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=21916 - * @deprecated using deprecated code - */ - public void test0362() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0362", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - ForStatement forStatement = this.ast.newForStatement(); - - VariableDeclarationFragment iFragment = this.ast.newVariableDeclarationFragment(); - iFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$ - iFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$ - VariableDeclarationFragment jFragment = this.ast.newVariableDeclarationFragment(); - jFragment.setName(this.ast.newSimpleName("j")); //$NON-NLS-1$ - jFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$ - VariableDeclarationFragment kFragment = this.ast.newVariableDeclarationFragment(); - kFragment.setName(this.ast.newSimpleName("k")); //$NON-NLS-1$ - kFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$ - - VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(iFragment); - variableDeclarationExpression.setModifiers(Modifier.NONE); -// variableDeclarationExpression.setType(this.ast.newPrimitiveType(PrimitiveType.INT)); - variableDeclarationExpression.fragments().add(jFragment); - variableDeclarationExpression.fragments().add(kFragment); - forStatement.initializers().add(variableDeclarationExpression); - - PostfixExpression iPostfixExpression = this.ast.newPostfixExpression(); - iPostfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$ - iPostfixExpression.setOperator(PostfixExpression.Operator.INCREMENT); - forStatement.updaters().add(iPostfixExpression); - - PostfixExpression jPostfixExpression = this.ast.newPostfixExpression(); - jPostfixExpression.setOperand(this.ast.newSimpleName("j"));//$NON-NLS-1$ - jPostfixExpression.setOperator(PostfixExpression.Operator.INCREMENT); - forStatement.updaters().add(jPostfixExpression); - - PostfixExpression kPostfixExpression = this.ast.newPostfixExpression(); - kPostfixExpression.setOperand(this.ast.newSimpleName("k"));//$NON-NLS-1$ - kPostfixExpression.setOperator(PostfixExpression.Operator.INCREMENT); - forStatement.updaters().add(kPostfixExpression); - - forStatement.setBody(this.ast.newBlock()); - - InfixExpression infixExpression = this.ast.newInfixExpression(); - infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.LESS); - infixExpression.setRightOperand(this.ast.newNumberLiteral("10")); //$NON-NLS-1$ - forStatement.setExpression(infixExpression); - - assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - checkSourceRange(node, "for (var i=0, j=0, k=0; i<10 ; i++, j++, k++) {}", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=22939 - */ - public void test0363() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0363", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 1); - assertNotNull(node); - assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - List fragments = variableDeclarationStatement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = variableDeclarationFragment.getInitializer(); - assertTrue("Not a parenthesized expression", expression.getNodeType() == ASTNode.PARENTHESIZED_EXPRESSION); //$NON-NLS-1$ - Expression expression2 = ((ParenthesizedExpression) expression).getExpression(); - checkSourceRange(expression2, "xxxx", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=11529 - */ - public void test0364() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0364", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull(node); - assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - List fragments = variableDeclarationStatement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - checkSourceRange(variableDeclarationStatement, "var local;", source); //$NON-NLS-1$ - SimpleName simpleName = variableDeclarationFragment.getName(); - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=11529 - */ - public void test0365() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0365", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull(node); - assertTrue("Not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$ - ForStatement forStatement = (ForStatement) node; - List initializers = forStatement.initializers(); - assertEquals("Wrong size", 1, initializers.size()); //$NON-NLS-1$ - VariableDeclarationExpression variableDeclarationExpression = (VariableDeclarationExpression) initializers.get(0); - List fragments = variableDeclarationExpression.fragments(); - assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$ - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0); - SimpleName simpleName = variableDeclarationFragment.getName(); - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23048 - */ - public void test0366() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0366", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull(node); - assertTrue("Not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$ - ForStatement forStatement = (ForStatement) node; - checkSourceRange(forStatement, "for (var i = 0; i < 5; ++i);", source); //$NON-NLS-1$ - Statement statement = forStatement.getBody(); - assertTrue("Not an empty statement", statement.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$ - checkSourceRange(statement, ";", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23048 - */ - public void test0367() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0367", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull(node); - assertTrue("Not a while statement", node.getNodeType() == ASTNode.WHILE_STATEMENT); //$NON-NLS-1$ - WhileStatement whileStatement = (WhileStatement) node; - checkSourceRange(whileStatement, "while(i == 2);", source); //$NON-NLS-1$ - Statement statement = whileStatement.getBody(); - assertTrue("Not an empty statement", statement.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$ - checkSourceRange(statement, ";", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23048 - */ - public void test0368() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0368", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertProblemsSize(compilationUnit, 1, "The label test is never explicitly referenced"); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull(node); - assertTrue("Not a labeled statement", node.getNodeType() == ASTNode.LABELED_STATEMENT); //$NON-NLS-1$ - LabeledStatement labeledStatement = (LabeledStatement) node; - checkSourceRange(labeledStatement, "test:;", source); //$NON-NLS-1$ - Statement statement = labeledStatement.getBody(); - assertTrue("Not an empty statement", statement.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$ - checkSourceRange(statement, ";", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23048 - */ - public void test0369() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0369", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertProblemsSize(compilationUnit, 1, "The label test is never explicitly referenced"); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull(node); - assertTrue("Not a labeled statement", node.getNodeType() == ASTNode.LABELED_STATEMENT); //$NON-NLS-1$ - LabeledStatement labeledStatement = (LabeledStatement) node; - checkSourceRange(labeledStatement, "test:\\u003B", source); //$NON-NLS-1$ - Statement statement = labeledStatement.getBody(); - assertTrue("Not an empty statement", statement.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$ - checkSourceRange(statement, "\\u003B", source); //$NON-NLS-1$ - } - - /** - * DoStatement ==> DoStatement - */ - public void test0370() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0370", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull("Expression should not be null", node); //$NON-NLS-1$ - DoStatement doStatement = this.ast.newDoStatement(); - doStatement.setBody(this.ast.newEmptyStatement()); - doStatement.setExpression(this.ast.newBooleanLiteral(true)); - assertTrue("Both AST trees should be identical", doStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$ - String expectedSource = "do ; while(true);";//$NON-NLS-1$ - checkSourceRange(node, expectedSource, source); - DoStatement doStatement2 = (DoStatement) node; - Statement statement = doStatement2.getBody(); - assertTrue("Not an empty statement", statement.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$ - checkSourceRange(statement, ";", source); //$NON-NLS-1$ - } -} - diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterTest2.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterTest2.java deleted file mode 100644 index 69fd0b4..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterTest2.java +++ /dev/null @@ -1,5418 +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.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import junit.framework.Test; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.wst.jsdt.core.*; -import org.eclipse.wst.jsdt.core.compiler.IProblem; -import org.eclipse.wst.jsdt.core.dom.*; -import org.eclipse.wst.jsdt.core.tests.model.CancelCounter; -import org.eclipse.wst.jsdt.core.tests.model.Canceler; -import org.eclipse.wst.jsdt.core.tests.model.ReconcilerTests; -import org.eclipse.wst.jsdt.core.tests.util.Util; - -public class ASTConverterTest2 extends ConverterTestSetup { - - /** @deprecated using deprecated code */ - public void setUpSuite() throws Exception { - super.setUpSuite(); - this.ast = AST.newAST(AST.JLS2); - } - - public ASTConverterTest2(String name) { - super(name); - } - - static { -// TESTS_NAMES = new String[] {"test0578"}; -// TESTS_NUMBERS = new int[] { 606 }; - } - public static Test suite() { - return buildModelTestSuite(ASTConverterTest2.class); - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=22560 - * @deprecated using deprecated code - */ - public void test0401() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0401", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull(node); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - Block block = methodDeclaration.getBody(); - List statements = block.statements(); - assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$ - Statement statement = (Statement) statements.get(0); - assertTrue("Not a return statement", statement.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) statement; - Expression expression = returnStatement.getExpression(); - assertNotNull("there is no expression", expression); //$NON-NLS-1$ - // call the default initialization - methodDeclaration.getReturnType(); - ITypeBinding typeBinding = expression.resolveTypeBinding(); - assertNotNull("No typebinding", typeBinding); //$NON-NLS-1$ - assertEquals("wrong name", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23464 - */ - public void test0402() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0402", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0, 0); - assertEquals("Wrong number of problems", 0, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$ - assertNotNull(node); - assertTrue("Not a super method invocation", node.getNodeType() == ASTNode.SUPER_CONSTRUCTOR_INVOCATION); //$NON-NLS-1$ - checkSourceRange(node, "new A().super();", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23597 - */ - public void test0403() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0403", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0, 1); - assertEquals("Wrong number of problems", 1, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$ - assertNotNull(node); - assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - Expression expression2 = methodInvocation.getExpression(); - assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$ - SimpleName simpleName = (SimpleName) expression2; - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertTrue("wrong type", binding.getKind() == IBinding.VARIABLE); //$NON-NLS-1$ - IVariableBinding variableBinding = (IVariableBinding) binding; - assertEquals("Wrong name", "test", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - SimpleName simpleName2 = methodInvocation.getName(); - assertEquals("Wrong name", "clone", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$ - IBinding binding2 = simpleName2.resolveBinding(); - assertNotNull("no binding2", binding2); //$NON-NLS-1$ - assertTrue("Wrong type", binding2.getKind() == IBinding.METHOD); //$NON-NLS-1$ - IFunctionBinding methodBinding = (IFunctionBinding) binding2; - assertEquals("Wrong name", "clone", methodBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - IFunctionBinding methodBinding2 = methodInvocation.resolveMethodBinding(); - assertNotNull("No method binding2", methodBinding2); - assertTrue("Wrong binding", methodBinding == methodBinding2); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23597 - */ - public void test0404() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0404", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertEquals("Wrong number of problems", 1, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$ - assertNotNull(node); - assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - Expression expression2 = methodInvocation.getExpression(); - assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$ - SimpleName simpleName = (SimpleName) expression2; - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertTrue("wrong type", binding.getKind() == IBinding.VARIABLE); //$NON-NLS-1$ - IVariableBinding variableBinding = (IVariableBinding) binding; - assertEquals("Wrong name", "a", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - SimpleName simpleName2 = methodInvocation.getName(); - assertEquals("Wrong name", "clone", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$ - IBinding binding2 = simpleName2.resolveBinding(); - assertNotNull("no binding2", binding2); //$NON-NLS-1$ - assertTrue("Wrong type", binding2.getKind() == IBinding.METHOD); //$NON-NLS-1$ - IFunctionBinding methodBinding = (IFunctionBinding) binding2; - assertEquals("Wrong name", "clone", methodBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23597 - */ - public void test0405() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0405", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0, 1); - assertEquals("Wrong number of problems", 1, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$ - assertNotNull(node); - assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - Expression expression2 = methodInvocation.getExpression(); - assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$ - SimpleName simpleName = (SimpleName) expression2; - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertTrue("wrong type", binding.getKind() == IBinding.VARIABLE); //$NON-NLS-1$ - IVariableBinding variableBinding = (IVariableBinding) binding; - assertEquals("Wrong name", "a", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - SimpleName simpleName2 = methodInvocation.getName(); - assertEquals("Wrong name", "clone", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$ - IBinding binding2 = simpleName2.resolveBinding(); - assertNotNull("no binding2", binding2); //$NON-NLS-1$ - assertTrue("Wrong type", binding2.getKind() == IBinding.METHOD); //$NON-NLS-1$ - IFunctionBinding methodBinding = (IFunctionBinding) binding2; - assertEquals("Wrong name", "clone", methodBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23597 - */ - public void test0406() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0406", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - JavaScriptUnit unit = (JavaScriptUnit) result; - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertEquals("Wrong number of problems", 1, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$ - assertNotNull(node); - assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - Expression expression2 = methodInvocation.getExpression(); - assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$ - SimpleName simpleName = (SimpleName) expression2; - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertTrue("wrong type", binding.getKind() == IBinding.VARIABLE); //$NON-NLS-1$ - IVariableBinding variableBinding = (IVariableBinding) binding; - assertEquals("Wrong name", "a", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - SimpleName simpleName2 = methodInvocation.getName(); - assertEquals("Wrong name", "foo", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$ - IBinding binding2 = simpleName2.resolveBinding(); - assertNotNull("no binding2", binding2); //$NON-NLS-1$ - assertTrue("Wrong type", binding2.getKind() == IBinding.METHOD); //$NON-NLS-1$ - IFunctionBinding methodBinding = (IFunctionBinding) binding2; - assertEquals("Wrong name", "foo", methodBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertNull("Got a declaring node in the unit", unit.findDeclaringNode(methodBinding)); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23162 - */ - public void test0407() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0407", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertEquals("Wrong number of problems", 0, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - JavaScriptUnit unit = (JavaScriptUnit) result; - assertNotNull(node); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - SimpleName simpleName = methodDeclaration.getName(); - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertTrue("Not a method binding", binding.getKind() == IBinding.METHOD); //$NON-NLS-1$ - IFunctionBinding methodBinding = (IFunctionBinding) binding; - assertEquals("wrong name", "foo", methodBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - methodDeclaration.setName(methodDeclaration.getAST().newSimpleName("foo2")); //$NON-NLS-1$ - IFunctionBinding methodBinding2 = methodDeclaration.resolveBinding(); - assertNotNull("No methodbinding2", methodBinding2); //$NON-NLS-1$ - assertEquals("wrong name", "foo", methodBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - simpleName = methodDeclaration.getName(); - IBinding binding2 = simpleName.resolveBinding(); - assertNull("Got a binding2", binding2); //$NON-NLS-1$ - - ASTNode astNode = unit.findDeclaringNode(methodBinding); - assertNotNull("No declaring node", astNode); - assertEquals("wrong declaring node", methodDeclaration, astNode); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23162 - * @deprecated using deprecated code - */ - public void test0408() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0408", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertEquals("Wrong number of problems", 0, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull(node); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - Type type = methodDeclaration.getReturnType(); - assertTrue("Not a simple type", type.isSimpleType()); //$NON-NLS-1$ - SimpleType simpleType = (SimpleType) type; - Name name = simpleType.getName(); - assertTrue("Not a qualified name", name.isQualifiedName()); //$NON-NLS-1$ - QualifiedName qualifiedName = (QualifiedName) name; - name = qualifiedName.getQualifier(); - assertTrue("Not a qualified name", name.isQualifiedName()); //$NON-NLS-1$ - qualifiedName = (QualifiedName) name; - name = qualifiedName.getQualifier(); - assertTrue("Not a simple name", name.isSimpleName()); //$NON-NLS-1$ - SimpleName simpleName = (SimpleName) name; - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertTrue("Not a package binding", binding.getKind() == IBinding.PACKAGE); //$NON-NLS-1$ - assertEquals("Wrong name", "java", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23162 - */ - public void test0409() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Hashtable newOptions = JavaScriptCore.getOptions(); - try { - newOptions.put(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_4); - JavaScriptCore.setOptions(newOptions); - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0409", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertProblemsSize(compilationUnit, 0); - BindingsCollectorVisitor bindingsCollectorVisitor = new BindingsCollectorVisitor(); - compilationUnit.accept(bindingsCollectorVisitor); - assertEquals("wrong number", 3, bindingsCollectorVisitor.getUnresolvedNodesSet().size()); //$NON-NLS-1$ - Map bindingsMap = bindingsCollectorVisitor.getBindingsMap(); - assertEquals("wrong number", 205, bindingsMap.size()); //$NON-NLS-1$ - ASTNodesCollectorVisitor nodesCollector = new ASTNodesCollectorVisitor(); - compilationUnit.accept(nodesCollector); - Set detachedNodes = nodesCollector.getDetachedAstNodes(); - int counter = 0; - for (Iterator iterator = detachedNodes.iterator(); iterator.hasNext(); ) { - ASTNode detachedNode = (ASTNode) iterator.next(); - counter++; - IBinding binding = (IBinding) bindingsMap.get(detachedNode); - assertNotNull(binding); - switch(detachedNode.getNodeType()) { - case ASTNode.ARRAY_ACCESS : - case ASTNode.ARRAY_CREATION : - case ASTNode.ARRAY_INITIALIZER : - case ASTNode.ASSIGNMENT : - case ASTNode.BOOLEAN_LITERAL : - case ASTNode.CHARACTER_LITERAL : - case ASTNode.CLASS_INSTANCE_CREATION : - case ASTNode.CONDITIONAL_EXPRESSION : - case ASTNode.FIELD_ACCESS : - case ASTNode.INFIX_EXPRESSION : - case ASTNode.INSTANCEOF_EXPRESSION : - case ASTNode.FUNCTION_INVOCATION : - case ASTNode.NULL_LITERAL : - case ASTNode.NUMBER_LITERAL : - case ASTNode.POSTFIX_EXPRESSION : - case ASTNode.PREFIX_EXPRESSION : - case ASTNode.THIS_EXPRESSION : - case ASTNode.TYPE_LITERAL : - case ASTNode.VARIABLE_DECLARATION_EXPRESSION : - ITypeBinding typeBinding = ((Expression) detachedNode).resolveTypeBinding(); - if (!binding.equals(typeBinding)) { - System.out.println(detachedNode); - } - assertTrue("binding not equals", binding.equals(typeBinding)); //$NON-NLS-1$ - break; - case ASTNode.VARIABLE_DECLARATION_FRAGMENT : - assertTrue("binding not equals", binding.equals(((VariableDeclarationFragment) detachedNode).resolveBinding())); //$NON-NLS-1$ - break; - case ASTNode.ANONYMOUS_CLASS_DECLARATION : - assertTrue("binding not equals", binding.equals(((AnonymousClassDeclaration) detachedNode).resolveBinding())); //$NON-NLS-1$ - break; - case ASTNode.QUALIFIED_NAME : - case ASTNode.SIMPLE_NAME : - IBinding newBinding = ((Name) detachedNode).resolveBinding(); - assertTrue("binding not equals", binding.equals(newBinding)); //$NON-NLS-1$ - break; - case ASTNode.ARRAY_TYPE : - case ASTNode.SIMPLE_TYPE : - case ASTNode.PRIMITIVE_TYPE : - assertTrue("binding not equals", binding.equals(((Type) detachedNode).resolveBinding())); //$NON-NLS-1$ - break; - case ASTNode.CONSTRUCTOR_INVOCATION : - assertTrue("binding not equals", binding.equals(((ConstructorInvocation) detachedNode).resolveConstructorBinding())); //$NON-NLS-1$ - break; - case ASTNode.IMPORT_DECLARATION : - assertTrue("binding not equals", binding.equals(((ImportDeclaration) detachedNode).resolveBinding())); //$NON-NLS-1$ - break; - case ASTNode.FUNCTION_DECLARATION : - assertTrue("binding not equals", binding.equals(((FunctionDeclaration) detachedNode).resolveBinding())); //$NON-NLS-1$ - break; - case ASTNode.PACKAGE_DECLARATION : - assertTrue("binding not equals", binding.equals(((PackageDeclaration) detachedNode).resolveBinding())); //$NON-NLS-1$ - break; - case ASTNode.TYPE_DECLARATION : - assertTrue("binding not equals", binding.equals(((TypeDeclaration) detachedNode).resolveBinding())); //$NON-NLS-1$ - break; - } - } - } finally { - JavaScriptCore.setOptions(options); - } - } - - /** - * Test for message on jdt-core-dev - */ - public void test0410() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0410", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertEquals("Wrong number of problems", 0, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull(node); - assertTrue("Not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$ - Expression expression = ((ReturnStatement) node).getExpression(); - assertTrue("Not an infix expression", expression.getNodeType() == ASTNode.INFIX_EXPRESSION); //$NON-NLS-1$ - InfixExpression infixExpression = (InfixExpression) expression; - List extendedOperands = infixExpression.extendedOperands(); - assertEquals("wrong size", 3, extendedOperands.size()); //$NON-NLS-1$ - } - - /** - * Test for message on jdt-core-dev - */ - public void test0411() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0411", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertEquals("Wrong number of problems", 0, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull(node); - assertTrue("Not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$ - Expression expression = ((ReturnStatement) node).getExpression(); - assertTrue("Not an infix expression", expression.getNodeType() == ASTNode.INFIX_EXPRESSION); //$NON-NLS-1$ - InfixExpression infixExpression = (InfixExpression) expression; - List extendedOperands = infixExpression.extendedOperands(); - assertEquals("wrong size", 0, extendedOperands.size()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=23901 - */ - public void test0412() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0412", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0); - assertNotNull(node); - assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertNotNull("No declaring node", unit.findDeclaringNode(typeBinding)); //$NON-NLS-1$ - Name name = typeDeclaration.getName(); - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - ASTNode declaringNode = unit.findDeclaringNode(binding); - assertNotNull("No declaring node", declaringNode); //$NON-NLS-1$ - assertEquals("Wrong node", typeDeclaration, declaringNode); //$NON-NLS-1$ - typeBinding = name.resolveTypeBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - declaringNode = unit.findDeclaringNode(typeBinding); - assertNotNull("No declaring node", declaringNode); //$NON-NLS-1$ - assertEquals("Wrong node", typeDeclaration, declaringNode); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=20881 - */ - public void test0413() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0413", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 1, 0); - assertNotNull(node); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - List throwsException = methodDeclaration.thrownExceptions(); - assertEquals("wrong size", 2, throwsException.size()); //$NON-NLS-1$ - Name name = (Name) throwsException.get(0); - IBinding binding = name.resolveBinding(); - assertNull("Got a binding", binding); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=23734 - * @deprecated using deprecated code - */ - public void test0414() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0414", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0); - assertNotNull(node); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - Type type = methodDeclaration.getReturnType(); - ITypeBinding typeBinding = type.resolveBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - ASTNode declaringNode = unit.findDeclaringNode(typeBinding); - assertNull("Got a declaring node", declaringNode); //$NON-NLS-1$ - - node = getASTNode(unit, 0, 1); - assertNotNull(node); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration2 = (FunctionDeclaration) node; - Type type2 = methodDeclaration2.getReturnType(); - ITypeBinding typeBinding2 = type2.resolveBinding(); - assertNotNull("No type binding", typeBinding2); //$NON-NLS-1$ - ASTNode declaringNode2 = unit.findDeclaringNode(typeBinding2); - assertNotNull("No declaring node", declaringNode2); //$NON-NLS-1$ - - IJavaScriptUnit sourceUnit2 = getCompilationUnit("Converter" , "src", "test0414", "B.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - - result = runConversion(sourceUnit2, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit2 = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit2.getProblems().length); //$NON-NLS-1$ - ASTNode declaringNode3 = unit2.findDeclaringNode(typeBinding); - assertNull("Got a declaring node", declaringNode3); //$NON-NLS-1$ - - ASTNode declaringNode4 = unit2.findDeclaringNode(typeBinding.getKey()); - assertNotNull("No declaring node", declaringNode4); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24268 - */ - public void test0415() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0415", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0, 0); - assertNotNull("No node", node); - assertTrue("not a switch statement", node.getNodeType() == ASTNode.SWITCH_STATEMENT); //$NON-NLS-1$ - SwitchStatement switchStatement = (SwitchStatement) node; - List statements = switchStatement.statements(); - assertEquals("wrong size", statements.size(), 5); //$NON-NLS-1$ - Statement statement = (Statement) statements.get(3); - assertTrue("not a switch case (default)", statement.getNodeType() == ASTNode.SWITCH_CASE); //$NON-NLS-1$ - SwitchCase defaultCase = (SwitchCase) statement; - assertTrue("not a default case", defaultCase.isDefault()); - checkSourceRange(defaultCase, "default:", source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24324 - */ - public void test0416() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0416", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 1, 0, 0); - assertNotNull("No node", node); - assertTrue("not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - List fragments = statement.fragments(); - assertEquals("Wrong size", fragments.size(), 1); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression init = fragment.getInitializer(); - assertTrue("not a qualified name", init.getNodeType() == ASTNode.QUALIFIED_NAME); //$NON-NLS-1$ - QualifiedName qualifiedName = (QualifiedName) init; - SimpleName simpleName = qualifiedName.getName(); - assertEquals("Wrong name", "CONST", simpleName.getIdentifier()); - IBinding binding = simpleName.resolveBinding(); - assertEquals("Wrong type", IBinding.VARIABLE, binding.getKind()); - IVariableBinding variableBinding = (IVariableBinding) binding; - assertEquals("Wrong modifier", variableBinding.getModifiers(), Modifier.PUBLIC | Modifier.STATIC | Modifier.FINAL); - ASTNode declaringNode = unit.findDeclaringNode(variableBinding); - assertNotNull("No declaring node", declaringNode); - assertTrue("not a variable declaration fragment", declaringNode.getNodeType() == ASTNode.VARIABLE_DECLARATION_FRAGMENT); - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) declaringNode; - FieldDeclaration fieldDeclaration = (FieldDeclaration) variableDeclarationFragment.getParent(); - assertEquals("Wrong modifier", fieldDeclaration.getModifiers(), Modifier.NONE); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24347 - */ - public void test0417() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0417", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0, 0); - assertNotNull("No node", node); - assertTrue("not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - Type type = statement.getType(); - assertTrue("not a simple type", type.getNodeType() == ASTNode.SIMPLE_TYPE); //$NON-NLS-1$ - SimpleType simpleType = (SimpleType) type; - Name name = simpleType.getName(); - assertTrue("Not a qualified name", name.isQualifiedName()); - QualifiedName qualifiedName = (QualifiedName) name; - Name qualifier = qualifiedName.getQualifier(); - assertTrue("Not a simple name", qualifier.isSimpleName()); - IBinding binding = qualifier.resolveBinding(); - assertNotNull("No binding", binding); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24406 - */ - public void test0418() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0418", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 1, 0); - assertNotNull("No node", node); - assertTrue("not an expression statement ", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertTrue("not an method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - Name name = methodInvocation.getName(); - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24449 - */ - public void test0419() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0419", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 1, 0, 0); - assertEquals("Not an expression statement", node.getNodeType(), ASTNode.EXPRESSION_STATEMENT); - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertEquals("Not an assignment", expression.getNodeType(), ASTNode.ASSIGNMENT); - Assignment assignment = (Assignment) expression; - Expression expression2 = assignment.getLeftHandSide(); - assertEquals("Not a name", expression2.getNodeType(), ASTNode.SIMPLE_NAME); - SimpleName simpleName = (SimpleName) expression2; - IBinding binding = simpleName.resolveBinding(); - assertNull(binding); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24453 - */ - public void test0420() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0420", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertEquals("Not an infix expression", expression.getNodeType(), ASTNode.INFIX_EXPRESSION); - InfixExpression infixExpression = (InfixExpression) expression; - Expression expression2 = infixExpression.getRightOperand(); - assertEquals("Not a parenthesized expression", expression2.getNodeType(), ASTNode.PARENTHESIZED_EXPRESSION); - checkSourceRange(expression2, "(2 + 3)", source); - ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression2; - Expression expression3 = parenthesizedExpression.getExpression(); - checkSourceRange(expression3, "2 + 3", source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24453 - */ - public void test0421() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0421", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertEquals("Not an infix expression", expression.getNodeType(), ASTNode.INFIX_EXPRESSION); - InfixExpression infixExpression = (InfixExpression) expression; - checkSourceRange(infixExpression, "(1 + 2) + 3", source); - Expression expression2 = infixExpression.getLeftOperand(); - assertEquals("Not a parenthesized expression", expression2.getNodeType(), ASTNode.PARENTHESIZED_EXPRESSION); - checkSourceRange(expression2, "(1 + 2)", source); - ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression2; - Expression expression3 = parenthesizedExpression.getExpression(); - checkSourceRange(expression3, "1 + 2", source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24453 - */ - public void test0422() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0422", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertEquals("Not an infix expression", expression.getNodeType(), ASTNode.INFIX_EXPRESSION); - InfixExpression infixExpression = (InfixExpression) expression; - checkSourceRange(infixExpression, "( 1 + 2 ) + 3", source); - Expression expression2 = infixExpression.getLeftOperand(); - assertEquals("Not a parenthesized expression", expression2.getNodeType(), ASTNode.PARENTHESIZED_EXPRESSION); - checkSourceRange(expression2, "( 1 + 2 )", source); - ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression2; - Expression expression3 = parenthesizedExpression.getExpression(); - checkSourceRange(expression3, "1 + 2", source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24453 - */ - public void test0423() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0423", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertEquals("Not an infix expression", expression.getNodeType(), ASTNode.INFIX_EXPRESSION); - InfixExpression infixExpression = (InfixExpression) expression; - Expression expression2 = infixExpression.getRightOperand(); - assertEquals("Not a parenthesized expression", expression2.getNodeType(), ASTNode.PARENTHESIZED_EXPRESSION); - checkSourceRange(expression2, "( 2 + 3 )", source); - ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression2; - Expression expression3 = parenthesizedExpression.getExpression(); - checkSourceRange(expression3, "2 + 3", source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24453 - */ - public void test0424() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0424", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertEquals("Not an infix expression", expression.getNodeType(), ASTNode.INFIX_EXPRESSION); - InfixExpression infixExpression = (InfixExpression) expression; - assertEquals("Wrong size", 1, infixExpression.extendedOperands().size()); - Expression expression2 = (Expression) infixExpression.extendedOperands().get(0); - checkSourceRange(expression2, "( 2 + 3 )", source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24453 - */ - public void test0425() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0425", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertEquals("Not an infix expression", expression.getNodeType(), ASTNode.INFIX_EXPRESSION); - InfixExpression infixExpression = (InfixExpression) expression; - assertEquals("Wrong size", 0, infixExpression.extendedOperands().size()); - Expression expression2 = infixExpression.getRightOperand(); - assertTrue("not an infix expression", expression2.getNodeType() == ASTNode.INFIX_EXPRESSION); //$NON-NLS-1$ - InfixExpression infixExpression2 = (InfixExpression) expression2; - Expression expression3 = infixExpression2.getRightOperand(); - assertTrue("not a parenthesized expression", expression3.getNodeType() == ASTNode.PARENTHESIZED_EXPRESSION); //$NON-NLS-1$ - checkSourceRange(expression3, "( 2 + 3 )", source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24449 - */ - public void test0426() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0426", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 1, 0, 0); - assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - Type type = statement.getType(); - assertTrue("not a simple type", type.getNodeType() == ASTNode.SIMPLE_TYPE); - SimpleType simpleType = (SimpleType) type; - Name name = simpleType.getName(); - assertNotNull("No name", name); - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24449 - */ - public void test0427() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0427", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 1, 0, 0); - assertEquals("Not an expression statement", node.getNodeType(), ASTNode.EXPRESSION_STATEMENT); - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertEquals("Not an assignment", expression.getNodeType(), ASTNode.ASSIGNMENT); - Assignment assignment = (Assignment) expression; - Expression expression2 = assignment.getLeftHandSide(); - assertEquals("Not a super field access", expression2.getNodeType(), ASTNode.SUPER_FIELD_ACCESS); - SuperFieldAccess superFieldAccess = (SuperFieldAccess) expression2; - Name name = superFieldAccess.getName(); - assertNotNull("No name", name); - IBinding binding = name.resolveBinding(); - assertNull("Got a binding", binding); - assertNull("Got a binding", superFieldAccess.resolveFieldBinding()); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24449 - */ - public void test0428() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0428", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 1, 0, 0); - assertEquals("Not an expression statement", node.getNodeType(), ASTNode.EXPRESSION_STATEMENT); - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertEquals("Not an assignment", expression.getNodeType(), ASTNode.ASSIGNMENT); - Assignment assignment = (Assignment) expression; - Expression expression2 = assignment.getLeftHandSide(); - assertEquals("Not a qualified name", expression2.getNodeType(), ASTNode.QUALIFIED_NAME); - QualifiedName name = (QualifiedName) expression2; - SimpleName simpleName = name.getName(); - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); - IBinding binding2 = name.resolveBinding(); - assertNotNull("No binding2", binding2); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24449 - */ - public void test0429() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0429", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 1, 0, 0); - assertEquals("Not an expression statement", node.getNodeType(), ASTNode.EXPRESSION_STATEMENT); - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertEquals("Not an assignment", expression.getNodeType(), ASTNode.ASSIGNMENT); - Assignment assignment = (Assignment) expression; - Expression expression2 = assignment.getLeftHandSide(); - assertEquals("Not a qualified name", expression2.getNodeType(), ASTNode.QUALIFIED_NAME); - QualifiedName name = (QualifiedName) expression2; - SimpleName simpleName = name.getName(); - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); - IBinding binding2 = name.resolveBinding(); - assertNotNull("No binding2", binding2); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24499 - */ - public void test0430() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0430", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0, 0); - assertTrue("Not a constructor invocation", node.getNodeType() == ASTNode.CONSTRUCTOR_INVOCATION); - ConstructorInvocation constructorInvocation = (ConstructorInvocation) node; - checkSourceRange(constructorInvocation, "this(coo2());", source); - List arguments = constructorInvocation.arguments(); - assertEquals("Wrong size", 1, arguments.size()); - Expression expression = (Expression) arguments.get(0); - assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - SimpleName simpleName = methodInvocation.getName(); - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24500 - */ - public void test0431() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0431", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0, 0); - assertTrue("Not a constructor invocation", node.getNodeType() == ASTNode.CONSTRUCTOR_INVOCATION); - ConstructorInvocation constructorInvocation = (ConstructorInvocation) node; - List arguments = constructorInvocation.arguments(); - assertEquals("Wrong size", 1, arguments.size()); - Expression expression = (Expression) arguments.get(0); - assertTrue("Not a simple name", expression.getNodeType() == ASTNode.SIMPLE_NAME); - SimpleName simpleName = (SimpleName) expression; - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24501 - */ - public void test0432() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0432", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 1, 0, 0); - assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType()); - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertEquals("Not an assignment", ASTNode.ASSIGNMENT, expression.getNodeType()); - Assignment assignment = (Assignment) expression; - Expression expression2 = assignment.getLeftHandSide(); - assertEquals("Not a simple name", ASTNode.SIMPLE_NAME, expression2.getNodeType()); - SimpleName simpleName = (SimpleName) expression2; - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24501 - */ - public void test0433() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0433", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 1, 0, 0); - assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType()); - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertEquals("Not an assignment", ASTNode.ASSIGNMENT, expression.getNodeType()); - Assignment assignment = (Assignment) expression; - Expression expression2 = assignment.getLeftHandSide(); - assertEquals("Not a super field access", ASTNode.SUPER_FIELD_ACCESS, expression2.getNodeType()); - SuperFieldAccess superFieldAccess = (SuperFieldAccess) expression2; - SimpleName simpleName = superFieldAccess.getName(); - assertEquals("wrong name", "fCoo", simpleName.getIdentifier()); - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); - assertEquals("Wrong binding", IBinding.VARIABLE, binding.getKind()); - IVariableBinding variableBinding = superFieldAccess.resolveFieldBinding(); - assertTrue("Different binding", binding == variableBinding); - ASTNode astNode = unit.findDeclaringNode(variableBinding); - assertTrue("Wrong type", astNode.getNodeType() == ASTNode.SINGLE_VARIABLE_DECLARATION || astNode.getNodeType() == ASTNode.VARIABLE_DECLARATION_FRAGMENT || astNode.getNodeType() == ASTNode.VARIABLE_DECLARATION_EXPRESSION); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24501 - */ - public void test0434() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0434", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 1, 0, 0); - assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType()); - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertEquals("Not an assignment", ASTNode.ASSIGNMENT, expression.getNodeType()); - Assignment assignment = (Assignment) expression; - Expression expression2 = assignment.getLeftHandSide(); - assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, expression2.getNodeType()); - QualifiedName qualifiedName = (QualifiedName) expression2; - SimpleName simpleName = qualifiedName.getName(); - assertEquals("wrong name", "fCoo", simpleName.getIdentifier()); - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24501 - */ - public void test0435() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0435", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 1, 0, 0); - assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType()); - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertEquals("Not an assignment", ASTNode.ASSIGNMENT, expression.getNodeType()); - Assignment assignment = (Assignment) expression; - Expression expression2 = assignment.getLeftHandSide(); - assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, expression2.getNodeType()); - QualifiedName qualifiedName = (QualifiedName) expression2; - SimpleName simpleName = qualifiedName.getName(); - assertEquals("wrong name", "fCoo", simpleName.getIdentifier()); - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24502 - */ - public void test0436() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0436", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertProblemsSize(unit, 1, "The type A.CInner is not visible"); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 1, 0, 0); - assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType()); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - Type type = statement.getType(); - assertEquals("Not a simple type", ASTNode.SIMPLE_TYPE, type.getNodeType()); - SimpleType simpleType = (SimpleType) type; - Name name = simpleType.getName(); - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); - assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, name.getNodeType()); - QualifiedName qualifiedName = (QualifiedName) name; - SimpleName simpleName = qualifiedName.getName(); - assertEquals("wrong name", "CInner", simpleName.getIdentifier()); - IBinding binding2 = simpleName.resolveBinding(); - assertNotNull("No binding", binding2); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24502 - */ - public void test0437() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0437", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertProblemsSize(unit, 1, "The type CInner is not visible"); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 1, 0, 0); - assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType()); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - Type type = statement.getType(); - assertEquals("Not a simple type", ASTNode.SIMPLE_TYPE, type.getNodeType()); - SimpleType simpleType = (SimpleType) type; - Name name = simpleType.getName(); - assertEquals("Not a simple name", ASTNode.SIMPLE_NAME, name.getNodeType()); - SimpleName simpleName = (SimpleName) name; - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24511 - */ - public void test0438() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0438", "D.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - List imports = unit.imports(); - assertEquals("Wrong size", 1, imports.size()); //$NON-NLS-1$< - ImportDeclaration importDeclaration = (ImportDeclaration) imports.get(0); - IBinding binding = importDeclaration.resolveBinding(); - assertNotNull("No binding", binding); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24502 - */ - public void test0439() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0439", "E.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType()); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - Type type = statement.getType(); - assertEquals("Not a simple type", ASTNode.SIMPLE_TYPE, type.getNodeType()); - SimpleType simpleType = (SimpleType) type; - Name name = simpleType.getName(); - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24622 - */ - public void test0440() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0440", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType()); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - List fragments = statement.fragments(); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertEquals("Not an infix expression", ASTNode.INFIX_EXPRESSION, expression.getNodeType()); - // 2 * 3 + "" + (true) - InfixExpression infixExpression = (InfixExpression) expression; - checkSourceRange(infixExpression, "2 * 3 + \"\" + (true)", source); - Expression leftOperand = infixExpression.getLeftOperand(); - checkSourceRange(leftOperand, "2 * 3 + \"\"", source); - checkSourceRange(infixExpression.getRightOperand(), "(true)", source); - assertEquals("wrong operator", infixExpression.getOperator(), InfixExpression.Operator.PLUS); - assertEquals("wrong type", ASTNode.INFIX_EXPRESSION, leftOperand.getNodeType()); - infixExpression = (InfixExpression) leftOperand; - checkSourceRange(infixExpression, "2 * 3 + \"\"", source); - leftOperand = infixExpression.getLeftOperand(); - checkSourceRange(leftOperand, "2 * 3", source); - checkSourceRange(infixExpression.getRightOperand(), "\"\"", source); - assertEquals("wrong operator", infixExpression.getOperator(), InfixExpression.Operator.PLUS); - assertEquals("wrong type", ASTNode.INFIX_EXPRESSION, leftOperand.getNodeType()); - infixExpression = (InfixExpression) leftOperand; - checkSourceRange(infixExpression, "2 * 3", source); - leftOperand = infixExpression.getLeftOperand(); - checkSourceRange(leftOperand, "2", source); - checkSourceRange(infixExpression.getRightOperand(), "3", source); - assertEquals("wrong operator", infixExpression.getOperator(), InfixExpression.Operator.TIMES); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24622 - */ - public void test0441() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0441", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType()); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - List fragments = statement.fragments(); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertEquals("Not an infix expression", ASTNode.INFIX_EXPRESSION, expression.getNodeType()); - InfixExpression infixExpression = (InfixExpression) expression; - checkSourceRange(infixExpression, "(2 + 2) * 3 * 1", source); - Expression leftOperand = infixExpression.getLeftOperand(); - checkSourceRange(leftOperand, "(2 + 2)", source); - checkSourceRange(infixExpression.getRightOperand(), "3", source); - List extendedOperands = infixExpression.extendedOperands(); - assertEquals("wrong size", 1, extendedOperands.size()); - checkSourceRange((Expression) extendedOperands.get(0), "1", source); - assertEquals("wrong operator", InfixExpression.Operator.TIMES, infixExpression.getOperator()); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24622 - */ - public void test0442() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0442", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType()); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - List fragments = statement.fragments(); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertEquals("Not an infix expression", ASTNode.INFIX_EXPRESSION, expression.getNodeType()); - InfixExpression infixExpression = (InfixExpression) expression; - checkSourceRange(infixExpression, "2 + (2 * 3) + 1", source); - Expression leftOperand = infixExpression.getLeftOperand(); - checkSourceRange(leftOperand, "2", source); - Expression rightOperand = infixExpression.getRightOperand(); - checkSourceRange(rightOperand, "(2 * 3)", source); - assertEquals("wrong type", ASTNode.PARENTHESIZED_EXPRESSION, rightOperand.getNodeType()); - List extendedOperands = infixExpression.extendedOperands(); - assertEquals("wrong size", 1, extendedOperands.size()); - checkSourceRange((Expression) extendedOperands.get(0), "1", source); - assertEquals("wrong operator", InfixExpression.Operator.PLUS, infixExpression.getOperator()); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24623 - */ - public void test0443() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0443", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 2, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0); - assertEquals("Wrong type", ASTNode.FUNCTION_DECLARATION, node.getNodeType()); - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertNotNull("No body", methodDeclaration.getBody()); - assertNotNull("No binding", methodDeclaration.resolveBinding()); - assertTrue("Not an abstract method", Modifier.isAbstract(methodDeclaration.getModifiers())); - assertTrue("Not malformed", isMalformed(methodDeclaration)); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24623 - */ - public void test0444() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0444", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 2, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0); - assertEquals("Wrong type", ASTNode.TYPE_DECLARATION, node.getNodeType()); - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - List bodyDeclarations = typeDeclaration.bodyDeclarations(); - assertEquals("Wrong size", 2, bodyDeclarations.size()); - BodyDeclaration bodyDeclaration = (BodyDeclaration)bodyDeclarations.get(0); - assertEquals("Wrong type", ASTNode.FUNCTION_DECLARATION, bodyDeclaration.getNodeType()); - FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration; - assertEquals("Wrong name", "foo", methodDeclaration.getName().getIdentifier()); - assertNull("Got a binding", methodDeclaration.resolveBinding()); - bodyDeclaration = (BodyDeclaration)bodyDeclarations.get(1); - assertEquals("Wrong type", ASTNode.FUNCTION_DECLARATION, bodyDeclaration.getNodeType()); - assertEquals("Wrong name", "foo", ((FunctionDeclaration) bodyDeclaration).getName().getIdentifier()); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24773 - */ - public void test0445() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0445", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=25018 - */ - public void test0446() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0446", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 2, unit.getProblems().length); //$NON-NLS-1$< - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=25124 - */ - public void test0447() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0447", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 3, unit.getProblems().length); //$NON-NLS-1$< - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=25330 - * @deprecated using deprecated code - */ - public void test0448() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0448", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0); - assertEquals("Not a method declaration", node.getNodeType(), ASTNode.FUNCTION_DECLARATION); - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertTrue("Not a constructor", methodDeclaration.isConstructor()); - ITypeBinding returnTypeBinding = methodDeclaration.getReturnType().resolveBinding(); - assertNotNull("No return type binding", returnTypeBinding); - Block block = methodDeclaration.getBody(); - assertNotNull("No method body", block); - assertEquals("wrong size", 0, block.statements().size()); - } - - /** - * Check that the implicit super constructor call is not there - */ - public void test0449() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0449", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0); - assertEquals("Not a method declaration", node.getNodeType(), ASTNode.FUNCTION_DECLARATION); - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertTrue("Not a constructor", methodDeclaration.isConstructor()); - Block block = methodDeclaration.getBody(); - assertNotNull("No method body", block); - assertEquals("wrong size", 1, block.statements().size()); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26452 - */ - public void test0450() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0450", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0); - assertEquals("Not a type declaration", node.getNodeType(), ASTNode.TYPE_DECLARATION); - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertNotNull("No type binding", typeBinding); - assertTrue("not a class", typeBinding.isClass()); - assertTrue("not a toplevel type", typeBinding.isTopLevel()); - assertTrue("a local type", !typeBinding.isLocal()); - assertTrue("an anonymous type", !typeBinding.isAnonymous()); - assertTrue("a member type", !typeBinding.isMember()); - assertTrue("a nested type", !typeBinding.isNested()); - node = getASTNode(unit, 0, 0, 0); - assertEquals("Not an expression statement", node.getNodeType(), ASTNode.EXPRESSION_STATEMENT); - Expression expression = ((ExpressionStatement) node).getExpression(); - assertEquals("Not a class instance creation", expression.getNodeType(), ASTNode.CLASS_INSTANCE_CREATION); - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression; - AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration(); - typeBinding = anonymousClassDeclaration.resolveBinding(); - assertNotNull("No type binding", typeBinding); - assertTrue("not a class", typeBinding.isClass()); - assertTrue("a toplevel type", !typeBinding.isTopLevel()); - assertTrue("not a local type", typeBinding.isLocal()); - assertTrue("not an anonymous type", typeBinding.isAnonymous()); - assertTrue("a member type", !typeBinding.isMember()); - assertTrue("not a nested type", typeBinding.isNested()); - ASTNode astNode = unit.findDeclaringNode(typeBinding); - assertEquals("Wrong type", ASTNode.ANONYMOUS_CLASS_DECLARATION, astNode.getNodeType()); - assertNotNull("Didn't get a key", typeBinding.getKey()); - astNode = unit.findDeclaringNode(typeBinding.getKey()); - assertNotNull("Didn't get a declaring node", astNode); - - ITypeBinding typeBinding3 = classInstanceCreation.resolveTypeBinding(); - assertEquals("wrong binding", typeBinding, typeBinding3); - - List bodyDeclarations = anonymousClassDeclaration.bodyDeclarations(); - assertEquals("wrong size", 2, bodyDeclarations.size()); - BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); - assertTrue("not a type declaration", bodyDeclaration.getNodeType() == ASTNode.TYPE_DECLARATION); - typeDeclaration = (TypeDeclaration) bodyDeclaration; - - bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(1); - FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration; - Block block = methodDeclaration.getBody(); - assertNotNull("No body", block); - List statements = block.statements(); - assertEquals("wrong size", 2, statements.size()); - Statement statement = (Statement) statements.get(1); - assertEquals("Not a variable declaration statement", statement.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT); - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) statement; - Type type = variableDeclarationStatement.getType(); - assertNotNull("No type", type); - - ITypeBinding typeBinding2 = type.resolveBinding(); - typeBinding = typeDeclaration.resolveBinding(); - assertTrue("not equals", typeBinding == typeBinding2); - assertNotNull("No type binding", typeBinding); - assertTrue("not a class", typeBinding.isClass()); - assertTrue("a toplevel type", !typeBinding.isTopLevel()); - assertTrue("an anonymous type", !typeBinding.isAnonymous()); - assertTrue("not a member type", typeBinding.isMember()); - assertTrue("not a nested type", typeBinding.isNested()); - assertTrue("a local type", !typeBinding.isLocal()); - - bodyDeclarations = typeDeclaration.bodyDeclarations(); - assertEquals("wrong size", 1, bodyDeclarations.size()); - bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); - assertTrue("not a type declaration", bodyDeclaration.getNodeType() == ASTNode.TYPE_DECLARATION); - typeDeclaration = (TypeDeclaration) bodyDeclaration; - typeBinding = typeDeclaration.resolveBinding(); - assertNotNull("No type binding", typeBinding); - assertTrue("not a class", typeBinding.isClass()); - assertTrue("a toplevel type", !typeBinding.isTopLevel()); - assertTrue("an anonymous type", !typeBinding.isAnonymous()); - assertTrue("not a member type", typeBinding.isMember()); - assertTrue("not a nested type", typeBinding.isNested()); - assertTrue("a local type", !typeBinding.isLocal()); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24916 - * @deprecated using deprecated code - */ - public void test0451() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0451", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 2, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0); - assertNotNull("No node", node); - assertTrue("not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - Type type = methodDeclaration.getReturnType(); - checkSourceRange(type, "int", source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=27204 - */ - public void test0452() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "", "NO_WORKING.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, false); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertNotNull("No node", node); - assertTrue("not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - SimpleName name = methodDeclaration.getName(); - assertEquals("wrong line number", 3, compilationUnit.getLineNumber(name.getStartPosition())); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=27173 - */ - public void test0453() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0453", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0,0); - assertNotNull("No node", node); - assertTrue("not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node; - Expression expression = returnStatement.getExpression(); - assertTrue("not a super method invocation", expression.getNodeType() == ASTNode.SUPER_METHOD_INVOCATION); //$NON-NLS-1$ - SuperMethodInvocation methodInvocation = (SuperMethodInvocation) expression; - IFunctionBinding methodBinding = methodInvocation.resolveMethodBinding(); - assertNotNull("No method binding", methodBinding); - assertEquals("Wrong binding", "toString", methodBinding.getName()); - } - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28296 - */ - public void test0454() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0454", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0,1); - assertNotNull("No node", node); - assertTrue("not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - List fragments = statement.fragments(); - assertEquals("wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - checkSourceRange(expression, "(int) (3.14f * a)", source); - } - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28682 - */ - public void test0455() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0455", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull("No node", node); - assertTrue("not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$ - ForStatement forStatement = (ForStatement) node; // first for loop - String expectedSource = "for (int i = 0; i < 10; i++) // for 1\n" + - " for (int j = 0; j < 10; j++) // for 2\n" + - " if (true) { }"; - checkSourceRange(forStatement, expectedSource, source); - Statement body = forStatement.getBody(); - expectedSource = "for (int j = 0; j < 10; j++) // for 2\n" + - " if (true) { }"; - checkSourceRange(body, expectedSource, source); - assertTrue("not a for statement", body.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$ - ForStatement forStatement2 = (ForStatement) body; - body = forStatement2.getBody(); - expectedSource = "if (true) { }"; - checkSourceRange(body, expectedSource, source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28682 - */ - public void test0456() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0456", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull("No node", node); - assertTrue("not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$ - ForStatement forStatement = (ForStatement) node; // first for loop - String expectedSource = "for (int x= 10; x < 20; x++)\n" + - " main();"; - checkSourceRange(forStatement, expectedSource, source); - Statement body = forStatement.getBody(); - expectedSource = "main();"; - checkSourceRange(body, expectedSource, source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28682 - */ - public void test0457() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0457", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull("No node", node); - assertTrue("not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$ - ForStatement forStatement = (ForStatement) node; // first for loop - String expectedSource = "for (int i= 10; i < 10; i++)/*[*/\n"+ - " for (int z= 10; z < 10; z++)\n" + - " foo();"; - checkSourceRange(forStatement, expectedSource, source); - Statement body = forStatement.getBody(); - expectedSource = "for (int z= 10; z < 10; z++)\n" + - " foo();"; - checkSourceRange(body, expectedSource, source); - assertTrue("not a for statement", body.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$ - ForStatement forStatement2 = (ForStatement) body; - body = forStatement2.getBody(); - expectedSource = "foo();"; - checkSourceRange(body, expectedSource, source); - } - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28682 - */ - public void test0458() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0458", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull("No node", node); - assertTrue("not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$ - ForStatement forStatement = (ForStatement) node; // first for loop - String expectedSource = "for (int i= 10; i < 10; i++)/*[*/\n"+ - " for (int z= 10; z < 10; z++)\n" + - " ;"; - checkSourceRange(forStatement, expectedSource, source); - Statement body = forStatement.getBody(); - expectedSource = "for (int z= 10; z < 10; z++)\n" + - " ;"; - checkSourceRange(body, expectedSource, source); - assertTrue("not a for statement", body.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$ - ForStatement forStatement2 = (ForStatement) body; - body = forStatement2.getBody(); - expectedSource = ";"; - checkSourceRange(body, expectedSource, source); - assertTrue("not an empty statement", body.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28682 - */ - public void test0459() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0459", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull("No node", node); - assertTrue("not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$ - ForStatement forStatement = (ForStatement) node; // first for loop - String expectedSource = "for (int i= 10; i < 10; i++)/*[*/\n"+ - " for (int z= 10; z < 10; z++)\n" + - " { }"; - checkSourceRange(forStatement, expectedSource, source); - Statement body = forStatement.getBody(); - expectedSource = "for (int z= 10; z < 10; z++)\n" + - " { }"; - checkSourceRange(body, expectedSource, source); - assertTrue("not a for statement", body.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$ - ForStatement forStatement2 = (ForStatement) body; - body = forStatement2.getBody(); - expectedSource = "{ }"; - checkSourceRange(body, expectedSource, source); - assertTrue("not a block", body.getNodeType() == ASTNode.BLOCK); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28869 - */ - public void test0460() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0460", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertTrue("Has error", compilationUnit.getProblems().length == 0); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull("No node", node); - assertTrue("Malformed", !isMalformed(node)); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28824 - */ - public void test0461() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0461", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, false); - char[] source = sourceUnit.getSource().toCharArray(); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertTrue("Has error", compilationUnit.getProblems().length == 0); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull("No node", node); - assertTrue("Malformed", !isMalformed(node)); - assertTrue("not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertTrue("not an assignment", expression.getNodeType() == ASTNode.ASSIGNMENT); //$NON-NLS-1$ - Assignment assignment = (Assignment) expression; - checkSourceRange(assignment, "z= foo().y.toList()", source); - Expression expression2 = assignment.getRightHandSide(); - checkSourceRange(expression2, "foo().y.toList()", source); - assertTrue("not a method invocation", expression2.getNodeType() == ASTNode.FUNCTION_INVOCATION); - FunctionInvocation methodInvocation = (FunctionInvocation) expression2; - Expression expression3 = methodInvocation.getExpression(); - checkSourceRange(expression3, "foo().y", source); - checkSourceRange(methodInvocation.getName(), "toList", source); - assertTrue("not a field access", expression3.getNodeType() == ASTNode.FIELD_ACCESS); - FieldAccess fieldAccess = (FieldAccess) expression3; - checkSourceRange(fieldAccess.getName(), "y", source); - Expression expression4 = fieldAccess.getExpression(); - checkSourceRange(expression4, "foo()", source); - assertTrue("not a method invocation", expression4.getNodeType() == ASTNode.FUNCTION_INVOCATION); - FunctionInvocation methodInvocation2 = (FunctionInvocation) expression4; - checkSourceRange(methodInvocation2.getName(), "foo", source); - assertNull("no null", methodInvocation2.getExpression()); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=32338 - */ - public void test0462() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "", "Test462.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertTrue("Has error", compilationUnit.getProblems().length == 0); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0); - assertNotNull("No node", node); - assertTrue("not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - assertEquals("Wrong name", "Test462", typeDeclaration.getName().getIdentifier()); - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertNotNull("No binding", typeBinding); - assertEquals("Wrong name", "Test462", typeBinding.getQualifiedName()); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=33450 - */ - public void test0463() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0463", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, false); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull("No node", node); - assertTrue("not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node; - Expression expression = returnStatement.getExpression(); - assertNotNull("No expression", expression); - assertTrue("not a string literal", expression.getNodeType() == ASTNode.STRING_LITERAL); //$NON-NLS-1$ - StringLiteral stringLiteral = (StringLiteral) expression; - checkSourceRange(stringLiteral, "\"\\012\\015\\u0061\"", source); - assertEquals("wrong value", "\012\015a", stringLiteral.getLiteralValue()); - assertEquals("wrong value", "\"\\012\\015\\u0061\"", stringLiteral.getEscapedValue()); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=33039 - */ - public void test0464() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0464", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertEquals("No error", 1, compilationUnit.getProblems().length); //$NON-NLS-1$ - assertNotNull("No node", node); - assertTrue("not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node; - Expression expression = returnStatement.getExpression(); - assertNotNull("No expression", expression); - assertTrue("not a null literal", expression.getNodeType() == ASTNode.NULL_LITERAL); //$NON-NLS-1$ - NullLiteral nullLiteral = (NullLiteral) expression; - ITypeBinding typeBinding = nullLiteral.resolveTypeBinding(); - assertNotNull("No type binding", typeBinding); - assertFalse("A primitive type", typeBinding.isPrimitive()); - assertTrue("Null type", typeBinding.isNullType()); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=33831 - */ - public void test0465() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0465", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 1, 0); - assertEquals("No error", 0, compilationUnit.getProblems().length); //$NON-NLS-1$ - assertNotNull("No node", node); - assertTrue("not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node; - Expression expression = returnStatement.getExpression(); - assertNotNull("No expression", expression); - assertTrue("not a field access", expression.getNodeType() == ASTNode.FIELD_ACCESS); //$NON-NLS-1$ - FieldAccess fieldAccess = (FieldAccess) expression; - Name name = fieldAccess.getName(); - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); - assertEquals("Wrong type", IBinding.VARIABLE, binding.getKind()); - IVariableBinding variableBinding = (IVariableBinding) binding; - assertEquals("Wrong name", "i", variableBinding.getName()); - assertEquals("Wrong type", "int", variableBinding.getType().getName()); - IVariableBinding variableBinding2 = fieldAccess.resolveFieldBinding(); - assertTrue("different binding", variableBinding == variableBinding2); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=33949 - */ - public void test0466() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Hashtable newOptions = JavaScriptCore.getOptions(); - try { - newOptions.put(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_4); - JavaScriptCore.setOptions(newOptions); - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0466", "Assert.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - checkSourceRange(node, "assert ref != null : message;", source); - } finally { - JavaScriptCore.setOptions(options); - } - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=33949 - */ - public void test0467() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Hashtable newOptions = JavaScriptCore.getOptions(); - try { - newOptions.put(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_4); - JavaScriptCore.setOptions(newOptions); - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0467", "Assert.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - checkSourceRange(node, "assert ref != null : message\\u003B", source); - - node = getASTNode(compilationUnit, 0, 0, 1); - checkSourceRange(node, "assert ref != null\\u003B", source); - } finally { - JavaScriptCore.setOptions(options); - } - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=36772 - */ - public void test0468() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0468", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 1, 0); - assertEquals("No error", 0, compilationUnit.getProblems().length); //$NON-NLS-1$ - assertNotNull("No node", node); - assertTrue("not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node; - Expression expression = returnStatement.getExpression(); - assertNotNull("No expression", expression); - assertTrue("not a field access", expression.getNodeType() == ASTNode.FIELD_ACCESS); //$NON-NLS-1$ - FieldAccess fieldAccess = (FieldAccess) expression; - Name name = fieldAccess.getName(); - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); - assertEquals("Wrong type", IBinding.VARIABLE, binding.getKind()); - IVariableBinding variableBinding = (IVariableBinding) binding; - assertEquals("Wrong name", "i", variableBinding.getName()); - assertEquals("Wrong type", "int", variableBinding.getType().getName()); - IVariableBinding variableBinding2 = fieldAccess.resolveFieldBinding(); - assertTrue("different binding", variableBinding == variableBinding2); - - node = getASTNode(compilationUnit, 0, 0); - assertNotNull("No node", node); - assertEquals("Wrong type", ASTNode.FIELD_DECLARATION, node.getNodeType()); - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - List fragments = fieldDeclaration.fragments(); - assertEquals("wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - - ASTNode foundNode = compilationUnit.findDeclaringNode(variableBinding); - assertNotNull("No found node", foundNode); - assertEquals("wrong node", fragment, foundNode); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=36895 - */ - public void test0469() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "codeManipulation", "bug.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 2, 0); - assertEquals("No error", 0, compilationUnit.getProblems().length); //$NON-NLS-1$ - assertNotNull("No node", node); - assertTrue("not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - ASTNode parent = node.getParent(); - assertNotNull(parent); - assertTrue("not a block", parent.getNodeType() == ASTNode.BLOCK); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=37381 - */ - public void test0470() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0470", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertEquals("No error", 0, compilationUnit.getProblems().length); //$NON-NLS-1$ - assertNotNull("No node", node); - assertTrue("not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$ - ForStatement forStatement = (ForStatement) node; - List initializers = forStatement.initializers(); - assertEquals("wrong size", 1, initializers.size()); - Expression initializer = (Expression) initializers.get(0); - assertTrue("not a variable declaration expression", initializer.getNodeType() == ASTNode.VARIABLE_DECLARATION_EXPRESSION); //$NON-NLS-1$ - VariableDeclarationExpression variableDeclarationExpression = (VariableDeclarationExpression) initializer; - List fragments = variableDeclarationExpression.fragments(); - assertEquals("wrong size", 2, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - checkSourceRange(fragment, "i= 0", source); - fragment = (VariableDeclarationFragment) fragments.get(1); - checkSourceRange(fragment, "j= goo(3)", source); - checkSourceRange(variableDeclarationExpression, "int i= 0, j= goo(3)", source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=38447 - */ - public void test0471() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0471", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("No error", 1, compilationUnit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertNotNull("No node", node); - assertTrue("not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertTrue("Is a constructor", !methodDeclaration.isConstructor()); - checkSourceRange(methodDeclaration, "private void foo(){", source); - node = getASTNode(compilationUnit, 0, 1); - assertNotNull("No node", node); - assertTrue("not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - methodDeclaration = (FunctionDeclaration) node; - assertTrue("Is a constructor", !methodDeclaration.isConstructor()); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=38447 - */ - public void test0472() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "junit.textui", "ResultPrinter.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("No error", 2, compilationUnit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 2); - assertNotNull("No node", node); - assertTrue("not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertTrue("Not a constructor", methodDeclaration.isConstructor()); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=38732 - */ - public void test0473() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Hashtable newOptions = JavaScriptCore.getOptions(); - try { - newOptions.put(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_4); - newOptions.put(JavaScriptCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaScriptCore.ERROR); - JavaScriptCore.setOptions(newOptions); - - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0473", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("No error", 2, compilationUnit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull("No node", node); - } finally { - JavaScriptCore.setOptions(options); - } - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=39259 - */ - public void test0474() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0474", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("No error", 0, compilationUnit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 1, 0); - assertNotNull("No node", node); - assertEquals("Not a while statement", node.getNodeType(), ASTNode.WHILE_STATEMENT); - WhileStatement whileStatement = (WhileStatement) node; - Statement statement = whileStatement.getBody(); - assertEquals("Not a while statement", statement.getNodeType(), ASTNode.WHILE_STATEMENT); - WhileStatement whileStatement2 = (WhileStatement) statement; - String expectedSource = - "while(b())\n" + - " foo();"; - checkSourceRange(whileStatement2, expectedSource, source); - Statement statement2 = whileStatement2.getBody(); - checkSourceRange(statement2, "foo();", source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=39259 - */ - public void test0475() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0475", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("No error", 0, compilationUnit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 1, 0); - assertNotNull("No node", node); - assertEquals("Not an if statement", node.getNodeType(), ASTNode.IF_STATEMENT); - IfStatement statement = (IfStatement) node; - Statement statement2 = statement.getThenStatement(); - assertEquals("Not an if statement", statement2.getNodeType(), ASTNode.IF_STATEMENT); - IfStatement statement3 = (IfStatement) statement2; - String expectedSource = - "if(b())\n" + - " foo();"; - checkSourceRange(statement3, expectedSource, source); - Statement statement4 = statement3.getThenStatement(); - checkSourceRange(statement4, "foo();", source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=39259 - */ - public void test0476() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0476", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("No error", 0, compilationUnit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 1, 0); - assertNotNull("No node", node); - assertEquals("Not a for statement", node.getNodeType(), ASTNode.FOR_STATEMENT); - ForStatement statement = (ForStatement) node; - Statement statement2 = statement.getBody(); - assertEquals("Not a for statement", statement2.getNodeType(), ASTNode.FOR_STATEMENT); - ForStatement statement3 = (ForStatement) statement2; - String expectedSource = - "for(;b();)\n" + - " foo();"; - checkSourceRange(statement3, expectedSource, source); - Statement statement4 = statement3.getBody(); - checkSourceRange(statement4, "foo();", source); - } - - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=39327 - */ - public void test0477() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0477", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("No error", 1, compilationUnit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 1, 0); - assertNotNull("No node", node); - - checkSourceRange(node, "this(undef());", source); - assertEquals("Not a constructor invocation", node.getNodeType(), ASTNode.CONSTRUCTOR_INVOCATION); - ConstructorInvocation constructorInvocation = (ConstructorInvocation) node; - List arguments = constructorInvocation.arguments(); - assertEquals("Wrong size", 1, arguments.size()); - IFunctionBinding binding = constructorInvocation.resolveConstructorBinding(); - assertNotNull("No binding", binding); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474 - */ - public void test0478() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0478", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - IType[] types = sourceUnit.getTypes(); - assertNotNull(types); - assertEquals("wrong size", 2, types.length); - IType type = types[1]; - IFunction[] methods = type.getFunctions(); - assertNotNull(methods); - assertEquals("wrong size", 1, methods.length); - IFunction method = methods[0]; - ISourceRange sourceRange = method.getSourceRange(); - ASTNode result = runConversion(sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, true); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier()); - IFunctionBinding methodBinding = methodDeclaration.resolveBinding(); - assertNotNull(methodBinding); - List statements = ((FunctionDeclaration) node).getBody().statements(); - assertEquals("wrong size", 2, statements.size()); - ASTNode node2 = (ASTNode) statements.get(1); - assertNotNull(node2); - assertTrue("Not an expression statement", node2.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node2; - Expression expression = expressionStatement.getExpression(); - assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - Expression expression2 = methodInvocation.getExpression(); - assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$ - SimpleName simpleName = (SimpleName) expression2; - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertTrue("wrong type", binding.getKind() == IBinding.VARIABLE); //$NON-NLS-1$ - IVariableBinding variableBinding = (IVariableBinding) binding; - assertEquals("Wrong name", "a", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - SimpleName simpleName2 = methodInvocation.getName(); - assertEquals("Wrong name", "clone", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$ - IBinding binding2 = simpleName2.resolveBinding(); - assertNotNull("no binding2", binding2); //$NON-NLS-1$ - assertTrue("Wrong type", binding2.getKind() == IBinding.METHOD); //$NON-NLS-1$ - IFunctionBinding methodBinding2 = (IFunctionBinding) binding2; - assertEquals("Wrong name", "clone", methodBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474 - */ - public void test0479() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0479", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - IType[] types = sourceUnit.getTypes(); - assertNotNull(types); - assertEquals("wrong size", 2, types.length); - IType type = types[1]; - IFunction[] methods = type.getFunctions(); - assertNotNull(methods); - assertEquals("wrong size", 1, methods.length); - IFunction method = methods[0]; - ISourceRange sourceRange = method.getSourceRange(); - ASTNode result = runConversion(sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, false); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier()); - List statements = ((FunctionDeclaration) node).getBody().statements(); - assertEquals("wrong size", 2, statements.size()); - ASTNode node2 = (ASTNode) statements.get(1); - assertNotNull(node2); - assertTrue("Not an expression statement", node2.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node2; - Expression expression = expressionStatement.getExpression(); - assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - Expression expression2 = methodInvocation.getExpression(); - assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$ - SimpleName simpleName = (SimpleName) expression2; - IBinding binding = simpleName.resolveBinding(); - assertNull("No binding", binding); //$NON-NLS-1$ - SimpleName simpleName2 = methodInvocation.getName(); - assertEquals("Wrong name", "clone", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474 - */ - public void test0480() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0480", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - IType[] types = sourceUnit.getTypes(); - assertNotNull(types); - assertEquals("wrong size", 1, types.length); - IType type = types[0]; - IFunction[] methods = type.getFunctions(); - assertNotNull(methods); - assertEquals("wrong size", 1, methods.length); - IFunction method = methods[0]; - ISourceRange sourceRange = method.getSourceRange(); - ASTNode result = runConversion(sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, false); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier()); - List statements = ((FunctionDeclaration) node).getBody().statements(); - assertEquals("wrong size", 1, statements.size()); - ASTNode node2 = (ASTNode) statements.get(0); - assertNotNull(node2); - assertTrue("Not an variable declaration statement", node2.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474 - */ - public void test0481() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0481", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - IType[] types = sourceUnit.getTypes(); - assertNotNull(types); - assertEquals("wrong size", 1, types.length); - IType type = types[0]; - IFunction[] methods = type.getFunctions(); - assertNotNull(methods); - assertEquals("wrong size", 1, methods.length); - IFunction method = methods[0]; - ISourceRange sourceRange = method.getSourceRange(); - ASTNode result = runConversion(sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, true); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier()); - List statements = ((FunctionDeclaration) node).getBody().statements(); - assertEquals("wrong size", 1, statements.size()); - ASTNode node2 = (ASTNode) statements.get(0); - assertNotNull(node2); - assertTrue("Not an variable declaration statement", node2.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement statement = (VariableDeclarationStatement) node2; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertTrue("Not a class instance creation", expression.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression; - ITypeBinding typeBinding = classInstanceCreation.resolveTypeBinding(); - assertNotNull(typeBinding); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474 - */ - public void test0482() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0482", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - IType[] types = sourceUnit.getTypes(); - assertNotNull(types); - assertEquals("wrong size", 1, types.length); - IType type = types[0]; - IType[] memberTypes = type.getTypes(); - assertNotNull(memberTypes); - assertEquals("wrong size", 1, memberTypes.length); - IType memberType = memberTypes[0]; - IFunction[] methods = memberType.getFunctions(); - assertEquals("wrong size", 1, methods.length); - IFunction method = methods[0]; - ISourceRange sourceRange = method.getSourceRange(); - ASTNode result = runConversion(sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, true); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier()); - List statements = ((FunctionDeclaration) node).getBody().statements(); - assertEquals("wrong size", 1, statements.size()); - ASTNode node2 = (ASTNode) statements.get(0); - assertNotNull(node2); - assertTrue("Not an variable declaration statement", node2.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement statement = (VariableDeclarationStatement) node2; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertTrue("Not a class instance creation", expression.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression; - ITypeBinding typeBinding = classInstanceCreation.resolveTypeBinding(); - assertNotNull(typeBinding); - assertTrue(typeBinding.isAnonymous()); - assertEquals("Wrong name", "", typeBinding.getName()); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474 - */ - public void test0483() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0483", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - IType[] types = sourceUnit.getTypes(); - assertNotNull(types); - assertEquals("wrong size", 1, types.length); - IType type = types[0]; - IFunction[] methods = type.getFunctions(); - assertEquals("wrong size", 1, methods.length); - IFunction method = methods[0]; - ISourceRange sourceRange = method.getSourceRange(); - ASTNode result = runConversion(sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, true); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertEquals("wrong name", "A", methodDeclaration.getName().getIdentifier()); - assertTrue("Not a constructor", methodDeclaration.isConstructor()); - IBinding binding = methodDeclaration.getName().resolveBinding(); - assertNotNull(binding); - assertEquals("Wrong type", IBinding.METHOD, binding.getKind()); - List statements = ((FunctionDeclaration) node).getBody().statements(); - assertEquals("wrong size", 1, statements.size()); - ASTNode node2 = (ASTNode) statements.get(0); - assertNotNull(node2); - assertTrue("Not an variable declaration statement", node2.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement statement = (VariableDeclarationStatement) node2; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertTrue("Not a class instance creation", expression.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression; - ITypeBinding typeBinding = classInstanceCreation.resolveTypeBinding(); - assertNotNull(typeBinding); - assertTrue(typeBinding.isAnonymous()); - assertEquals("Wrong name", "", typeBinding.getName()); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474 - */ - public void test0484() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0482", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - IType[] types = sourceUnit.getTypes(); - assertNotNull(types); - assertEquals("wrong size", 1, types.length); - IType type = types[0]; - IType[] memberTypes = type.getTypes(); - assertNotNull(memberTypes); - assertEquals("wrong size", 1, memberTypes.length); - IType memberType = memberTypes[0]; - ISourceRange sourceRange = memberType.getSourceRange(); - ASTNode result = runConversion(sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, true); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - assertEquals("wrong name", "B", typeDeclaration.getName().getIdentifier()); - List bodyDeclarations = typeDeclaration.bodyDeclarations(); - assertEquals("Wrong size", 1, bodyDeclarations.size()); - BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); - assertTrue("Not a method declaration", bodyDeclaration.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration; - Block block = methodDeclaration.getBody(); - List statements = block.statements(); - assertEquals("Wrong size", 1, statements.size()); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474 - */ - public void test0485() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0482", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - IType[] types = sourceUnit.getTypes(); - assertNotNull(types); - assertEquals("wrong size", 1, types.length); - IType type = types[0]; - IType[] memberTypes = type.getTypes(); - assertNotNull(memberTypes); - assertEquals("wrong size", 1, memberTypes.length); - IType memberType = memberTypes[0]; - ISourceRange sourceRange = memberType.getSourceRange(); - ASTNode result = runConversion(sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, false); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - assertEquals("wrong name", "B", typeDeclaration.getName().getIdentifier()); - List bodyDeclarations = typeDeclaration.bodyDeclarations(); - assertEquals("Wrong size", 1, bodyDeclarations.size()); - BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); - assertTrue("Not a method declaration", bodyDeclaration.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration; - Block block = methodDeclaration.getBody(); - List statements = block.statements(); - assertEquals("Wrong size", 1, statements.size()); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474 - */ - public void test0486() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0486", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - IType[] types = sourceUnit.getTypes(); - assertNotNull(types); - assertEquals("wrong size", 1, types.length); - IType type = types[0]; - IFunction[] methods = type.getFunctions(); - assertEquals("wrong size", 2, methods.length); - IFunction method = methods[1]; - ISourceRange sourceRange = method.getSourceRange(); - ASTNode result = runConversion(sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, false); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 2); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - Block block = methodDeclaration.getBody(); - List statements = block.statements(); - assertEquals("Wrong size", 2, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 1); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - methodDeclaration = (FunctionDeclaration) node; - block = methodDeclaration.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474 - */ - public void test0487() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0487", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - IType[] types = sourceUnit.getTypes(); - assertNotNull(types); - assertEquals("wrong size", 1, types.length); - IType type = types[0]; - IFunction[] methods = type.getFunctions(); - assertEquals("wrong size", 3, methods.length); - IFunction method = methods[1]; - ISourceRange sourceRange = method.getSourceRange(); - ASTNode result = runConversion(sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, false); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 5); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - Block block = methodDeclaration.getBody(); - List statements = block.statements(); - assertEquals("Wrong size", 2, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 4); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - methodDeclaration = (FunctionDeclaration) node; - block = methodDeclaration.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - List fragments = fieldDeclaration.fragments(); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertEquals("Wrong name", "field", fragment.getName().getIdentifier()); - assertNotNull("No initializer", expression); - - node = getASTNode((JavaScriptUnit) result, 0, 1); - assertTrue("Not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$ - fieldDeclaration = (FieldDeclaration) node; - fragments = fieldDeclaration.fragments(); - fragment = (VariableDeclarationFragment) fragments.get(0); - expression = fragment.getInitializer(); - assertEquals("Wrong name", "i", fragment.getName().getIdentifier()); - assertNotNull("No initializer", expression); - - node = getASTNode((JavaScriptUnit) result, 0, 2); - assertTrue("Not an initializer", node.getNodeType() == ASTNode.INITIALIZER); //$NON-NLS-1$ - Initializer initializer = (Initializer) node; - assertEquals("Not static", Modifier.NONE, initializer.getModifiers()); - block = initializer.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 3); - assertTrue("Not an initializer", node.getNodeType() == ASTNode.INITIALIZER); //$NON-NLS-1$ - initializer = (Initializer) node; - assertEquals("Not static", Modifier.STATIC, initializer.getModifiers()); - block = initializer.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 6); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - methodDeclaration = (FunctionDeclaration) node; - block = methodDeclaration.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474 - */ - public void test0488() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0488", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - IType[] types = sourceUnit.getTypes(); - assertNotNull(types); - assertEquals("wrong size", 1, types.length); - IType type = types[0]; - IInitializer[] initializers = type.getInitializers(); - assertEquals("wrong size", 2, initializers.length); - IInitializer init = initializers[1]; - ISourceRange sourceRange = init.getSourceRange(); - ASTNode result = runConversion(sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, false); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 5); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - Block block = methodDeclaration.getBody(); - List statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 4); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - methodDeclaration = (FunctionDeclaration) node; - block = methodDeclaration.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - List fragments = fieldDeclaration.fragments(); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertEquals("Wrong name", "field", fragment.getName().getIdentifier()); - assertNotNull("No initializer", expression); - - node = getASTNode((JavaScriptUnit) result, 0, 1); - assertTrue("Not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$ - fieldDeclaration = (FieldDeclaration) node; - fragments = fieldDeclaration.fragments(); - fragment = (VariableDeclarationFragment) fragments.get(0); - expression = fragment.getInitializer(); - assertEquals("Wrong name", "i", fragment.getName().getIdentifier()); - assertNotNull("No initializer", expression); - - node = getASTNode((JavaScriptUnit) result, 0, 2); - assertTrue("Not an initializer", node.getNodeType() == ASTNode.INITIALIZER); //$NON-NLS-1$ - Initializer initializer = (Initializer) node; - assertEquals("Not static", Modifier.NONE, initializer.getModifiers()); - block = initializer.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 3); - assertTrue("Not an initializer", node.getNodeType() == ASTNode.INITIALIZER); //$NON-NLS-1$ - initializer = (Initializer) node; - assertEquals("Not static", Modifier.STATIC, initializer.getModifiers()); - block = initializer.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 1, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 6); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - methodDeclaration = (FunctionDeclaration) node; - block = methodDeclaration.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - } - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=40804 - */ - public void test0489() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0489", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0); - assertNotNull("No node", node); - assertTrue("not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - assertNull("Got a type binding", typeDeclaration.resolveBinding()); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=40804 - */ - public void test0490() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0490", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=42647 - */ - public void test0491() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Hashtable newOptions = JavaScriptCore.getOptions(); - try { - newOptions.put(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_4); - JavaScriptCore.setOptions(newOptions); - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0491", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - } finally { - JavaScriptCore.setOptions(options); - } - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=42647 - */ - public void test0492() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Hashtable newOptions = JavaScriptCore.getOptions(); - try { - newOptions.put(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_4); - JavaScriptCore.setOptions(newOptions); - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0492", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - } finally { - JavaScriptCore.setOptions(options); - } - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=42839 - */ - public void test0493() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0493", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0); - assertTrue("not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - Type type = fieldDeclaration.getType(); - checkSourceRange(type, "Class[][]", source); - assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$ - ArrayType arrayType = (ArrayType) type; - Type componentType = arrayType.getComponentType(); - assertTrue("not an array type", componentType.isArrayType()); //$NON-NLS-1$ - checkSourceRange(componentType, "Class[]", source); - arrayType = (ArrayType) componentType; - componentType = arrayType.getComponentType(); - assertTrue("is an array type", !componentType.isArrayType()); //$NON-NLS-1$ - checkSourceRange(componentType, "Class", source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=42839 - */ - public void test0494() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0494", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0); - assertTrue("not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - Type type = fieldDeclaration.getType(); - checkSourceRange(type, "Class[][][]", source); - assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$ - ArrayType arrayType = (ArrayType) type; - Type componentType = arrayType.getComponentType(); - assertTrue("not an array type", componentType.isArrayType()); //$NON-NLS-1$ - checkSourceRange(componentType, "Class[][]", source); - arrayType = (ArrayType) componentType; - componentType = arrayType.getComponentType(); - assertTrue("not an array type", componentType.isArrayType()); //$NON-NLS-1$ - checkSourceRange(componentType, "Class[]", source); - arrayType = (ArrayType) componentType; - componentType = arrayType.getComponentType(); - assertTrue("is an array type", !componentType.isArrayType()); //$NON-NLS-1$ - checkSourceRange(componentType, "Class", source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=42839 - */ - public void test0495() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0495", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0); - assertTrue("not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - Type type = fieldDeclaration.getType(); - checkSourceRange(type, "Class[][]", source); - assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$ - ArrayType arrayType = (ArrayType) type; - Type componentType = arrayType.getComponentType(); - assertTrue("not an array type", componentType.isArrayType()); //$NON-NLS-1$ - checkSourceRange(componentType, "Class[]", source); - arrayType = (ArrayType) componentType; - componentType = arrayType.getComponentType(); - assertTrue("is an array type", !componentType.isArrayType()); //$NON-NLS-1$ - checkSourceRange(componentType, "Class", source); - List fragments = fieldDeclaration.fragments(); - assertEquals("wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - assertEquals("wrong extra dimension", 1, fragment.getExtraDimensions()); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=42839 - */ - public void test0496() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0496", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0); - assertTrue("not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - Type type = fieldDeclaration.getType(); - checkSourceRange(type, "Class[][][][]", source); - assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$ - ArrayType arrayType = (ArrayType) type; - Type componentType = arrayType.getComponentType(); - assertTrue("not an array type", componentType.isArrayType()); //$NON-NLS-1$ - checkSourceRange(componentType, "Class[][][]", source); - arrayType = (ArrayType) componentType; - componentType = arrayType.getComponentType(); - assertTrue("not an array type", componentType.isArrayType()); //$NON-NLS-1$ - checkSourceRange(componentType, "Class[][]", source); - arrayType = (ArrayType) componentType; - componentType = arrayType.getComponentType(); - assertTrue("not an array type", componentType.isArrayType()); //$NON-NLS-1$ - checkSourceRange(componentType, "Class[]", source); - arrayType = (ArrayType) componentType; - componentType = arrayType.getComponentType(); - assertTrue("is an array type", !componentType.isArrayType()); //$NON-NLS-1$ - checkSourceRange(componentType, "Class", source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=42839 - */ - public void test0497() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0497", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0); - assertTrue("not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - Type type = fieldDeclaration.getType(); - checkSourceRange(type, "Class[]", source); - assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$ - ArrayType arrayType = (ArrayType) type; - Type componentType = arrayType.getComponentType(); - assertTrue("is an array type", !componentType.isArrayType()); //$NON-NLS-1$ - checkSourceRange(componentType, "Class", source); - } - - /** - */ - public void test0498() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0498", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=45199 - */ - public void test0499() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0499", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0, 1); - assertNotNull(node); - assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - Expression expression = ((ExpressionStatement) node).getExpression(); - assertTrue("Not an assignment", expression.getNodeType() == ASTNode.ASSIGNMENT); //$NON-NLS-1$ - Assignment assignment = (Assignment) expression; - Expression expression2 = assignment.getRightHandSide(); - assertTrue("Not an infix expression", expression2.getNodeType() == ASTNode.INFIX_EXPRESSION); //$NON-NLS-1$ - InfixExpression infixExpression = (InfixExpression) expression2; - Expression expression3 = infixExpression.getLeftOperand(); - assertTrue("Not a simple name", expression3.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$ - ITypeBinding binding = expression3.resolveTypeBinding(); - assertNotNull("No binding", binding); - Expression expression4 = assignment.getLeftHandSide(); - assertTrue("Not a simple name", expression4.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$ - ITypeBinding binding2 = expression4.resolveTypeBinding(); - assertNotNull("No binding", binding2); - assertTrue("Should be the same", binding == binding2); - } - - /** - * Test for bug 45436 fix. - * When this bug happened, the first assertion was false (2 problems found). - * @see bug 45436 - * @throws JavaScriptModelException - */ - public void test0500() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0500", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - IJavaScriptProject project = sourceUnit.getJavaScriptProject(); - Map originalOptions = project.getOptions(false); - try { - project.setOption(JavaScriptCore.COMPILER_PB_INVALID_JAVADOC, JavaScriptCore.ERROR); - project.setOption(JavaScriptCore.COMPILER_PB_MISSING_JAVADOC_TAGS, JavaScriptCore.ERROR); - project.setOption(JavaScriptCore.COMPILER_PB_MISSING_JAVADOC_COMMENTS, JavaScriptCore.ERROR); - JavaScriptUnit result = (JavaScriptUnit)runConversion(sourceUnit, true); - IProblem[] problems= result.getProblems(); - assertTrue(problems.length == 1); - assertEquals("Invalid warning", "Javadoc: Missing tag for parameter a", problems[0].getMessage()); - } finally { - project.setOptions(originalOptions); - } - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46012 - */ - public void test0501() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0501", "JavaEditor.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, false); - assertNotNull(result); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013 - */ - public void test0502a() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true); - - // 'i' in initializer - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement)getASTNode(unit, 0, 0, 0); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableDeclarationStatement.fragments().get(0); - IVariableBinding localBinding = fragment.resolveBinding(); - assertEquals("Unexpected key", "Ltest0502/A;#0#i", localBinding.getKey()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013 - */ - public void test0502b() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true); - - // 'j' in 'then' block in initializer - IfStatement ifStatement = (IfStatement) getASTNode(unit, 0, 0, 1); - Block block = (Block)ifStatement.getThenStatement(); - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) block.statements().get(0); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableDeclarationStatement.fragments().get(0); - IVariableBinding localBinding = fragment.resolveBinding(); - assertEquals("Unexpected key", "Ltest0502/A;#0#0#j", localBinding.getKey()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013 - */ - public void test0502c() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true); - - // 'i' in 'foo()' - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement)getASTNode(unit, 0, 1, 0); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableDeclarationStatement.fragments().get(0); - IVariableBinding localBinding = fragment.resolveBinding(); - assertEquals("Unexpected key", "Ltest0502/A;.foo()V#i", localBinding.getKey()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013 - */ - public void test0502d() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true); - - // 'j' in 'then' block in 'foo()' - IfStatement ifStatement = (IfStatement) getASTNode(unit, 0, 1, 1); - Block block = (Block)ifStatement.getThenStatement(); - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) block.statements().get(0); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableDeclarationStatement.fragments().get(0); - IVariableBinding localBinding = fragment.resolveBinding(); - assertEquals("Unexpected key", "Ltest0502/A;.foo()V#0#j", localBinding.getKey()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013 - */ - public void test0502e() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true); - - // 'j' in 'else' block in 'foo()' - IfStatement ifStatement = (IfStatement) getASTNode(unit, 0, 1, 1); - Block block = (Block)ifStatement.getElseStatement(); - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) block.statements().get(0); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableDeclarationStatement.fragments().get(0); - IVariableBinding localBinding = fragment.resolveBinding(); - assertEquals("Unexpected key", "Ltest0502/A;.foo()V#1#j", localBinding.getKey()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013 - */ - public void test0502f() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true); - - // first 'new Object(){...}' in 'foo()' - ExpressionStatement expressionStatement = (ExpressionStatement) getASTNode(unit, 0, 1, 2); - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression(); - AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration(); - ITypeBinding typeBinding = anonymousClassDeclaration.resolveBinding(); - assertEquals("Unexpected key", "Ltest0502/A$182;", typeBinding.getKey()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013 - * @deprecated using deprecated code - */ - public void test0502g() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true); - - // 'B' in 'foo()' - TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) getASTNode(unit, 0, 1, 3); - TypeDeclaration typeDeclaration = typeDeclarationStatement.getTypeDeclaration(); - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertEquals("Unexpected key", "Ltest0502/A$206$B;", typeBinding.getKey()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013 - */ - public void test0502h() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true); - - // second 'new Object(){...}' in 'foo()' - ExpressionStatement expressionStatement = (ExpressionStatement) getASTNode(unit, 0, 1, 4); - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression(); - AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration(); - ITypeBinding typeBinding = anonymousClassDeclaration.resolveBinding(); - assertEquals("Unexpected key", "Ltest0502/A$255;", typeBinding.getKey()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013 - * @deprecated using deprecated code - */ - public void test0502i() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true); - - // 'field' in 'B' in 'foo()' - TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) getASTNode(unit, 0, 1, 3); - TypeDeclaration typeDeclaration = typeDeclarationStatement.getTypeDeclaration(); - FieldDeclaration fieldDeclaration = typeDeclaration.getFields()[0]; - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fieldDeclaration.fragments().get(0); - IVariableBinding fieldBinding = fragment.resolveBinding(); - assertEquals("Unexpected key", "Ltest0502/A$206$B;.field)I", fieldBinding.getKey()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013 - * @deprecated using deprecated code - */ - public void test0502j() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true); - - // 'bar()' in 'B' in 'foo()' - TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) getASTNode(unit, 0, 1, 3); - TypeDeclaration typeDeclaration = typeDeclarationStatement.getTypeDeclaration(); - FunctionDeclaration methodDeclaration = typeDeclaration.getMethods()[0]; - IFunctionBinding methodBinding = methodDeclaration.resolveBinding(); - assertEquals("Unexpected key", "Ltest0502/A$206$B;.bar()V", methodBinding.getKey()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057 - */ - public void test0503a() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true); - - // top level type A - TypeDeclaration type = (TypeDeclaration)getASTNode(unit, 0); - ITypeBinding typeBinding = type.resolveBinding(); - assertEquals("Unexpected binary name", "test0503.A", typeBinding.getBinaryName()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057 - */ - public void test0503b() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true); - - // member type B in A - TypeDeclaration type = (TypeDeclaration)getASTNode(unit, 0, 0); - ITypeBinding typeBinding = type.resolveBinding(); - assertEquals("Unexpected binary name", "test0503.A$B", typeBinding.getBinaryName()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057 - * @deprecated using deprecated code - */ - public void test0503c() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true); - - // local type E in foo() in A - TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) getASTNode(unit, 0, 1, 0); - TypeDeclaration typeDeclaration = typeDeclarationStatement.getTypeDeclaration(); - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertEquals("Unexpected binary name", "test0503.A$1$E", typeBinding.getBinaryName()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057 - */ - public void test0503d() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true); - - // anonymous type new Object() {...} in foo() in A - ExpressionStatement expressionStatement = (ExpressionStatement) getASTNode(unit, 0, 1, 1); - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression(); - AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration(); - ITypeBinding typeBinding = anonymousClassDeclaration.resolveBinding(); - assertEquals("Unexpected binary name", "test0503.A$2", typeBinding.getBinaryName()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057 - */ - public void test0503e() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true); - - // type F in anonymous type new Object() {...} in foo() in A - ExpressionStatement expressionStatement = (ExpressionStatement) getASTNode(unit, 0, 1, 1); - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression(); - AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration(); - TypeDeclaration type = (TypeDeclaration) anonymousClassDeclaration.bodyDeclarations().get(0); - ITypeBinding typeBinding = type.resolveBinding(); - assertEquals("Unexpected binary name", "test0503.A$2$F", typeBinding.getBinaryName()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057 - * @deprecated using deprecated code - */ - public void test0503f() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true); - - // local type C in bar() in B in A - FunctionDeclaration method = (FunctionDeclaration) getASTNode(unit, 0, 0, 0); - TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) method.getBody().statements().get(0); - TypeDeclaration typeDeclaration = typeDeclarationStatement.getTypeDeclaration(); - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertEquals("Unexpected binary name", "test0503.A$1$C", typeBinding.getBinaryName()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057 - */ - public void test0503g() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true); - - // anonymous type new Object() {...} in bar() in B in A - FunctionDeclaration method = (FunctionDeclaration) getASTNode(unit, 0, 0, 0); - ExpressionStatement expressionStatement = (ExpressionStatement) method.getBody().statements().get(1); - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression(); - AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration(); - ITypeBinding typeBinding = anonymousClassDeclaration.resolveBinding(); - assertEquals("Unexpected binary name", "test0503.A$1", typeBinding.getBinaryName()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057 - */ - public void test0503h() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true); - - // type D in anonymous type new Object() {...} in bar() in B in A - FunctionDeclaration method = (FunctionDeclaration) getASTNode(unit, 0, 0, 0); - ExpressionStatement expressionStatement = (ExpressionStatement) method.getBody().statements().get(1); - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression(); - AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration(); - TypeDeclaration type = (TypeDeclaration) anonymousClassDeclaration.bodyDeclarations().get(0); - ITypeBinding typeBinding = type.resolveBinding(); - assertEquals("Unexpected binary name", "test0503.A$1$D", typeBinding.getBinaryName()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057 - * @deprecated using deprecated code - */ - public void test0503i() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true); - - // unreachable type G in foo() in A - IfStatement ifStatement = (IfStatement) getASTNode(unit, 0, 1, 2); - Block block = (Block)ifStatement.getThenStatement(); - TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) block.statements().get(0); - TypeDeclaration typeDeclaration = typeDeclarationStatement.getTypeDeclaration(); - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertEquals("Unexpected binary name", null, typeBinding.getBinaryName()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=47396 - */ - public void test0504() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0504", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 1, 0); - assertNotNull(node); - assertTrue("Not a constructor declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration declaration = (FunctionDeclaration) node; - assertTrue("A constructor", !declaration.isConstructor()); - checkSourceRange(declaration, "public method(final int parameter);", source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=47396 - */ - public void test0505() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0505", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 1, 0); - assertNotNull(node); - assertTrue("Not a constructor declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration declaration = (FunctionDeclaration) node; - assertTrue("A constructor", !declaration.isConstructor()); - checkSourceRange(declaration, "public method(final int parameter) { }", source); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=46699 - */ - public void test0506() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0506", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - final JavaScriptUnit unit = (JavaScriptUnit) result; - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Wrong number of problems", 0, (unit).getProblems().length); //$NON-NLS-1$ - assertNotNull(node); - assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - assertTrue("Not a class instance creation", expressionStatement.getExpression().getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression(); - IFunctionBinding binding = classInstanceCreation.resolveConstructorBinding(); - assertTrue("is default constructor", binding.isDefaultConstructor()); - assertNull("Has a declaring node", unit.findDeclaringNode(binding)); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=46699 - */ - public void test0507() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0507", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - final JavaScriptUnit unit = (JavaScriptUnit) result; - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Wrong number of problems", 0, (unit).getProblems().length); //$NON-NLS-1$ - assertNotNull(node); - assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - assertTrue("Not a class instance creation", expressionStatement.getExpression().getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression(); - IFunctionBinding binding = classInstanceCreation.resolveConstructorBinding(); - assertTrue("is default constructor", binding.isDefaultConstructor()); - assertNull("Has a declaring node", unit.findDeclaringNode(binding)); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=46699 - */ - public void test0508() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0508", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - final JavaScriptUnit unit = (JavaScriptUnit) result; - ASTNode node = getASTNode(unit, 0, 1, 0); - assertEquals("Wrong number of problems", 0, (unit).getProblems().length); //$NON-NLS-1$ - assertNotNull(node); - assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - assertTrue("Not a class instance creation", expressionStatement.getExpression().getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression(); - IFunctionBinding binding = classInstanceCreation.resolveConstructorBinding(); - assertTrue("not a default constructor", !binding.isDefaultConstructor()); - assertNotNull("Has no declaring node", unit.findDeclaringNode(binding)); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=46699 - */ - public void test0509() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0509", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - final JavaScriptUnit unit = (JavaScriptUnit) result; - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Wrong number of problems", 0, (unit).getProblems().length); //$NON-NLS-1$ - assertNotNull(node); - assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - assertTrue("Not a class instance creation", expressionStatement.getExpression().getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression(); - IFunctionBinding binding = classInstanceCreation.resolveConstructorBinding(); - assertTrue("not a default constructor", !binding.isDefaultConstructor()); - assertNull("Has a declaring node", unit.findDeclaringNode(binding)); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=46699 - */ - public void test0510() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0510", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - final JavaScriptUnit unit = (JavaScriptUnit) result; - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Wrong number of problems", 0, (unit).getProblems().length); //$NON-NLS-1$ - assertNotNull(node); - assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - assertTrue("Not a class instance creation", expressionStatement.getExpression().getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression(); - IFunctionBinding binding = classInstanceCreation.resolveConstructorBinding(); - assertFalse("is default constructor", binding.isDefaultConstructor()); - assertNull("Has a declaring node", unit.findDeclaringNode(binding)); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=46699 - */ - public void test0511() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0511", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - final JavaScriptUnit unit = (JavaScriptUnit) result; - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Wrong number of problems", 0, (unit).getProblems().length); //$NON-NLS-1$ - assertNotNull(node); - assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - assertTrue("Not a class instance creation", expressionStatement.getExpression().getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression(); - IFunctionBinding binding = classInstanceCreation.resolveConstructorBinding(); - assertFalse("is default constructor", binding.isDefaultConstructor()); - assertNull("Has a declaring node", unit.findDeclaringNode(binding)); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=47326 - */ - public void test0512() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0512", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - final JavaScriptUnit unit = (JavaScriptUnit) result; - ASTNode node = getASTNode(unit, 0, 0); - assertEquals("Wrong number of problems", 2, unit.getProblems().length); //$NON-NLS-1$ - assertNotNull(node); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration declaration = (FunctionDeclaration) node; - assertTrue("Not a constructor", declaration.isConstructor()); - checkSourceRange(declaration, "public A();", source); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=49429 - */ - public void test0513() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0513", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=48502 - */ - public void test0514() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0514", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=49204 - */ - public void test0515() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0515", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0, 0); - assertNotNull("No node", node); - assertTrue("not a if statement", node.getNodeType() == ASTNode.IF_STATEMENT); - IfStatement ifStatement = (IfStatement) node; - assertTrue("not an empty statement", ifStatement.getThenStatement().getNodeType() == ASTNode.EMPTY_STATEMENT); - checkSourceRange(ifStatement.getThenStatement(), ";", source); - Statement statement = ifStatement.getElseStatement(); - assertTrue("not a if statement", statement.getNodeType() == ASTNode.IF_STATEMENT); - ifStatement = (IfStatement) statement; - assertTrue("not an empty statement", ifStatement.getThenStatement().getNodeType() == ASTNode.EMPTY_STATEMENT); - checkSourceRange(ifStatement.getThenStatement(), ";", source); - Statement statement2 = ifStatement.getElseStatement(); - assertTrue("not an empty statement", statement2.getNodeType() == ASTNode.EMPTY_STATEMENT); - checkSourceRange(statement2, ";", source); - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=48489 - * @deprecated using deprecated code - */ - public void test0516() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0516", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0); - assertNotNull("No node", node); - assertTrue("not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); - FunctionDeclaration declaration = (FunctionDeclaration) node; - ASTParser parser = ASTParser.newParser(AST.JLS2); - parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS); - parser.setSource(source); - parser.setSourceRange(declaration.getStartPosition(), declaration.getLength()); - parser.setCompilerOptions(JavaScriptCore.getOptions()); - ASTNode result2 = parser.createAST(null); - assertNotNull("No node", result2); - assertTrue("not a type declaration", result2.getNodeType() == ASTNode.TYPE_DECLARATION); - TypeDeclaration typeDeclaration = (TypeDeclaration) result2; - List bodyDeclarations = typeDeclaration.bodyDeclarations(); - assertEquals("wrong size", 1, bodyDeclarations.size()); - BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); - assertTrue(declaration.subtreeMatch(new ASTMatcher(), bodyDeclaration)); - ASTNode root = bodyDeclaration.getRoot(); - assertNotNull("No root", root); - assertTrue("not a compilation unit", root.getNodeType() == ASTNode.JAVASCRIPT_UNIT); - JavaScriptUnit compilationUnit = (JavaScriptUnit) root; - assertEquals("wrong problem size", 0, compilationUnit.getProblems().length); - assertNotNull("No comments", compilationUnit.getCommentList()); - assertEquals("Wrong size", 3, compilationUnit.getCommentList().size()); - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=48489 - * @deprecated using deprecated code - */ - public void test0517() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0517", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - assertNotNull("No comments", unit.getCommentList()); - assertEquals("Wrong size", 3, unit.getCommentList().size()); - ASTNode node = getASTNode(unit, 0, 0); - assertNotNull("No node", node); - assertTrue("not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); - FieldDeclaration declaration = (FieldDeclaration) node; - ASTParser parser = ASTParser.newParser(AST.JLS2); - parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS); - parser.setSource(source); - parser.setSourceRange(declaration.getStartPosition(), declaration.getLength()); - parser.setCompilerOptions(JavaScriptCore.getOptions()); - ASTNode result2 = parser.createAST(null); - assertNotNull("No node", result2); - assertTrue("not a type declaration", result2.getNodeType() == ASTNode.TYPE_DECLARATION); - TypeDeclaration typeDeclaration = (TypeDeclaration) result2; - List bodyDeclarations = typeDeclaration.bodyDeclarations(); - assertEquals("wrong size", 1, bodyDeclarations.size()); - BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); - assertTrue(declaration.subtreeMatch(new ASTMatcher(), bodyDeclaration)); - ASTNode root = bodyDeclaration.getRoot(); - assertNotNull("No root", root); - assertTrue("not a compilation unit", root.getNodeType() == ASTNode.JAVASCRIPT_UNIT); - JavaScriptUnit compilationUnit = (JavaScriptUnit) root; - assertEquals("wrong problem size", 0, compilationUnit.getProblems().length); - assertNotNull("No comments", compilationUnit.getCommentList()); - assertEquals("Wrong size", 2, compilationUnit.getCommentList().size()); - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=48489 - * @deprecated using deprecated code - */ - public void test0518() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0518", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0); - assertNotNull("No node", node); - assertTrue("not an initializer", node.getNodeType() == ASTNode.INITIALIZER); - Initializer declaration = (Initializer) node; - ASTParser parser = ASTParser.newParser(AST.JLS2); - parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS); - parser.setSource(source); - parser.setSourceRange(declaration.getStartPosition(), declaration.getLength()); - parser.setCompilerOptions(JavaScriptCore.getOptions()); - ASTNode result2 = parser.createAST(null); - assertNotNull("No node", result2); - assertTrue("not a type declaration", result2.getNodeType() == ASTNode.TYPE_DECLARATION); - TypeDeclaration typeDeclaration = (TypeDeclaration) result2; - List bodyDeclarations = typeDeclaration.bodyDeclarations(); - assertEquals("wrong size", 1, bodyDeclarations.size()); - BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); - assertTrue(declaration.subtreeMatch(new ASTMatcher(), bodyDeclaration)); - ASTNode root = bodyDeclaration.getRoot(); - assertNotNull("No root", root); - assertTrue("not a compilation unit", root.getNodeType() == ASTNode.JAVASCRIPT_UNIT); - JavaScriptUnit compilationUnit = (JavaScriptUnit) root; - assertEquals("wrong problem size", 0, compilationUnit.getProblems().length); - assertNotNull("No comments", compilationUnit.getCommentList()); - assertEquals("Wrong size", 3, compilationUnit.getCommentList().size()); - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=48489 - * @deprecated using deprecated code - */ - public void test0519() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0519", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - assertNotNull("No comments", unit.getCommentList()); - assertEquals("Wrong size", 2, unit.getCommentList().size()); - ASTNode node = getASTNode(unit, 0, 0, 0); - assertNotNull("No node", node); - ASTNode statement = node; - ASTParser parser = ASTParser.newParser(AST.JLS2); - parser.setKind(ASTParser.K_STATEMENTS); - parser.setSource(source); - parser.setSourceRange(statement.getStartPosition(), statement.getLength()); - parser.setCompilerOptions(JavaScriptCore.getOptions()); - ASTNode result2 = parser.createAST(null); - assertNotNull("No node", result2); - assertTrue("not a block", result2.getNodeType() == ASTNode.BLOCK); - Block block = (Block) result2; - List statements = block.statements(); - assertEquals("wrong size", 1, statements.size()); - Statement statement2 = (Statement) statements.get(0); - assertTrue(statement.subtreeMatch(new ASTMatcher(), statement2)); - ASTNode root = statement2.getRoot(); - assertNotNull("No root", root); - assertTrue("not a compilation unit", root.getNodeType() == ASTNode.JAVASCRIPT_UNIT); - JavaScriptUnit compilationUnit = (JavaScriptUnit) root; - assertEquals("wrong problem size", 0, compilationUnit.getProblems().length); - assertNotNull("No comments", compilationUnit.getCommentList()); - assertEquals("Wrong size", 1, compilationUnit.getCommentList().size()); - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=48489 - * @deprecated using deprecated code - */ - public void test0520() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0520", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - assertNotNull("No comments", unit.getCommentList()); - assertEquals("Wrong size", 2, unit.getCommentList().size()); - ASTNode node = getASTNode(unit, 0, 0, 0); - assertNotNull("No node", node); - assertTrue("not a block", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - ASTParser parser = ASTParser.newParser(AST.JLS2); - parser.setKind(ASTParser.K_EXPRESSION); - parser.setSource(source); - parser.setSourceRange(expression.getStartPosition(), expression.getLength()); - parser.setCompilerOptions(JavaScriptCore.getOptions()); - ASTNode result2 = parser.createAST(null); - assertNotNull("No node", result2); - assertTrue("not a method invocation", result2.getNodeType() == ASTNode.FUNCTION_INVOCATION); - assertTrue(expression.subtreeMatch(new ASTMatcher(), result2)); - ASTNode root = result2.getRoot(); - assertNotNull("No root", root); - assertTrue("not a compilation unit", root.getNodeType() == ASTNode.JAVASCRIPT_UNIT); - JavaScriptUnit compilationUnit = (JavaScriptUnit) root; - assertEquals("wrong problem size", 0, compilationUnit.getProblems().length); - assertNotNull("No comments", compilationUnit.getCommentList()); - assertEquals("Wrong size", 1, compilationUnit.getCommentList().size()); - } - /** - * Ensure an OperationCanceledException is correcly thrown when progress monitor is canceled - * @deprecated using deprecated code - */ - public void test0521() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0521", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - - // count the number of time isCanceled() is called when converting this source unit - WorkingCopyOwner owner = new WorkingCopyOwner() {}; - CancelCounter counter = new CancelCounter(); - ASTParser parser = ASTParser.newParser(AST.JLS2); - parser.setSource(sourceUnit); - parser.setResolveBindings(true); - parser.setWorkingCopyOwner(owner); - parser.createAST(counter); - - // throw an OperatonCanceledException at each point isCanceled() is called - for (int i = 0; i < counter.count; i++) { - boolean gotException = false; - try { - parser = ASTParser.newParser(AST.JLS2); - parser.setSource(sourceUnit); - parser.setResolveBindings(true); - parser.setWorkingCopyOwner(owner); - parser.createAST(new Canceler(i)); - } catch (OperationCanceledException e) { - gotException = true; - } - assertTrue("Should get an OperationCanceledException (" + i + ")", gotException); - } - - // last should not throw an OperationCanceledException - parser = ASTParser.newParser(AST.JLS2); - parser.setSource(sourceUnit); - parser.setResolveBindings(true); - parser.setWorkingCopyOwner(owner); - parser.createAST(new Canceler(counter.count)); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292 - */ - public void test0522() throws JavaScriptModelException { - IClassFile classFile = getClassFile("Converter" , "bins", "test0522", "Test.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - assertNotNull(classFile); - assertNotNull(classFile.getSource()); - IType type = classFile.getType(); - assertNotNull(type); - IFunction[] methods = type.getFunctions(); - assertNotNull(methods); - assertEquals("wrong size", 2, methods.length); - IFunction method = methods[1]; - ISourceRange sourceRange = method.getSourceRange(); - ASTNode result = runConversion(classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, true); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier()); - IFunctionBinding methodBinding = methodDeclaration.resolveBinding(); - assertNotNull(methodBinding); - List statements = ((FunctionDeclaration) node).getBody().statements(); - assertEquals("wrong size", 2, statements.size()); - ASTNode node2 = (ASTNode) statements.get(1); - assertNotNull(node2); - assertTrue("Not an expression statement", node2.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node2; - Expression expression = expressionStatement.getExpression(); - assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - Expression expression2 = methodInvocation.getExpression(); - assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$ - SimpleName simpleName = (SimpleName) expression2; - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertTrue("wrong type", binding.getKind() == IBinding.VARIABLE); //$NON-NLS-1$ - IVariableBinding variableBinding = (IVariableBinding) binding; - assertEquals("Wrong name", "a", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - SimpleName simpleName2 = methodInvocation.getName(); - assertEquals("Wrong name", "clone", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$ - IBinding binding2 = simpleName2.resolveBinding(); - assertNotNull("no binding2", binding2); //$NON-NLS-1$ - assertTrue("Wrong type", binding2.getKind() == IBinding.METHOD); //$NON-NLS-1$ - IFunctionBinding methodBinding2 = (IFunctionBinding) binding2; - assertEquals("Wrong name", "clone", methodBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292 - */ - public void test0523() throws JavaScriptModelException { - IClassFile classFile = getClassFile("Converter" , "bins", "test0523", "Test.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - assertNotNull(classFile); - assertNotNull(classFile.getSource()); - IType type = classFile.getType(); - assertNotNull(type); - IFunction[] methods = type.getFunctions(); - assertNotNull(methods); - assertEquals("wrong size", 2, methods.length); - IFunction method = methods[1]; - ISourceRange sourceRange = method.getSourceRange(); - ASTNode result = runConversion(classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, false); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier()); - List statements = ((FunctionDeclaration) node).getBody().statements(); - assertEquals("wrong size", 2, statements.size()); - ASTNode node2 = (ASTNode) statements.get(1); - assertNotNull(node2); - assertTrue("Not an expression statement", node2.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node2; - Expression expression = expressionStatement.getExpression(); - assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - Expression expression2 = methodInvocation.getExpression(); - assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$ - SimpleName simpleName = (SimpleName) expression2; - IBinding binding = simpleName.resolveBinding(); - assertNull("No binding", binding); //$NON-NLS-1$ - SimpleName simpleName2 = methodInvocation.getName(); - assertEquals("Wrong name", "clone", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292 - */ - public void test0524() throws JavaScriptModelException { - IClassFile classFile = getClassFile("Converter" , "bins", "test0524", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - assertNotNull(classFile); - assertNotNull(classFile.getSource()); - IType type = classFile.getType(); - assertNotNull(type); - IFunction[] methods = type.getFunctions(); - assertNotNull(methods); - assertEquals("wrong size", 2, methods.length); - IFunction method = methods[1]; - ISourceRange sourceRange = method.getSourceRange(); - ASTNode result = runConversion(classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, false); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier()); - List statements = ((FunctionDeclaration) node).getBody().statements(); - assertEquals("wrong size", 1, statements.size()); - ASTNode node2 = (ASTNode) statements.get(0); - assertNotNull(node2); - assertTrue("Not an variable declaration statement", node2.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292 - */ - public void test0525() throws JavaScriptModelException { - IClassFile classFile = getClassFile("Converter" , "bins", "test0525", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - assertNotNull(classFile); - assertNotNull(classFile.getSource()); - IType type = classFile.getType(); - assertNotNull(type); - IFunction[] methods = type.getFunctions(); - assertNotNull(methods); - assertEquals("wrong size", 2, methods.length); - IFunction method = methods[1]; - ISourceRange sourceRange = method.getSourceRange(); - ASTNode result = runConversion(classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, true); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier()); - List statements = ((FunctionDeclaration) node).getBody().statements(); - assertEquals("wrong size", 1, statements.size()); - ASTNode node2 = (ASTNode) statements.get(0); - assertNotNull(node2); - assertTrue("Not an variable declaration statement", node2.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement statement = (VariableDeclarationStatement) node2; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertTrue("Not a class instance creation", expression.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression; - ITypeBinding typeBinding = classInstanceCreation.resolveTypeBinding(); - assertNotNull(typeBinding); - } - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292 - */ - public void test0526() throws JavaScriptModelException { - IClassFile classFile = getClassFile("Converter" , "bins", "test0526", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - assertNotNull(classFile); - assertNotNull(classFile.getSource()); - IType type = classFile.getType(); - assertNotNull(type); - IType[] memberTypes = type.getTypes(); - assertNotNull(memberTypes); - assertEquals("wrong size", 1, memberTypes.length); - IType memberType = memberTypes[0]; - IFunction[] methods = memberType.getFunctions(); - assertEquals("wrong size", 2, methods.length); - IFunction method = methods[1]; - ISourceRange sourceRange = method.getSourceRange(); - ASTNode result = runConversion(classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, true); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier()); - List statements = ((FunctionDeclaration) node).getBody().statements(); - assertEquals("wrong size", 1, statements.size()); - ASTNode node2 = (ASTNode) statements.get(0); - assertNotNull(node2); - assertTrue("Not an variable declaration statement", node2.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement statement = (VariableDeclarationStatement) node2; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertTrue("Not a class instance creation", expression.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression; - ITypeBinding typeBinding = classInstanceCreation.resolveTypeBinding(); - assertNotNull(typeBinding); - assertTrue(typeBinding.isAnonymous()); - assertEquals("Wrong name", "", typeBinding.getName()); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292 - */ - public void test0527() throws JavaScriptModelException { - IClassFile classFile = getClassFile("Converter" , "bins", "test0527", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - assertNotNull(classFile); - assertNotNull(classFile.getSource()); - IType type = classFile.getType(); - assertNotNull(type); - IFunction[] methods = type.getFunctions(); - assertEquals("wrong size", 1, methods.length); - IFunction method = methods[0]; - ISourceRange sourceRange = method.getSourceRange(); - ASTNode result = runConversion(classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, true); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertEquals("wrong name", "A", methodDeclaration.getName().getIdentifier()); - assertTrue("Not a constructor", methodDeclaration.isConstructor()); - IBinding binding = methodDeclaration.getName().resolveBinding(); - assertNotNull(binding); - assertEquals("Wrong type", IBinding.METHOD, binding.getKind()); - List statements = ((FunctionDeclaration) node).getBody().statements(); - assertEquals("wrong size", 1, statements.size()); - ASTNode node2 = (ASTNode) statements.get(0); - assertNotNull(node2); - assertTrue("Not an variable declaration statement", node2.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement statement = (VariableDeclarationStatement) node2; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertTrue("Not a class instance creation", expression.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression; - ITypeBinding typeBinding = classInstanceCreation.resolveTypeBinding(); - assertNotNull(typeBinding); - assertTrue(typeBinding.isAnonymous()); - assertEquals("Wrong name", "", typeBinding.getName()); - } - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292 - */ - public void test0528() throws JavaScriptModelException { - IClassFile classFile = getClassFile("Converter" , "bins", "test0528", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - assertNotNull(classFile); - assertNotNull(classFile.getSource()); - IType type = classFile.getType(); - IType[] memberTypes = type.getTypes(); - assertNotNull(memberTypes); - assertEquals("wrong size", 1, memberTypes.length); - IType memberType = memberTypes[0]; - ISourceRange sourceRange = memberType.getSourceRange(); - ASTNode result = runConversion(classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, true); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - assertEquals("wrong name", "B", typeDeclaration.getName().getIdentifier()); - List bodyDeclarations = typeDeclaration.bodyDeclarations(); - assertEquals("Wrong size", 1, bodyDeclarations.size()); - BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); - assertTrue("Not a method declaration", bodyDeclaration.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration; - Block block = methodDeclaration.getBody(); - List statements = block.statements(); - assertEquals("Wrong size", 1, statements.size()); - } - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292 - */ - public void test0529() throws JavaScriptModelException { - IClassFile classFile = getClassFile("Converter" , "bins", "test0529", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - assertNotNull(classFile); - assertNotNull(classFile.getSource()); - IType type = classFile.getType(); - IType[] memberTypes = type.getTypes(); - assertNotNull(memberTypes); - assertEquals("wrong size", 1, memberTypes.length); - IType memberType = memberTypes[0]; - ISourceRange sourceRange = memberType.getSourceRange(); - ASTNode result = runConversion(classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, false); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - assertEquals("wrong name", "B", typeDeclaration.getName().getIdentifier()); - List bodyDeclarations = typeDeclaration.bodyDeclarations(); - assertEquals("Wrong size", 1, bodyDeclarations.size()); - BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); - assertTrue("Not a method declaration", bodyDeclaration.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration; - Block block = methodDeclaration.getBody(); - List statements = block.statements(); - assertEquals("Wrong size", 1, statements.size()); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292 - */ - public void test0530() throws JavaScriptModelException { - IClassFile classFile = getClassFile("Converter" , "bins", "test0530", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - assertNotNull(classFile); - assertNotNull(classFile.getSource()); - IType type = classFile.getType(); - IFunction[] methods = type.getFunctions(); - assertEquals("wrong size", 3, methods.length); - IFunction method = methods[2]; - ISourceRange sourceRange = method.getSourceRange(); - ASTNode result = runConversion(classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, false); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 2); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - Block block = methodDeclaration.getBody(); - List statements = block.statements(); - assertEquals("Wrong size", 2, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 1); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - methodDeclaration = (FunctionDeclaration) node; - block = methodDeclaration.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - } - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292 - */ - public void test0531() throws JavaScriptModelException { - IClassFile classFile = getClassFile("Converter" , "bins", "test0531", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - assertNotNull(classFile); - assertNotNull(classFile.getSource()); - IType type = classFile.getType(); - IFunction[] methods = type.getFunctions(); - assertEquals("wrong size", 5, methods.length); - IFunction method = methods[3]; - ISourceRange sourceRange = method.getSourceRange(); - ASTNode result = runConversion(classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, false); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 5); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - Block block = methodDeclaration.getBody(); - List statements = block.statements(); - assertEquals("Wrong size", 2, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 4); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - methodDeclaration = (FunctionDeclaration) node; - block = methodDeclaration.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - List fragments = fieldDeclaration.fragments(); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertEquals("Wrong name", "field", fragment.getName().getIdentifier()); - assertNotNull("No initializer", expression); - - node = getASTNode((JavaScriptUnit) result, 0, 1); - assertTrue("Not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$ - fieldDeclaration = (FieldDeclaration) node; - fragments = fieldDeclaration.fragments(); - fragment = (VariableDeclarationFragment) fragments.get(0); - expression = fragment.getInitializer(); - assertEquals("Wrong name", "i", fragment.getName().getIdentifier()); - assertNotNull("No initializer", expression); - - node = getASTNode((JavaScriptUnit) result, 0, 2); - assertTrue("Not an initializer", node.getNodeType() == ASTNode.INITIALIZER); //$NON-NLS-1$ - Initializer initializer = (Initializer) node; - assertEquals("Not static", Modifier.NONE, initializer.getModifiers()); - block = initializer.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 3); - assertTrue("Not an initializer", node.getNodeType() == ASTNode.INITIALIZER); //$NON-NLS-1$ - initializer = (Initializer) node; - assertEquals("Not static", Modifier.STATIC, initializer.getModifiers()); - block = initializer.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 6); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - methodDeclaration = (FunctionDeclaration) node; - block = methodDeclaration.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292 - */ - public void test0532() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0488", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - IType[] types = sourceUnit.getTypes(); - assertNotNull(types); - assertEquals("wrong size", 1, types.length); - IType type = types[0]; - IInitializer[] initializers = type.getInitializers(); - assertEquals("wrong size", 2, initializers.length); - IInitializer init = initializers[1]; - ISourceRange sourceRange = init.getSourceRange(); - int position = sourceRange.getOffset() + sourceRange.getLength() / 2; - - IClassFile classFile = getClassFile("Converter" , "bins", "test0532", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - assertNotNull(classFile); - assertNotNull(classFile.getSource()); - type = classFile.getType(); - initializers = type.getInitializers(); - assertEquals("wrong size", 0, initializers.length); - ASTNode result = runConversion(classFile, position, false); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 5); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - Block block = methodDeclaration.getBody(); - List statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 4); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - methodDeclaration = (FunctionDeclaration) node; - block = methodDeclaration.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - List fragments = fieldDeclaration.fragments(); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertEquals("Wrong name", "field", fragment.getName().getIdentifier()); - assertNotNull("No initializer", expression); - - node = getASTNode((JavaScriptUnit) result, 0, 1); - assertTrue("Not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$ - fieldDeclaration = (FieldDeclaration) node; - fragments = fieldDeclaration.fragments(); - fragment = (VariableDeclarationFragment) fragments.get(0); - expression = fragment.getInitializer(); - assertEquals("Wrong name", "i", fragment.getName().getIdentifier()); - assertNotNull("No initializer", expression); - - node = getASTNode((JavaScriptUnit) result, 0, 2); - assertTrue("Not an initializer", node.getNodeType() == ASTNode.INITIALIZER); //$NON-NLS-1$ - Initializer initializer = (Initializer) node; - assertEquals("Not static", Modifier.NONE, initializer.getModifiers()); - block = initializer.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 3); - assertTrue("Not an initializer", node.getNodeType() == ASTNode.INITIALIZER); //$NON-NLS-1$ - initializer = (Initializer) node; - assertEquals("Not static", Modifier.STATIC, initializer.getModifiers()); - block = initializer.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 1, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 6); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - methodDeclaration = (FunctionDeclaration) node; - block = methodDeclaration.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=48489 - * @deprecated using deprecated code - */ - public void test0533() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0533", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0); - assertNotNull("No node", node); - assertTrue("not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); - FunctionDeclaration declaration = (FunctionDeclaration) node; - ASTParser parser = ASTParser.newParser(AST.JLS2); - parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS); - parser.setSource(source); - parser.setSourceRange(declaration.getStartPosition(), declaration.getLength()); - parser.setCompilerOptions(JavaScriptCore.getOptions()); - ASTNode result2 = parser.createAST(null); - assertNotNull("No node", result2); - assertTrue("not a compilation unit", result2.getNodeType() == ASTNode.JAVASCRIPT_UNIT); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result2; - assertEquals("wrong problem size", 1, compilationUnit.getProblems().length); - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=48489 - * @deprecated using deprecated code - */ - public void test0534() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0534", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0); - assertNotNull("No node", node); - assertTrue("not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); - FieldDeclaration declaration = (FieldDeclaration) node; - ASTParser parser = ASTParser.newParser(AST.JLS2); - parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS); - parser.setSource(source); - parser.setSourceRange(declaration.getStartPosition(), declaration.getLength()); - parser.setCompilerOptions(JavaScriptCore.getOptions()); - ASTNode result2 = parser.createAST(null); - assertNotNull("No node", result2); - assertTrue("not a compilation unit", result2.getNodeType() == ASTNode.JAVASCRIPT_UNIT); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result2; - assertEquals("wrong problem size", 1, compilationUnit.getProblems().length); - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=48489 - * @deprecated using deprecated code - */ - public void test0535() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0535", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0); - assertNotNull("No node", node); - assertTrue("not an initializer", node.getNodeType() == ASTNode.INITIALIZER); - Initializer declaration = (Initializer) node; - ASTParser parser = ASTParser.newParser(AST.JLS2); - parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS); - parser.setSource(source); - parser.setSourceRange(declaration.getStartPosition(), declaration.getLength()); - parser.setCompilerOptions(JavaScriptCore.getOptions()); - ASTNode result2 = parser.createAST(null); - assertNotNull("No node", result2); - assertTrue("not a compilation unit", result2.getNodeType() == ASTNode.JAVASCRIPT_UNIT); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result2; - assertEquals("wrong problem size", 1, compilationUnit.getProblems().length); - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=47396 - */ - public void test0536() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0536", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, false); - assertNotNull("No compilation unit", result); - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=51089 - */ - public void test0537a() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0537", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, false); - assertNotNull("No compilation unit", result); - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=51089 - */ - public void test0537b() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0537", "B.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, false); - assertNotNull("No compilation unit", result); - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=51089 - */ - public void test0537c() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0537", "C.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, false); - assertNotNull("No compilation unit", result); - } - /** - * Ensures that an AST can be created during reconcile. - * @deprecated using deprecated code - */ - public void test0538a() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0538", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - try { - sourceUnit.becomeWorkingCopy(null); - sourceUnit.getBuffer().setContents( - "package test0538;\n" + - "public class A {\n" + - " int i;\n" + - "}" - ); - JavaScriptUnit unit = sourceUnit.reconcile(AST.JLS2, false, null, null); - assertNotNull("No level 2 compilation unit", unit); - assertEquals("Compilation unit has wrong AST level (2)", AST.JLS2, unit.getAST().apiLevel()); - // TODO improve test for AST.JLS3 - } finally { - sourceUnit.discardWorkingCopy(); - } - } - /* - * Ensures that no AST is created during reconcile if not requested. - */ - public void test0538b() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0538", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - try { - sourceUnit.becomeWorkingCopy(null); - sourceUnit.getBuffer().setContents( - "package test0538;\n" + - "public class A {\n" + - " int i;\n" + - "}" - ); - JavaScriptUnit unit = sourceUnit.reconcile(0, false, null, null); - assertNull("Unexpected compilation unit", unit); - } finally { - sourceUnit.discardWorkingCopy(); - } - } - /** - * Ensures that no AST is created during reconcile if consistent. - * @deprecated using deprecated code - */ - public void test0538c() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0538", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - try { - sourceUnit.becomeWorkingCopy(null); - JavaScriptUnit unit = sourceUnit.reconcile(AST.JLS2, false, null, null); - assertNull("Unexpected compilation unit", unit); - // TODO improve test for AST.JLS3 - } finally { - sourceUnit.discardWorkingCopy(); - } - } - /** - * Ensures that bindings are created during reconcile if the problem requestor is active. - * @deprecated using deprecated code - */ - public void test0538d() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0538", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - try { - ReconcilerTests.ProblemRequestor pbRequestor = new ReconcilerTests.ProblemRequestor(); - sourceUnit.becomeWorkingCopy(null); - sourceUnit.getBuffer().setContents( - "package test0538;\n" + - "public class A {\n" + - " Object field;\n" + - "}" - ); - // TODO improve test for AST.JLS3 - JavaScriptUnit unit = sourceUnit.reconcile(AST.JLS2, false, null, null); - ASTNode node = getASTNode(unit, 0, 0); - assertNotNull("No node", node); - assertTrue("Not original", isOriginal(node)); - assertTrue("not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); - FieldDeclaration declaration = (FieldDeclaration) node; - Type type = declaration.getType(); - ITypeBinding typeBinding = type.resolveBinding(); - assertNotNull("No type binding", typeBinding); - assertEquals("Wrong name", "Object", typeBinding.getName()); - } finally { - sourceUnit.discardWorkingCopy(); - } - } - /** - * Ensures that bindings are created during reconcile if force problem detection is turned on. - * @deprecated using deprecated code - */ - public void test0538e() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0538", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - try { - ReconcilerTests.ProblemRequestor pbRequestor = new ReconcilerTests.ProblemRequestor(); - sourceUnit.becomeWorkingCopy(null); - // TODO improve test for AST.JLS3 - JavaScriptUnit unit = sourceUnit.reconcile(AST.JLS2, true/*force pb detection*/, null, null); - ASTNode node = getASTNode(unit, 0); - assertNotNull("No node", node); - assertTrue("not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); - TypeDeclaration declaration = (TypeDeclaration) node; - ITypeBinding typeBinding = declaration.resolveBinding(); - assertNotNull("No type binding", typeBinding); - assertEquals("Wrong name", "A", typeBinding.getName()); - } finally { - sourceUnit.discardWorkingCopy(); - } - } - /** - * Ensures that bindings are created during reconcile if force problem detection is turned on. - * Case of a unit containing an anonymous type. - * (regression test for bug 55102 NPE when using ICU.reconcile(GET_AST_TRUE, ...)) - * @deprecated using deprecated code - */ - public void test0538f() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0538", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - try { - ReconcilerTests.ProblemRequestor pbRequestor = new ReconcilerTests.ProblemRequestor(); - sourceUnit.becomeWorkingCopy(null); - sourceUnit.getBuffer().setContents( - "package test0538;\n" + - "public class A {\n" + - " void foo() {\n" + - " new Object() {\n" + - " void bar() {\n" + - " }\n" + - " };\n" + - " }\n" + - "}" - ); - // TODO improve test for AST.JLS3 - JavaScriptUnit unit = sourceUnit.reconcile(AST.JLS2, true/*force pb detection*/, null, null); - ASTNode node = getASTNode(unit, 0); - assertNotNull("No node", node); - } finally { - sourceUnit.discardWorkingCopy(); - } - } - /** - * Ensures that bindings are created during reconcile if force problem detection is turned on. - * Case of a unit containing an anonymous type. - * (regression test for bug 55102 NPE when using ICU.reconcile(GET_AST_TRUE, ...)) - * @deprecated using deprecated code - */ - public void test0538g() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0538", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - try { - ReconcilerTests.ProblemRequestor pbRequestor = new ReconcilerTests.ProblemRequestor(); - sourceUnit.becomeWorkingCopy(null); - sourceUnit.getBuffer().setContents( - "package test0538;\n" + - "public class A {\n" + - " void foo() {\n" + - " new Object() {\n" + - " void bar() {\n" + - " }\n" + - " };\n" + - " }\n" + - "}" - ); - sourceUnit.reconcile(IJavaScriptUnit.NO_AST, false/* don't force pb detection*/, null, null); - // TODO improve test for AST.JLS3 - JavaScriptUnit unit = sourceUnit.reconcile(AST.JLS2, true/*force pb detection*/, null, null); - ASTNode node = getASTNode(unit, 0); - assertNotNull("No node", node); - } finally { - sourceUnit.discardWorkingCopy(); - } - } - /** - * Ensures that asking for well known type doesn't throw a NPE if the problem requestor is not active. - * (regression test for bug 64750 NPE in Java AST Creation - editing some random file) - * @deprecated using deprecated code - */ - public void test0538h() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0538", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - try { - ReconcilerTests.ProblemRequestor pbRequestor = new ReconcilerTests.ProblemRequestor() { - public boolean isActive() { - return false; - } - }; - sourceUnit.becomeWorkingCopy(null); - sourceUnit.getBuffer().setContents( - "package test0538;\n" + - "public class A {\n" + - " Object field;\n" + - "}" - ); - // TODO improve test for AST.JLS3 - JavaScriptUnit unit = sourceUnit.reconcile(AST.JLS2, false, null, null); - assertEquals("Unexpected well known type", null, unit.getAST().resolveWellKnownType("void")); - } finally { - sourceUnit.discardWorkingCopy(); - } - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=53477 - */ - public void test0539() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0539", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 1, 0); - assertNotNull("No node", node); - assertTrue("not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertTrue("not a class instance creation", expression.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression; - checkSourceRange(classInstanceCreation, "new A(){}.new Inner(){/*x*/}", source); - AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration(); - Expression expression2 = classInstanceCreation.getExpression(); - assertTrue("not a class instance creation", expression2.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); - ClassInstanceCreation classInstanceCreation2 = (ClassInstanceCreation) expression2; - AnonymousClassDeclaration anonymousClassDeclaration2 = classInstanceCreation2.getAnonymousClassDeclaration(); - assertNotNull("No anonymous class declaration", anonymousClassDeclaration2); - checkSourceRange(anonymousClassDeclaration2, "{}", source); - assertNotNull("No anonymous class declaration", anonymousClassDeclaration); - checkSourceRange(anonymousClassDeclaration, "{/*x*/}", source); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=54431 - */ - public void test0540() { - char[] source = - ("package test0540;\n" + //$NON-NLS-1$ - "\n" + //$NON-NLS-1$ - "class Test {\n" + //$NON-NLS-1$ - " public void foo(int arg) {\n" +//$NON-NLS-1$ - " assert true;\n" +//$NON-NLS-1$ - " }\n" + //$NON-NLS-1$ - "}").toCharArray(); //$NON-NLS-1$ - IJavaScriptProject project = getJavaProject("Converter"); //$NON-NLS-1$ - Map options = project.getOptions(true); - options.put(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_4); - options.put(JavaScriptCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaScriptCore.VERSION_1_4); - options.put(JavaScriptCore.COMPILER_COMPLIANCE, JavaScriptCore.VERSION_1_4); - ASTNode result = runConversion(source, "Test.js", project, options, true); //$NON-NLS-1$ - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("Problems found", 0, compilationUnit.getProblems().length); - ASTNode node = getASTNode(compilationUnit, 0); - assertTrue("not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "Test", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Wrong package", "test0540", typeBinding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue("Not an interface", typeBinding.isClass()); //$NON-NLS-1$ - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=56697 - */ - public void test0541() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0541", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0); - assertEquals("not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType()); - class Change14FieldAccessASTVisitor extends ASTVisitor { - int counter; - Change14FieldAccessASTVisitor() { - counter = 0; - } - public void endVisit(QualifiedName qualifiedName) { - IBinding i_binding = qualifiedName.getQualifier().resolveBinding(); - ITypeBinding type_binding = qualifiedName.getQualifier().resolveTypeBinding(); - if (i_binding == null || type_binding == null) { - counter++; - } - } - } - Change14FieldAccessASTVisitor visitor = new Change14FieldAccessASTVisitor(); - unit.accept(visitor); - assertEquals("Missing binding", 0, visitor.counter); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=55004 - */ - public void test0542() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0542", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0); - assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - assertEquals("Wrong name", "STRING_FIELD", variableBinding.getName()); - Object constantValue = variableBinding.getConstantValue(); - assertNotNull("No constant", constantValue); - assertEquals("Wrong value", "Hello world!", constantValue); - Expression initializer = fragment.getInitializer(); - assertNotNull("No initializer", initializer); - checkSourceRange(initializer, "\"Hello world!\"", source); - - node = getASTNode(unit, 0, 1); - assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - fieldDeclaration = (FieldDeclaration) node; - fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - fragment = (VariableDeclarationFragment) fragments.get(0); - variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - assertEquals("Wrong name", "BOOLEAN_FIELD", variableBinding.getName()); - constantValue = variableBinding.getConstantValue(); - assertNotNull("No constant", constantValue); - assertEquals("Wrong value", new Boolean(true), constantValue); - initializer = fragment.getInitializer(); - assertNotNull("No initializer", initializer); - checkSourceRange(initializer, "true", source); - - node = getASTNode(unit, 0, 2); - assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - fieldDeclaration = (FieldDeclaration) node; - fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - fragment = (VariableDeclarationFragment) fragments.get(0); - variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - assertEquals("Wrong name", "BYTE_FIELD", variableBinding.getName()); - constantValue = variableBinding.getConstantValue(); - assertNotNull("No constant", constantValue); - assertEquals("Wrong value", new Byte((byte)1), constantValue); - initializer = fragment.getInitializer(); - assertNotNull("No initializer", initializer); - checkSourceRange(initializer, "1", source); - - node = getASTNode(unit, 0, 3); - assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - fieldDeclaration = (FieldDeclaration) node; - fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - fragment = (VariableDeclarationFragment) fragments.get(0); - variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - assertEquals("Wrong name", "CHAR_FIELD", variableBinding.getName()); - constantValue = variableBinding.getConstantValue(); - assertNotNull("No constant", constantValue); - assertEquals("Wrong value", new Character('{'), constantValue); - initializer = fragment.getInitializer(); - assertNotNull("No initializer", initializer); - checkSourceRange(initializer, "\'{\'", source); - - node = getASTNode(unit, 0, 4); - assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - fieldDeclaration = (FieldDeclaration) node; - fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - fragment = (VariableDeclarationFragment) fragments.get(0); - variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - assertEquals("Wrong name", "DOUBLE_FIELD", variableBinding.getName()); - constantValue = variableBinding.getConstantValue(); - assertNotNull("No constant", constantValue); - assertEquals("Wrong value", new Double("3.1415"), constantValue); - initializer = fragment.getInitializer(); - assertNotNull("No initializer", initializer); - checkSourceRange(initializer, "3.1415", source); - - node = getASTNode(unit, 0, 5); - assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - fieldDeclaration = (FieldDeclaration) node; - fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - fragment = (VariableDeclarationFragment) fragments.get(0); - variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - assertEquals("Wrong name", "FLOAT_FIELD", variableBinding.getName()); - constantValue = variableBinding.getConstantValue(); - assertNotNull("No constant", constantValue); - assertEquals("Wrong value", new Float("3.14159f"), constantValue); - initializer = fragment.getInitializer(); - assertNotNull("No initializer", initializer); - checkSourceRange(initializer, "3.14159f", source); - - node = getASTNode(unit, 0, 6); - assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - fieldDeclaration = (FieldDeclaration) node; - fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - fragment = (VariableDeclarationFragment) fragments.get(0); - variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - assertEquals("Wrong name", "INT_FIELD", variableBinding.getName()); - constantValue = variableBinding.getConstantValue(); - assertNotNull("No constant", constantValue); - assertEquals("Wrong value", Integer.valueOf("7fffffff", 16), constantValue); - initializer = fragment.getInitializer(); - assertNotNull("No initializer", initializer); - checkSourceRange(initializer, "Integer.MAX_VALUE", source); - - node = getASTNode(unit, 0, 7); - assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - fieldDeclaration = (FieldDeclaration) node; - fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - fragment = (VariableDeclarationFragment) fragments.get(0); - variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - assertEquals("Wrong name", "LONG_FIELD", variableBinding.getName()); - constantValue = variableBinding.getConstantValue(); - assertNotNull("No constant", constantValue); - assertEquals("Wrong value", new Long("34"), constantValue); - initializer = fragment.getInitializer(); - assertNotNull("No initializer", initializer); - checkSourceRange(initializer, "34L", source); - - node = getASTNode(unit, 0, 8); - assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - fieldDeclaration = (FieldDeclaration) node; - fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - fragment = (VariableDeclarationFragment) fragments.get(0); - variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - assertEquals("Wrong name", "SHORT_FIELD", variableBinding.getName()); - constantValue = variableBinding.getConstantValue(); - assertNotNull("No constant", constantValue); - assertEquals("Wrong value", new Short("130"), constantValue); - initializer = fragment.getInitializer(); - assertNotNull("No initializer", initializer); - checkSourceRange(initializer, "130", source); - - node = getASTNode(unit, 0, 9); - assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - fieldDeclaration = (FieldDeclaration) node; - fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - fragment = (VariableDeclarationFragment) fragments.get(0); - variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - assertEquals("Wrong name", "int_field", variableBinding.getName()); - constantValue = variableBinding.getConstantValue(); - assertNull("Got a constant", constantValue); - initializer = fragment.getInitializer(); - assertNotNull("No initializer", initializer); - checkSourceRange(initializer, "Integer.MAX_VALUE", source); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=58436 - */ - public void test0543() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0543", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - unit.accept(new GetKeyVisitor()); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=51500 - */ - public void test0544() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0544", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0); - assertEquals("not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType()); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertTrue("Not an abstract method", (methodDeclaration.getModifiers() & Modifier.ABSTRACT) != 0); - IFunctionBinding methodBinding = methodDeclaration.resolveBinding(); - assertNotNull("No binding", methodBinding); - assertTrue("Not an abstract method binding", (methodBinding.getModifiers() & Modifier.ABSTRACT) != 0); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=59843 - */ - public void test0545() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0545", "First.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0); - assertEquals("not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType()); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertEquals("Wrong key", "Ltest0545/First$Test;", typeBinding.getKey()); - - sourceUnit = getCompilationUnit("Converter", "src", "test0545", "Second.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - result = runConversion(sourceUnit, true); - unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - node = getASTNode(unit, 0, 0); - assertEquals("not a method declaration", ASTNode.TYPE_DECLARATION, node.getNodeType()); //$NON-NLS-1$ - typeDeclaration = (TypeDeclaration) node; - typeBinding = typeDeclaration.resolveBinding(); - assertEquals("Wrong key", "Ltest0545/Second$Test;", typeBinding.getKey()); - - sourceUnit = getCompilationUnit("Converter", "src", "test0545", "Third.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - result = runConversion(sourceUnit, true); - unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - node = getASTNode(unit, 0, 0); - assertEquals("not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType()); //$NON-NLS-1$ - typeDeclaration = (TypeDeclaration) node; - typeBinding = typeDeclaration.resolveBinding(); - assertEquals("Wrong key", "Ltest0545/Third$Test;", typeBinding.getKey()); - - - sourceUnit = getCompilationUnit("Converter", "src", "test0545", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - result = runConversion(sourceUnit, true); - unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - node = getASTNode(unit, 0); - assertEquals("not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType()); //$NON-NLS-1$ - typeDeclaration = (TypeDeclaration) node; - typeBinding = typeDeclaration.resolveBinding(); - assertEquals("Wrong key", "Ltest0545/Test;", typeBinding.getKey()); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=59848 - * @deprecated using deprecated code - */ - public void test0546() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0546", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 1, 0, 0); - assertEquals("not a variable declaration", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType()); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - List fragments = variableDeclarationStatement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - ITypeBinding typeBinding = variableBinding.getType(); - assertTrue("An anonymous type binding", !typeBinding.isAnonymous()); - Expression initializer = fragment.getInitializer(); - assertEquals("not a class instance creation", ASTNode.CLASS_INSTANCE_CREATION, initializer.getNodeType()); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) initializer; - AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration(); - ITypeBinding typeBinding2 = anonymousClassDeclaration.resolveBinding(); - assertTrue("Not an anonymous type binding", typeBinding2.isAnonymous()); - ITypeBinding typeBinding3 = classInstanceCreation.resolveTypeBinding(); - assertTrue("Not an anonymous type binding", typeBinding3.isAnonymous()); - node = getASTNode(unit, 1, 0, 1); - assertEquals("not a expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType()); //$NON-NLS-1$ - ExpressionStatement statement = (ExpressionStatement) node; - Expression expression = statement.getExpression(); - assertEquals("not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType()); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - Expression expression2 = methodInvocation.getExpression(); - assertEquals("not a simple name", ASTNode.SIMPLE_NAME, expression2.getNodeType()); //$NON-NLS-1$ - SimpleName simpleName = (SimpleName) expression2; - ITypeBinding typeBinding4 = simpleName.resolveTypeBinding(); - assertTrue("An anonymous type binding", !typeBinding4.isAnonymous()); - Name name = classInstanceCreation.getName(); - IBinding binding = name.resolveBinding(); - assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); - ITypeBinding typeBinding5 = (ITypeBinding) binding; - assertTrue("An anonymous type binding", !typeBinding5.isAnonymous()); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=60078 - * @deprecated using deprecated code - */ - public void test0547() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0547", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("not a type declaration statement", ASTNode.TYPE_DECLARATION_STATEMENT, node.getNodeType()); //$NON-NLS-1$ - TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) node; - TypeDeclaration typeDeclaration = typeDeclarationStatement.getTypeDeclaration(); - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertEquals("Wrong key", "Ltest0547/A$74$Local;", typeBinding.getKey()); - - List bodyDeclarations = typeDeclaration.bodyDeclarations(); - assertEquals("wrong size", 3, bodyDeclarations.size()); - BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); - assertEquals("not a type declaration statement", ASTNode.TYPE_DECLARATION, bodyDeclaration.getNodeType()); //$NON-NLS-1$ - TypeDeclaration typeDeclaration2 = (TypeDeclaration) bodyDeclaration; - - typeBinding = typeDeclaration2.resolveBinding(); - assertEquals("Wrong key", "Ltest0547/A$100$LocalMember;", typeBinding.getKey()); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=60581 - */ - public void test0548() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0548", "PaletteStackEditPart.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, false); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48502 - */ - public void test0549() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0549", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, false); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48502 - */ - public void test0550() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0550", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, false); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=60848 - */ - public void test0551() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0551", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, false); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 1, problems.length); //$NON-NLS-1$ - IProblem problem = problems[0]; - assertEquals("wrong end position", source.length - 1, problem.getSourceEnd()); - } - - public void test0552() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0552", "Test.js"); - char[] source = sourceUnit.getSource().toCharArray(); - JavaScriptUnit result = (JavaScriptUnit) runConversion(sourceUnit, true); - assertEquals("Got errors", 0, result.getProblems().length); - TypeDeclaration declaration = (TypeDeclaration) result.types().get(0); - Block body = declaration.getMethods()[0].getBody(); - ExpressionStatement expr = (ExpressionStatement) body.statements().get(0); - FunctionInvocation invocation = (FunctionInvocation) expr.getExpression(); - InfixExpression node = (InfixExpression) invocation.arguments().get(0); - ITypeBinding typeBinding = node.resolveTypeBinding(); - assertEquals("wrong type", "java.lang.String", typeBinding.getQualifiedName()); - checkSourceRange(node, "\"a\" + \"a\" + \"a\"", source); - List extendedOperands = node.extendedOperands(); - assertEquals("Wrong size", 1, extendedOperands.size()); - Expression leftOperand = node.getLeftOperand(); - checkSourceRange(leftOperand, "\"a\"", source); - typeBinding = leftOperand.resolveTypeBinding(); - assertEquals("wrong type", "java.lang.String", typeBinding.getQualifiedName()); - Expression rightOperand = node.getRightOperand(); - checkSourceRange(rightOperand, "\"a\"", source); - typeBinding = rightOperand.resolveTypeBinding(); - assertEquals("wrong type", "java.lang.String", typeBinding.getQualifiedName()); - Expression expression = (Expression) extendedOperands.get(0); - checkSourceRange(expression, "\"a\"", source); - typeBinding = expression.resolveTypeBinding(); - assertEquals("wrong type", "java.lang.String", typeBinding.getQualifiedName()); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=61946 - */ - public void test0553() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0553", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0); - assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType()); - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - Object constantValue = variableBinding.getConstantValue(); - assertNull("Got a constant value", constantValue); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=61946 - */ - public void test0554() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0554", "B.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a return statement", ASTNode.RETURN_STATEMENT, node.getNodeType()); - ReturnStatement returnStatement = (ReturnStatement) node; - Expression expression = returnStatement.getExpression(); - assertNotNull("No expression", expression); - assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType()); - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - Expression expression2 = methodInvocation.getExpression(); - checkSourceRange(expression2, "A", source); - ITypeBinding typeBinding = expression2.resolveTypeBinding(); - assertEquals("wrong type", "test0554.A", typeBinding.getQualifiedName()); - IVariableBinding[] fields = typeBinding.getDeclaredFields(); - assertEquals("Wrong size", 1, fields.length); - IVariableBinding variableBinding = fields[0]; - Object constantValue = variableBinding.getConstantValue(); - assertNotNull("Missing constant", constantValue); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=61946 - */ - public void test0555() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0555", "B.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a return statement", ASTNode.RETURN_STATEMENT, node.getNodeType()); - ReturnStatement returnStatement = (ReturnStatement) node; - Expression expression = returnStatement.getExpression(); - assertNotNull("No expression", expression); - assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, expression.getNodeType()); - QualifiedName qualifiedName = (QualifiedName) expression; - Name name = qualifiedName.getQualifier(); - checkSourceRange(name, "A", source); - ITypeBinding typeBinding = name.resolveTypeBinding(); - assertEquals("wrong type", "test0555.A", typeBinding.getQualifiedName()); - IVariableBinding[] fields = typeBinding.getDeclaredFields(); - assertEquals("Wrong size", 1, fields.length); - IVariableBinding variableBinding = fields[0]; - Object constantValue = variableBinding.getConstantValue(); - assertNotNull("No constant value", constantValue); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=62463 - */ - public void test0556() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0556", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 1, 0); - assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType()); - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertEquals("Not an method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType()); - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - Expression expression2 = methodInvocation.getExpression(); - checkSourceRange(expression2, "(aa.bar())", source); - SimpleName simpleName = methodInvocation.getName(); - checkSourceRange(simpleName, "size", source); - checkSourceRange(expression, "(aa.bar()).size()", source); - checkSourceRange(expressionStatement, "(aa.bar()).size();", source); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=62463 - */ - public void test0557() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0557", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 1, 0); - assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType()); - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertEquals("Not an method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType()); - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - Expression expression2 = methodInvocation.getExpression(); - checkSourceRange(expression2, "(aa.bar())", source); - SimpleName simpleName = methodInvocation.getName(); - checkSourceRange(simpleName, "get", source); - checkSourceRange(expression, "(aa.bar()).get(0)", source); - checkSourceRange(expressionStatement, "(aa.bar()).get(0);", source); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65090 - * @deprecated using deprecated code - */ - public void test0558() { - String src = "\tSystem.out.println(\"Hello\");\n\tSystem.out.println(\"World\");\n"; - char[] source = src.toCharArray(); - ASTParser parser = ASTParser.newParser(AST.JLS2); - parser.setKind (ASTParser.K_STATEMENTS); - parser.setSource (source); - ASTNode result = parser.createAST (null); - assertNotNull("no result", result); - assertEquals("Wrong type", ASTNode.BLOCK, result.getNodeType()); - Block block = (Block) result; - List statements = block.statements(); - assertNotNull("No statements", statements); - assertEquals("Wrong size", 2, statements.size()); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562 - */ - public void test0559() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0559", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType()); - IfStatement ifStatement = (IfStatement) node; - Expression expression = ifStatement.getExpression(); - assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType()); - InfixExpression infixExpression = (InfixExpression) expression; - Expression expression2 = infixExpression.getLeftOperand(); - assertEquals("Wrong type", ASTNode.FUNCTION_INVOCATION, expression2.getNodeType()); - FunctionInvocation methodInvocation = (FunctionInvocation) expression2; - Expression expression3 = methodInvocation.getExpression(); - assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType()); - ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3; - Expression expression4 = parenthesizedExpression.getExpression(); - assertEquals("Wrong type", ASTNode.STRING_LITERAL, expression4.getNodeType()); - checkSourceRange(expression4, "\" \"", source); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562 - */ - public void test0560() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0560", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType()); - IfStatement ifStatement = (IfStatement) node; - Expression expression = ifStatement.getExpression(); - assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType()); - InfixExpression infixExpression = (InfixExpression) expression; - Expression expression2 = infixExpression.getLeftOperand(); - assertEquals("Wrong type", ASTNode.FUNCTION_INVOCATION, expression2.getNodeType()); - FunctionInvocation methodInvocation = (FunctionInvocation) expression2; - Expression expression3 = methodInvocation.getExpression(); - assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType()); - ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3; - Expression expression4 = parenthesizedExpression.getExpression(); - assertEquals("Wrong type", ASTNode.STRING_LITERAL, expression4.getNodeType()); - checkSourceRange(expression4, "\" \"", source); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562 - */ - public void test0561() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0561", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType()); - IfStatement ifStatement = (IfStatement) node; - Expression expression = ifStatement.getExpression(); - assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType()); - InfixExpression infixExpression = (InfixExpression) expression; - Expression expression2 = infixExpression.getLeftOperand(); - assertEquals("Wrong type", ASTNode.FUNCTION_INVOCATION, expression2.getNodeType()); - FunctionInvocation methodInvocation = (FunctionInvocation) expression2; - Expression expression3 = methodInvocation.getExpression(); - assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType()); - ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3; - Expression expression4 = parenthesizedExpression.getExpression(); - assertEquals("Wrong type", ASTNode.STRING_LITERAL, expression4.getNodeType()); - checkSourceRange(expression4, "\" \"", source); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562 - */ - public void test0562() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0562", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType()); - IfStatement ifStatement = (IfStatement) node; - Expression expression = ifStatement.getExpression(); - assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType()); - InfixExpression infixExpression = (InfixExpression) expression; - Expression expression2 = infixExpression.getLeftOperand(); - assertEquals("Wrong type", ASTNode.FUNCTION_INVOCATION, expression2.getNodeType()); - FunctionInvocation methodInvocation = (FunctionInvocation) expression2; - Expression expression3 = methodInvocation.getExpression(); - assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType()); - ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3; - Expression expression4 = parenthesizedExpression.getExpression(); - assertEquals("Wrong type", ASTNode.STRING_LITERAL, expression4.getNodeType()); - checkSourceRange(expression4, "\" \"", source); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562 - */ - public void test0563() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0563", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType()); - IfStatement ifStatement = (IfStatement) node; - Expression expression = ifStatement.getExpression(); - assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType()); - InfixExpression infixExpression = (InfixExpression) expression; - Expression expression2 = infixExpression.getLeftOperand(); - assertEquals("Wrong type", ASTNode.FUNCTION_INVOCATION, expression2.getNodeType()); - FunctionInvocation methodInvocation = (FunctionInvocation) expression2; - Expression expression3 = methodInvocation.getExpression(); - assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType()); - ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3; - Expression expression4 = parenthesizedExpression.getExpression(); - checkSourceRange(expression4, "new String()", source); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562 - */ - public void test0564() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0564", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType()); - IfStatement ifStatement = (IfStatement) node; - Expression expression = ifStatement.getExpression(); - assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType()); - InfixExpression infixExpression = (InfixExpression) expression; - Expression expression2 = infixExpression.getLeftOperand(); - assertEquals("Wrong type", ASTNode.FUNCTION_INVOCATION, expression2.getNodeType()); - FunctionInvocation methodInvocation = (FunctionInvocation) expression2; - Expression expression3 = methodInvocation.getExpression(); - assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType()); - ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3; - Expression expression4 = parenthesizedExpression.getExpression(); - checkSourceRange(expression4, "new String()", source); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562 - */ - public void test0565() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0565", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType()); - IfStatement ifStatement = (IfStatement) node; - Expression expression = ifStatement.getExpression(); - assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType()); - InfixExpression infixExpression = (InfixExpression) expression; - Expression expression2 = infixExpression.getLeftOperand(); - assertEquals("Wrong type", ASTNode.FUNCTION_INVOCATION, expression2.getNodeType()); - FunctionInvocation methodInvocation = (FunctionInvocation) expression2; - Expression expression3 = methodInvocation.getExpression(); - assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType()); - ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3; - Expression expression4 = parenthesizedExpression.getExpression(); - checkSourceRange(expression4, "(/**/ String /**/) new String()", source); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=69349 - */ - public void test0566() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0566", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0); - assertEquals("Wrong type", ASTNode.FUNCTION_DECLARATION, node.getNodeType()); - assertEquals("Wrong character", '}', source[node.getStartPosition() + node.getLength() - 1]); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=69349 - */ - public void test0567() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0567", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0); - assertEquals("Wrong type", ASTNode.FUNCTION_DECLARATION, node.getNodeType()); - assertEquals("Wrong character", '}', source[node.getStartPosition() + node.getLength() - 1]); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=74369 - * @deprecated using deprecated code - */ - public void test0569() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0569", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0, 1); - assertEquals("not a type declaration statement", ASTNode.TYPE_DECLARATION_STATEMENT, node.getNodeType()); //$NON-NLS-1$ - TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) node; - TypeDeclaration typeDeclaration = typeDeclarationStatement.getTypeDeclaration(); - assertEquals("wrong name", "Local", typeDeclaration.getName().getIdentifier()); - assertNull("Got a javadoc", typeDeclaration.getJavadoc()); - node = getASTNode(unit, 0); - assertEquals("not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType()); //$NON-NLS-1$ - typeDeclaration = (TypeDeclaration) node; - assertEquals("wrong name", "A", typeDeclaration.getName().getIdentifier()); - assertNotNull("No javadoc", typeDeclaration.getJavadoc()); - node = getASTNode(unit, 0, 0); - assertEquals("not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType()); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertEquals("wrong name", "method", methodDeclaration.getName().getIdentifier()); - assertNotNull("No javadoc", methodDeclaration.getJavadoc()); - } - - /* - * Ensures that the type binding from an import and the type binding from a type ref are equals - * when the AST is computed using IJavaScriptUnit#reconcile(...) - * (regression test for bug 83210 Unidentical ITypeBindings for same type from same AST from reconcile) - */ - public void test0570() throws CoreException { - IJavaScriptUnit workingCopy = null; - try { - workingCopy = getWorkingCopy("/Converter/src/X.js", true); - JavaScriptUnit unit = (JavaScriptUnit) buildAST( - "import java.util.List;\n" + - "public class X{\n" + - " List field;\n" + - "}", - workingCopy - ); - ImportDeclaration importDeclaration = (ImportDeclaration) unit.imports().iterator().next(); - TypeDeclaration typeDeclaration = (TypeDeclaration) unit.types().iterator().next(); - FieldDeclaration fieldDeclaration = typeDeclaration.getFields()[0]; - Type type = fieldDeclaration.getType(); - IBinding importBinding = importDeclaration.resolveBinding(); - IBinding typeBinding = type.resolveBinding(); - assertEquals(importBinding,typeBinding); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /* - * Ensures that the bindings for a member type in a .class file can be created. - */ - public void test0571() throws CoreException, IOException { - try { - IJavaScriptProject p = createJavaProject("P", new String[] {""}, new String[] {"CONVERTER_JCL_LIB"}); - String source = - "public class X {\n" + - " public class Y {\n" + - " }\n" + - "}"; - addLibrary(p, "test0571.jar", "test0571.zip", new String[] {"X.js", source }, "1.4"); - IClassFile classFile = getClassFile("P", "/P/test0571.jar", "", "X$Y.class"); - JavaScriptUnit unit = (JavaScriptUnit) runConversion(AST.JLS3, classFile, 0, true); - IProblem[] problems = unit.getProblems(); - StringBuffer buffer = new StringBuffer(); - for (int i = 0, length = problems.length; i < length; i++) - Util.appendProblem(buffer, problems[i], source.toCharArray(), i); - assertEquals("Unexpected problems", "", buffer.toString()); - } finally { - deleteProject("P"); - } - } - - /* - * Ensures that the method bindings of an anonymous type are correct. - */ - public void test0572() throws CoreException { - IJavaScriptUnit workingCopy = null; - try { - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - AnonymousClassDeclaration type = (AnonymousClassDeclaration) buildAST( - "public class X {\n" + - " void foo() {\n" + - " new X() /*start*/{\n" + - " void bar() {}\n" + - " }/*end*/;\n" + - " }\n" + - "}", - workingCopy); - ITypeBinding typeBinding = type.resolveBinding(); - assertBindingsEqual( - "LX$40;.(LX;)V\n" + - "LX$40;.bar()V", - typeBinding.getDeclaredMethods()); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /* - * Ensures that the Java element of a compilation is correct. - */ - public void test0573() throws CoreException { - IJavaScriptUnit workingCopy = null; - try { - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - JavaScriptUnit cu = (JavaScriptUnit) buildAST( - "public class X {\n" + - "}", - workingCopy); - assertElementEquals("Unexpected Java element", "[Working copy] X.java [in [in src [in Converter]]]", cu.getJavaElement()); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - /* - * Ensures that strings are not optimized when creating the AST through a reconcile. - * (regression test for bug 82830 AST: String concatenation represented as single node) - */ - public void test0574() throws CoreException { - IJavaScriptUnit workingCopy = null; - try { - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode string = buildAST( - "public class X {\n" + - " String s = /*start*/\"a\" + \"b\"/*end*/;\n" + - "}", - workingCopy); - assertEquals("Unexpected node type", ASTNode.INFIX_EXPRESSION, string.getNodeType()); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /* - * Ensures that 2 different method bindings with the same return type are not "isEqualTo(...)". - * (regression test for bug 99978 MalformedTreeException on Inline Method) - */ - public void test0575() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - String contents = - "public class X {\n" + - " /*start1*/String foo(String o) {return null;}/*end1*/\n" + - " /*start2*/String foo(Object o) {return null;}/*end2*/\n" + - "}"; - IBinding[] firstBatch = resolveBindings(contents, workingCopy); - IBinding[] secondBatch = resolveBindings(contents, workingCopy); - assertTrue("2 different method type bindings should not be equals", !firstBatch[0].isEqualTo(secondBatch[1])); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /* - * Ensures that the binding key of a raw member type is correct. - * (regression test for bug 100549 Strange binding keys from AST on class file of nested type) - */ - public void test0576() throws CoreException, IOException { - try { - IJavaScriptProject project = createJavaProject("P1", new String[] {""}, new String[] {"CONVERTER_JCL15_LIB"}, "", "1.5"); - addLibrary(project, "lib.jar", "src.zip", new String[] { - "/P1/p/X.js", - "package p;\n" + - "public class X {\n" + - " /*start*/public class Member {\n" + - " }/*end*/\n" + - "}", - }, "1.5"); - IClassFile classFile = getClassFile("P1", "/P1/lib.jar", "p", "X$Member.class"); - String source = classFile.getSource(); - MarkerInfo markerInfo = new MarkerInfo(source); - markerInfo.astStarts = new int[] {source.indexOf("/*start*/") + "/*start*/".length()}; - markerInfo.astEnds = new int[] {source.indexOf("/*end*/")}; - ASTNode node = buildAST(markerInfo, classFile); - ITypeBinding binding = ((TypeDeclaration) node).resolveBinding(); - assertBindingKeyEquals("Lp/X.Member;", binding.getKey()); - } finally { - deleteProject("P1"); - } - } - - /* - * Ensures that strings are not optimized when creating the AST through a reconcile - * even if the working copy was consistent. - * (regression test for bug 114909 AST: String concatenation represented as single node) - */ - public void test0577() throws CoreException { - IJavaScriptUnit workingCopy = null; - try { - workingCopy = getWorkingCopy( - "/Converter/src/X.js", - "public class X {\n" + - " String s = /*start*/\"a\" + \"b\"/*end*/;\n" + - "}", - true/*resolve*/); - ASTNode string = buildAST(workingCopy); - assertEquals("Unexpected node type", ASTNode.INFIX_EXPRESSION, string.getNodeType()); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - - - /* - * Ensures that the start position of an argument that has a previous sibbling with a comment is correct - * (regression test for bug 80904 Quick Fix "Assign parameter to new field" doesn't appear with commented type) - */ - public void test0579() throws CoreException { - IJavaScriptUnit workingCopy = null; - try { - workingCopy = getWorkingCopy( - "/Converter/src/X.js", - "public class X {\n" + - " /*start*/void foo(Object/*first arg*/ arg1, Object arg2) {\n" + - " }/*end*/\n" + - "}", - true/*resolve*/); - FunctionDeclaration method = (FunctionDeclaration) buildAST(workingCopy); - SingleVariableDeclaration arg2 = (SingleVariableDeclaration) method.parameters().get(1); - int start = arg2.getStartPosition(); - assertEquals("Unexpected range for arg2", "Object arg2", workingCopy.getSource().substring(start, start+arg2.getLength())); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - public void test0606() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0606", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertProblemsSize(unit, 0); - unit.accept(new ASTVisitor() { - public boolean visit(FunctionDeclaration methodDeclaration) { - IFunctionBinding methodBinding = methodDeclaration.resolveBinding(); - IJavaScriptElement javaElement = methodBinding.getJavaElement(); - assertNotNull("No java element", javaElement); - return false; - } - }); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=173853 - */ - public void test0607() throws CoreException { - IJavaScriptUnit workingCopy = null; - try { - workingCopy = getWorkingCopy( - "/Converter/src/X.js", - "public class X {\n" + - " void foo() {\n" + - " #\n" + - " /*start*/new Object() {\n" + - " }/*end*/;\n" + - " }\n" + - "}", - true/*resolve*/); - ASTNode string = buildAST(null, workingCopy, true, true); - assertEquals("Unexpected node type", ASTNode.CLASS_INSTANCE_CREATION, string.getNodeType()); - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) string; - ITypeBinding resolveTypeBinding = classInstanceCreation.resolveTypeBinding(); - assertNotNull("Binding is null", resolveTypeBinding); - IFunctionBinding[] declaredMethods = resolveTypeBinding.getDeclaredMethods(); - assertNotNull("Should have one method", declaredMethods); - assertEquals("Should have one method", 1, declaredMethods.length); - assertTrue("The method should be a default constructor", declaredMethods[0].isDefaultConstructor()); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterTestAST3_2.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterTestAST3_2.java deleted file mode 100644 index db189c3..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterTestAST3_2.java +++ /dev/null @@ -1,8652 +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.util.ArrayList; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import junit.framework.Test; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.wst.jsdt.core.IClassFile; -import org.eclipse.wst.jsdt.core.IFunction; -import org.eclipse.wst.jsdt.core.IInitializer; -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.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.WorkingCopyOwner; -import org.eclipse.wst.jsdt.core.compiler.IProblem; -import org.eclipse.wst.jsdt.core.dom.AST; -import org.eclipse.wst.jsdt.core.dom.ASTMatcher; -import org.eclipse.wst.jsdt.core.dom.ASTNode; -import org.eclipse.wst.jsdt.core.dom.ASTParser; -import org.eclipse.wst.jsdt.core.dom.ASTRequestor; -import org.eclipse.wst.jsdt.core.dom.ASTVisitor; -import org.eclipse.wst.jsdt.core.dom.AbstractTypeDeclaration; -import org.eclipse.wst.jsdt.core.dom.AnonymousClassDeclaration; -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.CatchClause; -import org.eclipse.wst.jsdt.core.dom.CharacterLiteral; -import org.eclipse.wst.jsdt.core.dom.ClassInstanceCreation; -import org.eclipse.wst.jsdt.core.dom.ConstructorInvocation; -import org.eclipse.wst.jsdt.core.dom.Expression; -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.IBinding; -import org.eclipse.wst.jsdt.core.dom.IFunctionBinding; -import org.eclipse.wst.jsdt.core.dom.ITypeBinding; -import org.eclipse.wst.jsdt.core.dom.IVariableBinding; -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.JavaScriptUnit; -import org.eclipse.wst.jsdt.core.dom.Modifier; -import org.eclipse.wst.jsdt.core.dom.Name; -import org.eclipse.wst.jsdt.core.dom.NullLiteral; -import org.eclipse.wst.jsdt.core.dom.PackageDeclaration; -import org.eclipse.wst.jsdt.core.dom.ParenthesizedExpression; -import org.eclipse.wst.jsdt.core.dom.PrimitiveType; -import org.eclipse.wst.jsdt.core.dom.QualifiedName; -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.Statement; -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.SwitchCase; -import org.eclipse.wst.jsdt.core.dom.SwitchStatement; -import org.eclipse.wst.jsdt.core.dom.TryStatement; -import org.eclipse.wst.jsdt.core.dom.Type; -import org.eclipse.wst.jsdt.core.dom.TypeDeclaration; -import org.eclipse.wst.jsdt.core.dom.TypeDeclarationStatement; -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; -import org.eclipse.wst.jsdt.core.tests.model.CancelCounter; -import org.eclipse.wst.jsdt.core.tests.model.Canceler; -import org.eclipse.wst.jsdt.core.tests.model.ReconcilerTests; -import org.eclipse.wst.jsdt.core.tests.util.Util; - -public class ASTConverterTestAST3_2 extends ConverterTestSetup { - - public void setUpSuite() throws Exception { - super.setUpSuite(); - this.ast = AST.newAST(AST.JLS3); - } - - public ASTConverterTestAST3_2(String name) { - super(name); - } - - static { -// TESTS_NAMES = new String[] {"test0602"}; -// TESTS_RANGE = new int[] { 664, -1 }; -// TESTS_NUMBERS = new int[] { 664 }; - } - public static Test suite() { - return buildModelTestSuite(ASTConverterTestAST3_2.class); - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=22560 - */ - public void test0401() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0401", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull(node); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - Block block = methodDeclaration.getBody(); - List statements = block.statements(); - assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$ - Statement statement = (Statement) statements.get(0); - assertTrue("Not a return statement", statement.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) statement; - Expression expression = returnStatement.getExpression(); - assertNotNull("there is no expression", expression); //$NON-NLS-1$ - // call the default initialization - methodDeclaration.getReturnType2(); - ITypeBinding typeBinding = expression.resolveTypeBinding(); - assertNotNull("No typebinding", typeBinding); //$NON-NLS-1$ - assertEquals("wrong name", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23464 - */ - public void test0402() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0402", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0, 0); - assertEquals("Wrong number of problems", 0, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$ - assertNotNull(node); - assertTrue("Not a super method invocation", node.getNodeType() == ASTNode.SUPER_CONSTRUCTOR_INVOCATION); //$NON-NLS-1$ - checkSourceRange(node, "new A().super();", source); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23597 - */ - public void test0403() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0403", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0, 1); - assertEquals("Wrong number of problems", 1, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$ - assertNotNull(node); - assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - Expression expression2 = methodInvocation.getExpression(); - assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$ - SimpleName simpleName = (SimpleName) expression2; - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertTrue("wrong type", binding.getKind() == IBinding.VARIABLE); //$NON-NLS-1$ - IVariableBinding variableBinding = (IVariableBinding) binding; - assertEquals("Wrong name", "test", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - SimpleName simpleName2 = methodInvocation.getName(); - assertEquals("Wrong name", "clone", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$ - IBinding binding2 = simpleName2.resolveBinding(); - assertNotNull("no binding2", binding2); //$NON-NLS-1$ - assertTrue("Wrong type", binding2.getKind() == IBinding.METHOD); //$NON-NLS-1$ - IFunctionBinding methodBinding = (IFunctionBinding) binding2; - assertEquals("Wrong name", "clone", methodBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - IFunctionBinding methodBinding2 = methodInvocation.resolveMethodBinding(); - assertNotNull("No method binding2", methodBinding2); - assertTrue("Wrong binding", methodBinding == methodBinding2); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23597 - */ - public void test0404() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0404", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertEquals("Wrong number of problems", 1, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$ - assertNotNull(node); - assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - Expression expression2 = methodInvocation.getExpression(); - assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$ - SimpleName simpleName = (SimpleName) expression2; - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertTrue("wrong type", binding.getKind() == IBinding.VARIABLE); //$NON-NLS-1$ - IVariableBinding variableBinding = (IVariableBinding) binding; - assertEquals("Wrong name", "a", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - SimpleName simpleName2 = methodInvocation.getName(); - assertEquals("Wrong name", "clone", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$ - IBinding binding2 = simpleName2.resolveBinding(); - assertNotNull("no binding2", binding2); //$NON-NLS-1$ - assertTrue("Wrong type", binding2.getKind() == IBinding.METHOD); //$NON-NLS-1$ - IFunctionBinding methodBinding = (IFunctionBinding) binding2; - assertEquals("Wrong name", "clone", methodBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23597 - */ - public void test0405() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0405", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0, 1); - assertEquals("Wrong number of problems", 1, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$ - assertNotNull(node); - assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - Expression expression2 = methodInvocation.getExpression(); - assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$ - SimpleName simpleName = (SimpleName) expression2; - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertTrue("wrong type", binding.getKind() == IBinding.VARIABLE); //$NON-NLS-1$ - IVariableBinding variableBinding = (IVariableBinding) binding; - assertEquals("Wrong name", "a", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - SimpleName simpleName2 = methodInvocation.getName(); - assertEquals("Wrong name", "clone", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$ - IBinding binding2 = simpleName2.resolveBinding(); - assertNotNull("no binding2", binding2); //$NON-NLS-1$ - assertTrue("Wrong type", binding2.getKind() == IBinding.METHOD); //$NON-NLS-1$ - IFunctionBinding methodBinding = (IFunctionBinding) binding2; - assertEquals("Wrong name", "clone", methodBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23597 - */ - public void test0406() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0406", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - JavaScriptUnit unit = (JavaScriptUnit) result; - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1); - assertEquals("Wrong number of problems", 1, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$ - assertNotNull(node); - assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - Expression expression2 = methodInvocation.getExpression(); - assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$ - SimpleName simpleName = (SimpleName) expression2; - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertTrue("wrong type", binding.getKind() == IBinding.VARIABLE); //$NON-NLS-1$ - IVariableBinding variableBinding = (IVariableBinding) binding; - assertEquals("Wrong name", "a", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - SimpleName simpleName2 = methodInvocation.getName(); - assertEquals("Wrong name", "foo", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$ - IBinding binding2 = simpleName2.resolveBinding(); - assertNotNull("no binding2", binding2); //$NON-NLS-1$ - assertTrue("Wrong type", binding2.getKind() == IBinding.METHOD); //$NON-NLS-1$ - IFunctionBinding methodBinding = (IFunctionBinding) binding2; - assertEquals("Wrong name", "foo", methodBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertNull("Got a declaring node in the unit", unit.findDeclaringNode(methodBinding)); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23162 - */ - public void test0407() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0407", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertEquals("Wrong number of problems", 0, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - JavaScriptUnit unit = (JavaScriptUnit) result; - assertNotNull(node); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - SimpleName simpleName = methodDeclaration.getName(); - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertTrue("Not a method binding", binding.getKind() == IBinding.METHOD); //$NON-NLS-1$ - IFunctionBinding methodBinding = (IFunctionBinding) binding; - assertEquals("wrong name", "foo", methodBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - methodDeclaration.setName(methodDeclaration.getAST().newSimpleName("foo2")); //$NON-NLS-1$ - IFunctionBinding methodBinding2 = methodDeclaration.resolveBinding(); - assertNotNull("No methodbinding2", methodBinding2); //$NON-NLS-1$ - assertEquals("wrong name", "foo", methodBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - simpleName = methodDeclaration.getName(); - IBinding binding2 = simpleName.resolveBinding(); - assertNull("Got a binding2", binding2); //$NON-NLS-1$ - - ASTNode astNode = unit.findDeclaringNode(methodBinding); - assertNotNull("No declaring node", astNode); - assertEquals("wrong declaring node", methodDeclaration, astNode); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23162 - */ - public void test0408() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0408", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertEquals("Wrong number of problems", 0, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertNotNull(node); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - Type type = methodDeclaration.getReturnType2(); - assertTrue("Not a simple type", type.isSimpleType()); //$NON-NLS-1$ - SimpleType simpleType = (SimpleType) type; - Name name = simpleType.getName(); - assertTrue("Not a qualified name", name.isQualifiedName()); //$NON-NLS-1$ - QualifiedName qualifiedName = (QualifiedName) name; - name = qualifiedName.getQualifier(); - assertTrue("Not a qualified name", name.isQualifiedName()); //$NON-NLS-1$ - qualifiedName = (QualifiedName) name; - name = qualifiedName.getQualifier(); - assertTrue("Not a simple name", name.isSimpleName()); //$NON-NLS-1$ - SimpleName simpleName = (SimpleName) name; - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertTrue("Not a package binding", binding.getKind() == IBinding.PACKAGE); //$NON-NLS-1$ - assertEquals("Wrong name", "java", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23162 - */ - public void test0409() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Hashtable newOptions = JavaScriptCore.getOptions(); - try { - newOptions.put(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_4); - JavaScriptCore.setOptions(newOptions); - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0409", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertProblemsSize(compilationUnit, 0); - BindingsCollectorVisitor bindingsCollectorVisitor = new BindingsCollectorVisitor(); - compilationUnit.accept(bindingsCollectorVisitor); - assertEquals("wrong number", 3, bindingsCollectorVisitor.getUnresolvedNodesSet().size()); //$NON-NLS-1$ - Map bindingsMap = bindingsCollectorVisitor.getBindingsMap(); - assertEquals("wrong number", 211, bindingsMap.size()); //$NON-NLS-1$ - ASTNodesCollectorVisitor nodesCollector = new ASTNodesCollectorVisitor(); - compilationUnit.accept(nodesCollector); - Set detachedNodes = nodesCollector.getDetachedAstNodes(); - int counter = 0; - for (Iterator iterator = detachedNodes.iterator(); iterator.hasNext(); ) { - ASTNode detachedNode = (ASTNode) iterator.next(); - counter++; - IBinding binding = (IBinding) bindingsMap.get(detachedNode); - assertNotNull(binding); - switch(detachedNode.getNodeType()) { - case ASTNode.ARRAY_ACCESS : - case ASTNode.ARRAY_CREATION : - case ASTNode.ARRAY_INITIALIZER : - case ASTNode.ASSIGNMENT : - case ASTNode.BOOLEAN_LITERAL : - case ASTNode.CHARACTER_LITERAL : - case ASTNode.CLASS_INSTANCE_CREATION : - case ASTNode.CONDITIONAL_EXPRESSION : - case ASTNode.FIELD_ACCESS : - case ASTNode.INFIX_EXPRESSION : - case ASTNode.INSTANCEOF_EXPRESSION : - case ASTNode.FUNCTION_INVOCATION : - case ASTNode.NULL_LITERAL : - case ASTNode.NUMBER_LITERAL : - case ASTNode.POSTFIX_EXPRESSION : - case ASTNode.PREFIX_EXPRESSION : - case ASTNode.THIS_EXPRESSION : - case ASTNode.TYPE_LITERAL : - case ASTNode.VARIABLE_DECLARATION_EXPRESSION : - ITypeBinding typeBinding = ((Expression) detachedNode).resolveTypeBinding(); - if (!binding.equals(typeBinding)) { - System.out.println(detachedNode); - } - assertTrue("binding not equals", binding.equals(typeBinding)); //$NON-NLS-1$ - break; - case ASTNode.VARIABLE_DECLARATION_FRAGMENT : - assertTrue("binding not equals", binding.equals(((VariableDeclarationFragment) detachedNode).resolveBinding())); //$NON-NLS-1$ - break; - case ASTNode.ANONYMOUS_CLASS_DECLARATION : - assertTrue("binding not equals", binding.equals(((AnonymousClassDeclaration) detachedNode).resolveBinding())); //$NON-NLS-1$ - break; - case ASTNode.QUALIFIED_NAME : - case ASTNode.SIMPLE_NAME : - IBinding newBinding = ((Name) detachedNode).resolveBinding(); - assertTrue("binding not equals", binding.equals(newBinding)); //$NON-NLS-1$ - break; - case ASTNode.ARRAY_TYPE : - case ASTNode.SIMPLE_TYPE : - case ASTNode.PRIMITIVE_TYPE : - assertTrue("binding not equals", binding.equals(((Type) detachedNode).resolveBinding())); //$NON-NLS-1$ - break; - case ASTNode.CONSTRUCTOR_INVOCATION : - assertTrue("binding not equals", binding.equals(((ConstructorInvocation) detachedNode).resolveConstructorBinding())); //$NON-NLS-1$ - break; - case ASTNode.IMPORT_DECLARATION : - assertTrue("binding not equals", binding.equals(((ImportDeclaration) detachedNode).resolveBinding())); //$NON-NLS-1$ - break; - case ASTNode.FUNCTION_DECLARATION : - assertTrue("binding not equals", binding.equals(((FunctionDeclaration) detachedNode).resolveBinding())); //$NON-NLS-1$ - break; - case ASTNode.PACKAGE_DECLARATION : - assertTrue("binding not equals", binding.equals(((PackageDeclaration) detachedNode).resolveBinding())); //$NON-NLS-1$ - break; - case ASTNode.TYPE_DECLARATION : - assertTrue("binding not equals", binding.equals(((TypeDeclaration) detachedNode).resolveBinding())); //$NON-NLS-1$ - break; - } - } - } finally { - JavaScriptCore.setOptions(options); - } - } - - /** - * Test for message on jdt-core-dev - */ - public void test0410() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0410", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertEquals("Wrong number of problems", 0, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull(node); - assertTrue("Not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$ - Expression expression = ((ReturnStatement) node).getExpression(); - assertTrue("Not an infix expression", expression.getNodeType() == ASTNode.INFIX_EXPRESSION); //$NON-NLS-1$ - InfixExpression infixExpression = (InfixExpression) expression; - List extendedOperands = infixExpression.extendedOperands(); - assertEquals("wrong size", 3, extendedOperands.size()); //$NON-NLS-1$ - } - - /** - * Test for message on jdt-core-dev - */ - public void test0411() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0411", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertEquals("Wrong number of problems", 0, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertNotNull(node); - assertTrue("Not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$ - Expression expression = ((ReturnStatement) node).getExpression(); - assertTrue("Not an infix expression", expression.getNodeType() == ASTNode.INFIX_EXPRESSION); //$NON-NLS-1$ - InfixExpression infixExpression = (InfixExpression) expression; - List extendedOperands = infixExpression.extendedOperands(); - assertEquals("wrong size", 0, extendedOperands.size()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=23901 - */ - public void test0412() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0412", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0); - assertNotNull(node); - assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertNotNull("No declaring node", unit.findDeclaringNode(typeBinding)); //$NON-NLS-1$ - Name name = typeDeclaration.getName(); - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - ASTNode declaringNode = unit.findDeclaringNode(binding); - assertNotNull("No declaring node", declaringNode); //$NON-NLS-1$ - assertEquals("Wrong node", typeDeclaration, declaringNode); //$NON-NLS-1$ - typeBinding = name.resolveTypeBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - declaringNode = unit.findDeclaringNode(typeBinding); - assertNotNull("No declaring node", declaringNode); //$NON-NLS-1$ - assertEquals("Wrong node", typeDeclaration, declaringNode); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=20881 - */ - public void test0413() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0413", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 1, 0); - assertNotNull(node); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - List throwsException = methodDeclaration.thrownExceptions(); - assertEquals("wrong size", 2, throwsException.size()); //$NON-NLS-1$ - Name name = (Name) throwsException.get(0); - IBinding binding = name.resolveBinding(); - assertNull("Got a binding", binding); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=23734 - */ - public void test0414() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0414", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0); - assertNotNull(node); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - Type type = methodDeclaration.getReturnType2(); - ITypeBinding typeBinding = type.resolveBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - ASTNode declaringNode = unit.findDeclaringNode(typeBinding); - assertNull("Got a declaring node", declaringNode); //$NON-NLS-1$ - - node = getASTNode(unit, 0, 1); - assertNotNull(node); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration2 = (FunctionDeclaration) node; - Type type2 = methodDeclaration2.getReturnType2(); - ITypeBinding typeBinding2 = type2.resolveBinding(); - assertNotNull("No type binding", typeBinding2); //$NON-NLS-1$ - ASTNode declaringNode2 = unit.findDeclaringNode(typeBinding2); - assertNotNull("No declaring node", declaringNode2); //$NON-NLS-1$ - - IJavaScriptUnit sourceUnit2 = getCompilationUnit("Converter" , "src", "test0414", "B.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - - result = runConversion(AST.JLS3, sourceUnit2, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit2 = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit2.getProblems().length); //$NON-NLS-1$ - ASTNode declaringNode3 = unit2.findDeclaringNode(typeBinding); - assertNull("Got a declaring node", declaringNode3); //$NON-NLS-1$ - - ASTNode declaringNode4 = unit2.findDeclaringNode(typeBinding.getKey()); - assertNotNull("No declaring node", declaringNode4); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24268 - */ - public void test0415() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0415", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0, 0); - assertNotNull("No node", node); - assertTrue("not a switch statement", node.getNodeType() == ASTNode.SWITCH_STATEMENT); //$NON-NLS-1$ - SwitchStatement switchStatement = (SwitchStatement) node; - List statements = switchStatement.statements(); - assertEquals("wrong size", statements.size(), 5); //$NON-NLS-1$ - Statement statement = (Statement) statements.get(3); - assertTrue("not a switch case (default)", statement.getNodeType() == ASTNode.SWITCH_CASE); //$NON-NLS-1$ - SwitchCase defaultCase = (SwitchCase) statement; - assertTrue("not a default case", defaultCase.isDefault()); - checkSourceRange(defaultCase, "default:", source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24324 - */ - public void test0416() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0416", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 1, 0, 0); - assertNotNull("No node", node); - assertTrue("not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - List fragments = statement.fragments(); - assertEquals("Wrong size", fragments.size(), 1); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression init = fragment.getInitializer(); - assertTrue("not a qualified name", init.getNodeType() == ASTNode.QUALIFIED_NAME); //$NON-NLS-1$ - QualifiedName qualifiedName = (QualifiedName) init; - SimpleName simpleName = qualifiedName.getName(); - assertEquals("Wrong name", "CONST", simpleName.getIdentifier()); - IBinding binding = simpleName.resolveBinding(); - assertEquals("Wrong type", IBinding.VARIABLE, binding.getKind()); - IVariableBinding variableBinding = (IVariableBinding) binding; - assertEquals("Wrong modifier", variableBinding.getModifiers(), Modifier.PUBLIC | Modifier.STATIC | Modifier.FINAL); - ASTNode declaringNode = unit.findDeclaringNode(variableBinding); - assertNotNull("No declaring node", declaringNode); - assertTrue("not a variable declaration fragment", declaringNode.getNodeType() == ASTNode.VARIABLE_DECLARATION_FRAGMENT); - VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) declaringNode; - FieldDeclaration fieldDeclaration = (FieldDeclaration) variableDeclarationFragment.getParent(); - assertEquals("Wrong modifier", fieldDeclaration.getModifiers(), Modifier.NONE); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24347 - */ - public void test0417() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0417", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0, 0); - assertNotNull("No node", node); - assertTrue("not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - Type type = statement.getType(); - assertTrue("not a simple type", type.getNodeType() == ASTNode.SIMPLE_TYPE); //$NON-NLS-1$ - SimpleType simpleType = (SimpleType) type; - Name name = simpleType.getName(); - assertTrue("Not a qualified name", name.isQualifiedName()); - QualifiedName qualifiedName = (QualifiedName) name; - Name qualifier = qualifiedName.getQualifier(); - assertTrue("Not a simple name", qualifier.isSimpleName()); - IBinding binding = qualifier.resolveBinding(); - assertNotNull("No binding", binding); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24406 - */ - public void test0418() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0418", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 1, 0); - assertNotNull("No node", node); - assertTrue("not an expression statement ", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertTrue("not an method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - Name name = methodInvocation.getName(); - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24449 - */ - public void test0419() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0419", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 1, 0, 0); - assertEquals("Not an expression statement", node.getNodeType(), ASTNode.EXPRESSION_STATEMENT); - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertEquals("Not an assignment", expression.getNodeType(), ASTNode.ASSIGNMENT); - Assignment assignment = (Assignment) expression; - Expression expression2 = assignment.getLeftHandSide(); - assertEquals("Not a name", expression2.getNodeType(), ASTNode.SIMPLE_NAME); - SimpleName simpleName = (SimpleName) expression2; - IBinding binding = simpleName.resolveBinding(); - assertNull(binding); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24453 - */ - public void test0420() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0420", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertEquals("Not an infix expression", expression.getNodeType(), ASTNode.INFIX_EXPRESSION); - InfixExpression infixExpression = (InfixExpression) expression; - Expression expression2 = infixExpression.getRightOperand(); - assertEquals("Not a parenthesized expression", expression2.getNodeType(), ASTNode.PARENTHESIZED_EXPRESSION); - checkSourceRange(expression2, "(2 + 3)", source); - ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression2; - Expression expression3 = parenthesizedExpression.getExpression(); - checkSourceRange(expression3, "2 + 3", source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24453 - */ - public void test0421() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0421", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertEquals("Not an infix expression", expression.getNodeType(), ASTNode.INFIX_EXPRESSION); - InfixExpression infixExpression = (InfixExpression) expression; - checkSourceRange(infixExpression, "(1 + 2) + 3", source); - Expression expression2 = infixExpression.getLeftOperand(); - assertEquals("Not a parenthesized expression", expression2.getNodeType(), ASTNode.PARENTHESIZED_EXPRESSION); - checkSourceRange(expression2, "(1 + 2)", source); - ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression2; - Expression expression3 = parenthesizedExpression.getExpression(); - checkSourceRange(expression3, "1 + 2", source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24453 - */ - public void test0422() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0422", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertEquals("Not an infix expression", expression.getNodeType(), ASTNode.INFIX_EXPRESSION); - InfixExpression infixExpression = (InfixExpression) expression; - checkSourceRange(infixExpression, "( 1 + 2 ) + 3", source); - Expression expression2 = infixExpression.getLeftOperand(); - assertEquals("Not a parenthesized expression", expression2.getNodeType(), ASTNode.PARENTHESIZED_EXPRESSION); - checkSourceRange(expression2, "( 1 + 2 )", source); - ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression2; - Expression expression3 = parenthesizedExpression.getExpression(); - checkSourceRange(expression3, "1 + 2", source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24453 - */ - public void test0423() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0423", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertEquals("Not an infix expression", expression.getNodeType(), ASTNode.INFIX_EXPRESSION); - InfixExpression infixExpression = (InfixExpression) expression; - Expression expression2 = infixExpression.getRightOperand(); - assertEquals("Not a parenthesized expression", expression2.getNodeType(), ASTNode.PARENTHESIZED_EXPRESSION); - checkSourceRange(expression2, "( 2 + 3 )", source); - ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression2; - Expression expression3 = parenthesizedExpression.getExpression(); - checkSourceRange(expression3, "2 + 3", source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24453 - */ - public void test0424() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0424", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertEquals("Not an infix expression", expression.getNodeType(), ASTNode.INFIX_EXPRESSION); - InfixExpression infixExpression = (InfixExpression) expression; - assertEquals("Wrong size", 1, infixExpression.extendedOperands().size()); - Expression expression2 = (Expression) infixExpression.extendedOperands().get(0); - checkSourceRange(expression2, "( 2 + 3 )", source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24453 - */ - public void test0425() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0425", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertEquals("Not an infix expression", expression.getNodeType(), ASTNode.INFIX_EXPRESSION); - InfixExpression infixExpression = (InfixExpression) expression; - assertEquals("Wrong size", 0, infixExpression.extendedOperands().size()); - Expression expression2 = infixExpression.getRightOperand(); - assertTrue("not an infix expression", expression2.getNodeType() == ASTNode.INFIX_EXPRESSION); //$NON-NLS-1$ - InfixExpression infixExpression2 = (InfixExpression) expression2; - Expression expression3 = infixExpression2.getRightOperand(); - assertTrue("not a parenthesized expression", expression3.getNodeType() == ASTNode.PARENTHESIZED_EXPRESSION); //$NON-NLS-1$ - checkSourceRange(expression3, "( 2 + 3 )", source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24449 - */ - public void test0426() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0426", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 1, 0, 0); - assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - Type type = statement.getType(); - assertTrue("not a simple type", type.getNodeType() == ASTNode.SIMPLE_TYPE); - SimpleType simpleType = (SimpleType) type; - Name name = simpleType.getName(); - assertNotNull("No name", name); - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24449 - */ - public void test0427() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0427", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 1, 0, 0); - assertEquals("Not an expression statement", node.getNodeType(), ASTNode.EXPRESSION_STATEMENT); - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertEquals("Not an assignment", expression.getNodeType(), ASTNode.ASSIGNMENT); - Assignment assignment = (Assignment) expression; - Expression expression2 = assignment.getLeftHandSide(); - assertEquals("Not a super field access", expression2.getNodeType(), ASTNode.SUPER_FIELD_ACCESS); - SuperFieldAccess superFieldAccess = (SuperFieldAccess) expression2; - Name name = superFieldAccess.getName(); - assertNotNull("No name", name); - IBinding binding = name.resolveBinding(); - assertNull("Got a binding", binding); - assertNull("Got a binding", superFieldAccess.resolveFieldBinding()); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24449 - */ - public void test0428() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0428", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 1, 0, 0); - assertEquals("Not an expression statement", node.getNodeType(), ASTNode.EXPRESSION_STATEMENT); - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertEquals("Not an assignment", expression.getNodeType(), ASTNode.ASSIGNMENT); - Assignment assignment = (Assignment) expression; - Expression expression2 = assignment.getLeftHandSide(); - assertEquals("Not a qualified name", expression2.getNodeType(), ASTNode.QUALIFIED_NAME); - QualifiedName name = (QualifiedName) expression2; - SimpleName simpleName = name.getName(); - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); - IBinding binding2 = name.resolveBinding(); - assertNotNull("No binding2", binding2); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24449 - */ - public void test0429() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0429", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 1, 0, 0); - assertEquals("Not an expression statement", node.getNodeType(), ASTNode.EXPRESSION_STATEMENT); - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertEquals("Not an assignment", expression.getNodeType(), ASTNode.ASSIGNMENT); - Assignment assignment = (Assignment) expression; - Expression expression2 = assignment.getLeftHandSide(); - assertEquals("Not a qualified name", expression2.getNodeType(), ASTNode.QUALIFIED_NAME); - QualifiedName name = (QualifiedName) expression2; - SimpleName simpleName = name.getName(); - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); - IBinding binding2 = name.resolveBinding(); - assertNotNull("No binding2", binding2); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24499 - */ - public void test0430() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0430", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0, 0); - assertTrue("Not a constructor invocation", node.getNodeType() == ASTNode.CONSTRUCTOR_INVOCATION); - ConstructorInvocation constructorInvocation = (ConstructorInvocation) node; - checkSourceRange(constructorInvocation, "this(coo2());", source); - List arguments = constructorInvocation.arguments(); - assertEquals("Wrong size", 1, arguments.size()); - Expression expression = (Expression) arguments.get(0); - assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - SimpleName simpleName = methodInvocation.getName(); - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24500 - */ - public void test0431() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0431", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0, 0); - assertTrue("Not a constructor invocation", node.getNodeType() == ASTNode.CONSTRUCTOR_INVOCATION); - ConstructorInvocation constructorInvocation = (ConstructorInvocation) node; - List arguments = constructorInvocation.arguments(); - assertEquals("Wrong size", 1, arguments.size()); - Expression expression = (Expression) arguments.get(0); - assertTrue("Not a simple name", expression.getNodeType() == ASTNode.SIMPLE_NAME); - SimpleName simpleName = (SimpleName) expression; - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24501 - */ - public void test0432() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0432", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 1, 0, 0); - assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType()); - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertEquals("Not an assignment", ASTNode.ASSIGNMENT, expression.getNodeType()); - Assignment assignment = (Assignment) expression; - Expression expression2 = assignment.getLeftHandSide(); - assertEquals("Not a simple name", ASTNode.SIMPLE_NAME, expression2.getNodeType()); - SimpleName simpleName = (SimpleName) expression2; - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24501 - */ - public void test0433() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0433", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 1, 0, 0); - assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType()); - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertEquals("Not an assignment", ASTNode.ASSIGNMENT, expression.getNodeType()); - Assignment assignment = (Assignment) expression; - Expression expression2 = assignment.getLeftHandSide(); - assertEquals("Not a super field access", ASTNode.SUPER_FIELD_ACCESS, expression2.getNodeType()); - SuperFieldAccess superFieldAccess = (SuperFieldAccess) expression2; - SimpleName simpleName = superFieldAccess.getName(); - assertEquals("wrong name", "fCoo", simpleName.getIdentifier()); - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); - assertEquals("Wrong binding", IBinding.VARIABLE, binding.getKind()); - IVariableBinding variableBinding = superFieldAccess.resolveFieldBinding(); - assertTrue("Different binding", binding == variableBinding); - ASTNode astNode = unit.findDeclaringNode(variableBinding); - assertTrue("Wrong type", astNode.getNodeType() == ASTNode.SINGLE_VARIABLE_DECLARATION || astNode.getNodeType() == ASTNode.VARIABLE_DECLARATION_FRAGMENT || astNode.getNodeType() == ASTNode.VARIABLE_DECLARATION_EXPRESSION); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24501 - */ - public void test0434() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0434", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 1, 0, 0); - assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType()); - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertEquals("Not an assignment", ASTNode.ASSIGNMENT, expression.getNodeType()); - Assignment assignment = (Assignment) expression; - Expression expression2 = assignment.getLeftHandSide(); - assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, expression2.getNodeType()); - QualifiedName qualifiedName = (QualifiedName) expression2; - SimpleName simpleName = qualifiedName.getName(); - assertEquals("wrong name", "fCoo", simpleName.getIdentifier()); - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24501 - */ - public void test0435() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0435", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 1, 0, 0); - assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType()); - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertEquals("Not an assignment", ASTNode.ASSIGNMENT, expression.getNodeType()); - Assignment assignment = (Assignment) expression; - Expression expression2 = assignment.getLeftHandSide(); - assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, expression2.getNodeType()); - QualifiedName qualifiedName = (QualifiedName) expression2; - SimpleName simpleName = qualifiedName.getName(); - assertEquals("wrong name", "fCoo", simpleName.getIdentifier()); - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24502 - */ - public void test0436() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0436", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertProblemsSize(unit, 1, "The type A.CInner is not visible"); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 1, 0, 0); - assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType()); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - Type type = statement.getType(); - assertEquals("Not a simple type", ASTNode.SIMPLE_TYPE, type.getNodeType()); - SimpleType simpleType = (SimpleType) type; - Name name = simpleType.getName(); - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); - assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, name.getNodeType()); - QualifiedName qualifiedName = (QualifiedName) name; - SimpleName simpleName = qualifiedName.getName(); - assertEquals("wrong name", "CInner", simpleName.getIdentifier()); - IBinding binding2 = simpleName.resolveBinding(); - assertNotNull("No binding", binding2); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24502 - */ - public void test0437() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0437", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertProblemsSize(unit, 1, "The type CInner is not visible"); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 1, 0, 0); - assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType()); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - Type type = statement.getType(); - assertEquals("Not a simple type", ASTNode.SIMPLE_TYPE, type.getNodeType()); - SimpleType simpleType = (SimpleType) type; - Name name = simpleType.getName(); - assertEquals("Not a simple name", ASTNode.SIMPLE_NAME, name.getNodeType()); - SimpleName simpleName = (SimpleName) name; - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24511 - */ - public void test0438() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0438", "D.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - List imports = unit.imports(); - assertEquals("Wrong size", 1, imports.size()); //$NON-NLS-1$< - ImportDeclaration importDeclaration = (ImportDeclaration) imports.get(0); - IBinding binding = importDeclaration.resolveBinding(); - assertNotNull("No binding", binding); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24502 - */ - public void test0439() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0439", "E.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType()); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - Type type = statement.getType(); - assertEquals("Not a simple type", ASTNode.SIMPLE_TYPE, type.getNodeType()); - SimpleType simpleType = (SimpleType) type; - Name name = simpleType.getName(); - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24622 - */ - public void test0440() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0440", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType()); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - List fragments = statement.fragments(); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertEquals("Not an infix expression", ASTNode.INFIX_EXPRESSION, expression.getNodeType()); - // 2 * 3 + "" + (true) - InfixExpression infixExpression = (InfixExpression) expression; - checkSourceRange(infixExpression, "2 * 3 + \"\" + (true)", source); - Expression leftOperand = infixExpression.getLeftOperand(); - checkSourceRange(leftOperand, "2 * 3 + \"\"", source); - checkSourceRange(infixExpression.getRightOperand(), "(true)", source); - assertEquals("wrong operator", infixExpression.getOperator(), InfixExpression.Operator.PLUS); - assertEquals("wrong type", ASTNode.INFIX_EXPRESSION, leftOperand.getNodeType()); - infixExpression = (InfixExpression) leftOperand; - checkSourceRange(infixExpression, "2 * 3 + \"\"", source); - leftOperand = infixExpression.getLeftOperand(); - checkSourceRange(leftOperand, "2 * 3", source); - checkSourceRange(infixExpression.getRightOperand(), "\"\"", source); - assertEquals("wrong operator", infixExpression.getOperator(), InfixExpression.Operator.PLUS); - assertEquals("wrong type", ASTNode.INFIX_EXPRESSION, leftOperand.getNodeType()); - infixExpression = (InfixExpression) leftOperand; - checkSourceRange(infixExpression, "2 * 3", source); - leftOperand = infixExpression.getLeftOperand(); - checkSourceRange(leftOperand, "2", source); - checkSourceRange(infixExpression.getRightOperand(), "3", source); - assertEquals("wrong operator", infixExpression.getOperator(), InfixExpression.Operator.TIMES); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24622 - */ - public void test0441() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0441", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType()); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - List fragments = statement.fragments(); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertEquals("Not an infix expression", ASTNode.INFIX_EXPRESSION, expression.getNodeType()); - InfixExpression infixExpression = (InfixExpression) expression; - checkSourceRange(infixExpression, "(2 + 2) * 3 * 1", source); - Expression leftOperand = infixExpression.getLeftOperand(); - checkSourceRange(leftOperand, "(2 + 2)", source); - checkSourceRange(infixExpression.getRightOperand(), "3", source); - List extendedOperands = infixExpression.extendedOperands(); - assertEquals("wrong size", 1, extendedOperands.size()); - checkSourceRange((Expression) extendedOperands.get(0), "1", source); - assertEquals("wrong operator", InfixExpression.Operator.TIMES, infixExpression.getOperator()); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24622 - */ - public void test0442() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0442", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType()); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - List fragments = statement.fragments(); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertEquals("Not an infix expression", ASTNode.INFIX_EXPRESSION, expression.getNodeType()); - InfixExpression infixExpression = (InfixExpression) expression; - checkSourceRange(infixExpression, "2 + (2 * 3) + 1", source); - Expression leftOperand = infixExpression.getLeftOperand(); - checkSourceRange(leftOperand, "2", source); - Expression rightOperand = infixExpression.getRightOperand(); - checkSourceRange(rightOperand, "(2 * 3)", source); - assertEquals("wrong type", ASTNode.PARENTHESIZED_EXPRESSION, rightOperand.getNodeType()); - List extendedOperands = infixExpression.extendedOperands(); - assertEquals("wrong size", 1, extendedOperands.size()); - checkSourceRange((Expression) extendedOperands.get(0), "1", source); - assertEquals("wrong operator", InfixExpression.Operator.PLUS, infixExpression.getOperator()); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24623 - */ - public void test0443() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0443", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 2, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0); - assertEquals("Wrong type", ASTNode.FUNCTION_DECLARATION, node.getNodeType()); - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertNotNull("No body", methodDeclaration.getBody()); - assertNotNull("No binding", methodDeclaration.resolveBinding()); - assertTrue("Not an abstract method", Modifier.isAbstract(methodDeclaration.getModifiers())); - List modifiers = methodDeclaration.modifiers(); - assertEquals("Wrong size", 2, modifiers.size()); - Modifier modifier1 = (Modifier) modifiers.get(0); - assertTrue("Not a public modifier", modifier1.isPublic()); - Modifier modifier2 = (Modifier) modifiers.get(1); - assertTrue("Not an abstract modifier", modifier2.isAbstract()); - assertTrue("Not malformed", isMalformed(methodDeclaration)); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24623 - */ - public void test0444() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0444", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 2, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0); - assertEquals("Wrong type", ASTNode.TYPE_DECLARATION, node.getNodeType()); - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - List bodyDeclarations = typeDeclaration.bodyDeclarations(); - assertEquals("Wrong size", 2, bodyDeclarations.size()); - BodyDeclaration bodyDeclaration = (BodyDeclaration)bodyDeclarations.get(0); - assertEquals("Wrong type", ASTNode.FUNCTION_DECLARATION, bodyDeclaration.getNodeType()); - FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration; - assertEquals("Wrong name", "foo", methodDeclaration.getName().getIdentifier()); - assertNull("Got a binding", methodDeclaration.resolveBinding()); - bodyDeclaration = (BodyDeclaration)bodyDeclarations.get(1); - assertEquals("Wrong type", ASTNode.FUNCTION_DECLARATION, bodyDeclaration.getNodeType()); - assertEquals("Wrong name", "foo", ((FunctionDeclaration) bodyDeclaration).getName().getIdentifier()); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24773 - */ - public void test0445() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0445", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=25018 - */ - public void test0446() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0446", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 2, unit.getProblems().length); //$NON-NLS-1$< - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=25124 - */ - public void test0447() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0447", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 3, unit.getProblems().length); //$NON-NLS-1$< - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=25330 - */ - public void test0448() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0448", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0); - assertEquals("Not a method declaration", node.getNodeType(), ASTNode.FUNCTION_DECLARATION); - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertTrue("Not a constructor", methodDeclaration.isConstructor()); - assertNull("No return type", methodDeclaration.getReturnType2()); - Block block = methodDeclaration.getBody(); - assertNotNull("No method body", block); - assertEquals("wrong size", 0, block.statements().size()); - } - - /** - * Check that the implicit super constructor call is not there - */ - public void test0449() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0449", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0); - assertEquals("Not a method declaration", node.getNodeType(), ASTNode.FUNCTION_DECLARATION); - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertTrue("Not a constructor", methodDeclaration.isConstructor()); - Block block = methodDeclaration.getBody(); - assertNotNull("No method body", block); - assertEquals("wrong size", 1, block.statements().size()); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26452 - */ - public void test0450() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0450", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0); - assertEquals("Not a type declaration", node.getNodeType(), ASTNode.TYPE_DECLARATION); - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertNotNull("No type binding", typeBinding); - assertTrue("not a class", typeBinding.isClass()); - assertTrue("not a toplevel type", typeBinding.isTopLevel()); - assertTrue("a local type", !typeBinding.isLocal()); - assertTrue("an anonymous type", !typeBinding.isAnonymous()); - assertTrue("a member type", !typeBinding.isMember()); - assertTrue("a nested type", !typeBinding.isNested()); - node = getASTNode(unit, 0, 0, 0); - assertEquals("Not an expression statement", node.getNodeType(), ASTNode.EXPRESSION_STATEMENT); - Expression expression = ((ExpressionStatement) node).getExpression(); - assertEquals("Not a class instance creation", expression.getNodeType(), ASTNode.CLASS_INSTANCE_CREATION); - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression; - AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration(); - typeBinding = anonymousClassDeclaration.resolveBinding(); - assertNotNull("No type binding", typeBinding); - assertTrue("not a class", typeBinding.isClass()); - assertTrue("a toplevel type", !typeBinding.isTopLevel()); - assertTrue("not a local type", typeBinding.isLocal()); - assertTrue("not an anonymous type", typeBinding.isAnonymous()); - assertTrue("a member type", !typeBinding.isMember()); - assertTrue("not a nested type", typeBinding.isNested()); - ASTNode astNode = unit.findDeclaringNode(typeBinding); - assertEquals("Wrong type", ASTNode.ANONYMOUS_CLASS_DECLARATION, astNode.getNodeType()); - assertNotNull("Didn't get a key", typeBinding.getKey()); - astNode = unit.findDeclaringNode(typeBinding.getKey()); - assertNotNull("Didn't get a declaring node", astNode); - - ITypeBinding typeBinding3 = classInstanceCreation.resolveTypeBinding(); - assertEquals("wrong binding", typeBinding, typeBinding3); - - List bodyDeclarations = anonymousClassDeclaration.bodyDeclarations(); - assertEquals("wrong size", 2, bodyDeclarations.size()); - BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); - assertTrue("not a type declaration", bodyDeclaration.getNodeType() == ASTNode.TYPE_DECLARATION); - typeDeclaration = (TypeDeclaration) bodyDeclaration; - - bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(1); - FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration; - Block block = methodDeclaration.getBody(); - assertNotNull("No body", block); - List statements = block.statements(); - assertEquals("wrong size", 2, statements.size()); - Statement statement = (Statement) statements.get(1); - assertEquals("Not a variable declaration statement", statement.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT); - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) statement; - Type type = variableDeclarationStatement.getType(); - assertNotNull("No type", type); - - ITypeBinding typeBinding2 = type.resolveBinding(); - typeBinding = typeDeclaration.resolveBinding(); - assertTrue("not equals", typeBinding == typeBinding2); - assertNotNull("No type binding", typeBinding); - assertTrue("not a class", typeBinding.isClass()); - assertTrue("a toplevel type", !typeBinding.isTopLevel()); - assertTrue("an anonymous type", !typeBinding.isAnonymous()); - assertTrue("not a member type", typeBinding.isMember()); - assertTrue("not a nested type", typeBinding.isNested()); - assertTrue("a local type", !typeBinding.isLocal()); - - bodyDeclarations = typeDeclaration.bodyDeclarations(); - assertEquals("wrong size", 1, bodyDeclarations.size()); - bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); - assertTrue("not a type declaration", bodyDeclaration.getNodeType() == ASTNode.TYPE_DECLARATION); - typeDeclaration = (TypeDeclaration) bodyDeclaration; - typeBinding = typeDeclaration.resolveBinding(); - assertNotNull("No type binding", typeBinding); - assertTrue("not a class", typeBinding.isClass()); - assertTrue("a toplevel type", !typeBinding.isTopLevel()); - assertTrue("an anonymous type", !typeBinding.isAnonymous()); - assertTrue("not a member type", typeBinding.isMember()); - assertTrue("not a nested type", typeBinding.isNested()); - assertTrue("a local type", !typeBinding.isLocal()); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24916 - */ - public void test0451() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0451", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 2, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0); - assertNotNull("No node", node); - assertTrue("not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - Type type = methodDeclaration.getReturnType2(); - checkSourceRange(type, "int", source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=27204 - */ - public void test0452() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "", "NO_WORKING.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertNotNull("No node", node); - assertTrue("not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - SimpleName name = methodDeclaration.getName(); - assertEquals("wrong line number", 3, compilationUnit.getLineNumber(name.getStartPosition())); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=27173 - */ - public void test0453() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0453", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0,0); - assertNotNull("No node", node); - assertTrue("not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node; - Expression expression = returnStatement.getExpression(); - assertTrue("not a super method invocation", expression.getNodeType() == ASTNode.SUPER_METHOD_INVOCATION); //$NON-NLS-1$ - SuperMethodInvocation methodInvocation = (SuperMethodInvocation) expression; - IFunctionBinding methodBinding = methodInvocation.resolveMethodBinding(); - assertNotNull("No method binding", methodBinding); - assertEquals("Wrong binding", "toString", methodBinding.getName()); - } - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28296 - */ - public void test0454() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0454", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0,1); - assertNotNull("No node", node); - assertTrue("not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - List fragments = statement.fragments(); - assertEquals("wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - checkSourceRange(expression, "(int) (3.14f * a)", source); - } - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28682 - */ - public void test0455() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0455", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull("No node", node); - assertTrue("not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$ - ForStatement forStatement = (ForStatement) node; // first for loop - String expectedSource = "for (int i = 0; i < 10; i++) // for 1\n" + - " for (int j = 0; j < 10; j++) // for 2\n" + - " if (true) { }"; - checkSourceRange(forStatement, expectedSource, source); - Statement body = forStatement.getBody(); - expectedSource = "for (int j = 0; j < 10; j++) // for 2\n" + - " if (true) { }"; - checkSourceRange(body, expectedSource, source); - assertTrue("not a for statement", body.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$ - ForStatement forStatement2 = (ForStatement) body; - body = forStatement2.getBody(); - expectedSource = "if (true) { }"; - checkSourceRange(body, expectedSource, source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28682 - */ - public void test0456() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0456", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull("No node", node); - assertTrue("not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$ - ForStatement forStatement = (ForStatement) node; // first for loop - String expectedSource = "for (int x= 10; x < 20; x++)\n" + - " main();"; - checkSourceRange(forStatement, expectedSource, source); - Statement body = forStatement.getBody(); - expectedSource = "main();"; - checkSourceRange(body, expectedSource, source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28682 - */ - public void test0457() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0457", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull("No node", node); - assertTrue("not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$ - ForStatement forStatement = (ForStatement) node; // first for loop - String expectedSource = "for (int i= 10; i < 10; i++)/*[*/\n"+ - " for (int z= 10; z < 10; z++)\n" + - " foo();"; - checkSourceRange(forStatement, expectedSource, source); - Statement body = forStatement.getBody(); - expectedSource = "for (int z= 10; z < 10; z++)\n" + - " foo();"; - checkSourceRange(body, expectedSource, source); - assertTrue("not a for statement", body.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$ - ForStatement forStatement2 = (ForStatement) body; - body = forStatement2.getBody(); - expectedSource = "foo();"; - checkSourceRange(body, expectedSource, source); - } - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28682 - */ - public void test0458() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0458", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull("No node", node); - assertTrue("not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$ - ForStatement forStatement = (ForStatement) node; // first for loop - String expectedSource = "for (int i= 10; i < 10; i++)/*[*/\n"+ - " for (int z= 10; z < 10; z++)\n" + - " ;"; - checkSourceRange(forStatement, expectedSource, source); - Statement body = forStatement.getBody(); - expectedSource = "for (int z= 10; z < 10; z++)\n" + - " ;"; - checkSourceRange(body, expectedSource, source); - assertTrue("not a for statement", body.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$ - ForStatement forStatement2 = (ForStatement) body; - body = forStatement2.getBody(); - expectedSource = ";"; - checkSourceRange(body, expectedSource, source); - assertTrue("not an empty statement", body.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28682 - */ - public void test0459() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0459", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull("No node", node); - assertTrue("not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$ - ForStatement forStatement = (ForStatement) node; // first for loop - String expectedSource = "for (int i= 10; i < 10; i++)/*[*/\n"+ - " for (int z= 10; z < 10; z++)\n" + - " { }"; - checkSourceRange(forStatement, expectedSource, source); - Statement body = forStatement.getBody(); - expectedSource = "for (int z= 10; z < 10; z++)\n" + - " { }"; - checkSourceRange(body, expectedSource, source); - assertTrue("not a for statement", body.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$ - ForStatement forStatement2 = (ForStatement) body; - body = forStatement2.getBody(); - expectedSource = "{ }"; - checkSourceRange(body, expectedSource, source); - assertTrue("not a block", body.getNodeType() == ASTNode.BLOCK); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28869 - */ - public void test0460() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0460", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertTrue("Has error", compilationUnit.getProblems().length == 0); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull("No node", node); - assertTrue("Malformed", !isMalformed(node)); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28824 - */ - public void test0461() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0461", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - char[] source = sourceUnit.getSource().toCharArray(); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertTrue("Has error", compilationUnit.getProblems().length == 0); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull("No node", node); - assertTrue("Malformed", !isMalformed(node)); - assertTrue("not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertTrue("not an assignment", expression.getNodeType() == ASTNode.ASSIGNMENT); //$NON-NLS-1$ - Assignment assignment = (Assignment) expression; - checkSourceRange(assignment, "z= foo().y.toList()", source); - Expression expression2 = assignment.getRightHandSide(); - checkSourceRange(expression2, "foo().y.toList()", source); - assertTrue("not a method invocation", expression2.getNodeType() == ASTNode.FUNCTION_INVOCATION); - FunctionInvocation methodInvocation = (FunctionInvocation) expression2; - Expression expression3 = methodInvocation.getExpression(); - checkSourceRange(expression3, "foo().y", source); - checkSourceRange(methodInvocation.getName(), "toList", source); - assertTrue("not a field access", expression3.getNodeType() == ASTNode.FIELD_ACCESS); - FieldAccess fieldAccess = (FieldAccess) expression3; - checkSourceRange(fieldAccess.getName(), "y", source); - Expression expression4 = fieldAccess.getExpression(); - checkSourceRange(expression4, "foo()", source); - assertTrue("not a method invocation", expression4.getNodeType() == ASTNode.FUNCTION_INVOCATION); - FunctionInvocation methodInvocation2 = (FunctionInvocation) expression4; - checkSourceRange(methodInvocation2.getName(), "foo", source); - assertNull("no null", methodInvocation2.getExpression()); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=32338 - */ - public void test0462() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "", "Test462.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertTrue("Has error", compilationUnit.getProblems().length == 0); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0); - assertNotNull("No node", node); - assertTrue("not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - assertEquals("Wrong name", "Test462", typeDeclaration.getName().getIdentifier()); - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertNotNull("No binding", typeBinding); - assertEquals("Wrong name", "Test462", typeBinding.getQualifiedName()); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=33450 - */ - public void test0463() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0463", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull("No node", node); - assertTrue("not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node; - Expression expression = returnStatement.getExpression(); - assertNotNull("No expression", expression); - assertTrue("not a string literal", expression.getNodeType() == ASTNode.STRING_LITERAL); //$NON-NLS-1$ - StringLiteral stringLiteral = (StringLiteral) expression; - checkSourceRange(stringLiteral, "\"\\012\\015\\u0061\"", source); - assertEquals("wrong value", "\012\015a", stringLiteral.getLiteralValue()); - assertEquals("wrong value", "\"\\012\\015\\u0061\"", stringLiteral.getEscapedValue()); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=33039 - */ - public void test0464() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0464", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertEquals("No error", 1, compilationUnit.getProblems().length); //$NON-NLS-1$ - assertNotNull("No node", node); - assertTrue("not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node; - Expression expression = returnStatement.getExpression(); - assertNotNull("No expression", expression); - assertTrue("not a null literal", expression.getNodeType() == ASTNode.NULL_LITERAL); //$NON-NLS-1$ - NullLiteral nullLiteral = (NullLiteral) expression; - ITypeBinding typeBinding = nullLiteral.resolveTypeBinding(); - assertNotNull("No type binding", typeBinding); - assertFalse("A primitive type", typeBinding.isPrimitive()); - assertTrue("Null type", typeBinding.isNullType()); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=33831 - */ - public void test0465() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0465", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 1, 0); - assertEquals("No error", 0, compilationUnit.getProblems().length); //$NON-NLS-1$ - assertNotNull("No node", node); - assertTrue("not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node; - Expression expression = returnStatement.getExpression(); - assertNotNull("No expression", expression); - assertTrue("not a field access", expression.getNodeType() == ASTNode.FIELD_ACCESS); //$NON-NLS-1$ - FieldAccess fieldAccess = (FieldAccess) expression; - Name name = fieldAccess.getName(); - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); - assertEquals("Wrong type", IBinding.VARIABLE, binding.getKind()); - IVariableBinding variableBinding = (IVariableBinding) binding; - assertEquals("Wrong name", "i", variableBinding.getName()); - assertEquals("Wrong type", "int", variableBinding.getType().getName()); - IVariableBinding variableBinding2 = fieldAccess.resolveFieldBinding(); - assertTrue("different binding", variableBinding == variableBinding2); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=33949 - */ - public void test0466() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Hashtable newOptions = JavaScriptCore.getOptions(); - try { - newOptions.put(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_4); - JavaScriptCore.setOptions(newOptions); - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0466", "Assert.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - checkSourceRange(node, "assert ref != null : message;", source); - } finally { - JavaScriptCore.setOptions(options); - } - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=33949 - */ - public void test0467() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Hashtable newOptions = JavaScriptCore.getOptions(); - try { - newOptions.put(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_4); - JavaScriptCore.setOptions(newOptions); - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0467", "Assert.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - checkSourceRange(node, "assert ref != null : message\\u003B", source); - - node = getASTNode(compilationUnit, 0, 0, 1); - checkSourceRange(node, "assert ref != null\\u003B", source); - } finally { - JavaScriptCore.setOptions(options); - } - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=36772 - */ - public void test0468() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0468", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 1, 0); - assertEquals("No error", 0, compilationUnit.getProblems().length); //$NON-NLS-1$ - assertNotNull("No node", node); - assertTrue("not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$ - ReturnStatement returnStatement = (ReturnStatement) node; - Expression expression = returnStatement.getExpression(); - assertNotNull("No expression", expression); - assertTrue("not a field access", expression.getNodeType() == ASTNode.FIELD_ACCESS); //$NON-NLS-1$ - FieldAccess fieldAccess = (FieldAccess) expression; - Name name = fieldAccess.getName(); - IBinding binding = name.resolveBinding(); - assertNotNull("No binding", binding); - assertEquals("Wrong type", IBinding.VARIABLE, binding.getKind()); - IVariableBinding variableBinding = (IVariableBinding) binding; - assertEquals("Wrong name", "i", variableBinding.getName()); - assertEquals("Wrong type", "int", variableBinding.getType().getName()); - IVariableBinding variableBinding2 = fieldAccess.resolveFieldBinding(); - assertTrue("different binding", variableBinding == variableBinding2); - - node = getASTNode(compilationUnit, 0, 0); - assertNotNull("No node", node); - assertEquals("Wrong type", ASTNode.FIELD_DECLARATION, node.getNodeType()); - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - List fragments = fieldDeclaration.fragments(); - assertEquals("wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - - ASTNode foundNode = compilationUnit.findDeclaringNode(variableBinding); - assertNotNull("No found node", foundNode); - assertEquals("wrong node", fragment, foundNode); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=36895 - */ - public void test0469() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "codeManipulation", "bug.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 2, 0); - assertEquals("No error", 0, compilationUnit.getProblems().length); //$NON-NLS-1$ - assertNotNull("No node", node); - assertTrue("not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - ASTNode parent = node.getParent(); - assertNotNull(parent); - assertTrue("not a block", parent.getNodeType() == ASTNode.BLOCK); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=37381 - */ - public void test0470() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0470", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertEquals("No error", 0, compilationUnit.getProblems().length); //$NON-NLS-1$ - assertNotNull("No node", node); - assertTrue("not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$ - ForStatement forStatement = (ForStatement) node; - List initializers = forStatement.initializers(); - assertEquals("wrong size", 1, initializers.size()); - Expression initializer = (Expression) initializers.get(0); - assertTrue("not a variable declaration expression", initializer.getNodeType() == ASTNode.VARIABLE_DECLARATION_EXPRESSION); //$NON-NLS-1$ - VariableDeclarationExpression variableDeclarationExpression = (VariableDeclarationExpression) initializer; - List fragments = variableDeclarationExpression.fragments(); - assertEquals("wrong size", 2, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - checkSourceRange(fragment, "i= 0", source); - fragment = (VariableDeclarationFragment) fragments.get(1); - checkSourceRange(fragment, "j= goo(3)", source); - checkSourceRange(variableDeclarationExpression, "int i= 0, j= goo(3)", source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=38447 - */ - public void test0471() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0471", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("No error", 1, compilationUnit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertNotNull("No node", node); - assertTrue("not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertTrue("Is a constructor", !methodDeclaration.isConstructor()); - checkSourceRange(methodDeclaration, "private void foo(){", source); - node = getASTNode(compilationUnit, 0, 1); - assertNotNull("No node", node); - assertTrue("not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - methodDeclaration = (FunctionDeclaration) node; - assertTrue("Is a constructor", !methodDeclaration.isConstructor()); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=38447 - */ - public void test0472() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "junit.textui", "ResultPrinter.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("No error", 2, compilationUnit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 2); - assertNotNull("No node", node); - assertTrue("not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertTrue("Not a constructor", methodDeclaration.isConstructor()); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=38732 - */ - public void test0473() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Hashtable newOptions = JavaScriptCore.getOptions(); - try { - newOptions.put(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_4); - newOptions.put(JavaScriptCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaScriptCore.ERROR); - JavaScriptCore.setOptions(newOptions); - - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0473", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("No error", 2, compilationUnit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 0, 0); - assertNotNull("No node", node); - } finally { - JavaScriptCore.setOptions(options); - } - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=39259 - */ - public void test0474() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0474", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("No error", 0, compilationUnit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 1, 0); - assertNotNull("No node", node); - assertEquals("Not a while statement", node.getNodeType(), ASTNode.WHILE_STATEMENT); - WhileStatement whileStatement = (WhileStatement) node; - Statement statement = whileStatement.getBody(); - assertEquals("Not a while statement", statement.getNodeType(), ASTNode.WHILE_STATEMENT); - WhileStatement whileStatement2 = (WhileStatement) statement; - String expectedSource = - "while(b())\n" + - " foo();"; - checkSourceRange(whileStatement2, expectedSource, source); - Statement statement2 = whileStatement2.getBody(); - checkSourceRange(statement2, "foo();", source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=39259 - */ - public void test0475() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0475", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("No error", 0, compilationUnit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 1, 0); - assertNotNull("No node", node); - assertEquals("Not an if statement", node.getNodeType(), ASTNode.IF_STATEMENT); - IfStatement statement = (IfStatement) node; - Statement statement2 = statement.getThenStatement(); - assertEquals("Not an if statement", statement2.getNodeType(), ASTNode.IF_STATEMENT); - IfStatement statement3 = (IfStatement) statement2; - String expectedSource = - "if(b())\n" + - " foo();"; - checkSourceRange(statement3, expectedSource, source); - Statement statement4 = statement3.getThenStatement(); - checkSourceRange(statement4, "foo();", source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=39259 - */ - public void test0476() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0476", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("No error", 0, compilationUnit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 1, 0); - assertNotNull("No node", node); - assertEquals("Not a for statement", node.getNodeType(), ASTNode.FOR_STATEMENT); - ForStatement statement = (ForStatement) node; - Statement statement2 = statement.getBody(); - assertEquals("Not a for statement", statement2.getNodeType(), ASTNode.FOR_STATEMENT); - ForStatement statement3 = (ForStatement) statement2; - String expectedSource = - "for(;b();)\n" + - " foo();"; - checkSourceRange(statement3, expectedSource, source); - Statement statement4 = statement3.getBody(); - checkSourceRange(statement4, "foo();", source); - } - - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=39327 - */ - public void test0477() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0477", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("No error", 1, compilationUnit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(compilationUnit, 0, 1, 0); - assertNotNull("No node", node); - - checkSourceRange(node, "this(undef());", source); - assertEquals("Not a constructor invocation", node.getNodeType(), ASTNode.CONSTRUCTOR_INVOCATION); - ConstructorInvocation constructorInvocation = (ConstructorInvocation) node; - List arguments = constructorInvocation.arguments(); - assertEquals("Wrong size", 1, arguments.size()); - IFunctionBinding binding = constructorInvocation.resolveConstructorBinding(); - assertNotNull("No binding", binding); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474 - */ - public void test0478() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0478", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - IType[] types = sourceUnit.getTypes(); - assertNotNull(types); - assertEquals("wrong size", 2, types.length); - IType type = types[1]; - IFunction[] methods = type.getFunctions(); - assertNotNull(methods); - assertEquals("wrong size", 1, methods.length); - IFunction method = methods[0]; - ISourceRange sourceRange = method.getSourceRange(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, true); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier()); - IFunctionBinding methodBinding = methodDeclaration.resolveBinding(); - assertNotNull(methodBinding); - List statements = ((FunctionDeclaration) node).getBody().statements(); - assertEquals("wrong size", 2, statements.size()); - ASTNode node2 = (ASTNode) statements.get(1); - assertNotNull(node2); - assertTrue("Not an expression statement", node2.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node2; - Expression expression = expressionStatement.getExpression(); - assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - Expression expression2 = methodInvocation.getExpression(); - assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$ - SimpleName simpleName = (SimpleName) expression2; - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertTrue("wrong type", binding.getKind() == IBinding.VARIABLE); //$NON-NLS-1$ - IVariableBinding variableBinding = (IVariableBinding) binding; - assertEquals("Wrong name", "a", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - SimpleName simpleName2 = methodInvocation.getName(); - assertEquals("Wrong name", "clone", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$ - IBinding binding2 = simpleName2.resolveBinding(); - assertNotNull("no binding2", binding2); //$NON-NLS-1$ - assertTrue("Wrong type", binding2.getKind() == IBinding.METHOD); //$NON-NLS-1$ - IFunctionBinding methodBinding2 = (IFunctionBinding) binding2; - assertEquals("Wrong name", "clone", methodBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474 - */ - public void test0479() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0479", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - IType[] types = sourceUnit.getTypes(); - assertNotNull(types); - assertEquals("wrong size", 2, types.length); - IType type = types[1]; - IFunction[] methods = type.getFunctions(); - assertNotNull(methods); - assertEquals("wrong size", 1, methods.length); - IFunction method = methods[0]; - ISourceRange sourceRange = method.getSourceRange(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, false); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier()); - List statements = ((FunctionDeclaration) node).getBody().statements(); - assertEquals("wrong size", 2, statements.size()); - ASTNode node2 = (ASTNode) statements.get(1); - assertNotNull(node2); - assertTrue("Not an expression statement", node2.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node2; - Expression expression = expressionStatement.getExpression(); - assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - Expression expression2 = methodInvocation.getExpression(); - assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$ - SimpleName simpleName = (SimpleName) expression2; - IBinding binding = simpleName.resolveBinding(); - assertNull("No binding", binding); //$NON-NLS-1$ - SimpleName simpleName2 = methodInvocation.getName(); - assertEquals("Wrong name", "clone", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474 - */ - public void test0480() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0480", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - IType[] types = sourceUnit.getTypes(); - assertNotNull(types); - assertEquals("wrong size", 1, types.length); - IType type = types[0]; - IFunction[] methods = type.getFunctions(); - assertNotNull(methods); - assertEquals("wrong size", 1, methods.length); - IFunction method = methods[0]; - ISourceRange sourceRange = method.getSourceRange(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, false); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier()); - List statements = ((FunctionDeclaration) node).getBody().statements(); - assertEquals("wrong size", 1, statements.size()); - ASTNode node2 = (ASTNode) statements.get(0); - assertNotNull(node2); - assertTrue("Not an variable declaration statement", node2.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474 - */ - public void test0481() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0481", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - IType[] types = sourceUnit.getTypes(); - assertNotNull(types); - assertEquals("wrong size", 1, types.length); - IType type = types[0]; - IFunction[] methods = type.getFunctions(); - assertNotNull(methods); - assertEquals("wrong size", 1, methods.length); - IFunction method = methods[0]; - ISourceRange sourceRange = method.getSourceRange(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, true); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier()); - List statements = ((FunctionDeclaration) node).getBody().statements(); - assertEquals("wrong size", 1, statements.size()); - ASTNode node2 = (ASTNode) statements.get(0); - assertNotNull(node2); - assertTrue("Not an variable declaration statement", node2.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement statement = (VariableDeclarationStatement) node2; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertTrue("Not a class instance creation", expression.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression; - ITypeBinding typeBinding = classInstanceCreation.resolveTypeBinding(); - assertNotNull(typeBinding); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474 - */ - public void test0482() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0482", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - IType[] types = sourceUnit.getTypes(); - assertNotNull(types); - assertEquals("wrong size", 1, types.length); - IType type = types[0]; - IType[] memberTypes = type.getTypes(); - assertNotNull(memberTypes); - assertEquals("wrong size", 1, memberTypes.length); - IType memberType = memberTypes[0]; - IFunction[] methods = memberType.getFunctions(); - assertEquals("wrong size", 1, methods.length); - IFunction method = methods[0]; - ISourceRange sourceRange = method.getSourceRange(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, true); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier()); - List statements = ((FunctionDeclaration) node).getBody().statements(); - assertEquals("wrong size", 1, statements.size()); - ASTNode node2 = (ASTNode) statements.get(0); - assertNotNull(node2); - assertTrue("Not an variable declaration statement", node2.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement statement = (VariableDeclarationStatement) node2; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertTrue("Not a class instance creation", expression.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression; - ITypeBinding typeBinding = classInstanceCreation.resolveTypeBinding(); - assertNotNull(typeBinding); - assertTrue(typeBinding.isAnonymous()); - assertEquals("Wrong name", "", typeBinding.getName()); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474 - */ - public void test0483() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0483", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - IType[] types = sourceUnit.getTypes(); - assertNotNull(types); - assertEquals("wrong size", 1, types.length); - IType type = types[0]; - IFunction[] methods = type.getFunctions(); - assertEquals("wrong size", 1, methods.length); - IFunction method = methods[0]; - ISourceRange sourceRange = method.getSourceRange(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, true); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertEquals("wrong name", "A", methodDeclaration.getName().getIdentifier()); - assertTrue("Not a constructor", methodDeclaration.isConstructor()); - IBinding binding = methodDeclaration.getName().resolveBinding(); - assertNotNull(binding); - assertEquals("Wrong type", IBinding.METHOD, binding.getKind()); - List statements = ((FunctionDeclaration) node).getBody().statements(); - assertEquals("wrong size", 1, statements.size()); - ASTNode node2 = (ASTNode) statements.get(0); - assertNotNull(node2); - assertTrue("Not an variable declaration statement", node2.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement statement = (VariableDeclarationStatement) node2; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertTrue("Not a class instance creation", expression.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression; - ITypeBinding typeBinding = classInstanceCreation.resolveTypeBinding(); - assertNotNull(typeBinding); - assertTrue(typeBinding.isAnonymous()); - assertEquals("Wrong name", "", typeBinding.getName()); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474 - */ - public void test0484() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0482", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - IType[] types = sourceUnit.getTypes(); - assertNotNull(types); - assertEquals("wrong size", 1, types.length); - IType type = types[0]; - IType[] memberTypes = type.getTypes(); - assertNotNull(memberTypes); - assertEquals("wrong size", 1, memberTypes.length); - IType memberType = memberTypes[0]; - ISourceRange sourceRange = memberType.getSourceRange(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, true); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - assertEquals("wrong name", "B", typeDeclaration.getName().getIdentifier()); - List bodyDeclarations = typeDeclaration.bodyDeclarations(); - assertEquals("Wrong size", 1, bodyDeclarations.size()); - BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); - assertTrue("Not a method declaration", bodyDeclaration.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration; - Block block = methodDeclaration.getBody(); - List statements = block.statements(); - assertEquals("Wrong size", 1, statements.size()); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474 - */ - public void test0485() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0482", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - IType[] types = sourceUnit.getTypes(); - assertNotNull(types); - assertEquals("wrong size", 1, types.length); - IType type = types[0]; - IType[] memberTypes = type.getTypes(); - assertNotNull(memberTypes); - assertEquals("wrong size", 1, memberTypes.length); - IType memberType = memberTypes[0]; - ISourceRange sourceRange = memberType.getSourceRange(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, false); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - assertEquals("wrong name", "B", typeDeclaration.getName().getIdentifier()); - List bodyDeclarations = typeDeclaration.bodyDeclarations(); - assertEquals("Wrong size", 1, bodyDeclarations.size()); - BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); - assertTrue("Not a method declaration", bodyDeclaration.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration; - Block block = methodDeclaration.getBody(); - List statements = block.statements(); - assertEquals("Wrong size", 1, statements.size()); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474 - */ - public void test0486() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0486", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - IType[] types = sourceUnit.getTypes(); - assertNotNull(types); - assertEquals("wrong size", 1, types.length); - IType type = types[0]; - IFunction[] methods = type.getFunctions(); - assertEquals("wrong size", 2, methods.length); - IFunction method = methods[1]; - ISourceRange sourceRange = method.getSourceRange(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, false); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 2); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - Block block = methodDeclaration.getBody(); - List statements = block.statements(); - assertEquals("Wrong size", 2, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 1); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - methodDeclaration = (FunctionDeclaration) node; - block = methodDeclaration.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474 - */ - public void test0487() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0487", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - IType[] types = sourceUnit.getTypes(); - assertNotNull(types); - assertEquals("wrong size", 1, types.length); - IType type = types[0]; - IFunction[] methods = type.getFunctions(); - assertEquals("wrong size", 3, methods.length); - IFunction method = methods[1]; - ISourceRange sourceRange = method.getSourceRange(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, false); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 5); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - Block block = methodDeclaration.getBody(); - List statements = block.statements(); - assertEquals("Wrong size", 2, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 4); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - methodDeclaration = (FunctionDeclaration) node; - block = methodDeclaration.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - List fragments = fieldDeclaration.fragments(); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertEquals("Wrong name", "field", fragment.getName().getIdentifier()); - assertNotNull("No initializer", expression); - - node = getASTNode((JavaScriptUnit) result, 0, 1); - assertTrue("Not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$ - fieldDeclaration = (FieldDeclaration) node; - fragments = fieldDeclaration.fragments(); - fragment = (VariableDeclarationFragment) fragments.get(0); - expression = fragment.getInitializer(); - assertEquals("Wrong name", "i", fragment.getName().getIdentifier()); - assertNotNull("No initializer", expression); - - node = getASTNode((JavaScriptUnit) result, 0, 2); - assertTrue("Not an initializer", node.getNodeType() == ASTNode.INITIALIZER); //$NON-NLS-1$ - Initializer initializer = (Initializer) node; - assertEquals("Not static", Modifier.NONE, initializer.getModifiers()); - block = initializer.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 3); - assertTrue("Not an initializer", node.getNodeType() == ASTNode.INITIALIZER); //$NON-NLS-1$ - initializer = (Initializer) node; - assertEquals("Not static", Modifier.STATIC, initializer.getModifiers()); - block = initializer.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 6); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - methodDeclaration = (FunctionDeclaration) node; - block = methodDeclaration.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474 - */ - public void test0488() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0488", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - IType[] types = sourceUnit.getTypes(); - assertNotNull(types); - assertEquals("wrong size", 1, types.length); - IType type = types[0]; - IInitializer[] initializers = type.getInitializers(); - assertEquals("wrong size", 2, initializers.length); - IInitializer init = initializers[1]; - ISourceRange sourceRange = init.getSourceRange(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, false); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 5); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - Block block = methodDeclaration.getBody(); - List statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 4); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - methodDeclaration = (FunctionDeclaration) node; - block = methodDeclaration.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - List fragments = fieldDeclaration.fragments(); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertEquals("Wrong name", "field", fragment.getName().getIdentifier()); - assertNotNull("No initializer", expression); - - node = getASTNode((JavaScriptUnit) result, 0, 1); - assertTrue("Not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$ - fieldDeclaration = (FieldDeclaration) node; - fragments = fieldDeclaration.fragments(); - fragment = (VariableDeclarationFragment) fragments.get(0); - expression = fragment.getInitializer(); - assertEquals("Wrong name", "i", fragment.getName().getIdentifier()); - assertNotNull("No initializer", expression); - - node = getASTNode((JavaScriptUnit) result, 0, 2); - assertTrue("Not an initializer", node.getNodeType() == ASTNode.INITIALIZER); //$NON-NLS-1$ - Initializer initializer = (Initializer) node; - assertEquals("Not static", Modifier.NONE, initializer.getModifiers()); - block = initializer.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 3); - assertTrue("Not an initializer", node.getNodeType() == ASTNode.INITIALIZER); //$NON-NLS-1$ - initializer = (Initializer) node; - assertEquals("Not static", Modifier.STATIC, initializer.getModifiers()); - block = initializer.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 1, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 6); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - methodDeclaration = (FunctionDeclaration) node; - block = methodDeclaration.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - } - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=40804 - */ - public void test0489() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0489", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0); - assertNotNull("No node", node); - assertTrue("not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - assertNull("Got a type binding", typeDeclaration.resolveBinding()); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=40804 - */ - public void test0490() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0490", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=42647 - */ - public void test0491() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Hashtable newOptions = JavaScriptCore.getOptions(); - try { - newOptions.put(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_4); - JavaScriptCore.setOptions(newOptions); - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0491", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - } finally { - JavaScriptCore.setOptions(options); - } - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=42647 - */ - public void test0492() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Hashtable newOptions = JavaScriptCore.getOptions(); - try { - newOptions.put(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_4); - JavaScriptCore.setOptions(newOptions); - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0492", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - } finally { - JavaScriptCore.setOptions(options); - } - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=42839 - */ - public void test0493() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0493", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0); - assertTrue("not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - Type type = fieldDeclaration.getType(); - checkSourceRange(type, "Class[][]", source); - assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$ - ArrayType arrayType = (ArrayType) type; - Type componentType = arrayType.getComponentType(); - assertTrue("not an array type", componentType.isArrayType()); //$NON-NLS-1$ - checkSourceRange(componentType, "Class[]", source); - arrayType = (ArrayType) componentType; - componentType = arrayType.getComponentType(); - assertTrue("is an array type", !componentType.isArrayType()); //$NON-NLS-1$ - checkSourceRange(componentType, "Class", source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=42839 - */ - public void test0494() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0494", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0); - assertTrue("not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - Type type = fieldDeclaration.getType(); - checkSourceRange(type, "Class[][][]", source); - assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$ - ArrayType arrayType = (ArrayType) type; - Type componentType = arrayType.getComponentType(); - assertTrue("not an array type", componentType.isArrayType()); //$NON-NLS-1$ - checkSourceRange(componentType, "Class[][]", source); - arrayType = (ArrayType) componentType; - componentType = arrayType.getComponentType(); - assertTrue("not an array type", componentType.isArrayType()); //$NON-NLS-1$ - checkSourceRange(componentType, "Class[]", source); - arrayType = (ArrayType) componentType; - componentType = arrayType.getComponentType(); - assertTrue("is an array type", !componentType.isArrayType()); //$NON-NLS-1$ - checkSourceRange(componentType, "Class", source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=42839 - */ - public void test0495() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0495", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0); - assertTrue("not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - Type type = fieldDeclaration.getType(); - checkSourceRange(type, "Class[][]", source); - assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$ - ArrayType arrayType = (ArrayType) type; - Type componentType = arrayType.getComponentType(); - assertTrue("not an array type", componentType.isArrayType()); //$NON-NLS-1$ - checkSourceRange(componentType, "Class[]", source); - arrayType = (ArrayType) componentType; - componentType = arrayType.getComponentType(); - assertTrue("is an array type", !componentType.isArrayType()); //$NON-NLS-1$ - checkSourceRange(componentType, "Class", source); - List fragments = fieldDeclaration.fragments(); - assertEquals("wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - assertEquals("wrong extra dimension", 1, fragment.getExtraDimensions()); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=42839 - */ - public void test0496() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0496", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0); - assertTrue("not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - Type type = fieldDeclaration.getType(); - checkSourceRange(type, "Class[][][][]", source); - assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$ - ArrayType arrayType = (ArrayType) type; - Type componentType = arrayType.getComponentType(); - assertTrue("not an array type", componentType.isArrayType()); //$NON-NLS-1$ - checkSourceRange(componentType, "Class[][][]", source); - arrayType = (ArrayType) componentType; - componentType = arrayType.getComponentType(); - assertTrue("not an array type", componentType.isArrayType()); //$NON-NLS-1$ - checkSourceRange(componentType, "Class[][]", source); - arrayType = (ArrayType) componentType; - componentType = arrayType.getComponentType(); - assertTrue("not an array type", componentType.isArrayType()); //$NON-NLS-1$ - checkSourceRange(componentType, "Class[]", source); - arrayType = (ArrayType) componentType; - componentType = arrayType.getComponentType(); - assertTrue("is an array type", !componentType.isArrayType()); //$NON-NLS-1$ - checkSourceRange(componentType, "Class", source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=42839 - */ - public void test0497() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0497", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$< - ASTNode node = getASTNode(unit, 0, 0); - assertTrue("not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - Type type = fieldDeclaration.getType(); - checkSourceRange(type, "Class[]", source); - assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$ - ArrayType arrayType = (ArrayType) type; - Type componentType = arrayType.getComponentType(); - assertTrue("is an array type", !componentType.isArrayType()); //$NON-NLS-1$ - checkSourceRange(componentType, "Class", source); - } - - /** - */ - public void test0498() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0498", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=45199 - */ - public void test0499() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0499", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0, 1); - assertNotNull(node); - assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - Expression expression = ((ExpressionStatement) node).getExpression(); - assertTrue("Not an assignment", expression.getNodeType() == ASTNode.ASSIGNMENT); //$NON-NLS-1$ - Assignment assignment = (Assignment) expression; - Expression expression2 = assignment.getRightHandSide(); - assertTrue("Not an infix expression", expression2.getNodeType() == ASTNode.INFIX_EXPRESSION); //$NON-NLS-1$ - InfixExpression infixExpression = (InfixExpression) expression2; - Expression expression3 = infixExpression.getLeftOperand(); - assertTrue("Not a simple name", expression3.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$ - ITypeBinding binding = expression3.resolveTypeBinding(); - assertNotNull("No binding", binding); - Expression expression4 = assignment.getLeftHandSide(); - assertTrue("Not a simple name", expression4.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$ - ITypeBinding binding2 = expression4.resolveTypeBinding(); - assertNotNull("No binding", binding2); - assertTrue("Should be the same", binding == binding2); - } - - /** - * Test for bug 45436 fix. - * When this bug happened, the first assertion was false (2 problems found). - * @see bug 45436 - * @throws JavaScriptModelException - */ - public void test0500() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0500", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - IJavaScriptProject project = sourceUnit.getJavaScriptProject(); - Map originalOptions = project.getOptions(false); - try { - project.setOption(JavaScriptCore.COMPILER_PB_INVALID_JAVADOC, JavaScriptCore.ERROR); - project.setOption(JavaScriptCore.COMPILER_PB_MISSING_JAVADOC_TAGS, JavaScriptCore.ERROR); - project.setOption(JavaScriptCore.COMPILER_PB_MISSING_JAVADOC_COMMENTS, JavaScriptCore.ERROR); - JavaScriptUnit result = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true); - IProblem[] problems= result.getProblems(); - assertTrue(problems.length == 1); - assertEquals("Invalid warning", "Javadoc: Missing tag for parameter a", problems[0].getMessage()); - } finally { - project.setOptions(originalOptions); - } - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46012 - */ - public void test0501() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0501", "JavaEditor.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - assertNotNull(result); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013 - */ - public void test0502a() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true); - - // 'i' in initializer - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement)getASTNode(unit, 0, 0, 0); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableDeclarationStatement.fragments().get(0); - IVariableBinding localBinding = fragment.resolveBinding(); - assertEquals("Unexpected key", "Ltest0502/A;#0#i", localBinding.getKey()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013 - */ - public void test0502b() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true); - - // 'j' in 'then' block in initializer - IfStatement ifStatement = (IfStatement) getASTNode(unit, 0, 0, 1); - Block block = (Block)ifStatement.getThenStatement(); - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) block.statements().get(0); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableDeclarationStatement.fragments().get(0); - IVariableBinding localBinding = fragment.resolveBinding(); - assertEquals("Unexpected key", "Ltest0502/A;#0#0#j", localBinding.getKey()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013 - */ - public void test0502c() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true); - - // 'i' in 'foo()' - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement)getASTNode(unit, 0, 1, 0); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableDeclarationStatement.fragments().get(0); - IVariableBinding localBinding = fragment.resolveBinding(); - assertEquals("Unexpected key", "Ltest0502/A;.foo()V#i", localBinding.getKey()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013 - */ - public void test0502d() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true); - - // 'j' in 'then' block in 'foo()' - IfStatement ifStatement = (IfStatement) getASTNode(unit, 0, 1, 1); - Block block = (Block)ifStatement.getThenStatement(); - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) block.statements().get(0); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableDeclarationStatement.fragments().get(0); - IVariableBinding localBinding = fragment.resolveBinding(); - assertEquals("Unexpected key", "Ltest0502/A;.foo()V#0#j", localBinding.getKey()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013 - */ - public void test0502e() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true); - - // 'j' in 'else' block in 'foo()' - IfStatement ifStatement = (IfStatement) getASTNode(unit, 0, 1, 1); - Block block = (Block)ifStatement.getElseStatement(); - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) block.statements().get(0); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableDeclarationStatement.fragments().get(0); - IVariableBinding localBinding = fragment.resolveBinding(); - assertEquals("Unexpected key", "Ltest0502/A;.foo()V#1#j", localBinding.getKey()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013 - */ - public void test0502f() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true); - - // first 'new Object(){...}' in 'foo()' - ExpressionStatement expressionStatement = (ExpressionStatement) getASTNode(unit, 0, 1, 2); - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression(); - AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration(); - ITypeBinding typeBinding = anonymousClassDeclaration.resolveBinding(); - assertEquals("Unexpected key", "Ltest0502/A$182;", typeBinding.getKey()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013 - */ - public void test0502g() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true); - - // 'B' in 'foo()' - TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) getASTNode(unit, 0, 1, 3); - AbstractTypeDeclaration typeDeclaration = typeDeclarationStatement.getDeclaration(); - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertEquals("Unexpected key", "Ltest0502/A$206$B;", typeBinding.getKey()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013 - */ - public void test0502h() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true); - - // second 'new Object(){...}' in 'foo()' - ExpressionStatement expressionStatement = (ExpressionStatement) getASTNode(unit, 0, 1, 4); - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression(); - AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration(); - ITypeBinding typeBinding = anonymousClassDeclaration.resolveBinding(); - assertEquals("Unexpected key", "Ltest0502/A$255;", typeBinding.getKey()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013 - */ - public void test0502i() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true); - - // 'field' in 'B' in 'foo()' - TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) getASTNode(unit, 0, 1, 3); - AbstractTypeDeclaration abstractTypeDeclaration = typeDeclarationStatement.getDeclaration(); - assertEquals("Wrong type", abstractTypeDeclaration.getNodeType(), ASTNode.TYPE_DECLARATION); - TypeDeclaration typeDeclaration = (TypeDeclaration) abstractTypeDeclaration; - FieldDeclaration fieldDeclaration = typeDeclaration.getFields()[0]; - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fieldDeclaration.fragments().get(0); - IVariableBinding fieldBinding = fragment.resolveBinding(); - assertEquals("Unexpected key", "Ltest0502/A$206$B;.field)I", fieldBinding.getKey()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013 - */ - public void test0502j() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true); - - // 'bar()' in 'B' in 'foo()' - TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) getASTNode(unit, 0, 1, 3); - AbstractTypeDeclaration abstractTypeDeclaration = typeDeclarationStatement.getDeclaration(); - assertEquals("Wrong type", abstractTypeDeclaration.getNodeType(), ASTNode.TYPE_DECLARATION); - TypeDeclaration typeDeclaration = (TypeDeclaration) abstractTypeDeclaration; - FunctionDeclaration methodDeclaration = typeDeclaration.getMethods()[0]; - IFunctionBinding methodBinding = methodDeclaration.resolveBinding(); - assertEquals("Unexpected key", "Ltest0502/A$206$B;.bar()V", methodBinding.getKey()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057 - */ - public void test0503a() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true); - - // top level type A - TypeDeclaration type = (TypeDeclaration)getASTNode(unit, 0); - ITypeBinding typeBinding = type.resolveBinding(); - assertEquals("Unexpected binary name", "test0503.A", typeBinding.getBinaryName()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057 - */ - public void test0503b() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true); - - // member type B in A - TypeDeclaration type = (TypeDeclaration)getASTNode(unit, 0, 0); - ITypeBinding typeBinding = type.resolveBinding(); - assertEquals("Unexpected binary name", "test0503.A$B", typeBinding.getBinaryName()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057 - */ - public void test0503c() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true); - - // local type E in foo() in A - TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) getASTNode(unit, 0, 1, 0); - AbstractTypeDeclaration typeDeclaration = typeDeclarationStatement.getDeclaration(); - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertEquals("Unexpected binary name", "test0503.A$1$E", typeBinding.getBinaryName()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057 - */ - public void test0503d() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true); - - // anonymous type new Object() {...} in foo() in A - ExpressionStatement expressionStatement = (ExpressionStatement) getASTNode(unit, 0, 1, 1); - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression(); - AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration(); - ITypeBinding typeBinding = anonymousClassDeclaration.resolveBinding(); - assertEquals("Unexpected binary name", "test0503.A$2", typeBinding.getBinaryName()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057 - */ - public void test0503e() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true); - - // type F in anonymous type new Object() {...} in foo() in A - ExpressionStatement expressionStatement = (ExpressionStatement) getASTNode(unit, 0, 1, 1); - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression(); - AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration(); - TypeDeclaration type = (TypeDeclaration) anonymousClassDeclaration.bodyDeclarations().get(0); - ITypeBinding typeBinding = type.resolveBinding(); - assertEquals("Unexpected binary name", "test0503.A$2$F", typeBinding.getBinaryName()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057 - */ - public void test0503f() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true); - - // local type C in bar() in B in A - FunctionDeclaration method = (FunctionDeclaration) getASTNode(unit, 0, 0, 0); - TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) method.getBody().statements().get(0); - AbstractTypeDeclaration typeDeclaration = typeDeclarationStatement.getDeclaration(); - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertEquals("Unexpected binary name", "test0503.A$1$C", typeBinding.getBinaryName()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057 - */ - public void test0503g() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true); - - // anonymous type new Object() {...} in bar() in B in A - FunctionDeclaration method = (FunctionDeclaration) getASTNode(unit, 0, 0, 0); - ExpressionStatement expressionStatement = (ExpressionStatement) method.getBody().statements().get(1); - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression(); - AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration(); - ITypeBinding typeBinding = anonymousClassDeclaration.resolveBinding(); - assertEquals("Unexpected binary name", "test0503.A$1", typeBinding.getBinaryName()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057 - */ - public void test0503h() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true); - - // type D in anonymous type new Object() {...} in bar() in B in A - FunctionDeclaration method = (FunctionDeclaration) getASTNode(unit, 0, 0, 0); - ExpressionStatement expressionStatement = (ExpressionStatement) method.getBody().statements().get(1); - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression(); - AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration(); - TypeDeclaration type = (TypeDeclaration) anonymousClassDeclaration.bodyDeclarations().get(0); - ITypeBinding typeBinding = type.resolveBinding(); - assertEquals("Unexpected binary name", "test0503.A$1$D", typeBinding.getBinaryName()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057 - */ - public void test0503i() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true); - - // unreachable type G in foo() in A - IfStatement ifStatement = (IfStatement) getASTNode(unit, 0, 1, 2); - Block block = (Block)ifStatement.getThenStatement(); - TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) block.statements().get(0); - AbstractTypeDeclaration typeDeclaration = typeDeclarationStatement.getDeclaration(); - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertEquals("Unexpected binary name", null, typeBinding.getBinaryName()); //$NON-NLS-1$ - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=47396 - */ - public void test0504() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0504", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 1, 0); - assertNotNull(node); - assertTrue("Not a constructor declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration declaration = (FunctionDeclaration) node; - assertTrue("A constructor", !declaration.isConstructor()); - checkSourceRange(declaration, "public method(final int parameter);", source); - } - - /** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=47396 - */ - public void test0505() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0505", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 1, 0); - assertNotNull(node); - assertTrue("Not a constructor declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration declaration = (FunctionDeclaration) node; - assertTrue("A constructor", !declaration.isConstructor()); - checkSourceRange(declaration, "public method(final int parameter) { }", source); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=46699 - */ - public void test0506() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0506", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - final JavaScriptUnit unit = (JavaScriptUnit) result; - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Wrong number of problems", 0, (unit).getProblems().length); //$NON-NLS-1$ - assertNotNull(node); - assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - assertTrue("Not a class instance creation", expressionStatement.getExpression().getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression(); - IFunctionBinding binding = classInstanceCreation.resolveConstructorBinding(); - assertTrue("is default constructor", binding.isDefaultConstructor()); - assertNull("Has a declaring node", unit.findDeclaringNode(binding)); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=46699 - */ - public void test0507() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0507", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - final JavaScriptUnit unit = (JavaScriptUnit) result; - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Wrong number of problems", 0, (unit).getProblems().length); //$NON-NLS-1$ - assertNotNull(node); - assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - assertTrue("Not a class instance creation", expressionStatement.getExpression().getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression(); - IFunctionBinding binding = classInstanceCreation.resolveConstructorBinding(); - assertTrue("is default constructor", binding.isDefaultConstructor()); - assertNull("Has a declaring node", unit.findDeclaringNode(binding)); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=46699 - */ - public void test0508() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0508", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - final JavaScriptUnit unit = (JavaScriptUnit) result; - ASTNode node = getASTNode(unit, 0, 1, 0); - assertEquals("Wrong number of problems", 0, (unit).getProblems().length); //$NON-NLS-1$ - assertNotNull(node); - assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - assertTrue("Not a class instance creation", expressionStatement.getExpression().getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression(); - IFunctionBinding binding = classInstanceCreation.resolveConstructorBinding(); - assertTrue("not a default constructor", !binding.isDefaultConstructor()); - assertNotNull("Has no declaring node", unit.findDeclaringNode(binding)); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=46699 - */ - public void test0509() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0509", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - final JavaScriptUnit unit = (JavaScriptUnit) result; - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Wrong number of problems", 0, (unit).getProblems().length); //$NON-NLS-1$ - assertNotNull(node); - assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - assertTrue("Not a class instance creation", expressionStatement.getExpression().getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression(); - IFunctionBinding binding = classInstanceCreation.resolveConstructorBinding(); - assertTrue("not a default constructor", !binding.isDefaultConstructor()); - assertNull("Has a declaring node", unit.findDeclaringNode(binding)); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=46699 - */ - public void test0510() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0510", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - final JavaScriptUnit unit = (JavaScriptUnit) result; - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Wrong number of problems", 0, (unit).getProblems().length); //$NON-NLS-1$ - assertNotNull(node); - assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - assertTrue("Not a class instance creation", expressionStatement.getExpression().getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression(); - IFunctionBinding binding = classInstanceCreation.resolveConstructorBinding(); - assertFalse("is default constructor", binding.isDefaultConstructor()); - assertNull("Has a declaring node", unit.findDeclaringNode(binding)); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=46699 - */ - public void test0511() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0511", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - final JavaScriptUnit unit = (JavaScriptUnit) result; - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Wrong number of problems", 0, (unit).getProblems().length); //$NON-NLS-1$ - assertNotNull(node); - assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node; - assertTrue("Not a class instance creation", expressionStatement.getExpression().getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression(); - IFunctionBinding binding = classInstanceCreation.resolveConstructorBinding(); - assertFalse("is default constructor", binding.isDefaultConstructor()); - assertNull("Has a declaring node", unit.findDeclaringNode(binding)); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=47326 - */ - public void test0512() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0512", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - final JavaScriptUnit unit = (JavaScriptUnit) result; - ASTNode node = getASTNode(unit, 0, 0); - assertEquals("Wrong number of problems", 2, unit.getProblems().length); //$NON-NLS-1$ - assertNotNull(node); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration declaration = (FunctionDeclaration) node; - assertTrue("Not a constructor", declaration.isConstructor()); - checkSourceRange(declaration, "public A();", source); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=49429 - */ - public void test0513() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0513", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$ - } - - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=48502 - */ - public void test0514() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0514", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=49204 - */ - public void test0515() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0515", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0, 0); - assertNotNull("No node", node); - assertTrue("not a if statement", node.getNodeType() == ASTNode.IF_STATEMENT); - IfStatement ifStatement = (IfStatement) node; - assertTrue("not an empty statement", ifStatement.getThenStatement().getNodeType() == ASTNode.EMPTY_STATEMENT); - checkSourceRange(ifStatement.getThenStatement(), ";", source); - Statement statement = ifStatement.getElseStatement(); - assertTrue("not a if statement", statement.getNodeType() == ASTNode.IF_STATEMENT); - ifStatement = (IfStatement) statement; - assertTrue("not an empty statement", ifStatement.getThenStatement().getNodeType() == ASTNode.EMPTY_STATEMENT); - checkSourceRange(ifStatement.getThenStatement(), ";", source); - Statement statement2 = ifStatement.getElseStatement(); - assertTrue("not an empty statement", statement2.getNodeType() == ASTNode.EMPTY_STATEMENT); - checkSourceRange(statement2, ";", source); - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=48489 - */ - public void test0516() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0516", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0); - assertNotNull("No node", node); - assertTrue("not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); - FunctionDeclaration declaration = (FunctionDeclaration) node; - ASTParser parser = ASTParser.newParser(AST.JLS3); - parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS); - parser.setSource(source); - parser.setSourceRange(declaration.getStartPosition(), declaration.getLength()); - parser.setCompilerOptions(JavaScriptCore.getOptions()); - ASTNode result2 = parser.createAST(null); - assertNotNull("No node", result2); - assertTrue("not a type declaration", result2.getNodeType() == ASTNode.TYPE_DECLARATION); - TypeDeclaration typeDeclaration = (TypeDeclaration) result2; - List bodyDeclarations = typeDeclaration.bodyDeclarations(); - assertEquals("wrong size", 1, bodyDeclarations.size()); - BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); - assertTrue(declaration.subtreeMatch(new ASTMatcher(), bodyDeclaration)); - ASTNode root = bodyDeclaration.getRoot(); - assertNotNull("No root", root); - assertTrue("not a compilation unit", root.getNodeType() == ASTNode.JAVASCRIPT_UNIT); - JavaScriptUnit compilationUnit = (JavaScriptUnit) root; - assertEquals("wrong problem size", 0, compilationUnit.getProblems().length); - assertNotNull("No comments", compilationUnit.getCommentList()); - assertEquals("Wrong size", 3, compilationUnit.getCommentList().size()); - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=48489 - */ - public void test0517() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0517", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - assertNotNull("No comments", unit.getCommentList()); - assertEquals("Wrong size", 3, unit.getCommentList().size()); - ASTNode node = getASTNode(unit, 0, 0); - assertNotNull("No node", node); - assertTrue("not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); - FieldDeclaration declaration = (FieldDeclaration) node; - ASTParser parser = ASTParser.newParser(AST.JLS3); - parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS); - parser.setSource(source); - parser.setSourceRange(declaration.getStartPosition(), declaration.getLength()); - parser.setCompilerOptions(JavaScriptCore.getOptions()); - ASTNode result2 = parser.createAST(null); - assertNotNull("No node", result2); - assertTrue("not a type declaration", result2.getNodeType() == ASTNode.TYPE_DECLARATION); - TypeDeclaration typeDeclaration = (TypeDeclaration) result2; - List bodyDeclarations = typeDeclaration.bodyDeclarations(); - assertEquals("wrong size", 1, bodyDeclarations.size()); - BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); - assertTrue(declaration.subtreeMatch(new ASTMatcher(), bodyDeclaration)); - ASTNode root = bodyDeclaration.getRoot(); - assertNotNull("No root", root); - assertTrue("not a compilation unit", root.getNodeType() == ASTNode.JAVASCRIPT_UNIT); - JavaScriptUnit compilationUnit = (JavaScriptUnit) root; - assertEquals("wrong problem size", 0, compilationUnit.getProblems().length); - assertNotNull("No comments", compilationUnit.getCommentList()); - assertEquals("Wrong size", 2, compilationUnit.getCommentList().size()); - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=48489 - */ - public void test0518() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0518", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0); - assertNotNull("No node", node); - assertTrue("not an initializer", node.getNodeType() == ASTNode.INITIALIZER); - Initializer declaration = (Initializer) node; - ASTParser parser = ASTParser.newParser(AST.JLS3); - parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS); - parser.setSource(source); - parser.setSourceRange(declaration.getStartPosition(), declaration.getLength()); - parser.setCompilerOptions(JavaScriptCore.getOptions()); - ASTNode result2 = parser.createAST(null); - assertNotNull("No node", result2); - assertTrue("not a type declaration", result2.getNodeType() == ASTNode.TYPE_DECLARATION); - TypeDeclaration typeDeclaration = (TypeDeclaration) result2; - List bodyDeclarations = typeDeclaration.bodyDeclarations(); - assertEquals("wrong size", 1, bodyDeclarations.size()); - BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); - assertTrue(declaration.subtreeMatch(new ASTMatcher(), bodyDeclaration)); - ASTNode root = bodyDeclaration.getRoot(); - assertNotNull("No root", root); - assertTrue("not a compilation unit", root.getNodeType() == ASTNode.JAVASCRIPT_UNIT); - JavaScriptUnit compilationUnit = (JavaScriptUnit) root; - assertEquals("wrong problem size", 0, compilationUnit.getProblems().length); - assertNotNull("No comments", compilationUnit.getCommentList()); - assertEquals("Wrong size", 3, compilationUnit.getCommentList().size()); - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=48489 - */ - public void test0519() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0519", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - assertNotNull("No comments", unit.getCommentList()); - assertEquals("Wrong size", 2, unit.getCommentList().size()); - ASTNode node = getASTNode(unit, 0, 0, 0); - assertNotNull("No node", node); - ASTNode statement = node; - ASTParser parser = ASTParser.newParser(AST.JLS3); - parser.setKind(ASTParser.K_STATEMENTS); - parser.setSource(source); - parser.setSourceRange(statement.getStartPosition(), statement.getLength()); - parser.setCompilerOptions(JavaScriptCore.getOptions()); - ASTNode result2 = parser.createAST(null); - assertNotNull("No node", result2); - assertTrue("not a block", result2.getNodeType() == ASTNode.BLOCK); - Block block = (Block) result2; - List statements = block.statements(); - assertEquals("wrong size", 1, statements.size()); - Statement statement2 = (Statement) statements.get(0); - assertTrue(statement.subtreeMatch(new ASTMatcher(), statement2)); - ASTNode root = statement2.getRoot(); - assertNotNull("No root", root); - assertTrue("not a compilation unit", root.getNodeType() == ASTNode.JAVASCRIPT_UNIT); - JavaScriptUnit compilationUnit = (JavaScriptUnit) root; - assertEquals("wrong problem size", 0, compilationUnit.getProblems().length); - assertNotNull("No comments", compilationUnit.getCommentList()); - assertEquals("Wrong size", 1, compilationUnit.getCommentList().size()); - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=48489 - */ - public void test0520() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0520", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - assertNotNull("No comments", unit.getCommentList()); - assertEquals("Wrong size", 2, unit.getCommentList().size()); - ASTNode node = getASTNode(unit, 0, 0, 0); - assertNotNull("No node", node); - assertTrue("not a block", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - ASTParser parser = ASTParser.newParser(AST.JLS3); - parser.setKind(ASTParser.K_EXPRESSION); - parser.setSource(source); - parser.setSourceRange(expression.getStartPosition(), expression.getLength()); - parser.setCompilerOptions(JavaScriptCore.getOptions()); - ASTNode result2 = parser.createAST(null); - assertNotNull("No node", result2); - assertTrue("not a method invocation", result2.getNodeType() == ASTNode.FUNCTION_INVOCATION); - assertTrue(expression.subtreeMatch(new ASTMatcher(), result2)); - ASTNode root = result2.getRoot(); - assertNotNull("No root", root); - assertTrue("not a compilation unit", root.getNodeType() == ASTNode.JAVASCRIPT_UNIT); - JavaScriptUnit compilationUnit = (JavaScriptUnit) root; - assertEquals("wrong problem size", 0, compilationUnit.getProblems().length); - assertNotNull("No comments", compilationUnit.getCommentList()); - assertEquals("Wrong size", 1, compilationUnit.getCommentList().size()); - } - /** - * Ensure an OperationCanceledException is correcly thrown when progress monitor is canceled - * @deprecated using deprecated code - */ - public void test0521() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0521", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - - // count the number of time isCanceled() is called when converting this source unit - WorkingCopyOwner owner = new WorkingCopyOwner() {}; - CancelCounter counter = new CancelCounter(); - ASTParser parser = ASTParser.newParser(AST.JLS2); - parser.setSource(sourceUnit); - parser.setResolveBindings(true); - parser.setWorkingCopyOwner(owner); - parser.createAST(counter); - - // throw an OperatonCanceledException at each point isCanceled() is called - for (int i = 0; i < counter.count; i++) { - boolean gotException = false; - try { - parser = ASTParser.newParser(AST.JLS2); - parser.setSource(sourceUnit); - parser.setResolveBindings(true); - parser.setWorkingCopyOwner(owner); - parser.createAST(new Canceler(i)); - } catch (OperationCanceledException e) { - gotException = true; - } - assertTrue("Should get an OperationCanceledException (" + i + ")", gotException); - } - - // last should not throw an OperationCanceledException - parser = ASTParser.newParser(AST.JLS2); - parser.setSource(sourceUnit); - parser.setResolveBindings(true); - parser.setWorkingCopyOwner(owner); - parser.createAST(new Canceler(counter.count)); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292 - */ - public void test0522() throws JavaScriptModelException { - IClassFile classFile = getClassFile("Converter" , "bins", "test0522", "Test.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - assertNotNull(classFile); - assertNotNull(classFile.getSource()); - IType type = classFile.getType(); - assertNotNull(type); - IFunction[] methods = type.getFunctions(); - assertNotNull(methods); - assertEquals("wrong size", 2, methods.length); - IFunction method = methods[1]; - ISourceRange sourceRange = method.getSourceRange(); - ASTNode result = runConversion(AST.JLS3, classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, true); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier()); - IFunctionBinding methodBinding = methodDeclaration.resolveBinding(); - assertNotNull(methodBinding); - List statements = ((FunctionDeclaration) node).getBody().statements(); - assertEquals("wrong size", 2, statements.size()); - ASTNode node2 = (ASTNode) statements.get(1); - assertNotNull(node2); - assertTrue("Not an expression statement", node2.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node2; - Expression expression = expressionStatement.getExpression(); - assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - Expression expression2 = methodInvocation.getExpression(); - assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$ - SimpleName simpleName = (SimpleName) expression2; - IBinding binding = simpleName.resolveBinding(); - assertNotNull("No binding", binding); //$NON-NLS-1$ - assertTrue("wrong type", binding.getKind() == IBinding.VARIABLE); //$NON-NLS-1$ - IVariableBinding variableBinding = (IVariableBinding) binding; - assertEquals("Wrong name", "a", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - SimpleName simpleName2 = methodInvocation.getName(); - assertEquals("Wrong name", "clone", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$ - IBinding binding2 = simpleName2.resolveBinding(); - assertNotNull("no binding2", binding2); //$NON-NLS-1$ - assertTrue("Wrong type", binding2.getKind() == IBinding.METHOD); //$NON-NLS-1$ - IFunctionBinding methodBinding2 = (IFunctionBinding) binding2; - assertEquals("Wrong name", "clone", methodBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292 - */ - public void test0523() throws JavaScriptModelException { - IClassFile classFile = getClassFile("Converter" , "bins", "test0523", "Test.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - assertNotNull(classFile); - assertNotNull(classFile.getSource()); - IType type = classFile.getType(); - assertNotNull(type); - IFunction[] methods = type.getFunctions(); - assertNotNull(methods); - assertEquals("wrong size", 2, methods.length); - IFunction method = methods[1]; - ISourceRange sourceRange = method.getSourceRange(); - ASTNode result = runConversion(AST.JLS3, classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, false); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier()); - List statements = ((FunctionDeclaration) node).getBody().statements(); - assertEquals("wrong size", 2, statements.size()); - ASTNode node2 = (ASTNode) statements.get(1); - assertNotNull(node2); - assertTrue("Not an expression statement", node2.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ - ExpressionStatement expressionStatement = (ExpressionStatement) node2; - Expression expression = expressionStatement.getExpression(); - assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - Expression expression2 = methodInvocation.getExpression(); - assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$ - SimpleName simpleName = (SimpleName) expression2; - IBinding binding = simpleName.resolveBinding(); - assertNull("No binding", binding); //$NON-NLS-1$ - SimpleName simpleName2 = methodInvocation.getName(); - assertEquals("Wrong name", "clone", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292 - */ - public void test0524() throws JavaScriptModelException { - IClassFile classFile = getClassFile("Converter" , "bins", "test0524", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - assertNotNull(classFile); - assertNotNull(classFile.getSource()); - IType type = classFile.getType(); - assertNotNull(type); - IFunction[] methods = type.getFunctions(); - assertNotNull(methods); - assertEquals("wrong size", 2, methods.length); - IFunction method = methods[1]; - ISourceRange sourceRange = method.getSourceRange(); - ASTNode result = runConversion(AST.JLS3, classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, false); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier()); - List statements = ((FunctionDeclaration) node).getBody().statements(); - assertEquals("wrong size", 1, statements.size()); - ASTNode node2 = (ASTNode) statements.get(0); - assertNotNull(node2); - assertTrue("Not an variable declaration statement", node2.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292 - */ - public void test0525() throws JavaScriptModelException { - IClassFile classFile = getClassFile("Converter" , "bins", "test0525", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - assertNotNull(classFile); - assertNotNull(classFile.getSource()); - IType type = classFile.getType(); - assertNotNull(type); - IFunction[] methods = type.getFunctions(); - assertNotNull(methods); - assertEquals("wrong size", 2, methods.length); - IFunction method = methods[1]; - ISourceRange sourceRange = method.getSourceRange(); - ASTNode result = runConversion(AST.JLS3, classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, true); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier()); - List statements = ((FunctionDeclaration) node).getBody().statements(); - assertEquals("wrong size", 1, statements.size()); - ASTNode node2 = (ASTNode) statements.get(0); - assertNotNull(node2); - assertTrue("Not an variable declaration statement", node2.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement statement = (VariableDeclarationStatement) node2; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertTrue("Not a class instance creation", expression.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression; - ITypeBinding typeBinding = classInstanceCreation.resolveTypeBinding(); - assertNotNull(typeBinding); - } - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292 - */ - public void test0526() throws JavaScriptModelException { - IClassFile classFile = getClassFile("Converter" , "bins", "test0526", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - assertNotNull(classFile); - assertNotNull(classFile.getSource()); - IType type = classFile.getType(); - assertNotNull(type); - IType[] memberTypes = type.getTypes(); - assertNotNull(memberTypes); - assertEquals("wrong size", 1, memberTypes.length); - IType memberType = memberTypes[0]; - IFunction[] methods = memberType.getFunctions(); - assertEquals("wrong size", 2, methods.length); - IFunction method = methods[1]; - ISourceRange sourceRange = method.getSourceRange(); - ASTNode result = runConversion(AST.JLS3, classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, true); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier()); - List statements = ((FunctionDeclaration) node).getBody().statements(); - assertEquals("wrong size", 1, statements.size()); - ASTNode node2 = (ASTNode) statements.get(0); - assertNotNull(node2); - assertTrue("Not an variable declaration statement", node2.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement statement = (VariableDeclarationStatement) node2; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertTrue("Not a class instance creation", expression.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression; - ITypeBinding typeBinding = classInstanceCreation.resolveTypeBinding(); - assertNotNull(typeBinding); - assertTrue(typeBinding.isAnonymous()); - assertEquals("Wrong name", "", typeBinding.getName()); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292 - */ - public void test0527() throws JavaScriptModelException { - IClassFile classFile = getClassFile("Converter" , "bins", "test0527", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - assertNotNull(classFile); - assertNotNull(classFile.getSource()); - IType type = classFile.getType(); - assertNotNull(type); - IFunction[] methods = type.getFunctions(); - assertEquals("wrong size", 1, methods.length); - IFunction method = methods[0]; - ISourceRange sourceRange = method.getSourceRange(); - ASTNode result = runConversion(AST.JLS3, classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, true); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertEquals("wrong name", "A", methodDeclaration.getName().getIdentifier()); - assertTrue("Not a constructor", methodDeclaration.isConstructor()); - IBinding binding = methodDeclaration.getName().resolveBinding(); - assertNotNull(binding); - assertEquals("Wrong type", IBinding.METHOD, binding.getKind()); - List statements = ((FunctionDeclaration) node).getBody().statements(); - assertEquals("wrong size", 1, statements.size()); - ASTNode node2 = (ASTNode) statements.get(0); - assertNotNull(node2); - assertTrue("Not an variable declaration statement", node2.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$ - VariableDeclarationStatement statement = (VariableDeclarationStatement) node2; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertTrue("Not a class instance creation", expression.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression; - ITypeBinding typeBinding = classInstanceCreation.resolveTypeBinding(); - assertNotNull(typeBinding); - assertTrue(typeBinding.isAnonymous()); - assertEquals("Wrong name", "", typeBinding.getName()); - } - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292 - */ - public void test0528() throws JavaScriptModelException { - IClassFile classFile = getClassFile("Converter" , "bins", "test0528", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - assertNotNull(classFile); - assertNotNull(classFile.getSource()); - IType type = classFile.getType(); - IType[] memberTypes = type.getTypes(); - assertNotNull(memberTypes); - assertEquals("wrong size", 1, memberTypes.length); - IType memberType = memberTypes[0]; - ISourceRange sourceRange = memberType.getSourceRange(); - ASTNode result = runConversion(AST.JLS3, classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, true); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - assertEquals("wrong name", "B", typeDeclaration.getName().getIdentifier()); - List bodyDeclarations = typeDeclaration.bodyDeclarations(); - assertEquals("Wrong size", 1, bodyDeclarations.size()); - BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); - assertTrue("Not a method declaration", bodyDeclaration.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration; - Block block = methodDeclaration.getBody(); - List statements = block.statements(); - assertEquals("Wrong size", 1, statements.size()); - } - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292 - */ - public void test0529() throws JavaScriptModelException { - IClassFile classFile = getClassFile("Converter" , "bins", "test0529", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - assertNotNull(classFile); - assertNotNull(classFile.getSource()); - IType type = classFile.getType(); - IType[] memberTypes = type.getTypes(); - assertNotNull(memberTypes); - assertEquals("wrong size", 1, memberTypes.length); - IType memberType = memberTypes[0]; - ISourceRange sourceRange = memberType.getSourceRange(); - ASTNode result = runConversion(AST.JLS3, classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, false); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - assertEquals("wrong name", "B", typeDeclaration.getName().getIdentifier()); - List bodyDeclarations = typeDeclaration.bodyDeclarations(); - assertEquals("Wrong size", 1, bodyDeclarations.size()); - BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); - assertTrue("Not a method declaration", bodyDeclaration.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration; - Block block = methodDeclaration.getBody(); - List statements = block.statements(); - assertEquals("Wrong size", 1, statements.size()); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292 - */ - public void test0530() throws JavaScriptModelException { - IClassFile classFile = getClassFile("Converter" , "bins", "test0530", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - assertNotNull(classFile); - assertNotNull(classFile.getSource()); - IType type = classFile.getType(); - IFunction[] methods = type.getFunctions(); - assertEquals("wrong size", 3, methods.length); - IFunction method = methods[2]; - ISourceRange sourceRange = method.getSourceRange(); - ASTNode result = runConversion(AST.JLS3, classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, false); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 2); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - Block block = methodDeclaration.getBody(); - List statements = block.statements(); - assertEquals("Wrong size", 2, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 1); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - methodDeclaration = (FunctionDeclaration) node; - block = methodDeclaration.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - } - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292 - */ - public void test0531() throws JavaScriptModelException { - IClassFile classFile = getClassFile("Converter" , "bins", "test0531", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - assertNotNull(classFile); - assertNotNull(classFile.getSource()); - IType type = classFile.getType(); - IFunction[] methods = type.getFunctions(); - assertEquals("wrong size", 5, methods.length); - IFunction method = methods[3]; - ISourceRange sourceRange = method.getSourceRange(); - ASTNode result = runConversion(AST.JLS3, classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, false); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 5); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - Block block = methodDeclaration.getBody(); - List statements = block.statements(); - assertEquals("Wrong size", 2, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 4); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - methodDeclaration = (FunctionDeclaration) node; - block = methodDeclaration.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - List fragments = fieldDeclaration.fragments(); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertEquals("Wrong name", "field", fragment.getName().getIdentifier()); - assertNotNull("No initializer", expression); - - node = getASTNode((JavaScriptUnit) result, 0, 1); - assertTrue("Not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$ - fieldDeclaration = (FieldDeclaration) node; - fragments = fieldDeclaration.fragments(); - fragment = (VariableDeclarationFragment) fragments.get(0); - expression = fragment.getInitializer(); - assertEquals("Wrong name", "i", fragment.getName().getIdentifier()); - assertNotNull("No initializer", expression); - - node = getASTNode((JavaScriptUnit) result, 0, 2); - assertTrue("Not an initializer", node.getNodeType() == ASTNode.INITIALIZER); //$NON-NLS-1$ - Initializer initializer = (Initializer) node; - assertEquals("Not static", Modifier.NONE, initializer.getModifiers()); - block = initializer.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 3); - assertTrue("Not an initializer", node.getNodeType() == ASTNode.INITIALIZER); //$NON-NLS-1$ - initializer = (Initializer) node; - assertEquals("Not static", Modifier.STATIC, initializer.getModifiers()); - block = initializer.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 6); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - methodDeclaration = (FunctionDeclaration) node; - block = methodDeclaration.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292 - */ - public void test0532() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0488", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - IType[] types = sourceUnit.getTypes(); - assertNotNull(types); - assertEquals("wrong size", 1, types.length); - IType type = types[0]; - IInitializer[] initializers = type.getInitializers(); - assertEquals("wrong size", 2, initializers.length); - IInitializer init = initializers[1]; - ISourceRange sourceRange = init.getSourceRange(); - int position = sourceRange.getOffset() + sourceRange.getLength() / 2; - - IClassFile classFile = getClassFile("Converter" , "bins", "test0532", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - assertNotNull(classFile); - assertNotNull(classFile.getSource()); - type = classFile.getType(); - initializers = type.getInitializers(); - assertEquals("wrong size", 0, initializers.length); - ASTNode result = runConversion(AST.JLS3, classFile, position, false); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$ - - ASTNode node = getASTNode((JavaScriptUnit) result, 0, 5); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - Block block = methodDeclaration.getBody(); - List statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 4); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - methodDeclaration = (FunctionDeclaration) node; - block = methodDeclaration.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 0); - assertTrue("Not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - List fragments = fieldDeclaration.fragments(); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertEquals("Wrong name", "field", fragment.getName().getIdentifier()); - assertNotNull("No initializer", expression); - - node = getASTNode((JavaScriptUnit) result, 0, 1); - assertTrue("Not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$ - fieldDeclaration = (FieldDeclaration) node; - fragments = fieldDeclaration.fragments(); - fragment = (VariableDeclarationFragment) fragments.get(0); - expression = fragment.getInitializer(); - assertEquals("Wrong name", "i", fragment.getName().getIdentifier()); - assertNotNull("No initializer", expression); - - node = getASTNode((JavaScriptUnit) result, 0, 2); - assertTrue("Not an initializer", node.getNodeType() == ASTNode.INITIALIZER); //$NON-NLS-1$ - Initializer initializer = (Initializer) node; - assertEquals("Not static", Modifier.NONE, initializer.getModifiers()); - block = initializer.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 3); - assertTrue("Not an initializer", node.getNodeType() == ASTNode.INITIALIZER); //$NON-NLS-1$ - initializer = (Initializer) node; - assertEquals("Not static", Modifier.STATIC, initializer.getModifiers()); - block = initializer.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 1, statements.size()); - - node = getASTNode((JavaScriptUnit) result, 0, 6); - assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$ - methodDeclaration = (FunctionDeclaration) node; - block = methodDeclaration.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 0, statements.size()); - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=48489 - * @deprecated using deprecated code - */ - public void test0533() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0533", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0); - assertNotNull("No node", node); - assertTrue("not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); - FunctionDeclaration declaration = (FunctionDeclaration) node; - ASTParser parser = ASTParser.newParser(AST.JLS2); - parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS); - parser.setSource(source); - parser.setSourceRange(declaration.getStartPosition(), declaration.getLength()); - parser.setCompilerOptions(JavaScriptCore.getOptions()); - ASTNode result2 = parser.createAST(null); - assertNotNull("No node", result2); - assertTrue("not a compilation unit", result2.getNodeType() == ASTNode.JAVASCRIPT_UNIT); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result2; - assertEquals("wrong problem size", 1, compilationUnit.getProblems().length); - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=48489 - * @deprecated using deprecated code - */ - public void test0534() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0534", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0); - assertNotNull("No node", node); - assertTrue("not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); - FieldDeclaration declaration = (FieldDeclaration) node; - ASTParser parser = ASTParser.newParser(AST.JLS2); - parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS); - parser.setSource(source); - parser.setSourceRange(declaration.getStartPosition(), declaration.getLength()); - parser.setCompilerOptions(JavaScriptCore.getOptions()); - ASTNode result2 = parser.createAST(null); - assertNotNull("No node", result2); - assertTrue("not a compilation unit", result2.getNodeType() == ASTNode.JAVASCRIPT_UNIT); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result2; - assertEquals("wrong problem size", 1, compilationUnit.getProblems().length); - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=48489 - * @deprecated using deprecated code - */ - public void test0535() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0535", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0); - assertNotNull("No node", node); - assertTrue("not an initializer", node.getNodeType() == ASTNode.INITIALIZER); - Initializer declaration = (Initializer) node; - ASTParser parser = ASTParser.newParser(AST.JLS2); - parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS); - parser.setSource(source); - parser.setSourceRange(declaration.getStartPosition(), declaration.getLength()); - parser.setCompilerOptions(JavaScriptCore.getOptions()); - ASTNode result2 = parser.createAST(null); - assertNotNull("No node", result2); - assertTrue("not a compilation unit", result2.getNodeType() == ASTNode.JAVASCRIPT_UNIT); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result2; - assertEquals("wrong problem size", 1, compilationUnit.getProblems().length); - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=47396 - */ - public void test0536() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0536", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - assertNotNull("No compilation unit", result); - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=51089 - */ - public void test0537a() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0537", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - assertNotNull("No compilation unit", result); - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=51089 - */ - public void test0537b() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0537", "B.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - assertNotNull("No compilation unit", result); - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=51089 - */ - public void test0537c() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0537", "C.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - assertNotNull("No compilation unit", result); - } - /** - * Ensures that an AST can be created during reconcile. - * @deprecated using deprecated code - */ - public void test0538a() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0538", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - try { - sourceUnit.becomeWorkingCopy(null); - sourceUnit.getBuffer().setContents( - "package test0538;\n" + - "public class A {\n" + - " int i;\n" + - "}" - ); - JavaScriptUnit unit = sourceUnit.reconcile(AST.JLS2, false, null, null); - assertNotNull("No level 2 compilation unit", unit); - assertEquals("Compilation unit has wrong AST level (2)", AST.JLS2, unit.getAST().apiLevel()); - // TODO improve test for AST.JLS3 - } finally { - sourceUnit.discardWorkingCopy(); - } - } - /* - * Ensures that no AST is created during reconcile if not requested. - */ - public void test0538b() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0538", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - try { - sourceUnit.becomeWorkingCopy(null); - sourceUnit.getBuffer().setContents( - "package test0538;\n" + - "public class A {\n" + - " int i;\n" + - "}" - ); - JavaScriptUnit unit = sourceUnit.reconcile(0, false, null, null); - assertNull("Unexpected compilation unit", unit); - } finally { - sourceUnit.discardWorkingCopy(); - } - } - /** - * Ensures that no AST is created during reconcile if consistent. - */ - public void test0538c() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0538", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - try { - sourceUnit.becomeWorkingCopy(null); - JavaScriptUnit unit = sourceUnit.reconcile(AST.JLS2, false, null, null); - assertNull("Unexpected compilation unit", unit); - // TODO improve test for AST.JLS3 - } finally { - sourceUnit.discardWorkingCopy(); - } - } - /** - * Ensures that bindings are created during reconcile if the problem requestor is active. - */ - public void test0538d() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0538", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - try { - sourceUnit.becomeWorkingCopy(null); - sourceUnit.getBuffer().setContents( - "package test0538;\n" + - "public class A {\n" + - " Object field;\n" + - "}" - ); - // TODO improve test for AST.JLS3 - JavaScriptUnit unit = sourceUnit.reconcile(AST.JLS2, false, null, null); - ASTNode node = getASTNode(unit, 0, 0); - assertNotNull("No node", node); - assertTrue("Not original", isOriginal(node)); - assertTrue("not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); - FieldDeclaration declaration = (FieldDeclaration) node; - Type type = declaration.getType(); - ITypeBinding typeBinding = type.resolveBinding(); - assertNotNull("No type binding", typeBinding); - assertEquals("Wrong name", "Object", typeBinding.getName()); - } finally { - sourceUnit.discardWorkingCopy(); - } - } - /** - * Ensures that bindings are created during reconcile if force problem detection is turned on. - * @deprecated using deprecated code - */ - public void test0538e() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0538", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - try { - ReconcilerTests.ProblemRequestor pbRequestor = new ReconcilerTests.ProblemRequestor(); - sourceUnit.becomeWorkingCopy(null); - // TODO improve test for AST.JLS3 - JavaScriptUnit unit = sourceUnit.reconcile(AST.JLS2, true/*force pb detection*/, null, null); - ASTNode node = getASTNode(unit, 0); - assertNotNull("No node", node); - assertTrue("not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); - TypeDeclaration declaration = (TypeDeclaration) node; - ITypeBinding typeBinding = declaration.resolveBinding(); - assertNotNull("No type binding", typeBinding); - assertEquals("Wrong name", "A", typeBinding.getName()); - } finally { - sourceUnit.discardWorkingCopy(); - } - } - /** - * Ensures that bindings are created during reconcile if force problem detection is turned on. - * Case of a unit containing an anonymous type. - * (regression test for bug 55102 NPE when using ICU.reconcile(GET_AST_TRUE, ...)) - * @deprecated using deprecated code - */ - public void test0538f() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0538", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - try { - ReconcilerTests.ProblemRequestor pbRequestor = new ReconcilerTests.ProblemRequestor(); - sourceUnit.becomeWorkingCopy(null); - sourceUnit.getBuffer().setContents( - "package test0538;\n" + - "public class A {\n" + - " void foo() {\n" + - " new Object() {\n" + - " void bar() {\n" + - " }\n" + - " };\n" + - " }\n" + - "}" - ); - // TODO improve test for AST.JLS3 - JavaScriptUnit unit = sourceUnit.reconcile(AST.JLS2, true/*force pb detection*/, null, null); - ASTNode node = getASTNode(unit, 0); - assertNotNull("No node", node); - } finally { - sourceUnit.discardWorkingCopy(); - } - } - /** - * Ensures that bindings are created during reconcile if force problem detection is turned on. - * Case of a unit containing an anonymous type. - * (regression test for bug 55102 NPE when using ICU.reconcile(GET_AST_TRUE, ...)) - * @deprecated using deprecated code - */ - public void test0538g() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0538", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - try { - ReconcilerTests.ProblemRequestor pbRequestor = new ReconcilerTests.ProblemRequestor(); - sourceUnit.becomeWorkingCopy(null); - sourceUnit.getBuffer().setContents( - "package test0538;\n" + - "public class A {\n" + - " void foo() {\n" + - " new Object() {\n" + - " void bar() {\n" + - " }\n" + - " };\n" + - " }\n" + - "}" - ); - sourceUnit.reconcile(IJavaScriptUnit.NO_AST, false/* don't force pb detection*/, null, null); - // TODO improve test for AST.JLS3 - JavaScriptUnit unit = sourceUnit.reconcile(AST.JLS2, true/*force pb detection*/, null, null); - ASTNode node = getASTNode(unit, 0); - assertNotNull("No node", node); - } finally { - sourceUnit.discardWorkingCopy(); - } - } - /** - * Ensures that asking for well known type doesn't throw a NPE if the problem requestor is not active. - * (regression test for bug 64750 NPE in Java AST Creation - editing some random file) - * @deprecated using deprecated code - */ - public void test0538h() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0538", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - try { - ReconcilerTests.ProblemRequestor pbRequestor = new ReconcilerTests.ProblemRequestor() { - public boolean isActive() { - return false; - } - }; - sourceUnit.becomeWorkingCopy(null); - sourceUnit.getBuffer().setContents( - "package test0538;\n" + - "public class A {\n" + - " Object field;\n" + - "}" - ); - // TODO improve test for AST.JLS3 - JavaScriptUnit unit = sourceUnit.reconcile(AST.JLS2, false, null, null); - assertEquals("Unexpected well known type", null, unit.getAST().resolveWellKnownType("void")); - } finally { - sourceUnit.discardWorkingCopy(); - } - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=53477 - */ - public void test0539() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0539", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 1, 0); - assertNotNull("No node", node); - assertTrue("not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertTrue("not a class instance creation", expression.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression; - checkSourceRange(classInstanceCreation, "new A(){}.new Inner(){/*x*/}", source); - AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration(); - Expression expression2 = classInstanceCreation.getExpression(); - assertTrue("not a class instance creation", expression2.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); - ClassInstanceCreation classInstanceCreation2 = (ClassInstanceCreation) expression2; - AnonymousClassDeclaration anonymousClassDeclaration2 = classInstanceCreation2.getAnonymousClassDeclaration(); - assertNotNull("No anonymous class declaration", anonymousClassDeclaration2); - checkSourceRange(anonymousClassDeclaration2, "{}", source); - assertNotNull("No anonymous class declaration", anonymousClassDeclaration); - checkSourceRange(anonymousClassDeclaration, "{/*x*/}", source); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=54431 - */ - public void test0540() { - char[] source = - ("package test0540;\n" + //$NON-NLS-1$ - "\n" + //$NON-NLS-1$ - "class Test {\n" + //$NON-NLS-1$ - " public void foo(int arg) {\n" +//$NON-NLS-1$ - " assert true;\n" +//$NON-NLS-1$ - " }\n" + //$NON-NLS-1$ - "}").toCharArray(); //$NON-NLS-1$ - IJavaScriptProject project = getJavaProject("Converter"); //$NON-NLS-1$ - Map options = project.getOptions(true); - options.put(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_4); - options.put(JavaScriptCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaScriptCore.VERSION_1_4); - options.put(JavaScriptCore.COMPILER_COMPLIANCE, JavaScriptCore.VERSION_1_4); - ASTNode result = runConversion(AST.JLS3, source, "Test.js", project, options, true); //$NON-NLS-1$ - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertEquals("Problems found", 0, compilationUnit.getProblems().length); - ASTNode node = getASTNode(compilationUnit, 0); - assertTrue("not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertNotNull("No type binding", typeBinding); //$NON-NLS-1$ - assertEquals("Wrong name", "Test", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Wrong package", "test0540", typeBinding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue("Not an interface", typeBinding.isClass()); //$NON-NLS-1$ - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=56697 - */ - public void test0541() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0541", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0); - assertEquals("not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType()); - class Change14FieldAccessASTVisitor extends ASTVisitor { - int counter; - Change14FieldAccessASTVisitor() { - counter = 0; - } - public void endVisit(QualifiedName qualifiedName) { - IBinding i_binding = qualifiedName.getQualifier().resolveBinding(); - ITypeBinding type_binding = qualifiedName.getQualifier().resolveTypeBinding(); - if (i_binding == null || type_binding == null) { - counter++; - } - } - } - Change14FieldAccessASTVisitor visitor = new Change14FieldAccessASTVisitor(); - unit.accept(visitor); - assertEquals("Missing binding", 0, visitor.counter); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=55004 - */ - public void test0542() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0542", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0); - assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - assertEquals("Wrong name", "STRING_FIELD", variableBinding.getName()); - Object constantValue = variableBinding.getConstantValue(); - assertNotNull("No constant", constantValue); - assertEquals("Wrong value", "Hello world!", constantValue); - Expression initializer = fragment.getInitializer(); - assertNotNull("No initializer", initializer); - checkSourceRange(initializer, "\"Hello world!\"", source); - - node = getASTNode(unit, 0, 1); - assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - fieldDeclaration = (FieldDeclaration) node; - fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - fragment = (VariableDeclarationFragment) fragments.get(0); - variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - assertEquals("Wrong name", "BOOLEAN_FIELD", variableBinding.getName()); - constantValue = variableBinding.getConstantValue(); - assertNotNull("No constant", constantValue); - assertEquals("Wrong value", new Boolean(true), constantValue); - initializer = fragment.getInitializer(); - assertNotNull("No initializer", initializer); - checkSourceRange(initializer, "true", source); - - node = getASTNode(unit, 0, 2); - assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - fieldDeclaration = (FieldDeclaration) node; - fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - fragment = (VariableDeclarationFragment) fragments.get(0); - variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - assertEquals("Wrong name", "BYTE_FIELD", variableBinding.getName()); - constantValue = variableBinding.getConstantValue(); - assertNotNull("No constant", constantValue); - assertEquals("Wrong value", new Byte((byte)1), constantValue); - initializer = fragment.getInitializer(); - assertNotNull("No initializer", initializer); - checkSourceRange(initializer, "1", source); - - node = getASTNode(unit, 0, 3); - assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - fieldDeclaration = (FieldDeclaration) node; - fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - fragment = (VariableDeclarationFragment) fragments.get(0); - variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - assertEquals("Wrong name", "CHAR_FIELD", variableBinding.getName()); - constantValue = variableBinding.getConstantValue(); - assertNotNull("No constant", constantValue); - assertEquals("Wrong value", new Character('{'), constantValue); - initializer = fragment.getInitializer(); - assertNotNull("No initializer", initializer); - checkSourceRange(initializer, "\'{\'", source); - - node = getASTNode(unit, 0, 4); - assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - fieldDeclaration = (FieldDeclaration) node; - fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - fragment = (VariableDeclarationFragment) fragments.get(0); - variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - assertEquals("Wrong name", "DOUBLE_FIELD", variableBinding.getName()); - constantValue = variableBinding.getConstantValue(); - assertNotNull("No constant", constantValue); - assertEquals("Wrong value", new Double("3.1415"), constantValue); - initializer = fragment.getInitializer(); - assertNotNull("No initializer", initializer); - checkSourceRange(initializer, "3.1415", source); - - node = getASTNode(unit, 0, 5); - assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - fieldDeclaration = (FieldDeclaration) node; - fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - fragment = (VariableDeclarationFragment) fragments.get(0); - variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - assertEquals("Wrong name", "FLOAT_FIELD", variableBinding.getName()); - constantValue = variableBinding.getConstantValue(); - assertNotNull("No constant", constantValue); - assertEquals("Wrong value", new Float("3.14159f"), constantValue); - initializer = fragment.getInitializer(); - assertNotNull("No initializer", initializer); - checkSourceRange(initializer, "3.14159f", source); - - node = getASTNode(unit, 0, 6); - assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - fieldDeclaration = (FieldDeclaration) node; - fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - fragment = (VariableDeclarationFragment) fragments.get(0); - variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - assertEquals("Wrong name", "INT_FIELD", variableBinding.getName()); - constantValue = variableBinding.getConstantValue(); - assertNotNull("No constant", constantValue); - assertEquals("Wrong value", Integer.valueOf("7fffffff", 16), constantValue); - initializer = fragment.getInitializer(); - assertNotNull("No initializer", initializer); - checkSourceRange(initializer, "Integer.MAX_VALUE", source); - - node = getASTNode(unit, 0, 7); - assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - fieldDeclaration = (FieldDeclaration) node; - fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - fragment = (VariableDeclarationFragment) fragments.get(0); - variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - assertEquals("Wrong name", "LONG_FIELD", variableBinding.getName()); - constantValue = variableBinding.getConstantValue(); - assertNotNull("No constant", constantValue); - assertEquals("Wrong value", new Long("34"), constantValue); - initializer = fragment.getInitializer(); - assertNotNull("No initializer", initializer); - checkSourceRange(initializer, "34L", source); - - node = getASTNode(unit, 0, 8); - assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - fieldDeclaration = (FieldDeclaration) node; - fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - fragment = (VariableDeclarationFragment) fragments.get(0); - variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - assertEquals("Wrong name", "SHORT_FIELD", variableBinding.getName()); - constantValue = variableBinding.getConstantValue(); - assertNotNull("No constant", constantValue); - assertEquals("Wrong value", new Short("130"), constantValue); - initializer = fragment.getInitializer(); - assertNotNull("No initializer", initializer); - checkSourceRange(initializer, "130", source); - - node = getASTNode(unit, 0, 9); - assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$ - fieldDeclaration = (FieldDeclaration) node; - fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - fragment = (VariableDeclarationFragment) fragments.get(0); - variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - assertEquals("Wrong name", "int_field", variableBinding.getName()); - constantValue = variableBinding.getConstantValue(); - assertNull("Got a constant", constantValue); - initializer = fragment.getInitializer(); - assertNotNull("No initializer", initializer); - checkSourceRange(initializer, "Integer.MAX_VALUE", source); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=58436 - */ - public void test0543() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0543", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - unit.accept(new GetKeyVisitor()); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=51500 - */ - public void test0544() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0544", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0); - assertEquals("not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType()); //$NON-NLS-1$ - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertTrue("Not an abstract method", (methodDeclaration.getModifiers() & Modifier.ABSTRACT) != 0); - IFunctionBinding methodBinding = methodDeclaration.resolveBinding(); - assertNotNull("No binding", methodBinding); - assertTrue("Not an abstract method binding", (methodBinding.getModifiers() & Modifier.ABSTRACT) != 0); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=59843 - */ - public void test0545() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0545", "First.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0); - assertEquals("not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType()); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertEquals("Wrong key", "Ltest0545/First$Test;", typeBinding.getKey()); - - sourceUnit = getCompilationUnit("Converter", "src", "test0545", "Second.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - result = runConversion(AST.JLS3, sourceUnit, true); - unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - node = getASTNode(unit, 0, 0); - assertEquals("not a method declaration", ASTNode.TYPE_DECLARATION, node.getNodeType()); //$NON-NLS-1$ - typeDeclaration = (TypeDeclaration) node; - typeBinding = typeDeclaration.resolveBinding(); - assertEquals("Wrong key", "Ltest0545/Second$Test;", typeBinding.getKey()); - - sourceUnit = getCompilationUnit("Converter", "src", "test0545", "Third.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - result = runConversion(AST.JLS3, sourceUnit, true); - unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - node = getASTNode(unit, 0, 0); - assertEquals("not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType()); //$NON-NLS-1$ - typeDeclaration = (TypeDeclaration) node; - typeBinding = typeDeclaration.resolveBinding(); - assertEquals("Wrong key", "Ltest0545/Third$Test;", typeBinding.getKey()); - - - sourceUnit = getCompilationUnit("Converter", "src", "test0545", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - result = runConversion(AST.JLS3, sourceUnit, true); - unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - node = getASTNode(unit, 0); - assertEquals("not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType()); //$NON-NLS-1$ - typeDeclaration = (TypeDeclaration) node; - typeBinding = typeDeclaration.resolveBinding(); - assertEquals("Wrong key", "Ltest0545/Test;", typeBinding.getKey()); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=59848 - */ - public void test0546() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0546", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 1, 0, 0); - assertEquals("not a variable declaration", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType()); //$NON-NLS-1$ - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node; - List fragments = variableDeclarationStatement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - ITypeBinding typeBinding = variableBinding.getType(); - assertTrue("An anonymous type binding", !typeBinding.isAnonymous()); - Expression initializer = fragment.getInitializer(); - assertEquals("not a class instance creation", ASTNode.CLASS_INSTANCE_CREATION, initializer.getNodeType()); //$NON-NLS-1$ - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) initializer; - AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration(); - ITypeBinding typeBinding2 = anonymousClassDeclaration.resolveBinding(); - assertTrue("Not an anonymous type binding", typeBinding2.isAnonymous()); - ITypeBinding typeBinding3 = classInstanceCreation.resolveTypeBinding(); - assertTrue("Not an anonymous type binding", typeBinding3.isAnonymous()); - node = getASTNode(unit, 1, 0, 1); - assertEquals("not a expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType()); //$NON-NLS-1$ - ExpressionStatement statement = (ExpressionStatement) node; - Expression expression = statement.getExpression(); - assertEquals("not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType()); //$NON-NLS-1$ - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - Expression expression2 = methodInvocation.getExpression(); - assertEquals("not a simple name", ASTNode.SIMPLE_NAME, expression2.getNodeType()); //$NON-NLS-1$ - SimpleName simpleName = (SimpleName) expression2; - ITypeBinding typeBinding4 = simpleName.resolveTypeBinding(); - assertTrue("An anonymous type binding", !typeBinding4.isAnonymous()); - Type type = classInstanceCreation.getType(); - IBinding binding = type.resolveBinding(); - assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); - ITypeBinding typeBinding5 = (ITypeBinding) binding; - assertTrue("An anonymous type binding", !typeBinding5.isAnonymous()); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=60078 - */ - public void test0547() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0547", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - JavaScriptUnit unit = (JavaScriptUnit) result; - assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("not a type declaration statement", ASTNode.TYPE_DECLARATION_STATEMENT, node.getNodeType()); //$NON-NLS-1$ - TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) node; - AbstractTypeDeclaration typeDeclaration = typeDeclarationStatement.getDeclaration(); - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertEquals("Wrong key", "Ltest0547/A$74$Local;", typeBinding.getKey()); - - List bodyDeclarations = typeDeclaration.bodyDeclarations(); - assertEquals("wrong size", 3, bodyDeclarations.size()); - BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); - assertEquals("not a type declaration statement", ASTNode.TYPE_DECLARATION, bodyDeclaration.getNodeType()); //$NON-NLS-1$ - TypeDeclaration typeDeclaration2 = (TypeDeclaration) bodyDeclaration; - - typeBinding = typeDeclaration2.resolveBinding(); - assertEquals("Wrong key", "Ltest0547/A$100$LocalMember;", typeBinding.getKey()); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=60581 - */ - public void test0548() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0548", "PaletteStackEditPart.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48502 - */ - public void test0549() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0549", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48502 - */ - public void test0550() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0550", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=60848 - */ - public void test0551() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0551", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 1, problems.length); //$NON-NLS-1$ - IProblem problem = problems[0]; - assertEquals("wrong end position", source.length - 1, problem.getSourceEnd()); - } - - public void test0552() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0552", "Test.js"); - char[] source = sourceUnit.getSource().toCharArray(); - JavaScriptUnit result = (JavaScriptUnit) runConversion(AST.JLS3, sourceUnit, true); - assertEquals("Got errors", 0, result.getProblems().length); - TypeDeclaration declaration = (TypeDeclaration) result.types().get(0); - Block body = declaration.getMethods()[0].getBody(); - ExpressionStatement expr = (ExpressionStatement) body.statements().get(0); - FunctionInvocation invocation = (FunctionInvocation) expr.getExpression(); - InfixExpression node = (InfixExpression) invocation.arguments().get(0); - ITypeBinding typeBinding = node.resolveTypeBinding(); - assertEquals("wrong type", "java.lang.String", typeBinding.getQualifiedName()); - checkSourceRange(node, "\"a\" + \"a\" + \"a\"", source); - List extendedOperands = node.extendedOperands(); - assertEquals("Wrong size", 1, extendedOperands.size()); - Expression leftOperand = node.getLeftOperand(); - checkSourceRange(leftOperand, "\"a\"", source); - typeBinding = leftOperand.resolveTypeBinding(); - assertEquals("wrong type", "java.lang.String", typeBinding.getQualifiedName()); - Expression rightOperand = node.getRightOperand(); - checkSourceRange(rightOperand, "\"a\"", source); - typeBinding = rightOperand.resolveTypeBinding(); - assertEquals("wrong type", "java.lang.String", typeBinding.getQualifiedName()); - Expression expression = (Expression) extendedOperands.get(0); - checkSourceRange(expression, "\"a\"", source); - typeBinding = expression.resolveTypeBinding(); - assertEquals("wrong type", "java.lang.String", typeBinding.getQualifiedName()); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=61946 - */ - public void test0553() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0553", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0); - assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType()); - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - Object constantValue = variableBinding.getConstantValue(); - assertNull("Got a constant value", constantValue); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=61946 - */ - public void test0554() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0554", "B.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a return statement", ASTNode.RETURN_STATEMENT, node.getNodeType()); - ReturnStatement returnStatement = (ReturnStatement) node; - Expression expression = returnStatement.getExpression(); - assertNotNull("No expression", expression); - assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType()); - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - Expression expression2 = methodInvocation.getExpression(); - checkSourceRange(expression2, "A", source); - ITypeBinding typeBinding = expression2.resolveTypeBinding(); - assertEquals("wrong type", "test0554.A", typeBinding.getQualifiedName()); - IVariableBinding[] fields = typeBinding.getDeclaredFields(); - assertEquals("Wrong size", 1, fields.length); - IVariableBinding variableBinding = fields[0]; - Object constantValue = variableBinding.getConstantValue(); - assertNotNull("Missing constant", constantValue); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=61946 - */ - public void test0555() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0555", "B.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a return statement", ASTNode.RETURN_STATEMENT, node.getNodeType()); - ReturnStatement returnStatement = (ReturnStatement) node; - Expression expression = returnStatement.getExpression(); - assertNotNull("No expression", expression); - assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, expression.getNodeType()); - QualifiedName qualifiedName = (QualifiedName) expression; - Name name = qualifiedName.getQualifier(); - checkSourceRange(name, "A", source); - ITypeBinding typeBinding = name.resolveTypeBinding(); - assertEquals("wrong type", "test0555.A", typeBinding.getQualifiedName()); - IVariableBinding[] fields = typeBinding.getDeclaredFields(); - assertEquals("Wrong size", 1, fields.length); - IVariableBinding variableBinding = fields[0]; - Object constantValue = variableBinding.getConstantValue(); - assertNotNull("No constant value", constantValue); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=62463 - */ - public void test0556() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0556", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 1, 0); - assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType()); - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertEquals("Not an method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType()); - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - Expression expression2 = methodInvocation.getExpression(); - checkSourceRange(expression2, "(aa.bar())", source); - SimpleName simpleName = methodInvocation.getName(); - checkSourceRange(simpleName, "size", source); - checkSourceRange(expression, "(aa.bar()).size()", source); - checkSourceRange(expressionStatement, "(aa.bar()).size();", source); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=62463 - */ - public void test0557() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0557", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 1, 0); - assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType()); - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertEquals("Not an method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType()); - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - Expression expression2 = methodInvocation.getExpression(); - checkSourceRange(expression2, "(aa.bar())", source); - SimpleName simpleName = methodInvocation.getName(); - checkSourceRange(simpleName, "get", source); - checkSourceRange(expression, "(aa.bar()).get(0)", source); - checkSourceRange(expressionStatement, "(aa.bar()).get(0);", source); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65090 - * @deprecated using deprecated code - */ - public void test0558() { - String src = "\tSystem.out.println(\"Hello\");\n\tSystem.out.println(\"World\");\n"; - char[] source = src.toCharArray(); - ASTParser parser = ASTParser.newParser(AST.JLS2); - parser.setKind (ASTParser.K_STATEMENTS); - parser.setSource (source); - ASTNode result = parser.createAST (null); - assertNotNull("no result", result); - assertEquals("Wrong type", ASTNode.BLOCK, result.getNodeType()); - Block block = (Block) result; - List statements = block.statements(); - assertNotNull("No statements", statements); - assertEquals("Wrong size", 2, statements.size()); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562 - */ - public void test0559() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0559", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType()); - IfStatement ifStatement = (IfStatement) node; - Expression expression = ifStatement.getExpression(); - assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType()); - InfixExpression infixExpression = (InfixExpression) expression; - Expression expression2 = infixExpression.getLeftOperand(); - assertEquals("Wrong type", ASTNode.FUNCTION_INVOCATION, expression2.getNodeType()); - FunctionInvocation methodInvocation = (FunctionInvocation) expression2; - Expression expression3 = methodInvocation.getExpression(); - assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType()); - ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3; - Expression expression4 = parenthesizedExpression.getExpression(); - assertEquals("Wrong type", ASTNode.STRING_LITERAL, expression4.getNodeType()); - checkSourceRange(expression4, "\" \"", source); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562 - */ - public void test0560() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0560", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType()); - IfStatement ifStatement = (IfStatement) node; - Expression expression = ifStatement.getExpression(); - assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType()); - InfixExpression infixExpression = (InfixExpression) expression; - Expression expression2 = infixExpression.getLeftOperand(); - assertEquals("Wrong type", ASTNode.FUNCTION_INVOCATION, expression2.getNodeType()); - FunctionInvocation methodInvocation = (FunctionInvocation) expression2; - Expression expression3 = methodInvocation.getExpression(); - assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType()); - ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3; - Expression expression4 = parenthesizedExpression.getExpression(); - assertEquals("Wrong type", ASTNode.STRING_LITERAL, expression4.getNodeType()); - checkSourceRange(expression4, "\" \"", source); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562 - */ - public void test0561() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0561", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType()); - IfStatement ifStatement = (IfStatement) node; - Expression expression = ifStatement.getExpression(); - assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType()); - InfixExpression infixExpression = (InfixExpression) expression; - Expression expression2 = infixExpression.getLeftOperand(); - assertEquals("Wrong type", ASTNode.FUNCTION_INVOCATION, expression2.getNodeType()); - FunctionInvocation methodInvocation = (FunctionInvocation) expression2; - Expression expression3 = methodInvocation.getExpression(); - assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType()); - ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3; - Expression expression4 = parenthesizedExpression.getExpression(); - assertEquals("Wrong type", ASTNode.STRING_LITERAL, expression4.getNodeType()); - checkSourceRange(expression4, "\" \"", source); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562 - */ - public void test0562() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0562", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType()); - IfStatement ifStatement = (IfStatement) node; - Expression expression = ifStatement.getExpression(); - assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType()); - InfixExpression infixExpression = (InfixExpression) expression; - Expression expression2 = infixExpression.getLeftOperand(); - assertEquals("Wrong type", ASTNode.FUNCTION_INVOCATION, expression2.getNodeType()); - FunctionInvocation methodInvocation = (FunctionInvocation) expression2; - Expression expression3 = methodInvocation.getExpression(); - assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType()); - ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3; - Expression expression4 = parenthesizedExpression.getExpression(); - assertEquals("Wrong type", ASTNode.STRING_LITERAL, expression4.getNodeType()); - checkSourceRange(expression4, "\" \"", source); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562 - */ - public void test0563() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0563", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType()); - IfStatement ifStatement = (IfStatement) node; - Expression expression = ifStatement.getExpression(); - assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType()); - InfixExpression infixExpression = (InfixExpression) expression; - Expression expression2 = infixExpression.getLeftOperand(); - assertEquals("Wrong type", ASTNode.FUNCTION_INVOCATION, expression2.getNodeType()); - FunctionInvocation methodInvocation = (FunctionInvocation) expression2; - Expression expression3 = methodInvocation.getExpression(); - assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType()); - ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3; - Expression expression4 = parenthesizedExpression.getExpression(); - checkSourceRange(expression4, "new String()", source); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562 - */ - public void test0564() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0564", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType()); - IfStatement ifStatement = (IfStatement) node; - Expression expression = ifStatement.getExpression(); - assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType()); - InfixExpression infixExpression = (InfixExpression) expression; - Expression expression2 = infixExpression.getLeftOperand(); - assertEquals("Wrong type", ASTNode.FUNCTION_INVOCATION, expression2.getNodeType()); - FunctionInvocation methodInvocation = (FunctionInvocation) expression2; - Expression expression3 = methodInvocation.getExpression(); - assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType()); - ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3; - Expression expression4 = parenthesizedExpression.getExpression(); - checkSourceRange(expression4, "new String()", source); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562 - */ - public void test0565() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0565", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0, 0); - assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType()); - IfStatement ifStatement = (IfStatement) node; - Expression expression = ifStatement.getExpression(); - assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType()); - InfixExpression infixExpression = (InfixExpression) expression; - Expression expression2 = infixExpression.getLeftOperand(); - assertEquals("Wrong type", ASTNode.FUNCTION_INVOCATION, expression2.getNodeType()); - FunctionInvocation methodInvocation = (FunctionInvocation) expression2; - Expression expression3 = methodInvocation.getExpression(); - assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType()); - ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3; - Expression expression4 = parenthesizedExpression.getExpression(); - checkSourceRange(expression4, "(/**/ String /**/) new String()", source); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=69349 - */ - public void test0566() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0566", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0); - assertEquals("Wrong type", ASTNode.FUNCTION_DECLARATION, node.getNodeType()); - assertEquals("Wrong character", '}', source[node.getStartPosition() + node.getLength() - 1]); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=69349 - */ - public void test0567() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0567", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0); - assertEquals("Wrong type", ASTNode.FUNCTION_DECLARATION, node.getNodeType()); - assertEquals("Wrong character", '}', source[node.getStartPosition() + node.getLength() - 1]); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=70398 - */ - public void test0568() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0568", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=70398 - */ - public void test0570() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0570", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - } - - /** - * No binding when there is no unit name set - */ - public void test0571() throws JavaScriptModelException { - ASTParser parser = ASTParser.newParser(AST.JLS3); - String source = "public class A {public boolean foo() {}}"; - parser.setSource(source.toCharArray()); - parser.setProject(getJavaProject("Converter")); - // no unit name parser.setUnitName("A"); - parser.setResolveBindings(true); - ASTNode node = parser.createAST(null); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) node; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - } - - /** - * No binding when there is no unit name set - */ - public void test0572() throws JavaScriptModelException { - ASTParser parser = ASTParser.newParser(AST.JLS3); - String source = "public class A {public boolean foo() {}}"; - parser.setSource(source.toCharArray()); - parser.setProject(getJavaProject("Converter")); - parser.setUnitName("A"); - parser.setResolveBindings(true); - ASTNode node = parser.createAST(null); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) node; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 1, problems.length); //$NON-NLS-1$ - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=77968 - */ - public void test0573() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0573", "Z.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - String source = sourceUnit.getSource(); - int pos = source.indexOf("his.ba"); - ASTNode result = runConversion(AST.JLS3, sourceUnit, pos, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - ASTNode node = getASTNode(unit, 0, 0, 0); - assertNotNull("Missing node", node); - assertEquals("Wrong type", ASTNode.EXPRESSION_STATEMENT, node.getNodeType()); - ExpressionStatement expressionStatement = (ExpressionStatement) node; - Expression expression = expressionStatement.getExpression(); - assertNotNull("Missing node", expression); - assertEquals("Wrong type", ASTNode.FUNCTION_INVOCATION, expression.getNodeType()); - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 1, problems.length); //$NON-NLS-1$ - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78735 - */ - public void test0574() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0574", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 0); - assertNotNull("Missing node", node); - assertEquals("Wrong type", ASTNode.FIELD_DECLARATION, node.getNodeType()); - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - node = getASTNode(unit, 0, 1, 0); - assertNotNull("Missing node", node); - assertEquals("Wrong type", ASTNode.FIELD_DECLARATION, node.getNodeType()); - fieldDeclaration = (FieldDeclaration) node; - fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding2 = fragment.resolveBinding(); - assertFalse("are Equals", variableBinding.isEqualTo(variableBinding2)); - } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78735 - */ - public void test0575() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0575", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - final IProblem[] problems = unit.getProblems(); - assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$ - ASTNode node = getASTNode(unit, 0, 2); - assertNotNull("Missing node", node); - assertEquals("Wrong type", ASTNode.FUNCTION_DECLARATION, node.getNodeType()); - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - IFunctionBinding methodBinding = methodDeclaration.resolveBinding(); - node = getASTNode(unit, 0, 1, 1); - assertNotNull("Missing node", node); - assertEquals("Wrong type", ASTNode.FUNCTION_DECLARATION, node.getNodeType()); - methodDeclaration = (FunctionDeclaration) node; - IFunctionBinding methodBinding2 = methodDeclaration.resolveBinding(); - assertFalse("are Equals", methodBinding.isEqualTo(methodBinding2)); - } - -// /** -// * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78740 -// * @deprecated marked deprecated to suppress JDOM-related deprecation warnings -// */ -// public void test0576() throws JavaScriptModelException { -// org.eclipse.wst.jsdt.core.jdom.DOMFactory factory = new org.eclipse.wst.jsdt.core.jdom.DOMFactory(); -// org.eclipse.wst.jsdt.core.jdom.IDOMCompilationUnit domCompilationUnit = factory.createCompilationUnit( -// "package x; /** @model */ interface X {}", "NAME"); -// org.eclipse.wst.jsdt.core.jdom.IDOMType domType = (org.eclipse.wst.jsdt.core.jdom.IDOMType) domCompilationUnit.getFirstChild().getNextNode(); -// assertTrue("Not an interface", Flags.isInterface(domType.getFlags())); -// domType.getComment(); -// assertTrue("Not an interface", Flags.isInterface(domType.getFlags())); -// } - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=77645 - */ - public void test0578() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0578", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertProblemsSize(unit, 0); - unit.accept(new ASTVisitor() { - /* (non-Javadoc) - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#visit(org.eclipse.wst.jsdt.core.dom.SingleVariableDeclaration) - */ - public boolean visit(SingleVariableDeclaration node) { - IVariableBinding binding = node.resolveBinding(); - assertNotNull("No method", binding.getDeclaringMethod()); - return false; - } - /* (non-Javadoc) - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#visit(org.eclipse.wst.jsdt.core.dom.VariableDeclarationFragment) - */ - public boolean visit(VariableDeclarationFragment node) { - IVariableBinding binding = node.resolveBinding(); - ASTNode parent = node.getParent(); - if (parent != null && binding != null) { - final IFunctionBinding declaringMethod = binding.getDeclaringMethod(); - final String variableBindingName = binding.getName(); - switch(parent.getNodeType()) { - case ASTNode.FIELD_DECLARATION : - assertNull("Got a method", declaringMethod); - break; - default : - if (variableBindingName.equals("var1") - || variableBindingName.equals("var2")) { - assertNull("Got a method", declaringMethod); - } else { - assertNotNull("No method", declaringMethod); - String methodName = declaringMethod.getName(); - if (variableBindingName.equals("var4")) { - assertEquals("Wrong method", "foo", methodName); - } else if (variableBindingName.equals("var5")) { - assertEquals("Wrong method", "foo2", methodName); - } else if (variableBindingName.equals("var7")) { - assertEquals("Wrong method", "foo3", methodName); - } else if (variableBindingName.equals("var8")) { - assertEquals("Wrong method", "X", methodName); - } else if (variableBindingName.equals("var9")) { - assertEquals("Wrong method", "bar3", methodName); - } else if (variableBindingName.equals("var10")) { - assertEquals("Wrong method", "bar3", methodName); - } else if (variableBindingName.equals("var11")) { - assertEquals("Wrong method", "X", methodName); - } - } - } - } - return false; - } - /* (non-Javadoc) - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#visit(org.eclipse.wst.jsdt.core.dom.FieldAccess) - */ - public boolean visit(FieldAccess node) { - IVariableBinding binding = node.resolveFieldBinding(); - assertNull("No method", binding.getDeclaringMethod()); - return false; - } - /* (non-Javadoc) - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.SuperFieldAccess) - */ - public boolean visit(SuperFieldAccess node) { - IVariableBinding binding = node.resolveFieldBinding(); - assertNull("No method", binding.getDeclaringMethod()); - return false; - } - }); - } - -// /** -// * https://bugs.eclipse.org/bugs/show_bug.cgi?id=77984 -// * @deprecated -// */ -// public void test0579() throws JavaScriptModelException { -// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0579", "ParserTask.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ -// ASTNode result = AST.parseCompilationUnit(sourceUnit, true); -// assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ -// JavaScriptUnit compilationUnit = (JavaScriptUnit) result; -// ASTNode node = getASTNode(compilationUnit, 0); -// assertEquals("not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType()); //$NON-NLS-1$ -// TypeDeclaration typeDeclaration = (TypeDeclaration) node; -// assertEquals("Wrong number of body declarations", 3, typeDeclaration.bodyDeclarations().size()); -// } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=79953 - */ - public void test0580() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - workingCopy = getWorkingCopy("/Converter/src/p/X.js", true/*resolve*/); - String source = "package p;\n" + - "public class X {\n" + - " d String[][]tab;\n" + - "}"; - ASTNode node = buildAST( - source, - workingCopy, - false); - assertEquals("wrong type", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit compilationUnit = (JavaScriptUnit) node; - node = getASTNode(compilationUnit, 0, 0); - assertEquals("wrong type", ASTNode.FIELD_DECLARATION, node.getNodeType()); - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - checkSourceRange(fieldDeclaration, "d String[][]", source.toCharArray()); - Type type = fieldDeclaration.getType(); - assertTrue("Not a simple type", type.isSimpleType()); - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - assertEquals("Wrong extended dimensions", 2, fragment.getExtraDimensions()); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=80041 - */ - public void test0581() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - workingCopy = getWorkingCopy("/Converter/src/p/X.js", true/*resolve*/); - ASTNode node = buildAST( - "package p;\n" + - "public class X {\n" + - " void m(Object obj) {}\n" + - " void foo(Object obj) {}\n" + - "}", - workingCopy); - assertEquals("wrong type", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit compilationUnit = (JavaScriptUnit) node; - node = getASTNode(compilationUnit, 0, 0); - assertEquals("wrong type", ASTNode.FUNCTION_DECLARATION, node.getNodeType()); - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - List parameters = methodDeclaration.parameters(); - SingleVariableDeclaration variableDeclaration = (SingleVariableDeclaration) parameters.get(0); - IVariableBinding variableBinding = variableDeclaration.resolveBinding(); - node = getASTNode(compilationUnit, 0, 1); - assertEquals("wrong type", ASTNode.FUNCTION_DECLARATION, node.getNodeType()); - methodDeclaration = (FunctionDeclaration) node; - parameters = methodDeclaration.parameters(); - variableDeclaration = (SingleVariableDeclaration) parameters.get(0); - IVariableBinding variableBinding2 = variableDeclaration.resolveBinding(); - assertFalse("Bindings are equal", variableBinding.isEqualTo(variableBinding2)); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=80338 - */ - // TODO (jerome) remove this test as it has nothing to do on ASTConverterTest and it is a dup of ExistenceTests#testMethodWithInvalidParameter() - public void test0582() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0582", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - IType[] types = sourceUnit.getTypes(); - assertEquals("wrong size", 1, types.length); - IType type = types[0]; - IFunction[] methods = type.getFunctions(); - assertEquals("wrong size", 1, methods.length); - IFunction method = methods[0]; - assertEquals("wrong number", 1, method.getNumberOfParameters()); - assertEquals("wrong signature", "([[I)[[[[[I", method.getSignature()); - assertEquals("wrong return type", "[[[[[I", method.getReturnType()); - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=82616 - */ - public void test0583() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " private char nextChar() {\n" + - " return \'\\000\';\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit compilationUnit = (JavaScriptUnit) node; - assertEquals("Got problems", 0, compilationUnit.getProblems().length); - node = getASTNode(compilationUnit, 0, 0, 0); - assertEquals("Not a return statement", ASTNode.RETURN_STATEMENT, node.getNodeType()); - ReturnStatement statement = (ReturnStatement) node; - Expression expression = statement.getExpression(); - assertEquals("Not a character literal", ASTNode.CHARACTER_LITERAL, expression.getNodeType()); - CharacterLiteral literal = (CharacterLiteral) expression; - assertEquals("Wrong character", '\000', literal.charValue()); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=82616 - */ - public void test0584() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " private char nextChar() {\n" + - " return \'\\u0020\';\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit compilationUnit = (JavaScriptUnit) node; - assertEquals("Got problems", 0, compilationUnit.getProblems().length); - node = getASTNode(compilationUnit, 0, 0, 0); - assertEquals("Not a return statement", ASTNode.RETURN_STATEMENT, node.getNodeType()); - ReturnStatement statement = (ReturnStatement) node; - Expression expression = statement.getExpression(); - assertEquals("Not a character literal", ASTNode.CHARACTER_LITERAL, expression.getNodeType()); - CharacterLiteral literal = (CharacterLiteral) expression; - assertEquals("Wrong character", 32, literal.charValue()); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=82616 - */ - public void test0585() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " private char nextChar() {\n" + - " return \'\\b\';\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit compilationUnit = (JavaScriptUnit) node; - assertEquals("Got problems", 0, compilationUnit.getProblems().length); - node = getASTNode(compilationUnit, 0, 0, 0); - assertEquals("Not a return statement", ASTNode.RETURN_STATEMENT, node.getNodeType()); - ReturnStatement statement = (ReturnStatement) node; - Expression expression = statement.getExpression(); - assertEquals("Not a character literal", ASTNode.CHARACTER_LITERAL, expression.getNodeType()); - CharacterLiteral literal = (CharacterLiteral) expression; - assertEquals("Wrong character", '\b', literal.charValue()); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=82616 - */ - public void test0586() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " private char nextChar() {\n" + - " return \'\\t\';\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit compilationUnit = (JavaScriptUnit) node; - assertEquals("Got problems", 0, compilationUnit.getProblems().length); - node = getASTNode(compilationUnit, 0, 0, 0); - assertEquals("Not a return statement", ASTNode.RETURN_STATEMENT, node.getNodeType()); - ReturnStatement statement = (ReturnStatement) node; - Expression expression = statement.getExpression(); - assertEquals("Not a character literal", ASTNode.CHARACTER_LITERAL, expression.getNodeType()); - CharacterLiteral literal = (CharacterLiteral) expression; - assertEquals("Wrong character", '\t', literal.charValue()); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=82616 - */ - public void test0587() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " private char nextChar() {\n" + - " return \'\\n\';\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit compilationUnit = (JavaScriptUnit) node; - assertEquals("Got problems", 0, compilationUnit.getProblems().length); - node = getASTNode(compilationUnit, 0, 0, 0); - assertEquals("Not a return statement", ASTNode.RETURN_STATEMENT, node.getNodeType()); - ReturnStatement statement = (ReturnStatement) node; - Expression expression = statement.getExpression(); - assertEquals("Not a character literal", ASTNode.CHARACTER_LITERAL, expression.getNodeType()); - CharacterLiteral literal = (CharacterLiteral) expression; - assertEquals("Wrong character", '\n', literal.charValue()); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=82616 - */ - public void test0588() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " private char nextChar() {\n" + - " return \'\\f\';\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit compilationUnit = (JavaScriptUnit) node; - assertEquals("Got problems", 0, compilationUnit.getProblems().length); - node = getASTNode(compilationUnit, 0, 0, 0); - assertEquals("Not a return statement", ASTNode.RETURN_STATEMENT, node.getNodeType()); - ReturnStatement statement = (ReturnStatement) node; - Expression expression = statement.getExpression(); - assertEquals("Not a character literal", ASTNode.CHARACTER_LITERAL, expression.getNodeType()); - CharacterLiteral literal = (CharacterLiteral) expression; - assertEquals("Wrong character", '\f', literal.charValue()); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=82616 - */ - public void test0589() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " private char nextChar() {\n" + - " return \'\\r\';\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit compilationUnit = (JavaScriptUnit) node; - assertEquals("Got problems", 0, compilationUnit.getProblems().length); - node = getASTNode(compilationUnit, 0, 0, 0); - assertEquals("Not a return statement", ASTNode.RETURN_STATEMENT, node.getNodeType()); - ReturnStatement statement = (ReturnStatement) node; - Expression expression = statement.getExpression(); - assertEquals("Not a character literal", ASTNode.CHARACTER_LITERAL, expression.getNodeType()); - CharacterLiteral literal = (CharacterLiteral) expression; - assertEquals("Wrong character", '\r', literal.charValue()); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=82616 - */ - public void test0590() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " private char nextChar() {\n" + - " return \'\\\"\';\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit compilationUnit = (JavaScriptUnit) node; - assertEquals("Got problems", 0, compilationUnit.getProblems().length); - node = getASTNode(compilationUnit, 0, 0, 0); - assertEquals("Not a return statement", ASTNode.RETURN_STATEMENT, node.getNodeType()); - ReturnStatement statement = (ReturnStatement) node; - Expression expression = statement.getExpression(); - assertEquals("Not a character literal", ASTNode.CHARACTER_LITERAL, expression.getNodeType()); - CharacterLiteral literal = (CharacterLiteral) expression; - assertEquals("Wrong character", '\"', literal.charValue()); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=82616 - */ - public void test0591() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " private char nextChar() {\n" + - " return \'\\'\';\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit compilationUnit = (JavaScriptUnit) node; - assertEquals("Got problems", 0, compilationUnit.getProblems().length); - node = getASTNode(compilationUnit, 0, 0, 0); - assertEquals("Not a return statement", ASTNode.RETURN_STATEMENT, node.getNodeType()); - ReturnStatement statement = (ReturnStatement) node; - Expression expression = statement.getExpression(); - assertEquals("Not a character literal", ASTNode.CHARACTER_LITERAL, expression.getNodeType()); - CharacterLiteral literal = (CharacterLiteral) expression; - assertEquals("Wrong character", '\'', literal.charValue()); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=82616 - */ - public void test0592() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " private char nextChar() {\n" + - " return \'\\\\\';\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit compilationUnit = (JavaScriptUnit) node; - assertEquals("Got problems", 0, compilationUnit.getProblems().length); - node = getASTNode(compilationUnit, 0, 0, 0); - assertEquals("Not a return statement", ASTNode.RETURN_STATEMENT, node.getNodeType()); - ReturnStatement statement = (ReturnStatement) node; - Expression expression = statement.getExpression(); - assertEquals("Not a character literal", ASTNode.CHARACTER_LITERAL, expression.getNodeType()); - CharacterLiteral literal = (CharacterLiteral) expression; - assertEquals("Wrong character", '\\', literal.charValue()); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=82616 - */ - public void test0593() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " private char nextChar() {\n" + - " return \'\\077\';\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit compilationUnit = (JavaScriptUnit) node; - assertEquals("Got problems", 0, compilationUnit.getProblems().length); - node = getASTNode(compilationUnit, 0, 0, 0); - assertEquals("Not a return statement", ASTNode.RETURN_STATEMENT, node.getNodeType()); - ReturnStatement statement = (ReturnStatement) node; - Expression expression = statement.getExpression(); - assertEquals("Not a character literal", ASTNode.CHARACTER_LITERAL, expression.getNodeType()); - CharacterLiteral literal = (CharacterLiteral) expression; - assertEquals("Wrong character", '\077', literal.charValue()); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=82616 - */ - public void test0594() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " private char nextChar() {\n" + - " return \'\\777\';\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - false); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit compilationUnit = (JavaScriptUnit) node; - assertEquals("Got problems", 1, compilationUnit.getProblems().length); - node = getASTNode(compilationUnit, 0, 0); - assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType()); - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertTrue("not malformed", isMalformed(methodDeclaration)); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=82985 - */ - public void test0595() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0595", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runJLS3Conversion(sourceUnit, true, false); - assertNotNull(result); - assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - assertProblemsSize(compilationUnit, 0); - List imports = compilationUnit.imports(); - assertEquals("Wrong size", 1, imports.size()); - ImportDeclaration importDeclaration = (ImportDeclaration) imports.get(0); - IBinding binding = importDeclaration.resolveBinding(); - assertNotNull("No binding", binding); - assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=83098 - */ - public void test0596() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " void m(String[] args) {\n" + - " for (int i= 0; i < args.length; i++) {\n" + - " String string= args[i];\n" + - " }\n" + - " for (int i= 0; i < args.length; i++) {\n" + - " String string= args[i];\n" + - " }\n" + - " }\n" + - "}\n"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit compilationUnit = (JavaScriptUnit) node; - assertEquals("Got problems", 0, compilationUnit.getProblems().length); - node = getASTNode(compilationUnit, 0, 0, 0); - assertEquals("Not a for statement", ASTNode.FOR_STATEMENT, node.getNodeType()); - ForStatement forStatement = (ForStatement) node; - Statement action = forStatement.getBody(); - assertEquals("Not a block", ASTNode.BLOCK, action.getNodeType()); - Block block = (Block) action; - List statements = block.statements(); - assertEquals("Wrong size", 1, statements.size()); - Statement statement = (Statement) statements.get(0); - assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, statement.getNodeType()); - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) statement; - List fragments = variableDeclarationStatement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - - node = getASTNode(compilationUnit, 0, 0, 1); - assertEquals("Not a for statement", ASTNode.FOR_STATEMENT, node.getNodeType()); - forStatement = (ForStatement) node; - action = forStatement.getBody(); - assertEquals("Not a block", ASTNode.BLOCK, action.getNodeType()); - block = (Block) action; - statements = block.statements(); - assertEquals("Wrong size", 1, statements.size()); - statement = (Statement) statements.get(0); - assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, statement.getNodeType()); - variableDeclarationStatement = (VariableDeclarationStatement) statement; - fragments = variableDeclarationStatement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding2 = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding2); - - assertFalse("Bindings are equals", variableBinding.isEqualTo(variableBinding2)); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=83210 - */ - public void test0597() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0597", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode node = runJLS3Conversion(sourceUnit, true, false); - assertNotNull(node); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit compilationUnit = (JavaScriptUnit) node; - assertProblemsSize(compilationUnit, 0); - node = getASTNode(compilationUnit, 0, 0, 0); - assertEquals("Not an if statement", ASTNode.IF_STATEMENT, node.getNodeType()); - IfStatement ifStatement = (IfStatement) node; - Expression expression = ifStatement.getExpression(); - assertEquals("Not an instanceof expression", ASTNode.INSTANCEOF_EXPRESSION, expression.getNodeType()); - InstanceofExpression instanceofExpression = (InstanceofExpression) expression; - Type type = instanceofExpression.getRightOperand(); - assertEquals("Not a simple type", ASTNode.SIMPLE_TYPE, type.getNodeType()); - SimpleType simpleType = (SimpleType) type; - Name name = simpleType.getName(); - assertEquals("Not a simple name", ASTNode.SIMPLE_NAME, name.getNodeType()); - SimpleName simpleName = (SimpleName) name; - ITypeBinding typeBinding = simpleName.resolveTypeBinding(); - - List imports = compilationUnit.imports(); - assertEquals("Wrong size", 2, imports.size()); - ImportDeclaration importDeclaration = (ImportDeclaration) imports.get(0); - name = importDeclaration.getName(); - assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, name.getNodeType()); - QualifiedName qualifiedName = (QualifiedName) name; - simpleName = qualifiedName.getName(); - ITypeBinding typeBinding2 = simpleName.resolveTypeBinding(); - - assertTrue("not identical", typeBinding == typeBinding2); - assertTrue("not identical", typeBinding.isEqualTo(typeBinding2)); - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=84778 - */ - public void test0598() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " int m(int i) {\n" + - " return /*start*/1 + 2 + ++i/*end*/;\n" + - " }\n" + - "}\n"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy); - assertEquals("Not an infix expression", ASTNode.INFIX_EXPRESSION, node.getNodeType()); - assertEquals("Wrong debug string", "1 + 2 + ++i", node.toString()); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=86541 - */ - public void test0599() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0599", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode node = runJLS3Conversion(sourceUnit, true, false); - assertNotNull(node); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit compilationUnit = (JavaScriptUnit) node; - String expectedResult = - "The hierarchy of the type X is inconsistent\n" + - "The type test0599.Zork2 cannot be resolved. It is indirectly referenced from required .class files"; - assertProblemsSize(compilationUnit, 2, expectedResult); - compilationUnit.accept(new ASTVisitor() { - public void endVisit(FunctionDeclaration methodDeclaration) { - Block body = methodDeclaration.getBody(); - assertNotNull("No body", body); - assertTrue("No statements", body.statements().size() != 0); - } - }); - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=87777 - */ - public void test0600() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0600", "Try.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode node = runJLS3Conversion(sourceUnit, true, false); - assertNotNull(node); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit compilationUnit = (JavaScriptUnit) node; - assertProblemsSize(compilationUnit, 0); - node = getASTNode(compilationUnit, 0, 0, 0); - assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType()); - ExpressionStatement statement = (ExpressionStatement) node; - Expression expression = statement.getExpression(); - assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType()); - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - IFunctionBinding methodBinding = methodInvocation.resolveMethodBinding().getMethodDeclaration(); - - sourceUnit = getCompilationUnit("Converter" , "src", "test0600", "C.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - node = runJLS3Conversion(sourceUnit, true, false); - assertNotNull(node); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - compilationUnit = (JavaScriptUnit) node; - assertProblemsSize(compilationUnit, 0); - node = getASTNode(compilationUnit, 0, 0); - assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType()); - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - IFunctionBinding methodBinding2 = methodDeclaration.resolveBinding().getMethodDeclaration(); - - assertTrue("Not equals", methodBinding.isEqualTo(methodBinding2)); - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=89014 - */ - public void test0601() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " Runnable one= new Runnable(){\n" + - " public void run() {\n" + - " }\n" + - " };\n" + - " Runnable two= new Runnable(){\n" + - " public void run() {\n" + - " }\n" + - " };\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit compilationUnit = (JavaScriptUnit) node; - assertProblemsSize(compilationUnit, 0); - node = getASTNode(compilationUnit, 0, 0); - assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType()); - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertEquals("Not a class instance creation", ASTNode.CLASS_INSTANCE_CREATION, expression.getNodeType()); - ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression; - AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration(); - assertNotNull("No anonymous", anonymousClassDeclaration); - List bodyDeclarations = anonymousClassDeclaration.bodyDeclarations(); - assertEquals("Wrong size", 1, bodyDeclarations.size()); - BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); - assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, bodyDeclaration.getNodeType()); - FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration; - IFunctionBinding methodBinding = methodDeclaration.resolveBinding(); - - node = getASTNode(compilationUnit, 0, 1); - assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType()); - fieldDeclaration = (FieldDeclaration) node; - fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - fragment = (VariableDeclarationFragment) fragments.get(0); - expression = fragment.getInitializer(); - assertEquals("Not a class instance creation", ASTNode.CLASS_INSTANCE_CREATION, expression.getNodeType()); - classInstanceCreation = (ClassInstanceCreation) expression; - anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration(); - assertNotNull("No anonymous", anonymousClassDeclaration); - bodyDeclarations = anonymousClassDeclaration.bodyDeclarations(); - assertEquals("Wrong size", 1, bodyDeclarations.size()); - bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); - assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, bodyDeclaration.getNodeType()); - methodDeclaration = (FunctionDeclaration) bodyDeclaration; - IFunctionBinding methodBinding2 = methodDeclaration.resolveBinding(); - - assertFalse("Bindings are equals", methodBinding.isEqualTo(methodBinding2)); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=70526 - */ - public void test0602() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0602", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode node = runJLS3Conversion(sourceUnit, true, false); - assertNotNull(node); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit compilationUnit = (JavaScriptUnit) node; - assertProblemsSize(compilationUnit, 0); - compilationUnit.accept(new ASTVisitor() { - public boolean visit(StringLiteral stringLiteral) { - assertTrue("Wrong start position", stringLiteral.getStartPosition() != 0); - assertTrue("Wrong length", stringLiteral.getLength() != -1); - return false; - } - }); - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=91098 - */ - public void test0603() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0603", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode node = runJLS3Conversion(sourceUnit, true, false); - assertNotNull(node); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit compilationUnit = (JavaScriptUnit) node; - assertProblemsSize(compilationUnit, 0); - assertProblemsSize(compilationUnit, 0); - compilationUnit.accept(new ASTVisitor() { - public boolean visit(SimpleType type) { - assertFalse("start cannot be -1", type.getStartPosition() == -1); - assertFalse("length cannot be 0", type.getLength() == 0); - return false; - } - public boolean visit(ArrayType type) { - assertFalse("start cannot be -1", type.getStartPosition() == -1); - assertFalse("length cannot be 0", type.getLength() == 0); - return true; - } - }); - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=91098 - */ - public void test0604() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0604", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode node = runJLS3Conversion(sourceUnit, true, false); - assertNotNull(node); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit compilationUnit = (JavaScriptUnit) node; - assertProblemsSize(compilationUnit, 0); - assertProblemsSize(compilationUnit, 0); - compilationUnit.accept(new ASTVisitor() { - public boolean visit(SimpleType type) { - assertFalse("start cannot be -1", type.getStartPosition() == -1); - assertFalse("length cannot be 0", type.getLength() == 0); - return false; - } - public boolean visit(ArrayType type) { - assertFalse("start cannot be -1", type.getStartPosition() == -1); - assertFalse("length cannot be 0", type.getLength() == 0); - return true; - } - }); - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=92059 - * check resolvedType binding from variable ref (of array type) - */ - public void test0605() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0605", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode node = runJLS3Conversion(sourceUnit, true, false); - assertNotNull(node); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit compilationUnit = (JavaScriptUnit) node; - assertProblemsSize(compilationUnit, 0); - node = getASTNode(compilationUnit, 0, 0, 1); - assertEquals("Not a variable declaration", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType()); - VariableDeclarationStatement varDecl = (VariableDeclarationStatement) node; - List fragments = varDecl.fragments(); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, expression.getNodeType()); - IBinding arraylength = ((QualifiedName)expression).resolveBinding(); - IJavaScriptElement element = arraylength.getJavaElement(); - assertNull("Shouldn't be binding for arraylength", element); - Name name = ((QualifiedName) expression).getQualifier(); - assertEquals("Not a simple name", ASTNode.SIMPLE_NAME, name.getNodeType()); - ITypeBinding binding = name.resolveTypeBinding(); - assertNotNull("No binding", binding); - assertTrue("No array", binding.isArray()); - - node = getASTNode(compilationUnit, 0, 0, 4); - assertEquals("Not a variable declaration", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType()); - varDecl = (VariableDeclarationStatement) node; - fragments = varDecl.fragments(); - fragment = (VariableDeclarationFragment) fragments.get(0); - expression = fragment.getInitializer(); - assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, expression.getNodeType()); - name = ((QualifiedName) expression).getQualifier(); - assertEquals("Not a simple name", ASTNode.QUALIFIED_NAME, name.getNodeType()); - name = ((QualifiedName) name).getName(); - assertEquals("Not a simple name", ASTNode.SIMPLE_NAME, name.getNodeType()); - ITypeBinding binding2 = name.resolveTypeBinding(); - assertNotNull("No binding", binding2); - assertTrue("No array", binding2.isArray()); - - assertEquals("Not same binding", binding, binding2); - - node = getASTNode(compilationUnit, 0, 0, 2); - assertEquals("Not a variable declaration", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType()); - varDecl = (VariableDeclarationStatement) node; - fragments = varDecl.fragments(); - fragment = (VariableDeclarationFragment) fragments.get(0); - expression = fragment.getInitializer(); - assertEquals("Not a qualified name", ASTNode.FIELD_ACCESS, expression.getNodeType()); - expression = ((FieldAccess) expression).getExpression(); - assertEquals("Not a simple name", ASTNode.FIELD_ACCESS, expression.getNodeType()); - name = ((FieldAccess) expression).getName(); - assertEquals("Not a simple name", ASTNode.SIMPLE_NAME, name.getNodeType()); - ITypeBinding binding3 = name.resolveTypeBinding(); - assertNotNull("No binding", binding3); - assertTrue("No array", binding3.isArray()); - - assertEquals("Not same binding", binding, binding3); - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=89014 - */ - public void test0606() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " public static void main(String[] args) {\n" + - " int i = 0;\n" + - " i += 1;\n" + - " String s = \"\";\n" + - " s += \"hello world\";\n" + - " System.out.println(i+s);\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit compilationUnit = (JavaScriptUnit) node; - assertProblemsSize(compilationUnit, 0); - node = getASTNode(compilationUnit, 0, 0, 1); - assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType()); - Expression expression = ((ExpressionStatement) node).getExpression(); - assertEquals("Not an assignment", ASTNode.ASSIGNMENT, expression.getNodeType()); - Assignment assignment = (Assignment) expression; - assertEquals("Wrong operator", Assignment.Operator.PLUS_ASSIGN, assignment.getOperator()); - ITypeBinding typeBinding = assignment.resolveTypeBinding(); - assertNotNull("No binding", typeBinding); - assertEquals("Wrong type", "int", typeBinding.getQualifiedName()); - - node = getASTNode(compilationUnit, 0, 0, 3); - assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType()); - expression = ((ExpressionStatement) node).getExpression(); - assertEquals("Not an assignment", ASTNode.ASSIGNMENT, expression.getNodeType()); - assignment = (Assignment) expression; - assertEquals("Wrong operator", Assignment.Operator.PLUS_ASSIGN, assignment.getOperator()); - typeBinding = assignment.resolveTypeBinding(); - assertNotNull("No binding", typeBinding); - assertEquals("Wrong type", "java.lang.String", typeBinding.getQualifiedName()); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=95262 - */ - public void test0607() throws JavaScriptModelException { - final char[] source = "private static Category[] values = new Category[]{v1, v2, v3};".toCharArray(); - ASTParser parser = ASTParser.newParser(AST.JLS3); - parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS); - parser.setSource(source); - ASTNode root = parser.createAST(null); - assertNotNull("cannot be null", root); - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=96698 - */ - public void test0608() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " public static void main(String[] args) {\n" + - " for (int /*start*/i = 0/*end*/; i < args.length; i++) {\n" + - " System.out.println(args[i]);\n" + - " }\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy); - assertEquals("Not a variable declaration fragment", ASTNode.VARIABLE_DECLARATION_FRAGMENT, node.getNodeType()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) node; - IVariableBinding variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - IJavaScriptElement javaElement = variableBinding.getJavaElement(); - assertNotNull("No java element", javaElement); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=96698 - */ - public void test0609() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " public static void main(String[] args) {\n" + - " int /*start*/i = 0/*end*/;\n" + - " System.out.println(i);\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy); - assertEquals("Not a variable declaration fragment", ASTNode.VARIABLE_DECLARATION_FRAGMENT, node.getNodeType()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) node; - IVariableBinding variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - IJavaScriptElement javaElement = variableBinding.getJavaElement(); - assertNotNull("No java element", javaElement); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=98088 - */ - public void test0610() throws JavaScriptModelException { - final IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0610", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - final ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit unit = (JavaScriptUnit) result; - assertProblemsSize(unit, 1, "The type Test is deprecated"); - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=96698 - */ - public void test0611() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "abstract class SearchPattern {\n" + - "}\n" + - "class InternalSearchPattern extends SearchPattern {\n" + - " boolean mustResolve;\n" + - "}\n" + - "public class X {\n" + - " public static final int POSSIBLE_MATCH = 0;\n" + - " public static final int ACCURATE_MATCH = 1;\n" + - " \n" + - " public void foo(SearchPattern pattern) {\n" + - " int declarationLevel = ((InternalSearchPattern) pattern).mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH;\n" + - " System.out.println(declarationLevel);\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - assertProblemsSize(unit, 0); - node = getASTNode(unit, 2, 2, 0); - assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType()); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - checkSourceRange(expression, "((InternalSearchPattern) pattern).mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH", contents); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - public void test0612() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " void foo(boolean[]value) {\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - assertProblemsSize(unit, 0); - node = getASTNode(unit, 0, 0); - assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType()); - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - List parameters = methodDeclaration.parameters(); - assertEquals("Wrong size", 1, parameters.size()); - SingleVariableDeclaration variableDeclaration = (SingleVariableDeclaration) parameters.get(0); - checkSourceRange(variableDeclaration, "boolean[]value", contents); - Type type = variableDeclaration.getType(); - checkSourceRange(type, "boolean[]", contents); - assertTrue("Not an array type", type.isArrayType()); - ArrayType arrayType = (ArrayType) type; - Type componentType = arrayType.getComponentType(); - assertTrue("Not a primitive type", componentType.isPrimitiveType()); - PrimitiveType primitiveType = (PrimitiveType) componentType; - assertEquals("Not boolean", PrimitiveType.BOOLEAN, primitiveType.getPrimitiveTypeCode()); - checkSourceRange(primitiveType, "boolean", contents); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - public void test0613() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " void foo(boolean b) {\n" + - " Zork z = null;\n" + - " if (b) {\n" + - " System.out.println(z);\n" + - " }\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - false); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - assertProblemsSize(unit, 1, "Zork cannot be resolved to a type"); - node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType()); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding binding = fragment.resolveBinding(); - assertNull("Got a binding", binding); - - node = getASTNode(unit, 0, 0, 1); - assertEquals("Not an if statement", ASTNode.IF_STATEMENT, node.getNodeType()); - IfStatement ifStatement = (IfStatement) node; - Statement statement2 = ifStatement.getThenStatement(); - assertEquals("Not a block", ASTNode.BLOCK, statement2.getNodeType()); - Block block = (Block) statement2; - List statements = block.statements(); - assertEquals("Wrong size", 1, statements.size()); - - Statement statement3 = (Statement) statements.get(0); - assertEquals("Not a expression statement", ASTNode.EXPRESSION_STATEMENT, statement3.getNodeType()); - ExpressionStatement expressionStatement = (ExpressionStatement) statement3; - Expression expression = expressionStatement.getExpression(); - assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType()); - FunctionInvocation methodInvocation = (FunctionInvocation) expression; - List arguments = methodInvocation.arguments(); - assertEquals("Wrong size", 1, arguments.size()); - Expression expression2 = (Expression) arguments.get(0); - ITypeBinding typeBinding = expression2.resolveTypeBinding(); - assertNull("Got a binding", typeBinding); - assertEquals("Not a simple name", ASTNode.SIMPLE_NAME, expression2.getNodeType()); - SimpleName simpleName = (SimpleName) expression2; - IBinding binding2 = simpleName.resolveBinding(); - assertNull("Got a binding", binding2); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=105192 - public void test0614() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "class T { void m() { for (i=0, j=0; i<10; i++, j++) ; }}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", false/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - false); - final String expectedOutput = "class T {\n" + - " void m(){\n" + - " for (i=0, j=0; i < 10; i++, j++) ;\n" + - " }\n" + - "}\n"; - assertEquals("Wrong output", Util.convertToIndependantLineDelimiter(expectedOutput), Util.convertToIndependantLineDelimiter(node.toString())); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=100041 - */ - public void test0615() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "class X {\n" + - " static Object object;\n" + - " static void foo() {\n" + - " /**\n" + - " * javadoc comment.\n" + - " */\n" + - " if (object instanceof String) {\n" + - " final String clr = null;\n" + - " }\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - assertProblemsSize(unit, 0); - node = getASTNode(unit, 0, 1, 0); - assertNotNull("No node", node); - assertEquals("Not an if statement", ASTNode.IF_STATEMENT, node.getNodeType()); - IfStatement ifStatement = (IfStatement) node; - String expectedSource = "if (object instanceof String) {\n" + - " final String clr = null;\n" + - " }"; - checkSourceRange(ifStatement, expectedSource, contents); - Statement statement = ifStatement.getThenStatement(); - assertNotNull("No then statement", statement); - assertEquals("not a block", ASTNode.BLOCK, statement.getNodeType()); - Block block = (Block) statement; - expectedSource = "{\n" + - " final String clr = null;\n" + - " }"; - checkSourceRange(block, expectedSource, contents); - List statements = block.statements(); - assertEquals("Wrong size", 1, statements.size()); - Statement statement2 = (Statement) statements.get(0); - assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, statement2.getNodeType()); - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) statement2; - checkSourceRange(variableDeclarationStatement, "final String clr = null;", contents); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=109333 - */ - public void test0616() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "class X {\n" + - " boolean val = true && false && true && false && true;\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - assertProblemsSize(unit, 0); - node = getASTNode(unit, 0, 0); - assertNotNull("No node", node); - assertEquals("Not a field declaration ", ASTNode.FIELD_DECLARATION, node.getNodeType()); - final FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - final List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - final Expression initializer = fragment.getInitializer(); - assertNotNull("No initializer", initializer); - assertEquals("Not an infix expression", ASTNode.INFIX_EXPRESSION, initializer.getNodeType()); - InfixExpression infixExpression = (InfixExpression) initializer; - final List extendedOperands = infixExpression.extendedOperands(); - assertEquals("Wrong size", 3, extendedOperands.size()); - assertEquals("Wrong operator", InfixExpression.Operator.CONDITIONAL_AND, infixExpression.getOperator()); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=109333 - */ - public void test0617() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "class X {\n" + - " boolean val = true || false || true || false || true;\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - assertProblemsSize(unit, 0); - node = getASTNode(unit, 0, 0); - assertNotNull("No node", node); - assertEquals("Not a field declaration ", ASTNode.FIELD_DECLARATION, node.getNodeType()); - final FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - final List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - final Expression initializer = fragment.getInitializer(); - assertNotNull("No initializer", initializer); - assertEquals("Not an infix expression", ASTNode.INFIX_EXPRESSION, initializer.getNodeType()); - InfixExpression infixExpression = (InfixExpression) initializer; - final List extendedOperands = infixExpression.extendedOperands(); - assertEquals("Wrong size", 3, extendedOperands.size()); - assertEquals("Wrong operator", InfixExpression.Operator.CONDITIONAL_OR, infixExpression.getOperator()); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=109535 - */ - public void test0618() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " String f = \"\" + \"\" - 1;\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", false/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - false); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - assertProblemsSize(unit, 0); - node = getASTNode(unit, 0, 0); - assertNotNull("No node", node); - assertEquals("Not a field declaration ", ASTNode.FIELD_DECLARATION, node.getNodeType()); - final FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - final List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - final Expression initializer = fragment.getInitializer(); - assertNotNull("No initializer", initializer); - assertEquals("Not an infix expression", ASTNode.INFIX_EXPRESSION, initializer.getNodeType()); - InfixExpression infixExpression = (InfixExpression) initializer; - List extendedOperands = infixExpression.extendedOperands(); - assertEquals("Wrong size", 0, extendedOperands.size()); - assertEquals("Wrong operator", InfixExpression.Operator.MINUS, infixExpression.getOperator()); - Expression leftOperand = infixExpression.getLeftOperand(); - assertEquals("Not an infix expression", ASTNode.INFIX_EXPRESSION, leftOperand.getNodeType()); - InfixExpression infixExpression2 = (InfixExpression) leftOperand; - extendedOperands = infixExpression.extendedOperands(); - assertEquals("Wrong size", 0, extendedOperands.size()); - assertEquals("Wrong operator", InfixExpression.Operator.PLUS, infixExpression2.getOperator()); - assertEquals("Not a string literal", ASTNode.STRING_LITERAL, infixExpression2.getLeftOperand().getNodeType()); - assertEquals("Not a string literal", ASTNode.STRING_LITERAL, infixExpression2.getRightOperand().getNodeType()); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=109646 - */ - public void test0619() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0619", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, false); - final JavaScriptUnit unit = (JavaScriptUnit) result; - assertProblemsSize(unit, 0); - ASTNode node = getASTNode(unit, 0, 0, 0); - assertNotNull("No node", node); - ASTNode statement = node; - ASTParser parser = ASTParser.newParser(AST.JLS3); - parser.setKind(ASTParser.K_STATEMENTS); - parser.setSource(source); - parser.setSourceRange(statement.getStartPosition(), statement.getLength()); - parser.setCompilerOptions(JavaScriptCore.getOptions()); - ASTNode result2 = parser.createAST(null); - assertNotNull("No node", result2); - assertTrue("not a block", result2.getNodeType() == ASTNode.BLOCK); - Block block = (Block) result2; - List statements = block.statements(); - assertEquals("wrong size", 1, statements.size()); - Statement statement2 = (Statement) statements.get(0); - assertEquals("Statement is not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, statement2.getNodeType()); - VariableDeclarationStatement declarationStatement = (VariableDeclarationStatement) statement2; - assertEquals("Wrong number of fragments", 4, declarationStatement.fragments().size()); - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=109940 - */ - public void test0620() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " public static void main(String[] args) {\n" + - " System.out.println((int) \'\\0\');\n" + - " System.out.println((int) \'\\1\');\n" + - " System.out.println((int) \'\\2\');\n" + - " System.out.println((int) \'\\3\');\n" + - " System.out.println((int) \'\\4\');\n" + - " System.out.println((int) \'\\5\');\n" + - " System.out.println((int) \'\\6\');\n" + - " System.out.println((int) \'\\7\');\n" + - " System.out.println((int) \'\\077\');\n" + - " System.out.println((int) \'\\55\');\n" + - " System.out.println((int) \'\\77\');\n" + - " System.out.println((int) \'\\377\');\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", false/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - false); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - assertProblemsSize(unit, 0); - unit.accept(new ASTVisitor() { - public boolean visit(CharacterLiteral characterLiteral) { - try { - final String escapedValue = characterLiteral.getEscapedValue(); - final char charValue = characterLiteral.charValue(); - if (escapedValue.equals("\'\\0\'")) { - assertEquals("Wrong value", 0, charValue); - } else if (escapedValue.equals("\'\\1\'")) { - assertEquals("Wrong value", 1, charValue); - } else if (escapedValue.equals("\'\\2\'")) { - assertEquals("Wrong value", 2, charValue); - } else if (escapedValue.equals("\'\\3\'")) { - assertEquals("Wrong value", 3, charValue); - } else if (escapedValue.equals("\'\\4\'")) { - assertEquals("Wrong value", 4, charValue); - } else if (escapedValue.equals("\'\\5\'")) { - assertEquals("Wrong value", 5, charValue); - } else if (escapedValue.equals("\'\\6\'")) { - assertEquals("Wrong value", 6, charValue); - } else if (escapedValue.equals("\'\\7\'")) { - assertEquals("Wrong value", 7, charValue); - } else if (escapedValue.equals("\'\\077\'")) { - assertEquals("Wrong value", 63, charValue); - } else if (escapedValue.equals("\'\\55\'")) { - assertEquals("Wrong value", 45, charValue); - } else if (escapedValue.equals("\'\\77\'")) { - assertEquals("Wrong value", 63, charValue); - } else if (escapedValue.equals("\'\\377\'")) { - assertEquals("Wrong value", 255, charValue); - } else { - assertTrue("Should not get there", false); - } - } catch(IllegalArgumentException e) { - assertTrue("Should not happen", false); - } - return false; - } - }); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=109963 - */ - public void test0621() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " public void foo(int y) {\n" + - " switch (y) {\n" + - " case 1:\n" + - " int i,j;\n" + - " }\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", false/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - false); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - assertProblemsSize(unit, 0); - node = getASTNode(unit, 0, 0, 0); - assertNotNull("No node", node); - assertEquals("Not a switch statement", ASTNode.SWITCH_STATEMENT, node.getNodeType()); - SwitchStatement switchStatement = (SwitchStatement) node; - List statements = switchStatement.statements(); - assertEquals("Wrong size", 2, statements.size()); - Statement statement = (Statement) statements.get(1); - assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, statement.getNodeType()); - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) statement; - assertEquals("Wrong size", 2, variableDeclarationStatement.fragments().size()); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=92866 - */ - public void test0622() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " public static void main(String[] args) {\n" + - " System.out.println((int) \'\\0\');\n" + - " System.out.println((int) \'\\00\');\n" + - " System.out.println((int) \'\\000\');\n" + - " System.out.println((int) \'\\40\');\n" + - " System.out.println((int) \'\\040\');\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", false/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - false); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - assertProblemsSize(unit, 0); - unit.accept(new ASTVisitor() { - public boolean visit(CharacterLiteral characterLiteral) { - try { - characterLiteral.charValue(); - } catch(IllegalArgumentException e) { - assertTrue("Should not happen", false); - } - return false; - } - }); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=116573 - */ - public void test0623() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "class X {\n" + - " X(boolean x, String y, String z) {}\n" + - " X(int x, String y) {}\n" + - " X(String x) {\n" + - " this(first, second);\n" + - " }\n" + - " void test() {\n" + - " new X(first, second);\n" + - " }\n" + - " class Z extends X {\n" + - " public Z() {\n" + - " super(first, second);\n" + - " }\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - false); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - String expectedOutput = - "first cannot be resolved\n" + - "second cannot be resolved\n" + - "first cannot be resolved\n" + - "second cannot be resolved\n" + - "first cannot be resolved\n" + - "second cannot be resolved"; - assertProblemsSize(unit, 6, expectedOutput); - unit.accept(new ASTVisitor() { - public boolean visit(ConstructorInvocation constructorInvocation) { - assertNotNull("No binding", constructorInvocation.resolveConstructorBinding()); - return false; - } - public boolean visit(ClassInstanceCreation classInstanceCreation) { - assertNotNull("No binding", classInstanceCreation.resolveConstructorBinding()); - return false; - } - }); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=118876 - */ - public void test0624() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X extend {}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - false); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - String expectedOutput = - "Syntax error on token \"extend\", delete this token"; - assertProblemsSize(unit, 1, expectedOutput); - unit.accept(new ASTVisitor() { - public boolean visit(TypeDeclaration typeDeclaration) { - assertTrue("Should be malformed", isMalformed(typeDeclaration)); - return false; - } - public boolean visit(JavaScriptUnit compilationUnit) { - assertFalse("Should not be malformed", isMalformed(compilationUnit)); - return true; - } - }); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=118897 - */ - public void test0625() { - char[] source = - ("package test0305;\n" + //$NON-NLS-1$ - "\n" + //$NON-NLS-1$ - "class Test {\n" + //$NON-NLS-1$ - " public void foo(int arg) {}\n" + //$NON-NLS-1$ - "}").toCharArray(); //$NON-NLS-1$ - IJavaScriptProject project = getJavaProject("Converter"); //$NON-NLS-1$ - ASTNode result = runConversion(AST.JLS3, source, "Test.js", project); //$NON-NLS-1$ - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0); - assertTrue("not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertNull("Got a type binding", typeBinding); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=118897 - */ - public void test0626() { - char[] source = - ("package java.lang;\n" + //$NON-NLS-1$ - "\n" + //$NON-NLS-1$ - "class Object {\n" + //$NON-NLS-1$ - " public void foo(int arg) {}\n" + //$NON-NLS-1$ - "}").toCharArray(); //$NON-NLS-1$ - IJavaScriptProject project = getJavaProject("Converter"); //$NON-NLS-1$ - ASTNode result = runConversion(AST.JLS3, source, "Object.js", project); //$NON-NLS-1$ - assertNotNull("No compilation unit", result); //$NON-NLS-1$ - assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - ASTNode node = getASTNode(compilationUnit, 0); - assertTrue("not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$ - TypeDeclaration typeDeclaration = (TypeDeclaration) node; - ITypeBinding typeBinding = typeDeclaration.resolveBinding(); - assertNull("Got a type binding", typeBinding); //$NON-NLS-1$ - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=116833 - */ - public void test0627() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " void m() {\n" + - " error();\n" + - " new Cloneable() {\n" + - " void xx() {}\n" + - " };\n" + - " new Cloneable() {\n" + - " void xx() {}\n" + - " };\n" + " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - false); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - String expectedOutput = - "The method error() is undefined for the type X"; - assertProblemsSize(unit, 1, expectedOutput); - node = getASTNode(unit, 0, 0, 1); - assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType()); - Expression expression = ((ExpressionStatement) node).getExpression(); - assertEquals("Not a class instance creation", ASTNode.CLASS_INSTANCE_CREATION, expression.getNodeType()); - AnonymousClassDeclaration anonymousClassDeclaration = ((ClassInstanceCreation) expression).getAnonymousClassDeclaration(); - assertNotNull("No anonymous class declaration", anonymousClassDeclaration); - List bodyDeclarations = anonymousClassDeclaration.bodyDeclarations(); - assertEquals("Wrong size", 1, bodyDeclarations.size()); - BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); - assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, bodyDeclaration.getNodeType()); - FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration; - IFunctionBinding methodBinding = methodDeclaration.resolveBinding(); - - node = getASTNode(unit, 0, 0, 2); - assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType()); - expression = ((ExpressionStatement) node).getExpression(); - assertEquals("Not a class instance creation", ASTNode.CLASS_INSTANCE_CREATION, expression.getNodeType()); - anonymousClassDeclaration = ((ClassInstanceCreation) expression).getAnonymousClassDeclaration(); - assertNotNull("No anonymous class declaration", anonymousClassDeclaration); - bodyDeclarations = anonymousClassDeclaration.bodyDeclarations(); - assertEquals("Wrong size", 1, bodyDeclarations.size()); - bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0); - assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, bodyDeclaration.getNodeType()); - methodDeclaration = (FunctionDeclaration) bodyDeclaration; - IFunctionBinding methodBinding2 = methodDeclaration.resolveBinding(); - - assertFalse("Should not be equal", methodBinding.isEqualTo(methodBinding2)); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=125270 - */ - public void test0628() throws JavaScriptModelException { - ASTParser parser = ASTParser.newParser(AST.JLS3); - parser.setKind(ASTParser.K_EXPRESSION); - String source = "{\"red\", \"yellow\"}"; - parser.setSource(source.toCharArray()); - parser.setSourceRange(0, source.length()); - parser.setCompilerOptions(JavaScriptCore.getOptions()); - ASTNode result = parser.createAST(null); - assertNotNull("No node", result); - assertEquals("not an array initializer", ASTNode.ARRAY_INITIALIZER, result.getNodeType()); - ArrayInitializer arrayInitializer = (ArrayInitializer) result; - List expressions = arrayInitializer.expressions(); - assertEquals("Wrong size", 2, expressions.size()); - assertEquals("Wrong type", ASTNode.STRING_LITERAL, ((Expression) expressions.get(0)).getNodeType()); - assertEquals("Wrong type", ASTNode.STRING_LITERAL, ((Expression) expressions.get(1)).getNodeType()); - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=126598 - */ - public void test0629() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0629", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true, true); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - String expectedOutput = - "Syntax error on token \",\", invalid VariableInitializer"; - assertProblemsSize(compilationUnit, 1, expectedOutput); - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertEquals("Not a compilation unit", ASTNode.FIELD_DECLARATION, node.getNodeType()); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - List fragments = fieldDeclaration.fragments(); - assertEquals("wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - checkSourceRange(fragment, "s = {\"\",,,}", source); - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=126598 - */ - public void test0630() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0630", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true, true); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - String expectedOutput = - "Syntax error on token \",\", invalid VariableInitializer"; - assertProblemsSize(compilationUnit, 1, expectedOutput); - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=126598 - */ - public void test0631() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0631", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - char[] source = sourceUnit.getSource().toCharArray(); - ASTNode result = runConversion(AST.JLS3, sourceUnit, true, true); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$ - JavaScriptUnit compilationUnit = (JavaScriptUnit) result; - String expectedOutput = - "Syntax error, insert \"}\" to complete ArrayInitializer\n" + - "Syntax error, insert \";\" to complete FieldDeclaration\n" + - "Syntax error, insert \"}\" to complete ClassBody"; - assertProblemsSize(compilationUnit, 3, expectedOutput); - ASTNode node = getASTNode(compilationUnit, 0, 0); - assertEquals("Not a compilation unit", ASTNode.FIELD_DECLARATION, node.getNodeType()); //$NON-NLS-1$ - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - List fragments = fieldDeclaration.fragments(); - assertEquals("wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - checkSourceRange(fragment, "s = {\"\",,,", source); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=128539 - */ - public void test0632() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " void m(int state) {\n" + - " switch (state) {\n" + - " case 4:\n" + - " double M0,M1;\n" + - " }\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - false); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - assertProblemsSize(unit, 0); - node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a switch statement", ASTNode.SWITCH_STATEMENT, node.getNodeType()); - SwitchStatement statement = (SwitchStatement) node; - List statements = statement.statements(); - assertEquals("wrong size", 2, statements.size()); - assertEquals("Not a switch case", ASTNode.SWITCH_CASE, ((ASTNode) statements.get(0)).getNodeType()); - assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, ((ASTNode) statements.get(1)).getNodeType()); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=128539 - */ - public void test0633() { - String src = "switch (state) {case 4:double M0,M1;}"; - char[] source = src.toCharArray(); - ASTParser parser = ASTParser.newParser(AST.JLS3); - parser.setKind (ASTParser.K_STATEMENTS); - parser.setSource (source); - ASTNode result = parser.createAST (null); - assertNotNull("no result", result); - assertEquals("Wrong type", ASTNode.BLOCK, result.getNodeType()); - Block block = (Block) result; - List statements = block.statements(); - assertNotNull("No statements", statements); - assertEquals("Wrong size", 1, statements.size()); - final ASTNode node = (ASTNode) statements.get(0); - assertEquals("Not a switch statement", ASTNode.SWITCH_STATEMENT, node.getNodeType()); - SwitchStatement statement = (SwitchStatement) node; - statements = statement.statements(); - assertEquals("wrong size", 2, statements.size()); - assertEquals("Not a switch case", ASTNode.SWITCH_CASE, ((ASTNode) statements.get(0)).getNodeType()); - assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, ((ASTNode) statements.get(1)).getNodeType()); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=128823 - */ - public void test0634() throws JavaScriptModelException { - try { - String src = - "public class X {\n" + - " void foo() {\n" + - " int i1 i1;\n" + - " int i2 i2;\n" + - " int i3 i3;\n" + - " int i4 i4;\n" + - " int i5 i5;\n" + - " int i6 i6;\n" + - " int i7 i7;\n" + - " int i8 i8;\n" + - " int i9 i9;\n" + - " int i10 i10;\n" + - " int i11 i11;\n" + - " \n" + - " for for ;;){}\n" + - " }\n" + - "}"; - - char[] source = src.toCharArray(); - ASTParser parser = ASTParser.newParser(AST.JLS3); - parser.setKind (ASTParser.K_COMPILATION_UNIT); - parser.setSource (source); - parser.setStatementsRecovery(true); - ASTNode result = parser.createAST (null); - assertNotNull("no result", result); - } catch (ArrayIndexOutOfBoundsException e) { - assertTrue("ArrayIndexOutOfBoundsException", false); - } - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=128960 - */ - public void test0635() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " void foo(Object tab[]) {\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - true); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - assertProblemsSize(unit, 0); - node = getASTNode(unit, 0, 0); - assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType()); - FunctionDeclaration declaration = (FunctionDeclaration) node; - List parameters = declaration.parameters(); - assertEquals("wrong number", 1, parameters.size()); - SingleVariableDeclaration variableDeclaration = (SingleVariableDeclaration) parameters.get(0); - checkSourceRange(variableDeclaration, "Object tab[]", contents); - checkSourceRange(variableDeclaration.getType(), "Object", contents); - checkSourceRange(variableDeclaration.getName(), "tab", contents); - assertEquals("wrong number of extra dimensions", 1, variableDeclaration.getExtraDimensions()); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=128960 - */ - public void test0636() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " void foo(java.lang.Object tab[]) {\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - true); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - assertProblemsSize(unit, 0); - node = getASTNode(unit, 0, 0); - assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType()); - FunctionDeclaration declaration = (FunctionDeclaration) node; - List parameters = declaration.parameters(); - assertEquals("wrong number", 1, parameters.size()); - SingleVariableDeclaration variableDeclaration = (SingleVariableDeclaration) parameters.get(0); - checkSourceRange(variableDeclaration, "java.lang.Object tab[]", contents); - checkSourceRange(variableDeclaration.getType(), "java.lang.Object", contents); - checkSourceRange(variableDeclaration.getName(), "tab", contents); - assertEquals("wrong number of extra dimensions", 1, variableDeclaration.getExtraDimensions()); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=128961 - */ - public void test0637() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " void foo() {\n" + - " for( int i = (1); ; ) {\n" + - " }\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - true); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - assertProblemsSize(unit, 0); - node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a for statement", ASTNode.FOR_STATEMENT, node.getNodeType()); - ForStatement forStatement = (ForStatement) node; - List inits = forStatement.initializers(); - assertEquals("Wrong size", 1, inits.size()); - Expression expression = (Expression) inits.get(0); - assertEquals("Not a variable declaration expression", ASTNode.VARIABLE_DECLARATION_EXPRESSION, expression.getNodeType()); - VariableDeclarationExpression declarationExpression = (VariableDeclarationExpression) expression; - List fragments = declarationExpression.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression initializer = fragment.getInitializer(); - checkSourceRange(initializer, "(1)", contents); - checkSourceRange(fragment, "i = (1)", contents); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=128961 - */ - public void test0638() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " int i = (1);\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - true); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - assertProblemsSize(unit, 0); - node = getASTNode(unit, 0, 0); - assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType()); - FieldDeclaration fieldDeclaration = (FieldDeclaration) node; - List fragments = fieldDeclaration.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression initializer = fragment.getInitializer(); - checkSourceRange(initializer, "(1)", contents); - checkSourceRange(fragment, "i = (1)", contents); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=128961 - */ - public void test0639() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " void foo() {\n" + - " for( int i = (1), j = 0; ; ) {\n" + - " }\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - true); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - assertProblemsSize(unit, 0); - node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a for statement", ASTNode.FOR_STATEMENT, node.getNodeType()); - ForStatement forStatement = (ForStatement) node; - List inits = forStatement.initializers(); - assertEquals("Wrong size", 1, inits.size()); - Expression expression = (Expression) inits.get(0); - assertEquals("Not a variable declaration expression", ASTNode.VARIABLE_DECLARATION_EXPRESSION, expression.getNodeType()); - VariableDeclarationExpression declarationExpression = (VariableDeclarationExpression) expression; - List fragments = declarationExpression.fragments(); - assertEquals("Wrong size", 2, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression initializer = fragment.getInitializer(); - checkSourceRange(initializer, "(1)", contents); - checkSourceRange(fragment, "i = (1)", contents); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=129589 - * TODO (david) enable once fixed - */ - public void _test0640() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " protected void primExecute() {\n" + - " String temp= this.toString();\n" + - " }\n" + - " if (image != null) {\n" + - " Object loc = null;\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - false, - true); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - assertProblemsSize(unit, 2, "Syntax error on token \"}\", { expected after this token\n" + - "Syntax error, insert \"}\" to complete ClassBody"); - node = getASTNode(unit, 0, 0); - assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType()); - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - assertFalse("A recovered node", isRecovered(methodDeclaration)); - assertFalse("A malformed node", isMalformed(methodDeclaration)); - assertFalse("A recovered node", isRecovered(methodDeclaration.getBody())); - assertFalse("A malformed node", isMalformed(methodDeclaration.getBody())); - node = getASTNode(unit, 0, 1); - assertEquals("Not an initializer", ASTNode.INITIALIZER, node.getNodeType()); - Initializer initializer = (Initializer) node; - assertTrue("Not a recovered node", isRecovered(initializer)); - assertTrue("Not a malformed node", isMalformed(initializer)); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /* - * Ensures that 2 type bindings (one from .class file, the other from attache source) are "isEqualTo(...)". - * (regression test for bug 130317 ASTParser with IClassFile as source creates type bindings that are not isEqualTo(..) binary bindings) - */ - public void test0641() throws JavaScriptModelException { - // Integer from attached source - IClassFile classFile = getClassFile("Converter", getConverterJCLPath().toOSString(), "java.lang", "Integer.class"); - String source = classFile.getSource(); - MarkerInfo markerInfo = new MarkerInfo(source); - markerInfo.astStarts = new int[] {source.indexOf("public")}; - markerInfo.astEnds = new int[] {source.lastIndexOf('}') + 1}; - ASTNode node = buildAST(markerInfo, classFile); - IBinding bindingFromAttachedSource = ((TypeDeclaration) node).resolveBinding(); - - IJavaScriptUnit workingCopy = null; - try { - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - String contents = - "public class X {\n" + - " /*start*/Integer/*end*/ field;\n" + - "}"; - IBinding[] bindings = resolveBindings(contents, workingCopy); - assertTrue("2 type bindings should be equals", bindingFromAttachedSource.isEqualTo(bindings[0])); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=129330 - */ - public void test0642() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "import java.awt.Point;\n" + - "public class X {\n" + - " public void foo(Point p, int[] a) {\n" + - " p.x;\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - false, - true); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - assertProblemsSize(unit, 1, "Syntax error, insert \"AssignmentOperator Expression\" to complete Expression"); - node = getASTNode(unit, 0, 0, 0); - assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType()); - assertTrue("Not recovered", isRecovered(node)); - final Expression expression = ((ExpressionStatement) node).getExpression(); - assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, expression.getNodeType()); - assertTrue("Not recovered", isRecovered(expression)); - checkSourceRange(expression, "p.x", contents); - checkSourceRange(node, "p.x;", contents); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=129330 - */ - public void test0643() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "import java.awt.Point;\n" + - "public class X {\n" + - " public void foo(Point p, int[] a) {\n" + - " a[0];\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - false, - true); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - assertProblemsSize(unit, 1, "Syntax error, insert \"AssignmentOperator Expression\" to complete Expression"); - node = getASTNode(unit, 0, 0, 0); - assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType()); - assertTrue("Not recovered", isRecovered(node)); - final Expression expression = ((ExpressionStatement) node).getExpression(); - assertEquals("Not an array access", ASTNode.ARRAY_ACCESS, expression.getNodeType()); - assertTrue("Not recovered", isRecovered(expression)); - checkSourceRange(expression, "a[0]", contents); - checkSourceRange(node, "a[0];", contents); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=129330 - */ - public void test0644() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " public void foo() {\n" + - " int x =;\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - false, - true); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - assertProblemsSize(unit, 1, "Syntax error on token \"=\", VariableInitializer expected after this token"); - node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a vaviable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType()); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertNull("No initializer", expression); - assertTrue("Not recovered", isRecovered(fragment)); - checkSourceRange(fragment, "x =", contents); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=135997 - */ - public void test0645() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " {\n" + - " new Object();\n" + - " Object.equ;\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - false, - true); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - assertProblemsSize( - unit, - 2, - "Object.equ cannot be resolved\n" + - "Syntax error, insert \"AssignmentOperator Expression\" to complete Expression"); - node = getASTNode(unit, 0, 0); - assertEquals("Not a field declaration statement", ASTNode.INITIALIZER, node.getNodeType()); - Initializer initializer = (Initializer) node; - checkSourceRange( - initializer, - "{\n" + - " new Object();\n" + - " Object.equ;\n" + - " }", - contents); - Block block = initializer.getBody(); - checkSourceRange( - block, - "{\n" + - " new Object();\n" + - " Object.equ;\n" + - " }", - contents); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=136972 - */ - public void test0646() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " static {\n" + - " class A\n" + - " Object o = new Object(){\n" + - " void test(){\n" + - " }\n" + - " };\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - false, - true); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=141043 - */ - public void test0647() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " public void run(int i) {\n" + - " }\n" + - " public void foo() {\n" + - " new Runnable() {\n" + - " public void run() {\n" + - " run(1); \n" + - " }\n" + - " };\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - false, - true); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - assertProblemsSize(unit, 1, "The method run() in the type new Runnable(){} is not applicable for the arguments (int)"); - node = getASTNode(unit, 0, 1, 0); - assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType()); - Expression expression = ((ExpressionStatement) node).getExpression(); - ITypeBinding typeBinding = expression.resolveTypeBinding(); - IFunctionBinding[] methodBindings = typeBinding.getDeclaredMethods(); - assertEquals("Wrong size", 2, methodBindings.length); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=147877 - */ - public void test0648() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " public void foo(int[] a) {\n" + - " int i = a[0];\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - false, - true); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - assertProblemsSize(unit, 0); - node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a vaviable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType()); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertNotNull("No initializer", expression); - checkSourceRange(expression, "a[0]", contents); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=147877 - */ - public void test0649() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " public void foo(int[] a) {\n" + - " int i = a[0\\u005D;\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - false, - true); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - assertProblemsSize(unit, 0); - node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a vaviable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType()); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertNotNull("No initializer", expression); - checkSourceRange(expression, "a[0\\u005D", contents); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=147877 - */ - public void test0650() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " public void foo(int[] a) {\n" + - " int[] i = new int[0];\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - false, - true); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - assertProblemsSize(unit, 0); - node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a vaviable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType()); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertNotNull("No initializer", expression); - checkSourceRange(expression, "new int[0]", contents); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=147877 - */ - public void test0651() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " public void foo(int[] a) {\n" + - " int[] i = new int[0\\u005D;\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - false, - true); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - assertProblemsSize(unit, 0); - node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a vaviable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType()); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - Expression expression = fragment.getInitializer(); - assertNotNull("No initializer", expression); - checkSourceRange(expression, "new int[0\\u005D", contents); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=149126 - */ - public void _test0652() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "import java.nio.ByteBuffer;\n" + - "import java.nio.CharBuffer;\n" + - "import java.nio.charset.Charset;\n" + - "import java.nio.charset.CharsetDecoder;\n" + - "import java.nio.charset.CharsetEncoder;\n" + - "import java.nio.charset.CoderResult;\n" + - "public class TestCharset extends Charset {\n" + - " public CharsetDecoder newDecoder() {\n" + - " return new CharsetDecoder(this, 2.0, 2.0) {\n" + - " CharsetDecoder(CharSet\n" + - " protected CoderResult decodeLoop(ByteBuffer in,\n" + - "CharBuffer out) {\n" + - " return null;\n" + - " }\n" + - " };;\n" + - " }\n" + - " public CharsetEncoder newEncoder() {\n" + - " return null;\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - false, - true); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - assertProblemsSize(unit, 1); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=150409 - * TODO (olivier) renable if the bindings are available - */ - public void _test0653() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0653", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - ASTNode result = runConversion(AST.JLS3, sourceUnit, true); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) result; - - ASTNode node = getASTNode(unit, 0, 2, 0); - assertEquals("Not a method invocation", ASTNode.EXPRESSION_STATEMENT, node.getNodeType()); - ExpressionStatement statement = (ExpressionStatement) node; - FunctionInvocation invocation = (FunctionInvocation) statement.getExpression(); - List arguments = invocation.arguments(); - assertEquals("Wrong size", 1, arguments.size()); - Expression argument = (Expression) arguments.get(0); - assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, argument.getNodeType()); - invocation = (FunctionInvocation) argument; - Expression expression = invocation.getExpression(); - assertEquals("Not a method invocation", ASTNode.FIELD_ACCESS, expression.getNodeType()); - FieldAccess fieldAccess = (FieldAccess) expression; - IVariableBinding variableBinding = fieldAccess.resolveFieldBinding(); - assertNotNull("No variable binding", variableBinding); - } - - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=148224 - */ - public void test0654() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " int i;\n" + - " public void foo(int[] a) {\n" + - " }\n" + - " String s;\n" + - " public String[][] bar() {\n" + - " return null;\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - false, - true); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - assertProblemsSize(unit, 0); - node = getASTNode(unit, 0, 0); - assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType()); - FieldDeclaration declaration = (FieldDeclaration) node; - Type type = declaration.getType(); - ITypeBinding typeBinding = type.resolveBinding(); - assertTrue("Not a primitive type", typeBinding.isPrimitive()); - assertEquals("Not int", "int", typeBinding.getName()); - try { - typeBinding.createArrayType(-1); - assertTrue("Should throw an exception", false); - } catch(IllegalArgumentException exception) { - // ignore - } - try { - typeBinding.createArrayType(0); - assertTrue("Should throw an exception", false); - } catch(IllegalArgumentException exception) { - // ignore - } - try { - typeBinding.createArrayType(256); - assertTrue("Should throw an exception", false); - } catch(IllegalArgumentException exception) { - // ignore - } - ITypeBinding binding = typeBinding.createArrayType(2); - assertEquals("Wrong dimensions", 2, binding.getDimensions()); - assertTrue("Not an array type binding", binding.isArray()); - ITypeBinding componentType = binding.getComponentType(); - assertTrue("Not an array type binding", componentType.isArray()); - assertEquals("Wrong dimensions", 1, componentType.getDimensions()); - componentType = componentType.getComponentType(); - assertFalse("An array type binding", componentType.isArray()); - assertEquals("Wrong dimensions", 0, componentType.getDimensions()); - - binding = typeBinding.createArrayType(1); - node = getASTNode(unit, 0, 1); - assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType()); - FunctionDeclaration methodDeclaration = (FunctionDeclaration) node; - List parameters = methodDeclaration.parameters(); - assertEquals("Wrong size", 1, parameters.size()); - SingleVariableDeclaration parameter = (SingleVariableDeclaration) parameters.get(0); - Type type2 = parameter.getType(); - ITypeBinding typeBinding2 = type2.resolveBinding(); - assertNotNull("No binding", typeBinding2); - assertTrue("Not an array binding", typeBinding2.isArray()); - assertEquals("Wrong dimension", 1, typeBinding2.getDimensions()); - assertEquals("Wrong type", "int", typeBinding2.getElementType().getName()); - assertTrue("Should be equals", binding == typeBinding2); - - binding = typeBinding2.createArrayType(3); - assertTrue("Not an array binding", binding.isArray()); - assertEquals("Wrong dimension", 4, binding.getDimensions()); - - node = getASTNode(unit, 0, 2); - assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType()); - declaration = (FieldDeclaration) node; - type = declaration.getType(); - typeBinding = type.resolveBinding(); - assertTrue("A primitive type", !typeBinding.isPrimitive()); - assertEquals("Not String", "String", typeBinding.getName()); - - binding = typeBinding.createArrayType(1); - node = getASTNode(unit, 0, 3); - assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType()); - methodDeclaration = (FunctionDeclaration) node; - type = methodDeclaration.getReturnType2(); - assertNotNull("No return type", type); - typeBinding2 = type.resolveBinding(); - assertNotNull("No binding", typeBinding2); - assertTrue("Not an array binding", typeBinding2.isArray()); - assertEquals("Wrong dimension", 2, typeBinding2.getDimensions()); - assertEquals("Wrong type", "String", typeBinding2.getElementType().getName()); - typeBinding2 = typeBinding2.getComponentType(); - assertTrue("Not an array binding", typeBinding2.isArray()); - assertEquals("Wrong dimension", 1, typeBinding2.getDimensions()); - assertTrue("Should be equals", binding == typeBinding2); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=157570 - */ - public void _test0655() { - String src = "public static void m1()\n" + - " {\n" + - " int a;\n" + - " int b;\n" + - " }\n" + - "\n" + - " public static void m2()\n" + - " {\n" + - " int c;\n" + - " int d;\n" + - " }"; - char[] source = src.toCharArray(); - ASTParser parser = ASTParser.newParser(AST.JLS3); - parser.setKind (ASTParser.K_STATEMENTS); - parser.setStatementsRecovery(true); - parser.setSource (source); - ASTNode result = parser.createAST (null); - assertNotNull("no result", result); - assertEquals("Not a block", ASTNode.BLOCK, result.getNodeType()); - Block block = (Block) result; - List statements = block.statements(); - for (Iterator iterator = statements.iterator(); iterator.hasNext(); ) { - Statement statement = (Statement) iterator.next(); - assertTrue(isMalformed(statement)); - } - } - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=157570 - */ - public void test0656() { - String src = "public static void m1()\n" + - " {\n" + - " int a;\n" + - " int b;\n" + - " }\n" + - "\n" + - " public static void m2()\n" + - " {\n" + - " int c;\n" + - " int d;\n" + - " }"; - char[] source = src.toCharArray(); - ASTParser parser = ASTParser.newParser(AST.JLS3); - parser.setKind (ASTParser.K_STATEMENTS); - parser.setStatementsRecovery(false); - parser.setSource (source); - ASTNode result = parser.createAST (null); - assertNotNull("no result", result); - assertEquals("Not a block", ASTNode.BLOCK, result.getNodeType()); - Block block = (Block) result; - List statements = block.statements(); - assertEquals("Should be empty", 0, statements.size()); - } - - // http://dev.eclipse.org/bugs/show_bug.cgi?id=160198 - public void test0657() throws JavaScriptModelException { - IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0657", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - IJavaScriptUnit sourceUnit2 = getCompilationUnit("Converter" , "src", "test0657", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - class TestASTRequestor extends ASTRequestor { - public ArrayList asts = new ArrayList(); - public void acceptAST(IJavaScriptUnit source, JavaScriptUnit compilationUnit) { - this.asts.add(compilationUnit); - } - public void acceptBinding(String bindingKey, IBinding binding) { - } - } - TestASTRequestor requestor = new TestASTRequestor(); - resolveASTs( - new IJavaScriptUnit[] {sourceUnit, sourceUnit2}, - new String[0], - requestor, - getJavaProject("Converter"), - sourceUnit.getOwner() - ); - ArrayList arrayList = requestor.asts; - assertEquals("Wrong size", 2, arrayList.size()); - int problemsCount = 0; - for (int i = 0, max = arrayList.size(); i < max; i++) { - Object current = arrayList.get(i); - assertTrue("not a compilation unit", current instanceof JavaScriptUnit); - JavaScriptUnit unit = (JavaScriptUnit) current; - IProblem[] problems = unit.getProblems(); - problemsCount += problems.length; - } - assertEquals("wrong size", 1, problemsCount); - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=157570 - */ - public void test0658() { - String src = "public static void m1()\n" + - " {\n" + - " int a;\n" + - " int b;\n" + - " }\n" + - "\n" + - " public static void m2()\n" + - " {\n" + - " int c;\n" + - " int d;\n" + - " }"; - char[] source = src.toCharArray(); - ASTParser parser = ASTParser.newParser(AST.JLS3); - parser.setKind (ASTParser.K_STATEMENTS); - parser.setStatementsRecovery(true); - parser.setSource (source); - ASTNode result = parser.createAST (null); - assertNotNull("no result", result); - assertEquals("Not a block", ASTNode.BLOCK, result.getNodeType()); - Block block = (Block) result; - List statements = block.statements(); - assertEquals("Should be empty", 4, statements.size()); - assertTrue("Not recovered", isRecovered(block)); - ASTNode root = block.getRoot(); - assertNotNull("No root", root); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, root.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) root; - String errors = - "Syntax error on token(s), misplaced construct(s)\n" + - "Syntax error, insert \";\" to complete BlockStatements\n" + - "Syntax error on token(s), misplaced construct(s)\n" + - "Syntax error, insert \";\" to complete Statement"; - assertProblemsSize(unit, 4, errors); - } - - public void test0659() throws CoreException, JavaScriptModelException { - IJavaScriptProject javaProject = createJavaProject("P659", new String[] { "src" }, new String[0]); - try { - ASTParser parser = ASTParser.newParser(AST.JLS3); - parser.setKind(ASTParser.K_COMPILATION_UNIT); - parser.setStatementsRecovery(true); - String source ="package java.lang;\n" + - "public class Object {\n" + - " public String toString() {\n" + - " return \"\";\n" + - " }\n" + - "}"; - parser.setSource(source.toCharArray()); - parser.setProject(javaProject); - parser.setResolveBindings(true); - parser.setUnitName("Object.js"); - ASTNode result = parser.createAST (null); - assertNotNull("no result", result); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) result; - ASTNode node = getASTNode(unit, 0, 0); - assertNotNull("No node", node); - assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType()); - FunctionDeclaration declaration = (FunctionDeclaration) node; - Block block = declaration.getBody(); - assertNotNull("no block", block); - List statements = block.statements(); - assertEquals("Wrong size", 1, statements.size()); - ReturnStatement returnStatement = (ReturnStatement) statements.get(0); - Expression expression = returnStatement.getExpression(); - assertNotNull("No expression", expression); - ITypeBinding binding = expression.resolveTypeBinding(); - assertNull("No binding", binding); - } finally { - deleteProject("P659"); - } - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=144858 - * TODO (frederic) check that keys are different (PR 149590) - */ - public void test0660() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " void foo() {\n" + - " int x = 0;\n" + - " String x = \"\"; //$NON-NLS-1$\n" + - " x.toString();\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - false); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - assertProblemsSize(unit, 1, "Duplicate local variable x"); - node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType()); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - assertEquals("Wrong name", "x", variableBinding.getName()); - // (PR 149590) - // String key = variableBinding.getKey(); - - node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType()); - statement = (VariableDeclarationStatement) node; - fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - fragment = (VariableDeclarationFragment) fragments.get(0); - variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - assertEquals("Wrong name", "x", variableBinding.getName()); - // (PR 149590) - // String key2 = variableBinding.getKey(); - //assertFalse("Keys should not be equals", key2.equals(key)); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=144858 - * TODO (frederic) check that keys are different (PR 149590) - */ - public void test0661() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " public static void main(String[] args) {\n" + - " int x = 2;\n" + - " try {\n" + - "\n" + - " } catch(NullPointerException x) {\n" + - " } catch(Exception e) {\n" + - " }\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - false); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - assertProblemsSize(unit, 1, "Duplicate parameter x"); - node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType()); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - assertEquals("Wrong name", "x", variableBinding.getName()); - // (PR 149590) - // String key = variableBinding.getKey(); - - node = getASTNode(unit, 0, 0, 1); - assertEquals("Not a try statement", ASTNode.TRY_STATEMENT, node.getNodeType()); - TryStatement statement2 = (TryStatement) node; - List catchClauses = statement2.catchClauses(); - assertEquals("Wrong size", 2, catchClauses.size()); - CatchClause catchClause = (CatchClause) catchClauses.get(0); - SingleVariableDeclaration variableDeclaration = catchClause.getException(); - variableBinding = variableDeclaration.resolveBinding(); - assertNotNull("No binding", variableBinding); - assertEquals("Wrong name", "x", variableBinding.getName()); - // (PR 149590) - // String key2 = variableBinding.getKey(); - //assertFalse("Keys should not be equals", key2.equals(key)); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=144858 - * TODO (frederic) check that keys are different (PR 149590) - */ - public void test0662() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " public static void main(String[] args) {\n" + - " int x = x = 0;\n" + - " if (true) {\n" + - " int x = x = 1;\n" + - " }\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - false); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - String expectedLog = - "The assignment to variable x has no effect\n" + - "Duplicate local variable x\n" + - "The assignment to variable x has no effect"; - assertProblemsSize(unit, 3, expectedLog); - node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType()); - VariableDeclarationStatement statement = (VariableDeclarationStatement) node; - List fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - assertEquals("Wrong name", "x", variableBinding.getName()); - // (PR 149590) - // String key = variableBinding.getKey(); - - node = getASTNode(unit, 0, 0, 1); - assertEquals("Not an if statement", ASTNode.IF_STATEMENT, node.getNodeType()); - IfStatement ifStatement = (IfStatement) node; - Block block = (Block) ifStatement.getThenStatement(); - List statements = block.statements(); - assertEquals("Wrong size", 1, statements.size()); - Statement statement2 = (Statement) statements.get(0); - assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, statement2.getNodeType()); - statement = (VariableDeclarationStatement) statement2; - fragments = statement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - fragment = (VariableDeclarationFragment) fragments.get(0); - variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - assertEquals("Wrong name", "x", variableBinding.getName()); - - // (PR 149590) - // String key2 = variableBinding.getKey(); - //assertFalse("Keys should not be equals", key2.equals(key)); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=144858 - * TODO (frederic) check that keys are different (PR 149590) - */ - public void test0663() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " public static void main(String[] args) {\n" + - " for (int i = 0; i < 10; i++) {\n" + - " for (int i = 0; i < 5; i++) {\n" + - " // do something\n" + - " }\n" + - " }\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - false); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - String expectedLog = "Duplicate local variable i"; - assertProblemsSize(unit, 1, expectedLog); - node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a for statement", ASTNode.FOR_STATEMENT, node.getNodeType()); - ForStatement statement = (ForStatement) node; - List initializers = statement.initializers(); - assertEquals("Wrong size", 1, initializers.size()); - Expression expression = (Expression) initializers.get(0); - assertEquals("Not a variable declaration expression", ASTNode.VARIABLE_DECLARATION_EXPRESSION, expression.getNodeType()); - VariableDeclarationExpression expression2 = (VariableDeclarationExpression) expression; - List fragments = expression2.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - assertEquals("Wrong name", "i", variableBinding.getName()); - // (PR 149590) - // String key = variableBinding.getKey(); - - Block block = (Block) statement.getBody(); - List statements = block.statements(); - assertEquals("Wrong size", 1, statements.size()); - Statement statement2 = (Statement) statements.get(0); - assertEquals("Not a for statement", ASTNode.FOR_STATEMENT, statement2.getNodeType()); - statement = (ForStatement) statement2; - initializers = statement.initializers(); - assertEquals("Wrong size", 1, initializers.size()); - expression = (Expression) initializers.get(0); - assertEquals("Not a variable declaration expression", ASTNode.VARIABLE_DECLARATION_EXPRESSION, expression.getNodeType()); - expression2 = (VariableDeclarationExpression) expression; - fragments = expression2.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - fragment = (VariableDeclarationFragment) fragments.get(0); - variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - assertEquals("Wrong name", "i", variableBinding.getName()); - - // (PR 149590) - // String key2 = variableBinding.getKey(); - //assertFalse("Keys should not be equals", key2.equals(key)); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=165662 - */ - public void test0664() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " void foo() {\n" + - " class Local {\n" + - " void foo() {}\n" + - " }\n" + - " {\n" + - " class Local {\n" + - " Local(int i) {\n" + - " this.init(i);\n" + - " }\n" + - " void init(int i) {}\n" + - " }\n" + - " Local l = new Local(0);\n" + - " }\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - false); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - String expectedLog = "Duplicate nested type Local"; - assertProblemsSize(unit, 1, expectedLog); - node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a type declaration statement", ASTNode.TYPE_DECLARATION_STATEMENT, node.getNodeType()); - TypeDeclarationStatement statement = (TypeDeclarationStatement) node; - ITypeBinding typeBinding = statement.resolveBinding(); - assertNotNull("No binding", typeBinding); - String key = typeBinding.getKey(); - assertNotNull("No key", key); - - node = getASTNode(unit, 0, 0, 1); - assertEquals("Not a block", ASTNode.BLOCK, node.getNodeType()); - Block block = (Block) node; - List statements = block.statements(); - assertEquals("wrong size", 2, statements.size()); - Statement statement2 = (Statement) statements.get(0); - assertEquals("Not a type declaration statement", ASTNode.TYPE_DECLARATION_STATEMENT, statement2.getNodeType()); - statement = (TypeDeclarationStatement) statement2; - typeBinding = statement.resolveBinding(); - assertNotNull("No binding", typeBinding); - String key2 = typeBinding.getKey(); - assertNotNull("No key2", key2); - assertFalse("Keys should not be equals", key.equals(key2)); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=165662 - */ - public void test0665() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - String contents = - "public class X {\n" + - " void foo() {\n" + - " class Local {\n" + - " void foo() {\n" + - " }\n" + - " }\n" + - " {\n" + - " class Local {\n" + - " Local(int i) {\n" + - " this.init(i);\n" + - " this.bar();\n" + - " }\n" + - " void init(int i) {}\n" + - " void bar() {\n" + - " }\n" + - " }\n" + - " Local l = new Local(0);\n" + - " }\n" + - " Local l = new Local();\n" + - " l.foo();\n" + - " }\n" + - "}"; - workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - ASTNode node = buildAST( - contents, - workingCopy, - false); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit unit = (JavaScriptUnit) node; - String expectedLog = "Duplicate nested type Local"; - assertProblemsSize(unit, 1, expectedLog); - node = getASTNode(unit, 0, 0, 0); - assertEquals("Not a type declaration statement", ASTNode.TYPE_DECLARATION_STATEMENT, node.getNodeType()); - TypeDeclarationStatement statement = (TypeDeclarationStatement) node; - ITypeBinding typeBinding = statement.resolveBinding(); - assertNotNull("No binding", typeBinding); - String key = typeBinding.getKey(); - assertNotNull("No key", key); - - node = getASTNode(unit, 0, 0, 1); - assertEquals("Not a block", ASTNode.BLOCK, node.getNodeType()); - Block block = (Block) node; - List statements = block.statements(); - assertEquals("wrong size", 2, statements.size()); - Statement statement2 = (Statement) statements.get(0); - assertEquals("Not a type declaration statement", ASTNode.TYPE_DECLARATION_STATEMENT, statement2.getNodeType()); - statement = (TypeDeclarationStatement) statement2; - typeBinding = statement.resolveBinding(); - assertNotNull("No binding", typeBinding); - String key2 = typeBinding.getKey(); - assertNotNull("No key2", key2); - assertFalse("Keys should not be equals", key.equals(key2)); - - Statement statement3 = (Statement) statements.get(1); - assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, statement3.getNodeType()); - VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) statement3; - List fragments = variableDeclarationStatement.fragments(); - assertEquals("Wrong size", 1, fragments.size()); - VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); - IVariableBinding variableBinding = fragment.resolveBinding(); - assertNotNull("No binding", variableBinding); - assertEquals("Wrong name", "l", variableBinding.getName()); - Expression expression = fragment.getInitializer(); - ITypeBinding typeBinding2 = expression.resolveTypeBinding(); - assertNotNull("No type binding2", typeBinding2); - - AbstractTypeDeclaration declaration = statement.getDeclaration(); - List bodyDeclarations = declaration.bodyDeclarations(); - assertEquals("Wrong size", 3, bodyDeclarations.size()); - BodyDeclaration declaration2 = (BodyDeclaration) bodyDeclarations.get(0); - assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, declaration2.getNodeType()); - FunctionDeclaration methodDeclaration = (FunctionDeclaration) declaration2; - assertTrue("not a constructor", methodDeclaration.isConstructor()); - block = methodDeclaration.getBody(); - statements = block.statements(); - assertEquals("Wrong size", 2, statements.size()); - statement3 = (Statement) statements.get(1); - assertEquals("Not a expression statement", ASTNode.EXPRESSION_STATEMENT, statement3.getNodeType()); - expression = ((ExpressionStatement) statement3).getExpression(); - assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType()); - FunctionInvocation invocation = (FunctionInvocation) expression; - IFunctionBinding methodBinding = invocation.resolveMethodBinding(); - assertNotNull(methodBinding); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTMatcherTest.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTMatcherTest.java deleted file mode 100644 index 861606a..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTMatcherTest.java +++ /dev/null @@ -1,1112 +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.Method; - -import junit.framework.Test; - -import org.eclipse.wst.jsdt.core.dom.AST; -import org.eclipse.wst.jsdt.core.dom.ASTMatcher; -import org.eclipse.wst.jsdt.core.dom.ASTNode; -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.BlockComment; -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.Expression; -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.FunctionRefParameter; -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.JSdoc; -import org.eclipse.wst.jsdt.core.dom.JavaScriptUnit; -import org.eclipse.wst.jsdt.core.dom.LabeledStatement; -import org.eclipse.wst.jsdt.core.dom.LineComment; -import org.eclipse.wst.jsdt.core.dom.MemberRef; -import org.eclipse.wst.jsdt.core.dom.Modifier; -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.Statement; -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.TextElement; -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.Type; -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; - -/** - * Test suite for ASTMatcher and ASTNode.subtreeMatch. - */ -public class ASTMatcherTest extends org.eclipse.wst.jsdt.core.tests.junit.extension.TestCase { - - /** @deprecated using deprecated code */ - public static Test suite() { - // TODO (frederic) use buildList + setAstLevel(init) instead... - junit.framework.TestSuite suite = new junit.framework.TestSuite(ASTMatcherTest.class.getName()); - - Class c = ASTMatcherTest.class; - Method[] methods = c.getMethods(); - for (int i = 0, max = methods.length; i < max; i++) { - if (methods[i].getName().startsWith("test")) { //$NON-NLS-1$ - suite.addTest(new ASTMatcherTest(methods[i].getName(), AST.JLS2)); - suite.addTest(new ASTMatcherTest(methods[i].getName(), AST.JLS3)); - } - } - return suite; - } - - AST ast; - SimpleName N1; - SimpleName N2; - SimpleName N3; - SimpleName N4; - Expression E1; - Expression E2; - Type T1; - String T1S; - Type T2; - String T2S; - String PT1S; - Statement S1; - Statement S2; - Block B1; - SingleVariableDeclaration V1; - SingleVariableDeclaration V2; - VariableDeclarationFragment W1; - VariableDeclarationFragment W2; - FieldDeclaration FD1; - FieldDeclaration FD2; - PackageDeclaration PD1; - ImportDeclaration ID1; - ImportDeclaration ID2; - TypeDeclaration TD1; - TypeDeclaration TD2; - AnonymousClassDeclaration ACD1; - JSdoc JD1; - JSdoc JD2; - String JD2S; - String TP1S; - String TP2S; - TagElement TAG1; - TagElement TAG2; - TextElement TEXT1; - MemberRef MBREF1; - FunctionRef MTHREF1; - FunctionRefParameter MPARM1; - LineComment LC1; - BlockComment BC1; - Modifier MOD1; - Modifier MOD2; - - final StringBuffer b = new StringBuffer(); - - int API_LEVEL; - - public ASTMatcherTest(String name, int apiLevel) { - super(name); - this.API_LEVEL = apiLevel; - } - - /** - * @deprecated (not really - just suppressing the warnings - * that come from testing Javadoc.getComment()) - * - */ - protected void setUp() throws Exception { - super.setUp(); - - ast = AST.newAST(this.API_LEVEL); - N1 = ast.newSimpleName("N"); //$NON-NLS-1$ - N2 = ast.newSimpleName("M"); //$NON-NLS-1$ - N3 = ast.newSimpleName("O"); //$NON-NLS-1$ - N4 = ast.newSimpleName("P"); //$NON-NLS-1$ - E1 = ast.newSimpleName("X"); //$NON-NLS-1$ - E2 = ast.newSimpleName("Y"); //$NON-NLS-1$ - T1 = ast.newSimpleType(ast.newSimpleName("Z")); //$NON-NLS-1$ - T1S = "(tS(nSZZnS)tS)"; //$NON-NLS-1$ - T2 = ast.newSimpleType(ast.newSimpleName("Y")); //$NON-NLS-1$ - T2S = "(tS(nSYYnS)tS)"; //$NON-NLS-1$ - S1 = ast.newContinueStatement(); - S2 = ast.newBreakStatement(); - B1 = ast.newBlock(); - V1 = ast.newSingleVariableDeclaration(); - V1.setType(ast.newPrimitiveType(PrimitiveType.INT)); - V1.setName(ast.newSimpleName("a")); //$NON-NLS-1$ - V2 = ast.newSingleVariableDeclaration(); - V2.setType(ast.newPrimitiveType(PrimitiveType.BYTE)); - V2.setName(ast.newSimpleName("b")); //$NON-NLS-1$ - W1 = ast.newVariableDeclarationFragment(); - W1.setName(ast.newSimpleName("a")); //$NON-NLS-1$ - W2 = ast.newVariableDeclarationFragment(); - W2.setName(ast.newSimpleName("b")); //$NON-NLS-1$ - { - VariableDeclarationFragment temp = ast.newVariableDeclarationFragment(); - temp.setName(ast.newSimpleName("f")); //$NON-NLS-1$ - FD1 = ast.newFieldDeclaration(temp); - FD1.setType(ast.newPrimitiveType(PrimitiveType.INT)); - } - { - VariableDeclarationFragment temp = ast.newVariableDeclarationFragment(); - temp.setName(ast.newSimpleName("g")); //$NON-NLS-1$ - FD2 = ast.newFieldDeclaration(temp); - FD2.setType(ast.newPrimitiveType(PrimitiveType.CHAR)); - } - PD1 = ast.newPackageDeclaration(); - PD1.setName(ast.newSimpleName("p")); //$NON-NLS-1$ - ID1 = ast.newImportDeclaration(); - ID1.setName(ast.newSimpleName("i")); //$NON-NLS-1$ - ID2 = ast.newImportDeclaration(); - ID2.setName(ast.newSimpleName("j")); //$NON-NLS-1$ - TD1 = ast.newTypeDeclaration(); - TD1.setName(ast.newSimpleName("c")); //$NON-NLS-1$ - TD2 = ast.newTypeDeclaration(); - TD2.setName(ast.newSimpleName("d")); //$NON-NLS-1$ - - ACD1 = ast.newAnonymousClassDeclaration(); - - JD1 = ast.newJSdoc(); - JD2 = ast.newJSdoc(); - if (ast.apiLevel() == AST.JLS2) { - JD1.setComment("/**X*/"); //$NON-NLS-1$ - JD2.setComment("/**Y*/"); //$NON-NLS-1$ - } - - BC1 = ast.newBlockComment(); - - TAG1 = ast.newTagElement(); - TAG1.setTagName("@foo"); //$NON-NLS-1$ - - TAG2 = ast.newTagElement(); - TAG2.setTagName("@bar"); //$NON-NLS-1$ - - TEXT1 = ast.newTextElement(); - TEXT1.setText("foo"); //$NON-NLS-1$ - - MBREF1 = ast.newMemberRef(); - MBREF1.setName(ast.newSimpleName("p")); //$NON-NLS-1$ - - MTHREF1 = ast.newFunctionRef(); - MTHREF1.setName(ast.newSimpleName("p")); //$NON-NLS-1$ - - MPARM1 = ast.newFunctionRefParameter(); - MPARM1.setType(ast.newPrimitiveType(PrimitiveType.CHAR)); - - if (ast.apiLevel() >= AST.JLS3) { - PT1S = "[(tM[(tS[(nSZZnS)]tS)]tM)]"; //$NON-NLS-1$ - - TP1S = "[(tTP[(nSxxnS)]tTP)]"; //$NON-NLS-1$ - - TP2S = "[(tTP[(nSyynS)]tTP)]"; //$NON-NLS-1$ - LC1 = ast.newLineComment(); - - - MOD1 = ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD); - MOD2 = ast.newModifier(Modifier.ModifierKeyword.FINAL_KEYWORD); - - } - - } - - protected void tearDown() throws Exception { - ast = null; - super.tearDown(); - } - - /** @deprecated using deprecated code */ - public String getName() { - String name = super.getName(); - switch (this.API_LEVEL) { - case AST.JLS2: - name = "JLS2 - " + name; - break; - case AST.JLS3: - name = "JLS3 - " + name; - break; - } - return name; - } - - /** - * An ASTMatcher that simply records the arguments it is passed, - * immediately returns a pre-ordained answer, and counts how many - * times it is called. - */ - class TestMatcher extends ASTMatcher { - - public Object receiverNode; - public Object otherNode; - public boolean result; - public boolean superMatch; - public boolean superMatchResult; - public int matchCalls = 0; - - TestMatcher() { - this(false); - } - - TestMatcher(boolean visitDocTags) { - super(visitDocTags); - } - - boolean standardBody(ASTNode receiver, Object other, boolean matchResult) { - matchCalls++; - this.receiverNode = receiver; - this.otherNode = other; - this.superMatchResult = matchResult; - if (superMatch) { - return this.superMatchResult; - } - return this.result; - } - - public boolean match(AnonymousClassDeclaration node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(ArrayAccess node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(ArrayCreation node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(ArrayInitializer node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(ArrayType node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(Assignment node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(Block node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(BlockComment node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(BooleanLiteral node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(BreakStatement node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(CatchClause node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(CharacterLiteral node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(ClassInstanceCreation node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(JavaScriptUnit node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(ConditionalExpression node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(ConstructorInvocation node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(ContinueStatement node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(DoStatement node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(EmptyStatement node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(EnhancedForStatement node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(ExpressionStatement node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(FieldAccess node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(FieldDeclaration node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(ForStatement node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(IfStatement node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(ImportDeclaration node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(InfixExpression node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(Initializer node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(JSdoc node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(LabeledStatement node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(LineComment node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(MemberRef node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(FunctionDeclaration node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(FunctionInvocation node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(FunctionRef node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(FunctionRefParameter node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(Modifier node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(NullLiteral node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(NumberLiteral node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(PackageDeclaration node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(ParenthesizedExpression node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(PostfixExpression node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(PrefixExpression node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(PrimitiveType node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(QualifiedName node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(QualifiedType node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(ReturnStatement node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(SimpleName node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(SimpleType node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(SingleVariableDeclaration node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(StringLiteral node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(SuperConstructorInvocation node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(SuperFieldAccess node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(SuperMethodInvocation node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(SwitchCase node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(SwitchStatement node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - - public boolean match(TagElement node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(TextElement node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(ThisExpression node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(ThrowStatement node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(TryStatement node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(TypeDeclaration node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(TypeDeclarationStatement node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(TypeLiteral node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(VariableDeclarationExpression node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(VariableDeclarationFragment node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(VariableDeclarationStatement node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - public boolean match(WhileStatement node, Object other) { - return standardBody(node, other, superMatch ? super.match(node, other) : false); - } - } - - /** - * AST node visitor that counts the nodes visited. - */ - static class NodeCounter extends ASTVisitor { - public NodeCounter(boolean visitDocTags) { - super(visitDocTags); - } - - public int count = 0; - - /* (no javadoc for this method) - * Method declared on ASTVisitor. - */ - public void preVisit(ASTNode node) { - count++; - } - - } - - /** - * Returns the number of AST nodes in the given subtree. - * - * @param node the root of the subtree - * @param visitDocTags true if doc tags should be visited - * @return the number of nodes (always positive) - */ - static int nodeCount(ASTNode node, boolean visitDocTags) { - NodeCounter c = new NodeCounter(visitDocTags); - node.accept(c); - return c.count; - } - - /** - * Checks that the ASTNode.subtreeMatch mechanism is working - * for a node of a given type. - */ - void basicMatch(ASTNode node) { - TestMatcher[] m = { - new TestMatcher(), - new TestMatcher(true), - new TestMatcher(false)}; - for (int i = 0; i < m.length; i++) { - // check that matcher was called with right arguments - // and that matches succeed - TestMatcher m1 = m[i]; - Object o1 = new Object(); - m1.result = true; - boolean result = node.subtreeMatch(m1, o1); - assertTrue(m1.matchCalls == 1); - assertTrue(m1.receiverNode == node); - assertTrue(m1.otherNode == o1); - assertTrue(result == true); - } - - m = new TestMatcher[] { - new TestMatcher(), - new TestMatcher(true), - new TestMatcher(false)}; - for (int i = 0; i < m.length; i++) { - // check that matcher was called with right arguments - // and that non-matches fail - TestMatcher m1 = m[i]; - Object o1 = new Object(); - m1.result = false; - boolean result = node.subtreeMatch(m1, o1); - assertTrue(m1.matchCalls == 1); - assertTrue(m1.receiverNode == node); - assertTrue(m1.otherNode == o1); - assertTrue(result == false); - } - - // check that ASTMatcher() default implementations delegate - { - int count = nodeCount(node, false); // ignore doc tags - TestMatcher m1 = new TestMatcher(); - m1.superMatch = true; - boolean result = node.subtreeMatch(m1, node); - assertTrue(m1.matchCalls == count); - assertTrue(result == true); - } - - // check that ASTMatcher(false) default implementations delegate - { - int count = nodeCount(node, false); // ignore doc tags - TestMatcher m1 = new TestMatcher(false); - m1.superMatch = true; - boolean result = node.subtreeMatch(m1, node); - assertTrue(m1.matchCalls == count); - assertTrue(result == true); - } - - // check that ASTMatcher(true) default implementations delegate - { - int count = nodeCount(node, true); // include doc tags - TestMatcher m1 = new TestMatcher(true); - m1.superMatch = true; - boolean result = node.subtreeMatch(m1, node); - assertTrue(m1.matchCalls == count); - assertTrue(result == true); - } - - } - - // NAMES - public void testSimpleName() { - Name x1 = ast.newName(new String[]{"Z"}); //$NON-NLS-1$ - basicMatch(x1); - } - - public void testQualifiedName() { - Name x1 = ast.newName(new String[]{"X", "Y"}); //$NON-NLS-1$ //$NON-NLS-2$ - basicMatch(x1); - } - - - // TYPES - public void testPrimitiveType() { - Type x1 = ast.newPrimitiveType(PrimitiveType.CHAR); - basicMatch(x1); - } - - public void testSimpleType() { - Type x1 = ast.newSimpleType(N1); - basicMatch(x1); - } - - public void testArrayType() { - Type x0 = ast.newPrimitiveType(PrimitiveType.CHAR); - Type x1 = ast.newArrayType(x0); - basicMatch(x1); - } - - /** @deprecated using deprecated code */ - public void testQualifiedType() { - if (ast.apiLevel() == AST.JLS2) { - return; - } - Type x1 = ast.newQualifiedType(T1, N1); - basicMatch(x1); - } - - // EXPRESSIONS and STATEMENTS - - public void testAnonymousClassDeclaration() { - AnonymousClassDeclaration x1 = ast.newAnonymousClassDeclaration(); - x1.bodyDeclarations().add(FD1); - x1.bodyDeclarations().add(FD2); - basicMatch(x1); - } - public void testArrayAccess() { - ArrayAccess x1 = ast.newArrayAccess(); - x1.setArray(E1); - x1.setIndex(E2); - basicMatch(x1); - } - public void testArrayCreation() { - ArrayCreation x1 = ast.newArrayCreation(); - x1.setType(ast.newArrayType(T1)); - x1.dimensions().add(E1); - x1.dimensions().add(E2); - x1.setInitializer(ast.newArrayInitializer()); - basicMatch(x1); - } - public void testArrayInitializer() { - ArrayInitializer x1 = ast.newArrayInitializer(); - x1.expressions().add(E1); - x1.expressions().add(E2); - basicMatch(x1); - } - public void testAssignment() { - Assignment x1 = ast.newAssignment(); - x1.setLeftHandSide(E1); - x1.setRightHandSide(E2); - basicMatch(x1); - } - public void testBlock() { - Block x1 = ast.newBlock(); - x1.statements().add(S1); - x1.statements().add(S2); - basicMatch(x1); - } - - public void testBlockComment() { - BlockComment x1 = ast.newBlockComment(); - basicMatch(x1); - } - - public void testBooleanLiteral() { - BooleanLiteral x1 = ast.newBooleanLiteral(true); - basicMatch(x1); - } - public void testBreakStatement() { - BreakStatement x1 = ast.newBreakStatement(); - x1.setLabel(N1); - basicMatch(x1); - } - public void testCatchClause() { - CatchClause x1 = ast.newCatchClause(); - x1.setException(V1); - x1.setBody(B1); - basicMatch(x1); - } - public void testCharacterLiteral() { - CharacterLiteral x1 = ast.newCharacterLiteral(); - x1.setCharValue('q'); - basicMatch(x1); - } - /** @deprecated using deprecated code */ - public void testClassInstanceCreation() { - ClassInstanceCreation x1 = ast.newClassInstanceCreation(); - x1.setExpression(E1); - if (ast.apiLevel() == AST.JLS2) { - x1.setName(N1); - } else { - x1.setType(T1); - } - x1.setAnonymousClassDeclaration(ACD1); - basicMatch(x1); - } - public void testCompilationUnit() { - JavaScriptUnit x1 = ast.newJavaScriptUnit(); - x1.setPackage(PD1); - x1.imports().add(ID1); - x1.imports().add(ID2); - x1.types().add(TD1); - x1.types().add(TD2); - basicMatch(x1); - } - public void testConditionalExpression() { - ConditionalExpression x1 = ast.newConditionalExpression(); - x1.setExpression(E1); - x1.setThenExpression(E2); - x1.setElseExpression(N1); - basicMatch(x1); - } - public void testConstructorInvocation() { - ConstructorInvocation x1 = ast.newConstructorInvocation(); - - x1.arguments().add(E1); - x1.arguments().add(E2); - basicMatch(x1); - } - public void testContinueStatement() { - ContinueStatement x1 = ast.newContinueStatement(); - x1.setLabel(N1); - basicMatch(x1); - } - public void testDoStatement() { - DoStatement x1 = ast.newDoStatement(); - x1.setExpression(E1); - x1.setBody(S1); - basicMatch(x1); - } - public void testEmptyStatement() { - EmptyStatement x1 = ast.newEmptyStatement(); - basicMatch(x1); - } - /** @deprecated using deprecated code */ - public void testEnhancedForStatement() { - if (ast.apiLevel() == AST.JLS2) { - return; - } - EnhancedForStatement x1 = ast.newEnhancedForStatement(); - x1.setParameter(V1); - x1.setExpression(E1); - x1.setBody(S1); - basicMatch(x1); - } - public void testExpressionStatement() { - ExpressionStatement x1 = ast.newExpressionStatement(E1); - basicMatch(x1); - } - public void testFieldAccess() { - FieldAccess x1 = ast.newFieldAccess(); - x1.setExpression(E1); - x1.setName(N1); - basicMatch(x1); - } - public void testFieldDeclaration() { - FieldDeclaration x1 = ast.newFieldDeclaration(W1); - x1.setJavadoc(JD1); - if (ast.apiLevel() >= AST.JLS3) { - x1.modifiers().add(MOD1); - x1.modifiers().add(MOD2); - } - x1.setType(T1); - x1.fragments().add(W2); - basicMatch(x1); - } - public void testForStatement() { - ForStatement x1 = ast.newForStatement(); - x1.initializers().add(E1); - x1.initializers().add(E2); - x1.setExpression(N1); - x1.updaters().add(N2); - x1.updaters().add(N3); - x1.setBody(S1); - basicMatch(x1); - } - public void testIfStatement() { - IfStatement x1 = ast.newIfStatement(); - x1.setExpression(E1); - x1.setThenStatement(S1); - x1.setElseStatement(S2); - basicMatch(x1); - } - public void testImportDeclaration() { - ImportDeclaration x1 = ast.newImportDeclaration(); - x1.setName(N1); - basicMatch(x1); - } - public void testInfixExpression() { - InfixExpression x1 = ast.newInfixExpression(); - x1.setOperator(InfixExpression.Operator.PLUS); - x1.setLeftOperand(E1); - x1.setRightOperand(E2); - x1.extendedOperands().add(N1); - x1.extendedOperands().add(N2); - basicMatch(x1); - } - public void testInitializer() { - Initializer x1 = ast.newInitializer(); - x1.setJavadoc(JD1); - if (ast.apiLevel() >= AST.JLS3) { - x1.modifiers().add(MOD1); - x1.modifiers().add(MOD2); - } - x1.setBody(B1); - basicMatch(x1); - } - /** - * @deprecated (not really - just suppressing the warnings - * that come from testing Javadoc.getComment()) - * - */ - public void testJavadoc() { - JSdoc x1 = ast.newJSdoc(); - if (ast.apiLevel() == AST.JLS2) { - x1.setComment("/**?*/"); //$NON-NLS-1$ - } - x1.tags().add(TAG1); - x1.tags().add(TAG2); - basicMatch(x1); - } - - public void testLabeledStatement() { - LabeledStatement x1 = ast.newLabeledStatement(); - x1.setLabel(N1); - x1.setBody(S1); - basicMatch(x1); - } - - public void testLineComment() { - LineComment x1 = ast.newLineComment(); - basicMatch(x1); - } - - public void testMemberRef() { - MemberRef x1 = ast.newMemberRef(); - x1.setQualifier(N1); - x1.setName(N2); - basicMatch(x1); - } - - /** @deprecated using deprecated code */ - public void testMethodDeclaration() { - FunctionDeclaration x1 = ast.newFunctionDeclaration(); - x1.setJavadoc(JD1); - if (ast.apiLevel() == AST.JLS2) { - x1.setReturnType(T1); - } else { - x1.modifiers().add(MOD1); - x1.modifiers().add(MOD2); - x1.setReturnType2(T1); - } - x1.setName(N1); - x1.parameters().add(V1); - x1.parameters().add(V2); - x1.thrownExceptions().add(N2); - x1.thrownExceptions().add(N3); - x1.setBody(B1); - basicMatch(x1); - } - public void testMethodInvocation() { - FunctionInvocation x1 = ast.newFunctionInvocation(); - x1.setExpression(N1); - - x1.setName(N2); - x1.arguments().add(E1); - x1.arguments().add(E2); - basicMatch(x1); - } - - public void testMethodRef() { - FunctionRef x1 = ast.newFunctionRef(); - basicMatch(x1); - x1.setQualifier(N1); - x1.setName(N2); - x1.parameters().add(MPARM1); - } - public void testMethodRefParameter() { - FunctionRefParameter x1 = ast.newFunctionRefParameter(); - x1.setType(T1); - x1.setName(N1); - basicMatch(x1); - } - - public void testNullLiteral() { - NullLiteral x1 = ast.newNullLiteral(); - basicMatch(x1); - } - public void testNumberLiteral() { - NumberLiteral x1 = ast.newNumberLiteral("1.0"); //$NON-NLS-1$ - basicMatch(x1); - } - public void testParenthesizedExpression() { - ParenthesizedExpression x1 = ast.newParenthesizedExpression(); - basicMatch(x1); - } - public void testPostfixExpression() { - PostfixExpression x1 = ast.newPostfixExpression(); - x1.setOperand(E1); - x1.setOperator(PostfixExpression.Operator.INCREMENT); - basicMatch(x1); - } - public void testPrefixExpression() { - PrefixExpression x1 = ast.newPrefixExpression(); - x1.setOperand(E1); - x1.setOperator(PrefixExpression.Operator.INCREMENT); - basicMatch(x1); - } - public void testReturnStatement() { - ReturnStatement x1 = ast.newReturnStatement(); - x1.setExpression(E1); - basicMatch(x1); - } - public void testSingleVariableDeclaration() { - SingleVariableDeclaration x1 = ast.newSingleVariableDeclaration(); - if (ast.apiLevel() >= AST.JLS3) { - x1.modifiers().add(MOD1); - x1.modifiers().add(MOD2); - } - x1.setType(T1); - x1.setName(N1); - x1.setInitializer(E1); - basicMatch(x1); - } - public void testStringLiteral() { - StringLiteral x1 = ast.newStringLiteral(); - x1.setLiteralValue("H"); //$NON-NLS-1$ - basicMatch(x1); - } - public void testSuperConstructorInvocation() { - SuperConstructorInvocation x1 = ast.newSuperConstructorInvocation(); - x1.setExpression(N1); - - x1.arguments().add(E1); - x1.arguments().add(E2); - basicMatch(x1); - } - public void testSuperFieldAccess() { - SuperFieldAccess x1 = ast.newSuperFieldAccess(); - x1.setQualifier(N1); - x1.setName(N2); - basicMatch(x1); - } - public void testSuperMethodInvocation() { - SuperMethodInvocation x1 = ast.newSuperMethodInvocation(); - x1.setQualifier(N1); - - x1.setName(N2); - x1.arguments().add(E1); - x1.arguments().add(E2); - basicMatch(x1); - } - public void testSwitchCase() { - SwitchCase x1 = ast.newSwitchCase(); - x1.setExpression(E1); - basicMatch(x1); - } - public void testSwitchStatement() { - SwitchStatement x1 = ast.newSwitchStatement(); - x1.setExpression(E1); - x1.statements().add(S1); - x1.statements().add(S2); - basicMatch(x1); - } - - public void testTagElement() { - TagElement x1 = ast.newTagElement(); - x1.setTagName("@foo"); //$NON-NLS-1$ - x1.fragments().add(TAG1); - x1.fragments().add(TEXT1); - x1.fragments().add(N1); - x1.fragments().add(MTHREF1); - basicMatch(x1); - } - public void testTextElement() { - TextElement x1 = ast.newTextElement(); - x1.setText("foo"); //$NON-NLS-1$ - basicMatch(x1); - } - - public void testThisExpression() { - ThisExpression x1 = ast.newThisExpression(); - x1.setQualifier(N1); - basicMatch(x1); - } - public void testThrowStatement() { - ThrowStatement x1 = ast.newThrowStatement(); - x1.setExpression(E1); - basicMatch(x1); - } - public void testTryStatement() { - TryStatement x1 = ast.newTryStatement(); - x1.setBody(B1); - CatchClause c1 = ast.newCatchClause(); - c1.setException(V1); - c1.setBody(ast.newBlock()); - x1.catchClauses().add(c1); - CatchClause c2 = ast.newCatchClause(); - c2.setException(V2); - c2.setBody(ast.newBlock()); - x1.catchClauses().add(c2); - x1.setFinally(ast.newBlock()); - basicMatch(x1); - } - /** @deprecated using deprecated code */ - public void testTypeDeclaration() { - TypeDeclaration x1 = ast.newTypeDeclaration(); - x1.setJavadoc(JD1); - x1.setName(N1); - if (ast.apiLevel() == AST.JLS2) { - x1.setSuperclass(N2); - } else { - x1.modifiers().add(MOD1); - x1.modifiers().add(MOD2); - } - x1.bodyDeclarations().add(FD1); - x1.bodyDeclarations().add(FD2); - basicMatch(x1); - } - public void testTypeDeclarationStatement() { - TypeDeclarationStatement x1 = ast.newTypeDeclarationStatement(TD1); - basicMatch(x1); - } - public void testTypeLiteral() { - TypeLiteral x1 = ast.newTypeLiteral(); - x1.setType(T1); - basicMatch(x1); - } - public void testVariableDeclarationFragment() { - VariableDeclarationFragment x1 = ast.newVariableDeclarationFragment(); - x1.setName(N1); - x1.setInitializer(E1); - basicMatch(x1); - } - public void testVariableDeclarationExpression() { - VariableDeclarationExpression x1 = ast.newVariableDeclarationExpression(W1); - if (ast.apiLevel() >= AST.JLS3) { - x1.modifiers().add(MOD1); - x1.modifiers().add(MOD2); - } - x1.setType(T1); - x1.fragments().add(W2); - basicMatch(x1); - } - public void testVariableDeclarationStatement() { - VariableDeclarationStatement x1 = ast.newVariableDeclarationStatement(W1); - if (ast.apiLevel() >= AST.JLS3) { - x1.modifiers().add(MOD1); - x1.modifiers().add(MOD2); - } - x1.setType(T1); - x1.fragments().add(W2); - basicMatch(x1); - } - public void testWhileStatement() { - WhileStatement x1 = ast.newWhileStatement(); - x1.setExpression(E1); - x1.setBody(S1); - basicMatch(x1); - } - - -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTModelBridgeTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTModelBridgeTests.java deleted file mode 100644 index 2642df9..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTModelBridgeTests.java +++ /dev/null @@ -1,1419 +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.io.IOException; - -import junit.framework.Test; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.wst.jsdt.core.IClassFile; -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.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.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.AnonymousClassDeclaration; -import org.eclipse.wst.jsdt.core.dom.ArrayType; -import org.eclipse.wst.jsdt.core.dom.FunctionDeclaration; -import org.eclipse.wst.jsdt.core.dom.FunctionInvocation; -import org.eclipse.wst.jsdt.core.dom.IBinding; -import org.eclipse.wst.jsdt.core.dom.IFunctionBinding; -import org.eclipse.wst.jsdt.core.dom.IPackageBinding; -import org.eclipse.wst.jsdt.core.dom.ITypeBinding; -import org.eclipse.wst.jsdt.core.dom.QualifiedName; -import org.eclipse.wst.jsdt.core.dom.SimpleName; -import org.eclipse.wst.jsdt.core.dom.SuperConstructorInvocation; -import org.eclipse.wst.jsdt.core.dom.Type; -import org.eclipse.wst.jsdt.core.dom.TypeDeclaration; -import org.eclipse.wst.jsdt.core.dom.TypeDeclarationStatement; -import org.eclipse.wst.jsdt.core.dom.VariableDeclaration; -import org.eclipse.wst.jsdt.core.search.IJavaScriptSearchConstants; -import org.eclipse.wst.jsdt.core.search.IJavaScriptSearchScope; -import org.eclipse.wst.jsdt.core.search.SearchEngine; -import org.eclipse.wst.jsdt.core.tests.model.AbstractJavaSearchTests; - -/* - * Test the bridge between the DOM AST and the Java model. - */ -public class ASTModelBridgeTests extends AbstractASTTests { - - IJavaScriptUnit workingCopy; - - public ASTModelBridgeTests(String name) { - super(name); - } - - public static Test suite() { - return buildModelTestSuite(ASTModelBridgeTests.class); - } - - // Use this static initializer to specify subset for tests - // All specified tests which do not belong to the class are skipped... - static { -// TESTS_PREFIX = "testBug86380"; -// TESTS_NAMES = new String[] { "testCreateBindings19" }; -// TESTS_NUMBERS = new int[] { 83230 }; -// TESTS_RANGE = new int[] { 83304, -1 }; - } - - /* - * Removes the marker comments "*start*" and "*end*" from the given contents, - * builds an AST from the resulting source, and returns the AST node that was delimited - * by "*start*" and "*end*". - */ - private ASTNode buildAST(String contents) throws JavaScriptModelException { - return buildAST(contents, this.workingCopy); - } - - private IBinding[] createBindings(String contents, IJavaScriptElement element) throws JavaScriptModelException { - this.workingCopy.getBuffer().setContents(contents); - this.workingCopy.makeConsistent(null); - ASTParser parser = ASTParser.newParser(AST.JLS3); - parser.setProject(getJavaProject("P")); - IJavaScriptElement[] elements = new IJavaScriptElement[] {element}; - return parser.createBindings(elements, null); - } - - private IBinding[] createBinaryBindings(String contents, IJavaScriptElement element) throws CoreException { - createClassFile("/P/lib", "A.class", contents); - ASTParser parser = ASTParser.newParser(AST.JLS3); - parser.setProject(getJavaProject("P")); - IJavaScriptElement[] elements = new IJavaScriptElement[] {element}; - return parser.createBindings(elements, null); - } - - public void setUpSuite() throws Exception { - super.setUpSuite(); - setUpJavaProject(); - } - - private void setUpJavaProject() throws CoreException, IOException, JavaScriptModelException { - IJavaScriptProject project = createJavaProject("P", new String[] {"src"}, new String[] {"JCL15_LIB,JCL15_SRC", "/P/lib"}, "bin", "1.5"); - project.setOption(JavaScriptCore.COMPILER_PB_UNUSED_LOCAL, JavaScriptCore.IGNORE); - project.setOption(JavaScriptCore.COMPILER_PB_UNUSED_PRIVATE_MEMBER, JavaScriptCore.IGNORE); - project.setOption(JavaScriptCore.COMPILER_PB_FIELD_HIDING, JavaScriptCore.IGNORE); - project.setOption(JavaScriptCore.COMPILER_PB_LOCAL_VARIABLE_HIDING, JavaScriptCore.IGNORE); - project.setOption(JavaScriptCore.COMPILER_PB_TYPE_PARAMETER_HIDING, JavaScriptCore.IGNORE); - project.setOption(JavaScriptCore.COMPILER_PB_RAW_TYPE_REFERENCE, JavaScriptCore.IGNORE); - addLibrary( - project, - "lib.jar", - "libsrc.zip", - new String[] { - "p/Y.js", - "package p;\n" + - "public class Y {\n" + - " public Y(T t) {\n" + - " }\n" + - "}", - "p/Z.js", - "package p;\n" + - "public class Z {\n" + - " /*start*/class Member {\n" + - " }/*end*/\n" + - " void foo() {\n" + - " new Member() {};\n" + - " }\n" + - "}", - "p/W.js", - "package p;\n" + - "public class W {\n" + - " class Member {\n" + - " /*start*/Member(String s) {\n" + - " }/*end*/\n" + - " }\n" + - "}", - "p/ABC.js", - "package p;\n" + - "public class ABC {\n" + - "}", - "Z.js", - "public class Z {\n" + - " /*start*/class Member {\n" + - " }/*end*/\n" + - " void foo() {\n" + - " new Member() {};\n" + - " }\n" + - "}" - }, - "1.5"); - this.workingCopy = getCompilationUnit("/P/src/X.js").getWorkingCopy( - new WorkingCopyOwner() {}, - null/*no progress*/); - } - - public void tearDownSuite() throws Exception { - tearDownJavaProject(); - super.tearDownSuite(); - } - - private void tearDownJavaProject() throws JavaScriptModelException, CoreException { - if (this.workingCopy != null) - this.workingCopy.discardWorkingCopy(); - deleteProject("P"); - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing an anonymous type is correct. - */ - public void testAnonymousType() throws JavaScriptModelException { - ASTNode node = buildAST( - "public class X {\n" + - " Object foo() {\n" + - " return new Object() /*start*/{\n" + - " }/*end*/;\n" + - " }\n" + - "}" - ); - IBinding binding = ((AnonymousClassDeclaration) node).resolveBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - " [in foo() [in X [in [Working copy] X.java [in [in src [in P]]]]]]", - element - ); - assertTrue("Element should exist", element.exists()); - } - - public void testAnonymousType2() throws JavaScriptModelException { - ASTNode node = buildAST( - "public class X {\n" + - " public void foo() {\n" + - " new Y(0/*c*/) /*start*/{\n" + - " Object field;\n" + - " }/*end*/;\n" + - " }\n" + - "}\n" + - "class Y {\n" + - " Y(int i) {\n" + - " }\n" + - "}" - ); - IBinding binding = ((AnonymousClassDeclaration) node).resolveBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - " [in foo() [in X [in [Working copy] X.java [in [in src [in P]]]]]]", - element - ); - assertTrue("Element should exist", element.exists()); - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing an array type is correct. - */ - public void testArrayType1() throws JavaScriptModelException { - ASTNode node = buildAST( - "public class X {\n" + - " /*start*/Object[]/*end*/ field;\n" + - "}" - ); - IBinding binding = ((ArrayType) node).resolveBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - "Object [in Object.class [in java.lang [in "+ getExternalJCLPathString("1.5") + "]]]", - element - ); - assertTrue("Element should exist", element.exists()); - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing an array type of base type null. - * (regression test for bug 100142 - CCE when calling ITypeBinding#getJavaElement() on char[][] - */ - public void testArrayType2() throws JavaScriptModelException { - ASTNode node = buildAST( - "public class X {\n" + - " /*start*/char[][]/*end*/ field;\n" + - "}" - ); - IBinding binding = ((ArrayType) node).resolveBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - "", - element - ); - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing a method coming from a class file is correct. - * (regression test for bug 91445 IFunctionBinding.getJavaElement() returns an "unopen" IFunction) - */ - public void testBinaryMethod() throws JavaScriptModelException { - IClassFile classFile = getClassFile("P", getExternalJCLPathString("1.5"), "java.lang", "Enum.class"); - String source = classFile.getSource(); - MarkerInfo markerInfo = new MarkerInfo(source); - markerInfo.astStarts = new int[] {source.indexOf("protected Enum")}; - markerInfo.astEnds = new int[] {source.indexOf('}', markerInfo.astStarts[0]) + 1}; - ASTNode node = buildAST(markerInfo, classFile); - IBinding binding = ((FunctionDeclaration) node).resolveBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - "Enum(java.lang.String, int) [in Enum [in Enum.class [in java.lang [in "+ getExternalJCLPathString("1.5") + "]]]]", - element - ); - assertTrue("Element should exist", element.exists()); - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing 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 testBinaryMemberTypeConstructor() throws JavaScriptModelException { - IClassFile classFile = getClassFile("P", "/P/lib.jar", "p", "W$Member.class"); - String source = classFile.getSource(); - MarkerInfo markerInfo = new MarkerInfo(source); - markerInfo.astStarts = new int[] {source.indexOf("/*start*/") + "/*start*/".length()}; - markerInfo.astEnds = new int[] {source.indexOf("/*end*/")}; - ASTNode node = buildAST(markerInfo, classFile); - IBinding binding = ((FunctionDeclaration) node).resolveBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - "Member(p.W, java.lang.String) [in Member [in W$Member.class [in p [in lib.jar [in P]]]]]", - element - ); - assertTrue("Element should exist", element.exists()); - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing a type coming from a class file is correct. - */ - public void testBinaryType() throws JavaScriptModelException { - IClassFile classFile = getClassFile("P", getExternalJCLPathString("1.5"), "java.lang", "String.class"); - String source = classFile.getSource(); - MarkerInfo markerInfo = new MarkerInfo(source); - markerInfo.astStarts = new int[] {source.indexOf("public")}; - markerInfo.astEnds = new int[] {source.lastIndexOf('}') + 1}; - ASTNode node = buildAST(markerInfo, classFile); - IBinding binding = ((TypeDeclaration) node).resolveBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - "String [in String.class [in java.lang [in "+ getExternalJCLPathString("1.5") + "]]]", - element - ); - assertTrue("Element should exist", element.exists()); - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing a type coming from a class file is correct - * after searching for references to this type. - * (regression test for bug 136016 [refactoring] CCE during Use Supertype refactoring) - */ - public void testBinaryType2() throws CoreException { - IClassFile classFile = getClassFile("P", "lib.jar", "p", "ABC.class"); // class with no references - - // ensure classfile is open - classFile.open(null); - - //search for references to p.ABC after adding references in exactly 1 file - try { - createFile( - "/P/src/Test.js", - "import p.ABC;\n" + - "public class Test extends ABC {\n" + - "}" - ); - IJavaScriptSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaScriptElement[] {getPackageFragmentRoot("/P/src")}); - search(classFile.getType(), IJavaScriptSearchConstants.REFERENCES, scope, new AbstractJavaSearchTests.JavaSearchResultCollector()); - } finally { - deleteFile("/P/src/Test.js"); - } - - String source = classFile.getSource(); - MarkerInfo markerInfo = new MarkerInfo(source); - markerInfo.astStarts = new int[] {source.indexOf("public")}; - markerInfo.astEnds = new int[] {source.lastIndexOf('}') + 1}; - ASTNode node = buildAST(markerInfo, classFile); - IBinding binding = ((TypeDeclaration) node).resolveBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - "ABC [in ABC.class [in p [in lib.jar [in P]]]]", - element - ); - assertTrue("Element should exist", element.exists()); - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing a type in a jar is correct after deleting the first project - * referencing it. - */ - public void testBinaryType3() throws CoreException, IOException { - // force String to be put in the jar cache - buildAST( - "public class X {\n" + - " /*start*/String/*end*/ field;\n" + - "}" - ); - try { - tearDownJavaProject(); - - createJavaProject("P1", new String[] {""}, new String[] {"JCL15_LIB"}, "", "1.5"); - createFile( - "/P1/X.js", - "public class X {\n" + - " /*start*/String/*end*/ field;\n" + - "}" - ); - ASTNode node = buildAST(getCompilationUnit("/P1/X.js")); - IBinding binding = ((Type) node).resolveBinding(); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - "String [in String.class [in java.lang [in "+ getExternalJCLPathString("1.5") + "]]]", - element - ); - assertTrue("Element should exist", element.exists()); - } finally { - deleteProject("P1"); - setUpJavaProject(); - } - } - - /* - * Ensures that the IJavaScriptElement for a binary member type coming from an anoumous class file is correct. - * (regression test for bug 100636 [model] Can't find overriden methods of protected nonstatic inner class.) - */ - public void testBinaryMemberTypeFromAnonymousClassFile1() throws JavaScriptModelException { - IClassFile classFile = getClassFile("P", "/P/lib.jar", "p", "Z$1.class"); - String source = classFile.getSource(); - MarkerInfo markerInfo = new MarkerInfo(source); - markerInfo.astStarts = new int[] {source.indexOf("/*start*/") + "/*start*/".length()}; - markerInfo.astEnds = new int[] {source.indexOf("/*end*/")}; - ASTNode node = buildAST(markerInfo, classFile); - IBinding binding = ((TypeDeclaration) node).resolveBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - "Member [in Z$Member.class [in p [in lib.jar [in P]]]]", - element - ); - assertTrue("Element should exist", element.exists()); - } - - /* - * Ensures that the IJavaScriptElement for a binary member type coming from an anoumous class file is correct. - * (regression test for bug 100636 [model] Can't find overriden methods of protected nonstatic inner class.) - */ - public void testBinaryMemberTypeFromAnonymousClassFile2() throws JavaScriptModelException { - IClassFile classFile = getClassFile("P", "/P/lib.jar", "", "Z$1.class"); - String source = classFile.getSource(); - MarkerInfo markerInfo = new MarkerInfo(source); - markerInfo.astStarts = new int[] {source.indexOf("/*start*/") + "/*start*/".length()}; - markerInfo.astEnds = new int[] {source.indexOf("/*end*/")}; - ASTNode node = buildAST(markerInfo, classFile); - IBinding binding = ((TypeDeclaration) node).resolveBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - "Member [in Z$Member.class [in [in lib.jar [in P]]]]", - element - ); - assertTrue("Element should exist", element.exists()); - } - - /* - * Ensures that the correct IBindings are created for a given set of IJavaScriptElement - * (test several kinds of elements) - */ - public void testCreateBindings01() throws JavaScriptModelException { - ASTParser parser = ASTParser.newParser(AST.JLS3); - parser.setResolveBindings(true); - parser.setProject(getJavaProject("P")); - WorkingCopyOwner owner = new WorkingCopyOwner() {}; - this.workingCopies = new IJavaScriptUnit[3]; - this.workingCopies[0] = getWorkingCopy( - "/P/src/X.js", - "public class X {\n" + - " public void foo(int i, String s) {\n" + - " }\n" + - "}", - owner, false); - this.workingCopies[1] = getWorkingCopy( - "/P/src/Y.js", - "public class Y extends X {\n" + - " void bar() {\n" + - " new Y() {};\n" + - " }\n" + - "}", - owner, false); - this.workingCopies[2] = getWorkingCopy( - "/P/src/I.js", - "public interface I {\n" + - " int BAR;\n" + - "}", - owner, false); - IType typeX = this.workingCopies[0].getType("X"); - IJavaScriptElement[] elements = new IJavaScriptElement[] { - typeX, - getClassFile("P", getExternalJCLPathString("1.5"), "java.lang", "Object.class").getType(), - typeX.getFunction("foo", new String[] {"I", "QString;"}), - this.workingCopies[2].getType("I").getField("BAR"), - this.workingCopies[1].getType("Y").getFunction("bar", new String[0]).getType("", 1) - }; - IBinding[] bindings = parser.createBindings(elements, null); - assertBindingsEqual( - "LX;\n" + - "Ljava/lang/Object;\n" + - "LX;.foo(ILjava/lang/String;)V\n" + - "LI;.BAR)I\n" + - "LY$50;", - bindings); - } - - /* - * Ensures that the correct IBindings are created for a given set of IJavaScriptElement - * (top level type) - */ - public void testCreateBindings02() throws JavaScriptModelException { - IBinding[] bindings = createBindings( - "public class X {\n" + - "}", - this.workingCopy.getType("X") - ); - assertBindingsEqual( - "LX;", - bindings); - } - - /* - * Ensures that the correct IBindings are created for a given set of IJavaScriptElement - * (member type) - */ - public void testCreateBindings03() throws JavaScriptModelException { - IBinding[] bindings = createBindings( - "public class X {\n" + - " public class Member {\n" + - " }\n" + - "}", - this.workingCopy.getType("X").getType("Member") - ); - assertBindingsEqual( - "LX$Member;", - bindings); - } - - /* - * Ensures that the correct IBindings are created for a given set of IJavaScriptElement - * (anonymous type) - */ - public void testCreateBindings04() throws JavaScriptModelException { - IBinding[] bindings = createBindings( - "public class X {\n" + - " void foo() {\n" + - " new X() {\n" + - " };\n" + - " }\n" + - "}", - this.workingCopy.getType("X").getFunction("foo", new String[0]).getType("", 1) - ); - assertBindingsEqual( - "LX$40;", - bindings); - } - - /* - * Ensures that the correct IBindings are created for a given set of IJavaScriptElement - * (local type) - */ - public void testCreateBindings05() throws JavaScriptModelException { - IBinding[] bindings = createBindings( - "public class X {\n" + - " void foo() {\n" + - " class Y {\n" + - " }\n" + - " }\n" + - "}", - this.workingCopy.getType("X").getFunction("foo", new String[0]).getType("Y", 1) - ); - assertBindingsEqual( - "LX$42$Y;", - bindings); - } - - /* - * Ensures that the correct IBindings are created for a given set of IJavaScriptElement - * (field) - */ - public void testCreateBindings06() throws JavaScriptModelException { - IBinding[] bindings = createBindings( - "public class X {\n" + - " int field;\n" + - "}", - this.workingCopy.getType("X").getField("field") - ); - assertBindingsEqual( - "LX;.field)I", - bindings); - } - - /* - * Ensures that the correct IBindings are created for a given set of IJavaScriptElement - * (method) - */ - public void testCreateBindings07() throws JavaScriptModelException { - IBinding[] bindings = createBindings( - "public class X {\n" + - " void foo() {}\n" + - "}", - this.workingCopy.getType("X").getFunction("foo", new String[0]) - ); - assertBindingsEqual( - "LX;.foo()V", - bindings); - } - - /* - * Ensures that the correct IBindings are created for a given set of IJavaScriptElement - * (annotation declaration) - */ - public void testCreateBindings08() throws JavaScriptModelException { - IBinding[] bindings = createBindings( - "@interface X {\n" + - "}", - this.workingCopy.getType("X") - ); - assertBindingsEqual( - "LX;", - bindings); - } - - /* - * Ensures that the correct IBindings are created for a given set of IJavaScriptElement - * (enum declaration) - */ - public void testCreateBindings09() throws JavaScriptModelException { - IBinding[] bindings = createBindings( - "public enum X {\n" + - "}", - this.workingCopy.getType("X") - ); - assertBindingsEqual( - "LX;", - bindings); - } - - /* - * Ensures that the correct IBindings are created for a given set of IJavaScriptElement - * (annotation member declaration) - */ - public void testCreateBindings10() throws JavaScriptModelException { - IBinding[] bindings = createBindings( - "@interface X {\n" + - " int foo();\n" + - "}", - this.workingCopy.getType("X").getFunction("foo", new String[0]) - ); - assertBindingsEqual( - "LX;.foo()I", - bindings); - } - - /* - * Ensures that the correct IBindings are created for a given set of IJavaScriptElement - * (enum constant) - */ - public void testCreateBindings11() throws JavaScriptModelException { - IBinding[] bindings = createBindings( - "public enum X {\n" + - " FOO;\n" + - "}", - this.workingCopy.getType("X").getField("FOO") - ); - assertBindingsEqual( - "LX;.FOO)LX;", - bindings); - } - - /* - * Ensures that the correct IBindings are created for a given set of IJavaScriptElement - * (import) - */ - public void testCreateBindings12() throws JavaScriptModelException { - IBinding[] bindings = createBindings( - "import java.io.*;\n" + - "public class X implements Serializable {\n" + - " static final long serialVersionUID = 0;\n" + - "}", - this.workingCopy.getImport("java.io.*") - ); - assertBindingsEqual( - "java/io", - bindings); - } - - /* - * Ensures that the correct IBindings are created for a given set of IJavaScriptElement - * (import) - */ - public void testCreateBindings13() throws JavaScriptModelException { - IBinding[] bindings = createBindings( - "import java.io.Serializable;\n" + - "public class X implements Serializable {\n" + - " static final long serialVersionUID = 0;\n" + - "}", - this.workingCopy.getImport("java.io.Serializable") - ); - assertBindingsEqual( - "Ljava/io/Serializable;", - bindings); - } - - /* - * Ensures that the correct IBindings are created for a given set of IJavaScriptElement - * (binary type) - */ - public void testCreateBindings15() throws CoreException { - IBinding[] bindings = createBinaryBindings( - "public class A {\n" + - "}", - getClassFile("/P/lib/A.class").getType() - ); - assertBindingsEqual( - "LA;", - bindings); - } - - /* - * Ensures that the correct IBindings are created for a given set of IJavaScriptElement - * (binary field) - */ - public void testCreateBindings16() throws CoreException { - IBinding[] bindings = createBinaryBindings( - "public class A {\n" + - " int field;\n" + - "}", - getClassFile("/P/lib/A.class").getType().getField("field") - ); - assertBindingsEqual( - "LA;.field)I", - bindings); - } - - /* - * Ensures that the correct IBindings are created for a given set of IJavaScriptElement - * (binary method) - */ - public void testCreateBindings17() throws CoreException { - IBinding[] bindings = createBinaryBindings( - "public class A {\n" + - " int foo(String s, boolean b) {\n" + - " return -1;\n" + - " }\n" + - "}", - getClassFile("/P/lib/A.class").getType().getFunction("foo", new String[] {"Ljava.lang.String;", "Z"}) - ); - assertBindingsEqual( - "LA;.foo(Ljava/lang/String;Z)I", - bindings); - } - - /* - * Ensures that the correct IBindings are created for a given set of IJavaScriptElement - * (binary method) - * (regression test for bug 122650 ASTParser.createBindings(IJavaScriptElement[]) returns wrong element) - */ - public void testCreateBindings18() throws CoreException { - IBinding[] bindings = createBinaryBindings( - "public class A {\n" + - " void foo(E e) {\n" + - " }\n" + - "}", - getClassFile("/P/lib/A.class").getType().getFunction("foo", new String[] {"TE;"}) - ); - assertBindingsEqual( - "LA;.foo(TE;)V", - bindings); - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing a field is correct. - */ - public void testField1() throws JavaScriptModelException { - ASTNode node = buildAST( - "public class X {\n" + - " Object /*start*/field/*end*/;\n" + - "}" - ); - IBinding binding = ((VariableDeclaration) node).resolveBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - "field [in X [in [Working copy] X.java [in [in src [in P]]]]]", - element - ); - assertTrue("Element should exist", element.exists()); - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing a field is correct. - */ - public void testField2() throws JavaScriptModelException { - ASTNode node = buildAST( - "public class X {\n" + - " Object foo() {\n" + - " return new Object() {\n" + - " Object /*start*/field/*end*/;\n" + - " };\n" + - " }\n" + - "}" - ); - IBinding binding = ((VariableDeclaration) node).resolveBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - "field [in [in foo() [in X [in [Working copy] X.java [in [in src [in P]]]]]]]", - element - ); - assertTrue("Element should exist", element.exists()); - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing a local type is correct. - */ - public void testLocalType() throws JavaScriptModelException { - ASTNode node = buildAST( - "public class X {\n" + - " void foo() {\n" + - " /*start*/class Y {\n" + - " }/*end*/\n" + - " }\n" + - "}" - ); - IBinding binding = ((TypeDeclarationStatement) node).resolveBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - "Y [in foo() [in X [in [Working copy] X.java [in [in src [in P]]]]]]", - element - ); - assertTrue("Element should exist", element.exists()); - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing a local type - * and coming from a binding key resolution is correct. - */ - public void testLocalType2() throws CoreException { - String filePath = "/P/src/Z.js"; - try { - String contents = - "public class Z {\n" + - " void foo() {\n" + - " /*start*/class Local {\n" + - " }/*end*/\n" + - " }\n" + - "}"; - createFile(filePath, contents); - - // Get the binding key - ASTNode node = buildAST(contents, getCompilationUnit(filePath)); - IBinding binding = ((TypeDeclarationStatement) node).resolveBinding(); - String bindingKey = binding.getKey(); - - // Resolve the binding key - BindingRequestor requestor = new BindingRequestor(); - String[] bindingKeys = new String[] {bindingKey}; - resolveASTs( - new IJavaScriptUnit[] {}, - bindingKeys, - requestor, - getJavaProject("P"), - workingCopy.getOwner() - ); - IBinding[] bindings = requestor.getBindings(bindingKeys); - - // Ensure the Java element is correct - IJavaScriptElement element = bindings[0].getJavaElement(); - assertElementEquals( - "Unexpected Java element", - "Local [in foo() [in Z [in Z.java [in [in src [in P]]]]]]", - element - ); - assertTrue("Element should exist", element.exists()); - } finally { - deleteFile(filePath); - } - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing a local variable is correct. - * (regression test for bug 79610 IVariableBinding#getJavaElement() returns null for local variables) - */ - public void testLocalVariable1() throws JavaScriptModelException { - ASTNode node = buildAST( - "public class X {\n" + - " void foo() {\n" + - " int /*start*/local/*end*/;\n" + - " }\n" + - "}" - ); - IBinding binding = ((VariableDeclaration) node).resolveBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - IJavaScriptElement expected = getLocalVariable(this.workingCopy, "local", "local"); - assertEquals( - "Unexpected Java element", - expected, - element - ); - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing a local variable is correct. - * (regression test for bug 79610 IVariableBinding#getJavaElement() returns null for local variables) - */ - public void testLocalVariable2() throws JavaScriptModelException { - ASTNode node = buildAST( - "public class X {\n" + - " void foo() {\n" + - " Object first, /*start*/second/*end*/, third;\n" + - " }\n" + - "}" - ); - IBinding binding = ((VariableDeclaration) node).resolveBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - IJavaScriptElement expected = getLocalVariable(this.workingCopy, "second", "second"); - assertEquals( - "Unexpected Java element", - expected, - element - ); - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing a local variable is correct. - * (regression test for bug 80021 [1.5] CCE in VariableBinding.getJavaElement()) - */ - public void testLocalVariable3() throws JavaScriptModelException { - ASTNode node = buildAST( - "public class X {\n" + - " void foo(/*start*/int arg/*end*/) {\n" + - " }\n" + - "}" - ); - IBinding binding = ((VariableDeclaration) node).resolveBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - IJavaScriptElement expected = getLocalVariable(this.workingCopy, "arg", "arg"); - assertEquals( - "Unexpected Java element", - expected, - element - ); - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing a member type is correct. - */ - public void testMemberType() throws JavaScriptModelException { - ASTNode node = buildAST( - "public class X {\n" + - " /*start*/class Y {\n" + - " }/*end*/\n" + - "}" - ); - IBinding binding = ((TypeDeclaration) node).resolveBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - "Y [in X [in [Working copy] X.java [in [in src [in P]]]]]", - element - ); - assertTrue("Element should exist", element.exists()); - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing a method is correct. - */ - public void testMethod01() throws JavaScriptModelException { - ASTNode node = buildAST( - "public class X {\n" + - " /*start*/void foo(int i, Object o, java.lang.String s, Class[] c, X x) {\n" + - " }/*end*/\n" + - "}" - ); - IBinding binding = ((FunctionDeclaration) node).resolveBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - "foo(int, Object, java.lang.String, Class[], X) [in X [in [Working copy] X.java [in [in src [in P]]]]]", - element - ); - assertTrue("Element should exist", element.exists()); - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing a method is correct. - */ - public void testMethod02() throws JavaScriptModelException { - ASTNode node = buildAST( - "public class X {\n" + - " /*start*/void foo() {\n" + - " }/*end*/\n" + - "}" - ); - IBinding binding = ((FunctionDeclaration) node).resolveBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - "foo() [in X [in [Working copy] X.java [in [in src [in P]]]]]", - element - ); - assertTrue("Element should exist", element.exists()); - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing a method is correct. - * (regression test for bug 78757 FunctionBinding.getJavaElement() returns null) - */ - public void testMethod03() throws JavaScriptModelException { - IJavaScriptUnit otherWorkingCopy = null; - try { - otherWorkingCopy = getWorkingCopy( - "/P/src/Y.js", - "public class Y {\n" + - " void foo(int i, String[] args, java.lang.Class clazz) {}\n" + - "}", - this.workingCopy.getOwner(), - null - ); - ASTNode node = buildAST( - "public class X {\n" + - " void bar() {\n" + - " Y y = new Y();\n" + - " /*start*/y.foo(1, new String[0], getClass())/*end*/;\n" + - " }\n" + - "}" - ); - IBinding binding = ((FunctionInvocation) node).resolveMethodBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - "foo(int, String[], java.lang.Class) [in Y [in [Working copy] Y.java [in [in src [in P]]]]]", - element - ); - assertTrue("Element should exist", element.exists()); - } finally { - if (otherWorkingCopy != null) - otherWorkingCopy.discardWorkingCopy(); - } - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing a method is correct. - * (regression test for bug 81258 IFunctionBinding#getJavaElement() is null with inferred method parameterization) - */ - public void testMethod04() throws JavaScriptModelException { - ASTNode node = buildAST( - "public class X {\n" + - " void foo() {\n" + - " /*start*/bar(new B())/*end*/;\n" + - " }\n" + - " void bar(A arg) {\n" + - " }\n" + - "}\n" + - "class A {\n" + - "}\n" + - "class B extends A { \n" + - "}" - ); - IBinding binding = ((FunctionInvocation) node).resolveMethodBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - "bar(A) [in X [in [Working copy] X.java [in [in src [in P]]]]]", - element - ); - assertTrue("Element should exist", element.exists()); - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing a parameterized method is correct. - * (regression test for bug 82382 IFunctionBinding#getJavaElement() for method m(T t) in parameterized type Gen is null) - */ - public void testMethod05() throws JavaScriptModelException { - ASTNode node = buildAST( - "public class X {\n" + - " void m(T t) { }\n" + - "}\n" + - "\n" + - "class Y {\n" + - " {\n" + - " /*start*/new X().m(\"s\")/*end*/;\n" + - " }\n" + - "}" - ); - IBinding binding = ((FunctionInvocation) node).resolveMethodBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - "m(T) [in X [in [Working copy] X.java [in [in src [in P]]]]]", - element - ); - assertTrue("Element should exist", element.exists()); - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing a method inside an annotation is correct. - * (regression test for bug 83300 [1.5] ClassCastException in #getJavaElement() on binding of annotation element) - */ - public void testMethod06() throws JavaScriptModelException { - ASTNode node = buildAST( - "@X(/*start*/value/*end*/=\"Hello\", count=-1)\n" + - "@interface X {\n" + - " String value();\n" + - " int count();\n" + - "}" - ); - IBinding binding = ((SimpleName) node).resolveBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - "value() [in X [in [Working copy] X.java [in [in src [in P]]]]]", - element - ); - assertTrue("Element should exist", element.exists()); - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing a method with array parameters is correct. - * (regression test for bug 88769 IFunctionBinding#getJavaElement() drops extra array dimensions and varargs - */ - public void testMethod07() throws JavaScriptModelException { - ASTNode node = buildAST( - "public class X {\n" + - " /*start*/public int[] bar(int a[]) {\n" + - " return a;\n" + - " }/*end*/\n" + - "}" - ); - IBinding binding = ((FunctionDeclaration) node).resolveBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - "bar(int[]) [in X [in [Working copy] X.java [in [in src [in P]]]]]", - element - ); - assertTrue("Element should exist", element.exists()); - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing a method with array parameters is correct. - * (regression test for bug 88769 IFunctionBinding#getJavaElement() drops extra array dimensions and varargs - */ - public void testMethod08() throws JavaScriptModelException { - ASTNode node = buildAST( - "public class X {\n" + - " /*start*/public Object[] bar2(Object[] o[][]) [][] {\n" + - " return o;\n" + - " }/*end*/\n" + - "}" - ); - IBinding binding = ((FunctionDeclaration) node).resolveBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - "bar2(Object[][][]) [in X [in [Working copy] X.java [in [in src [in P]]]]]", - element - ); - assertTrue("Element should exist", element.exists()); - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing a method with varargs parameters is correct. - * (regression test for bug 88769 IFunctionBinding#getJavaElement() drops extra array dimensions and varargs - */ - public void testMethod09() throws JavaScriptModelException { - ASTNode node = buildAST( - "public class X {\n" + - " /*start*/public void bar3(Object... objs) {\n" + - " }/*end*/\n" + - "}" - ); - IBinding binding = ((FunctionDeclaration) node).resolveBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - "bar3(Object[]) [in X [in [Working copy] X.java [in [in src [in P]]]]]", - element - ); - assertTrue("Element should exist", element.exists()); - } - - /* - * Ensures that getting the IJavaScriptElement of an IBinding representing a method in an anonymous type - * doesn't throw a ClassCastException if there is a syntax error. - * (regression test for bug 149853 CCE in IFunctionBinding#getJavaElement() for recovered anonymous type) - */ - public void testMethod10() throws CoreException { - try { - // use a compilation unit instead of a working copy to use the ASTParser instead of reconcile - createFile( - "/P/src/Test.js", - "public class X {\n" + - " void test() {\n" + - " new Object() {\n" + - " /*start*/public void yes() {\n" + - " System.out.println(\"hello world\");\n" + - " }/*end*/\n" + - " } // missing semicolon;\n" + - " }\n" + - "}" - ); - IJavaScriptUnit cu = getCompilationUnit("/P/src/Test.js"); - - ASTNode node = buildAST(null/*use existing contents*/, cu, false/*don't report errors*/, true/*statement recovery*/); - IBinding binding = ((FunctionDeclaration) node).resolveBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - "yes() [in [in test() [in X [in Test.java [in [in src [in P]]]]]]]", - element - ); - assertTrue("Element should exist", element.exists()); - } finally { - deleteFile("/P/src/Test.js"); - } - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing a package is correct. - */ - public void testPackage1() throws CoreException { - ASTNode node = buildAST( - "public class X {\n" + - " /*start*/java.lang/*end*/.String field;\n" + - "}" - ); - IBinding binding = ((QualifiedName) node).resolveBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - "java.lang [in "+ getExternalJCLPathString("1.5") + "]", - element - ); - assertTrue("Element should exist", element.exists()); - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing a package is correct - * (case of default package) - */ - public void testPackage2() throws CoreException { - ASTNode node = buildAST( - "/*start*/public class X {\n" + - "}/*end*/" - ); - ITypeBinding typeBinding = ((TypeDeclaration) node).resolveBinding(); - assertNotNull("No binding", typeBinding); - IPackageBinding binding = typeBinding.getPackage(); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - " [in src [in P]]", - element - ); - assertTrue("Element should exist", element.exists()); - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing a parameterized binary type is correct. - * (regression test for bug 78087 [dom] TypeBinding#getJavaElement() throws IllegalArgumentException for parameterized or raw reference to binary type) - */ - public void testParameterizedBinaryType() throws CoreException { - ASTNode node = buildAST( - "public class X {\n" + - " /*start*/Comparable/*end*/ field;\n" + - "}" - ); - IBinding binding = ((Type) node).resolveBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - "Comparable [in Comparable.class [in java.lang [in "+ getExternalJCLPathString("1.5") + "]]]", - element - ); - assertTrue("Element should exist", element.exists()); - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing a parameterized binary method is correct. - * (regression test for bug 88892 [1.5] IFunctionBinding#getJavaElement() returns nonexistent IMethods (wrong parameter types)) - */ - public void testParameterizedBinaryMethod() throws CoreException { - ASTNode node = buildAST( - "public class X extends p.Y {\n" + - " public X(String s) {\n" + - " /*start*/super(s);/*end*/\n" + - " }\n" + - "}" - ); - IBinding binding = ((SuperConstructorInvocation) node).resolveConstructorBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - "Y(T) [in Y [in Y.class [in p [in lib.jar [in P]]]]]", - element - ); - assertTrue("Element should exist", element.exists()); - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing a raw binary type is correct. - * (regression test for bug 78087 [dom] TypeBinding#getJavaElement() throws IllegalArgumentException for parameterized or raw reference to binary type) - */ - public void testRawBinaryType() throws CoreException { - ASTNode node = buildAST( - "public class X {\n" + - " /*start*/Comparable/*end*/ field;\n" + - "}" - ); - IBinding binding = ((Type) node).resolveBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - "Comparable [in Comparable.class [in java.lang [in "+ getExternalJCLPathString("1.5") + "]]]", - element - ); - assertTrue("Element should exist", element.exists()); - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing a top level type is correct. - */ - public void testTopLevelType1() throws JavaScriptModelException { - ASTNode node = buildAST( - "/*start*/public class X {\n" + - "}/*end*/" - ); - IBinding binding = ((TypeDeclaration) node).resolveBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - "X [in [Working copy] X.java [in [in src [in P]]]]", - element - ); - assertTrue("Element should exist", element.exists()); - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing a top level type is correct - * (the top level type being in another compilation unit) - */ - public void testTopLevelType2() throws CoreException { - try { - createFile( - "/P/src/Y.js", - "public class Y {\n" + - "}" - ); - ASTNode node = buildAST( - "public class X extends /*start*/Y/*end*/ {\n" + - "}" - ); - IBinding binding = ((Type) node).resolveBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - "Y [in Y.java [in [in src [in P]]]]", - element - ); - assertTrue("Element should exist", element.exists()); - } finally { - deleteFile("/P/src/Y.js"); - } - } - - /* - * Ensures that the IJavaScriptElement of an IBinding representing a top level type is correct - * (the top level type being in a jar) - */ - public void testTopLevelType3() throws CoreException { - ASTNode node = buildAST( - "public class X {\n" + - " /*start*/String/*end*/ field;\n" + - "}" - ); - IBinding binding = ((Type) node).resolveBinding(); - assertNotNull("No binding", binding); - IJavaScriptElement element = binding.getJavaElement(); - assertElementEquals( - "Unexpected Java element", - "String [in String.class [in java.lang [in "+ getExternalJCLPathString("1.5") + "]]]", - element - ); - assertTrue("Element should exist", element.exists()); - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=160637 - */ - public void testCreateBindings19() throws CoreException { - IBinding[] bindings = createBinaryBindings( - "public class A {\n" + - " String foo(String s) {\n" + - " return null;\n" + - " }\n" + - "}", - getClassFile("/P/lib/A.class").getType().getFunction("foo", new String[] {"Ljava.lang.String;"}) - ); - assertNotNull("No bindings", bindings); - assertEquals("Wrong size", 1, bindings.length); - assertTrue("Not a method binding", bindings[0] instanceof IFunctionBinding); - assertBindingsEqual( - "LA;.foo(Ljava/lang/String;)Ljava/lang/String;", - bindings); - } -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTNodesCollectorVisitor.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTNodesCollectorVisitor.java deleted file mode 100644 index 2b9ec0e..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTNodesCollectorVisitor.java +++ /dev/null @@ -1,260 +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.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.eclipse.wst.jsdt.core.dom.AST; -import org.eclipse.wst.jsdt.core.dom.ASTNode; -import org.eclipse.wst.jsdt.core.dom.ASTVisitor; -import org.eclipse.wst.jsdt.core.dom.AnonymousClassDeclaration; -import org.eclipse.wst.jsdt.core.dom.ClassInstanceCreation; -import org.eclipse.wst.jsdt.core.dom.FieldAccess; -import org.eclipse.wst.jsdt.core.dom.FieldDeclaration; -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.JavaScriptUnit; -import org.eclipse.wst.jsdt.core.dom.MemberRef; -import org.eclipse.wst.jsdt.core.dom.PackageDeclaration; -import org.eclipse.wst.jsdt.core.dom.QualifiedName; -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.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.VariableDeclarationExpression; -import org.eclipse.wst.jsdt.core.dom.VariableDeclarationFragment; -import org.eclipse.wst.jsdt.core.dom.VariableDeclarationStatement; - -class ASTNodesCollectorVisitor extends ASTVisitor { - - private Set detachedAstNodes; - - /** - * - * @see java.lang.Object#Object() - */ - ASTNodesCollectorVisitor() { - // visit Javadoc.tags() - super(true); - this.detachedAstNodes = new HashSet(); - } - - private void add(ASTNode node) { - this.detachedAstNodes.add(node); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.AnonymousClassDeclaration) - */ - public void endVisit(AnonymousClassDeclaration node) { - add(node); - detachedListElement(node.bodyDeclarations()); - } - - private void detachedListElement(List list) { - for (int i = 0; i < list.size(); i++) { - list.remove(0); - } - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.ClassInstanceCreation) - * @deprecated using deprecated code - */ - public void endVisit(ClassInstanceCreation node) { - if (node.getAST().apiLevel() == AST.JLS2) { - node.setName( - node.getAST().newSimpleName("XXX")); //$NON-NLS-1$ - } - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.JavaScriptUnit) - */ - public void endVisit(JavaScriptUnit node) { - detachedListElement(node.imports()); - node.setPackage(node.getAST().newPackageDeclaration()); - } - - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.FieldAccess) - */ - public void endVisit(FieldAccess node) { - node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$ - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.FieldDeclaration) - */ - public void endVisit(FieldDeclaration node) { - detachedListElement(node.fragments()); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.ImportDeclaration) - */ - public void endVisit(ImportDeclaration node) { - add(node); - node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$ - } - - /** - * @see ASTVisitor#endVisit(MemberRef) - * @since 3.0 - */ - public void endVisit(MemberRef node) { - add(node); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.FunctionDeclaration) - */ - public void endVisit(FunctionDeclaration node) { - node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$ - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.FunctionInvocation) - */ - public void endVisit(FunctionInvocation node) { - add(node); - node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$ - } - - /** - * @see ASTVisitor#endVisit(FunctionRef) - * @since 3.0 - */ - public void endVisit(FunctionRef node) { - add(node); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.PackageDeclaration) - */ - public void endVisit(PackageDeclaration node) { - add(node); - node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$ - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.QualifiedName) - */ - public void endVisit(QualifiedName node) { - add(node); - node.setQualifier(node.getAST().newSimpleName("sss")); //$NON-NLS-1$ - node.setName(node.getAST().newSimpleName("sss")); //$NON-NLS-1$ - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.SimpleName) - */ - public void endVisit(SimpleName node) { - ASTNode parent = node.getParent(); - switch(parent.getNodeType()) { - case ASTNode.CONTINUE_STATEMENT : - case ASTNode.BREAK_STATEMENT : - case ASTNode.LABELED_STATEMENT : - break; - default : - add(node); - } - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.SimpleType) - */ - public void endVisit(SimpleType node) { - node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$ - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.SingleVariableDeclaration) - */ - public void endVisit(SingleVariableDeclaration node) { - node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$ - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.SuperFieldAccess) - */ - public void endVisit(SuperFieldAccess node) { - node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$ - node.setQualifier(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$ - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.SuperMethodInvocation) - */ - public void endVisit(SuperMethodInvocation node) { - node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$ - node.setQualifier(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$ - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.ThisExpression) - */ - public void endVisit(ThisExpression node) { - node.setQualifier(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$ - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.TypeDeclaration) - * @deprecated using deprecated code - */ - public void endVisit(TypeDeclaration node) { - add(node); - node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$ - if (node.getAST().apiLevel() == AST.JLS2) { - node.setSuperclass(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$ - } - detachedListElement(node.bodyDeclarations()); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.VariableDeclarationExpression) - */ - public void endVisit(VariableDeclarationExpression node) { - detachedListElement(node.fragments()); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.VariableDeclarationFragment) - */ - public void endVisit(VariableDeclarationFragment node) { - add(node); - node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$ - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.VariableDeclarationStatement) - */ - public void endVisit(VariableDeclarationStatement node) { - detachedListElement(node.fragments()); - } - - /** - * Returns the detachedAstNodes. - * @return Set - */ - public Set getDetachedAstNodes() { - return detachedAstNodes; - } - -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTParserTest.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTParserTest.java deleted file mode 100644 index 52c580e..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTParserTest.java +++ /dev/null @@ -1,116 +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.lang.reflect.Method; -import java.util.HashMap; - -import junit.framework.Test; - -import org.eclipse.wst.jsdt.core.IClassFile; -import org.eclipse.wst.jsdt.core.IJavaScriptUnit; -import org.eclipse.wst.jsdt.core.dom.AST; -import org.eclipse.wst.jsdt.core.dom.ASTParser; - -public class ASTParserTest extends org.eclipse.wst.jsdt.core.tests.junit.extension.TestCase { - - /** @deprecated using deprecated code */ - public static Test suite() { - // TODO (frederic) use buildList + setAstLevel(init) instead... - junit.framework.TestSuite suite = new junit.framework.TestSuite(ASTParserTest.class.getName()); - - Class c = ASTParserTest.class; - Method[] methods = c.getMethods(); - for (int i = 0, max = methods.length; i < max; i++) { - if (methods[i].getName().startsWith("test")) { //$NON-NLS-1$ - suite.addTest(new ASTParserTest(methods[i].getName(), AST.JLS2)); - //suite.addTest(new ASTParserTest(methods[i].getName(), AST.JLS3)); - } - } - return suite; - } - - AST ast; - ASTParser parser; - int API_LEVEL; - - public ASTParserTest(String name, int apiLevel) { - super(name); - this.API_LEVEL = apiLevel; - } - - protected void setUp() throws Exception { - super.setUp(); - ast = AST.newAST(this.API_LEVEL); - parser = ASTParser.newParser(this.API_LEVEL); - } - - protected void tearDown() throws Exception { - ast = null; - super.tearDown(); - } - - /** @deprecated using deprecated code */ - public String getName() { - String name = super.getName(); - switch (this.API_LEVEL) { - case AST.JLS2: - name = "JLS2 - " + name; - break; - case AST.JLS3: - name = "JLS3 - " + name; - break; - } - return name; - } - - public void testKConstants() { - assertTrue(ASTParser.K_EXPRESSION == 1); - assertTrue(ASTParser.K_STATEMENTS == 2); - assertTrue(ASTParser.K_CLASS_BODY_DECLARATIONS == 4); - assertTrue(ASTParser.K_COMPILATION_UNIT == 8); - } - - public void testSetting() { - // for now, just slam some values in - parser.setKind(ASTParser.K_COMPILATION_UNIT); - parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS); - parser.setKind(ASTParser.K_EXPRESSION); - parser.setKind(ASTParser.K_STATEMENTS); - - parser.setSource(new char[0]); - parser.setSource((char[]) null); - parser.setSource((IJavaScriptUnit) null); - parser.setSource((IClassFile) null); - - parser.setResolveBindings(false); - parser.setResolveBindings(true); - - parser.setSourceRange(0, -1); - parser.setSourceRange(0, 1); - parser.setSourceRange(1, 0); - parser.setSourceRange(1, -1); - - parser.setWorkingCopyOwner(null); - - parser.setUnitName(null); - parser.setUnitName("Foo.js"); //$NON-NLS-1$ - - parser.setProject(null); - - parser.setFocalPosition(-1); - parser.setFocalPosition(0); - - parser.setCompilerOptions(null); - parser.setCompilerOptions(new HashMap()); - } -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTPositionsTest.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTPositionsTest.java deleted file mode 100644 index e95775a..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTPositionsTest.java +++ /dev/null @@ -1,144 +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.Test; - -import org.eclipse.wst.jsdt.core.IJavaScriptUnit; -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.JavaScriptUnit; - -public class ASTPositionsTest extends ConverterTestSetup { - - IJavaScriptUnit workingCopy; - - public void setUpSuite() throws Exception { - super.setUpSuite(); - this.ast = AST.newAST(AST.JLS3); - } - - public ASTPositionsTest(String name) { - super(name); - } - - public static Test suite() { - return buildModelTestSuite(ASTPositionsTest.class); - } - - private void sanityCheck(final String contents, JavaScriptUnit compilationUnit) { - for (int i = 0, max = contents.length(); i < max; i++) { - final int lineNumber = compilationUnit.getLineNumber(i); - assertTrue("Wrong value for char at " + i, lineNumber >= 1); - final int columnNumber = compilationUnit.getColumnNumber(i); - assertTrue("Wrong value for char at " + i, columnNumber >= 0); - final int position = compilationUnit.getPosition(lineNumber, columnNumber); - assertTrue("Wrong value for char at i", position >= 0); - if (position == 0) { - assertEquals("Only true for first character", 0, i); - } - assertEquals("Wrong char", contents.charAt(i), contents.charAt(position)); - } - } - - protected void tearDown() throws Exception { - super.tearDown(); - if (this.workingCopy != null) { - this.workingCopy.discardWorkingCopy(); - this.workingCopy = null; - } - } - - public void test001() throws JavaScriptModelException { - this.workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - final String contents = - "var d = new Date();\r\n" + - "function X() {\r\n" + - " var date= d;\r\n" + - "}"; - ASTNode node = buildAST( - contents, - this.workingCopy, - false); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit compilationUnit = (JavaScriptUnit) node; - assertEquals("Wrong char", 'X', contents.charAt(compilationUnit.getPosition(2, 9))); - assertEquals("Wrong char", 'v', contents.charAt(compilationUnit.getPosition(1, 0))); - assertEquals("Wrong position", -1, compilationUnit.getPosition(1, -1)); - assertEquals("Wrong position", -1, compilationUnit.getPosition(-1, 0)); - assertEquals("Wrong position", -1, compilationUnit.getPosition(5, 0)); - assertEquals("Wrong position", -1, compilationUnit.getPosition(4, 1)); - assertEquals("Wrong char", '}', contents.charAt(compilationUnit.getPosition(4, 0))); - assertEquals("Wrong char", '\r', contents.charAt(compilationUnit.getPosition(1, 19))); - - sanityCheck(contents, compilationUnit); - } - - public void test002() throws JavaScriptModelException { - this.workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - final String contents = - "function X() {\n" + - " var map= null;\n" + - "}\n"; - ASTNode node = buildAST( - contents, - this.workingCopy, - false); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit compilationUnit = (JavaScriptUnit) node; - sanityCheck(contents, compilationUnit); - } - - public void test003() throws JavaScriptModelException { - this.workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - final String contents = - "function X() {\r" + - " var map= null;\r" + - "}\r"; - ASTNode node = buildAST( - contents, - this.workingCopy, - false); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit compilationUnit = (JavaScriptUnit) node; - sanityCheck(contents, compilationUnit); - } - - public void test004() throws JavaScriptModelException { - this.workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - String contents = - "function X() {}"; - ASTNode node = buildAST( - contents, - this.workingCopy, - false); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit compilationUnit = (JavaScriptUnit) node; - sanityCheck(contents, compilationUnit); - assertEquals(1, compilationUnit.getLineNumber(0)); - } - - public void test005() throws JavaScriptModelException { - this.workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/); - String contents = - "function X() {}"; - ASTNode node = buildAST( - contents, - this.workingCopy, - false); - assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); - JavaScriptUnit compilationUnit = (JavaScriptUnit) node; - assertEquals(1, compilationUnit.getLineNumber(0)); - sanityCheck(contents, compilationUnit); - } -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTStructuralPropertyTest.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTStructuralPropertyTest.java deleted file mode 100644 index 13eab69..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTStructuralPropertyTest.java +++ /dev/null @@ -1,348 +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.dom; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import junit.framework.Test; - -import org.eclipse.wst.jsdt.core.dom.*; - -public class ASTStructuralPropertyTest extends org.eclipse.wst.jsdt.core.tests.junit.extension.TestCase { - - /** @deprecated using deprecated code */ - public static Test suite() { - // TODO (frederic) use buildList + setAstLevel(init) instead... - junit.framework.TestSuite suite = new junit.framework.TestSuite(ASTStructuralPropertyTest.class.getName()); - - Class c = ASTStructuralPropertyTest.class; - Method[] methods = c.getMethods(); - for (int i = 0, max = methods.length; i < max; i++) { - if (methods[i].getName().startsWith("test")) { //$NON-NLS-1$ - suite.addTest(new ASTStructuralPropertyTest(methods[i].getName(), AST.JLS2)); - suite.addTest(new ASTStructuralPropertyTest(methods[i].getName(), AST.JLS3)); - } - } - return suite; - } - - AST ast; - ASTParser parser; - int API_LEVEL; - - public ASTStructuralPropertyTest(String name, int apiLevel) { - super(name); - this.API_LEVEL = apiLevel; - } - - protected void setUp() throws Exception { - super.setUp(); - ast = AST.newAST(this.API_LEVEL); - parser = ASTParser.newParser(this.API_LEVEL); - } - - protected void tearDown() throws Exception { - ast = null; - super.tearDown(); - } - - /** @deprecated using deprecated code */ - public String getName() { - String name = super.getName(); - switch (this.API_LEVEL) { - case AST.JLS2: - name = "JLS2 - " + name; - break; - case AST.JLS3: - name = "JLS3 - " + name; - break; - } - return name; - } - - public void testLocationInParent() { - final ASTNode root = SampleASTs.oneOfEach(ast); - ASTVisitor v = new ASTVisitor(true) { - public void postVisit(ASTNode node) { - StructuralPropertyDescriptor me = node.getLocationInParent(); - assertTrue(me != null || (node == root)); - ASTNode p = node.getParent(); - if (p != null) { - List parentProperties = p.structuralPropertiesForType(); - boolean foundMe = false; - for (Iterator it = parentProperties.iterator(); it - .hasNext();) { - StructuralPropertyDescriptor prop = - (StructuralPropertyDescriptor) it.next(); - if (me == prop || prop.getId().equals(me.getId())) { - foundMe = true; - break; - } - } - assertTrue(foundMe); - } - } - }; - root.accept(v); - } - - /** - * @deprecated since using deprecated constant - */ - public void testStructuralProperties() { - final ASTNode root = SampleASTs.oneOfEach(ast); - - final Set simpleProperties = new HashSet(400); - final Set childProperties = new HashSet(400); - final Set childListProperties = new HashSet(400); - final Set visitedProperties = new HashSet(400); - final Set nodeClasses = new HashSet(100); - - ASTVisitor v = new ASTVisitor(true) { - public void postVisit(ASTNode node) { - StructuralPropertyDescriptor me = node.getLocationInParent(); - if (me != null) { - visitedProperties.add(me); - } - visitedProperties.add(me); - nodeClasses.add(node.getClass()); - List ps = node.structuralPropertiesForType(); - for (Iterator it = ps.iterator(); it.hasNext(); ) { - StructuralPropertyDescriptor p = (StructuralPropertyDescriptor) it.next(); - Object o = node.getStructuralProperty(p); - if (p.isSimpleProperty()) { - simpleProperties.add(p); - // slam simple properties - node.setStructuralProperty(p, o); - } else if (p.isChildProperty()) { - childProperties.add(p); - // replace child with a copy - ASTNode copy = ASTNode.copySubtree(ast, (ASTNode) o); - node.setStructuralProperty(p, copy); - } else if (p.isChildListProperty()) { - childListProperties.add(p); - // replace child list with copies - List list = (List) o; - List copy = ASTNode.copySubtrees(ast, list); - list.clear(); - list.addAll(copy); - } - } - } - }; - root.accept(v); - switch(this.API_LEVEL) { - case AST.JLS2 : - assertEquals("Wrong number of visited node classes", 67, nodeClasses.size()); - assertEquals("Wrong number of visited properties", 82, visitedProperties.size()); - assertEquals("Wrong number of simple properties", 26, simpleProperties.size()); - assertEquals("Wrong number of child properties", 90, childProperties.size()); - assertEquals("Wrong number of child list properties", 26, childListProperties.size()); - break; - case AST.JLS3 : - assertEquals("Wrong number of visited node classes", 80, nodeClasses.size()); - assertEquals("Wrong number of visited properties", 104, visitedProperties.size()); - assertEquals("Wrong number of simple properties", 23, simpleProperties.size()); - assertEquals("Wrong number of child properties", 115, childProperties.size()); - assertEquals("Wrong number of child list properties", 52, childListProperties.size()); - } - // visit should rebuild tree - ASTNode newRoot = SampleASTs.oneOfEach(ast); - assertTrue(root.subtreeMatch(new ASTMatcher(), newRoot)); - } - - public void testProtect() { - final ASTNode root = SampleASTs.oneOfEach(ast); - - // check that all properties are again modifiable - class Slammer extends ASTVisitor { - boolean shouldBeProtected; - Slammer(boolean shouldBeProtected){ - super(true); // visit doc - this.shouldBeProtected = shouldBeProtected; - } - public void postVisit(ASTNode node) { - try { - node.setSourceRange(1, 1); - assertTrue(!shouldBeProtected); - } catch (RuntimeException e) { - assertTrue(shouldBeProtected); - } - List ps = node.structuralPropertiesForType(); - for (Iterator it = ps.iterator(); it.hasNext(); ) { - StructuralPropertyDescriptor p = (StructuralPropertyDescriptor) it.next(); - Object o = node.getStructuralProperty(p); - if (p.isSimpleProperty()) { - // slam simple properties - try { - node.setStructuralProperty(p, o); - assertTrue(!shouldBeProtected); - } catch (RuntimeException e) { - assertTrue(shouldBeProtected); - } - } else if (p.isChildProperty()) { - // replace child with a copy - ASTNode copy = ASTNode.copySubtree(ast, (ASTNode) o); - try { - node.setStructuralProperty(p, copy); - assertTrue(!shouldBeProtected); - } catch (RuntimeException e) { - assertTrue(shouldBeProtected); - } - } else if (p.isChildListProperty()) { - // replace child list with copies - List list = (List) o; - List copy = ASTNode.copySubtrees(ast, list); - if (!list.isEmpty()) { - try { - list.clear(); - assertTrue(!shouldBeProtected); - } catch (RuntimeException e) { - assertTrue(shouldBeProtected); - } - try { - list.addAll(copy); - assertTrue(!shouldBeProtected); - } catch (RuntimeException e) { - assertTrue(shouldBeProtected); - } - } - } - } - } - } - - class Protector extends ASTVisitor { - boolean shouldBeProtected; - Protector(boolean shouldBeProtected){ - super(true); // visit doc - this.shouldBeProtected = shouldBeProtected; - } - public void preVisit(ASTNode node) { - int f = node.getFlags(); - if (shouldBeProtected) { - f |= ASTNode.PROTECT; - } else { - f &= ~ASTNode.PROTECT; - } - node.setFlags(f); - } - } - - - // mark all nodes as protected - root.accept(new Protector(true)); - root.accept(new Slammer(true)); - - // mark all nodes as unprotected - root.accept(new Protector(false)); - root.accept(new Slammer(false)); - } - - public void testDelete() { - final ASTNode root = SampleASTs.oneOfEach(ast); - - // check that nodes can be deleted unless mandatory - root.accept(new ASTVisitor(true) { - public void postVisit(ASTNode node) { - List ps = node.structuralPropertiesForType(); - for (Iterator it = ps.iterator(); it.hasNext(); ) { - StructuralPropertyDescriptor p = (StructuralPropertyDescriptor) it.next(); - if (p.isChildProperty()) { - ChildPropertyDescriptor c = (ChildPropertyDescriptor) p; - ASTNode child = (ASTNode) node.getStructuralProperty(c); - if (!c.isMandatory() && child != null) { - try { - child.delete(); - assertTrue(node.getStructuralProperty(c) == null); - } catch (RuntimeException e) { - assertTrue(false); - } - } - } else if (p.isChildListProperty()) { - // replace child list with copies - List list = (List) node.getStructuralProperty(p); - // iterate over a copy and try removing all members - List copy = new ArrayList(); - copy.addAll(list); - for (Iterator it2 = copy.iterator(); it2.hasNext(); ) { - ASTNode n = (ASTNode) it2.next(); - try { - n.delete(); - assertTrue(!list.contains(n)); - } catch (RuntimeException e) { - assertTrue(false); - } - } - } - } - } - }); - } - - /** @deprecated using deprecated code */ - public void testCreateInstance() { - 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) { - try { - ASTNode node = ast.createInstance(nodeClass); - if (ast.apiLevel() == AST.JLS2) { - assertTrue((nodeType >= 1) && (nodeType <= 69)); - } else { - assertTrue((nodeType >= 1) && (nodeType <= 83)); - } - assertTrue(node.getNodeType() == nodeType); - //ASTNode node2 = ast.createInstance(nodeType); - //assertTrue(node2.getNodeType() == nodeType); - } catch (RuntimeException e) { - if (ast.apiLevel() == AST.JLS2) { - assertTrue((nodeType < 1) || (nodeType > 69)); - } else { - assertTrue((nodeType < 1) || (nodeType > 83)); - } - } - } - } - } - - public void testNodeClassForType() { - Set classes = new HashSet(100); - // make sure node types are contiguous starting at 0 - int hi = 0; - for (int nodeType = 1; nodeType < 100; nodeType++) { - try { - Class nodeClass = ASTNode.nodeClassForType(nodeType); - assertTrue(ASTNode.class.isAssignableFrom(nodeClass)); - classes.add(nodeClass); - if (nodeType > 1) { - assertTrue(hi == nodeType - 1); - } - hi = nodeType; - } catch (RuntimeException e) { - // oops - guess that's not valid - } - } - assertTrue(hi == 83); // last known one - assertTrue(classes.size() == hi); // all classes are distinct - } -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTTest.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTTest.java deleted file mode 100644 index dfb9462..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTTest.java +++ /dev/null @@ -1,7191 +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.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import junit.framework.Test; - -import org.eclipse.wst.jsdt.core.dom.AST; -import org.eclipse.wst.jsdt.core.dom.ASTMatcher; -import org.eclipse.wst.jsdt.core.dom.ASTNode; -import org.eclipse.wst.jsdt.core.dom.ASTVisitor; -import org.eclipse.wst.jsdt.core.dom.AbstractTypeDeclaration; -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.BlockComment; -import org.eclipse.wst.jsdt.core.dom.BodyDeclaration; -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.Comment; -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.Expression; -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.FunctionRefParameter; -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.LineComment; -import org.eclipse.wst.jsdt.core.dom.MemberRef; -import org.eclipse.wst.jsdt.core.dom.Modifier; -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.Statement; -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.TextElement; -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.Type; -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; - -// testing - -public class ASTTest extends org.eclipse.wst.jsdt.core.tests.junit.extension.TestCase { - - class CheckPositionsMatcher extends ASTMatcher { - - public CheckPositionsMatcher() { - // include doc tags - super(true); - } - - private void checkPositions(Object source, Object destination) { - assertTrue(source instanceof ASTNode); - assertTrue(destination instanceof ASTNode); - int startPosition = ((ASTNode)source).getStartPosition(); - if (startPosition != -1) { - assertTrue(startPosition == ((ASTNode)destination).getStartPosition()); - } - int length = ((ASTNode)source).getLength(); - if (length != 0) { - assertTrue(length == ((ASTNode)destination).getLength()); - } - } - - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(AnonymousClassDeclaration, Object) - */ - public boolean match(AnonymousClassDeclaration node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(ArrayAccess, Object) - */ - public boolean match(ArrayAccess node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(ArrayCreation, Object) - */ - public boolean match(ArrayCreation node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(ArrayInitializer, Object) - */ - public boolean match(ArrayInitializer node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(ArrayType, Object) - */ - public boolean match(ArrayType node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(Assignment, Object) - */ - public boolean match(Assignment node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(Block, Object) - */ - public boolean match(Block node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(BlockComment, Object) - * @since 3.0 - */ - public boolean match(BlockComment node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(BooleanLiteral, Object) - */ - public boolean match(BooleanLiteral node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(BreakStatement, Object) - */ - public boolean match(BreakStatement node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(CatchClause, Object) - */ - public boolean match(CatchClause node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(CharacterLiteral, Object) - */ - public boolean match(CharacterLiteral node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(ClassInstanceCreation, Object) - */ - public boolean match(ClassInstanceCreation node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(JavaScriptUnit, Object) - */ - public boolean match(JavaScriptUnit node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(ConditionalExpression, Object) - */ - public boolean match(ConditionalExpression node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(ConstructorInvocation, Object) - */ - public boolean match(ConstructorInvocation node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(ContinueStatement, Object) - */ - public boolean match(ContinueStatement node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(DoStatement, Object) - */ - public boolean match(DoStatement node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(EmptyStatement, Object) - */ - public boolean match(EmptyStatement node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(EnhancedForStatement, Object) - * @since 3.0 - */ - public boolean match(EnhancedForStatement node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(ExpressionStatement, Object) - */ - public boolean match(ExpressionStatement node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(FieldAccess, Object) - */ - public boolean match(FieldAccess node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(FieldDeclaration, Object) - */ - public boolean match(FieldDeclaration node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(ForStatement, Object) - */ - public boolean match(ForStatement node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(IfStatement, Object) - */ - public boolean match(IfStatement node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(ImportDeclaration, Object) - */ - public boolean match(ImportDeclaration node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(InfixExpression, Object) - */ - public boolean match(InfixExpression node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(Initializer, Object) - */ - public boolean match(Initializer node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(InstanceofExpression, Object) - */ - public boolean match(InstanceofExpression node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(JSdoc, Object) - */ - public boolean match(JSdoc node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(LabeledStatement, Object) - */ - public boolean match(LabeledStatement node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(LineComment, Object) - * @since 3.0 - */ - public boolean match(LineComment node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(MemberRef, Object) - * @since 3.0 - */ - public boolean match(MemberRef node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(FunctionDeclaration, Object) - */ - public boolean match(FunctionDeclaration node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(FunctionInvocation, Object) - */ - public boolean match(FunctionInvocation node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(FunctionRef, Object) - * @since 3.0 - */ - public boolean match(FunctionRef node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(FunctionRefParameter, Object) - * @since 3.0 - */ - public boolean match(FunctionRefParameter node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(Modifier, Object) - * @since 3.0 - */ - public boolean match(Modifier node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(NullLiteral, Object) - */ - public boolean match(NullLiteral node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(NumberLiteral, Object) - */ - public boolean match(NumberLiteral node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(PackageDeclaration, Object) - */ - public boolean match(PackageDeclaration node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(ParenthesizedExpression, Object) - */ - public boolean match(ParenthesizedExpression node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(PostfixExpression, Object) - */ - public boolean match(PostfixExpression node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(PrefixExpression, Object) - */ - public boolean match(PrefixExpression node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(PrimitiveType, Object) - */ - public boolean match(PrimitiveType node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(QualifiedName, Object) - */ - public boolean match(QualifiedName node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(QualifiedType, Object) - * @since 3.0 - */ - public boolean match(QualifiedType node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(ReturnStatement, Object) - */ - public boolean match(ReturnStatement node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(SimpleName, Object) - */ - public boolean match(SimpleName node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(SimpleType, Object) - */ - public boolean match(SimpleType node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(SingleVariableDeclaration, Object) - */ - public boolean match(SingleVariableDeclaration node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(StringLiteral, Object) - */ - public boolean match(StringLiteral node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(SuperConstructorInvocation, Object) - */ - public boolean match(SuperConstructorInvocation node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(SuperFieldAccess, Object) - */ - public boolean match(SuperFieldAccess node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(SuperMethodInvocation, Object) - */ - public boolean match(SuperMethodInvocation node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(SwitchCase, Object) - */ - public boolean match(SwitchCase node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(SwitchStatement, Object) - */ - public boolean match(SwitchStatement node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(TagElement, Object) - * @since 3.0 - */ - public boolean match(TagElement node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(TextElement, Object) - * @since 3.0 - */ - public boolean match(TextElement node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(ThisExpression, Object) - */ - public boolean match(ThisExpression node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(ThrowStatement, Object) - */ - public boolean match(ThrowStatement node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(TryStatement, Object) - */ - public boolean match(TryStatement node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(TypeDeclaration, Object) - */ - public boolean match(TypeDeclaration node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(TypeDeclarationStatement, Object) - */ - public boolean match(TypeDeclarationStatement node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(TypeLiteral, Object) - */ - public boolean match(TypeLiteral node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(VariableDeclarationExpression, Object) - */ - public boolean match(VariableDeclarationExpression node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(VariableDeclarationFragment, Object) - */ - public boolean match(VariableDeclarationFragment node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(VariableDeclarationStatement, Object) - */ - public boolean match(VariableDeclarationStatement node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(WhileStatement, Object) - */ - public boolean match(WhileStatement node, Object other) { - checkPositions(node, other); - return super.match(node, other); - } - } - - /** @deprecated using deprecated code */ - public static Test suite() { - // TODO (frederic) use buildList + setAstLevel(init) instead... - junit.framework.TestSuite suite = new junit.framework.TestSuite(ASTTest.class.getName()); - - Class c = ASTTest.class; - Method[] methods = c.getMethods(); - for (int i = 0, max = methods.length; i < max; i++) { - if (methods[i].getName().startsWith("test")) { //$NON-NLS-1$ - suite.addTest(new ASTTest(methods[i].getName(), AST.JLS2)); - //suite.addTest(new ASTTest(methods[i].getName(), AST.JLS3)); - } - } - return suite; - } - - AST ast; - int API_LEVEL; - - - public ASTTest(String name, int apiLevel) { - super(name); - this.API_LEVEL = apiLevel; - } - - protected void setUp() throws Exception { - super.setUp(); - ast = AST.newAST(this.API_LEVEL); - } - - protected void tearDown() throws Exception { - ast = null; - super.tearDown(); - } - - /** @deprecated using deprecated code */ - public String getName() { - String name = super.getName(); - switch (this.API_LEVEL) { - case AST.JLS2: - name = "JLS2 - " + name; - break; - case AST.JLS3: - name = "JLS3 - " + name; - break; - } - return name; - } - - /** - * Snippets that show how to... - * @deprecated using deprecated code - */ - public void testExampleSnippets() { - { - AST localAst = AST.newAST(ast.apiLevel()); - JavaScriptUnit cu = localAst.newJavaScriptUnit(); - - // package com.example; - PackageDeclaration pd = localAst.newPackageDeclaration(); - pd.setName(localAst.newName(new String[]{"com", "example"})); //$NON-NLS-1$ //$NON-NLS-2$ - cu.setPackage(pd); - assertTrue(pd.getRoot() == cu); - - // import java.io;*; - ImportDeclaration im1 = localAst.newImportDeclaration(); - im1.setName(localAst.newName(new String[]{"java", "io"})); //$NON-NLS-1$ //$NON-NLS-2$ - im1.setOnDemand(true); - cu.imports().add(im1); - assertTrue(im1.getRoot() == cu); - - // import java.util.List; - ImportDeclaration im2 = localAst.newImportDeclaration(); - im2.setName(localAst.newName(new String[]{"java", "util", "List"})); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - im2.setOnDemand(false); - cu.imports().add(im2); - assertTrue(im2.getRoot() == cu); - - // /** Spec. \n @deprecated Use {@link #foo() bar} instead. */public class MyClass {} - TypeDeclaration td = localAst.newTypeDeclaration(); - if (ast.apiLevel() == AST.JLS2) { - td.setModifiers(Modifier.PUBLIC); - } else { - td.modifiers().add(localAst.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD)); - } - td.setName(localAst.newSimpleName("MyClass")); //$NON-NLS-1$ - { - JSdoc jd = localAst.newJSdoc(); - TagElement tg0 = localAst.newTagElement(); - jd.tags().add(tg0); - TextElement tx1 = localAst.newTextElement(); - tx1.setText("Spec."); //$NON-NLS-1$ - tg0.fragments().add(tx1); - TagElement tg1 = localAst.newTagElement(); - tg1.setTagName(TagElement.TAG_DEPRECATED); - jd.tags().add(tg1); - TextElement tx2 = localAst.newTextElement(); - tx2.setText("Use "); //$NON-NLS-1$ - tg1.fragments().add(tx2); - TagElement tg2 = localAst.newTagElement(); - tg2.setTagName(TagElement.TAG_LINK); - tg1.fragments().add(tg2); - FunctionRef mr1 = localAst.newFunctionRef(); - mr1.setName(localAst.newSimpleName("foo")); - tg2.fragments().add(mr1); - TextElement tx3 = localAst.newTextElement(); - tx3.setText("bar"); //$NON-NLS-1$ - tg2.fragments().add(tx3); - TextElement tx4 = localAst.newTextElement(); - tx2.setText(" instead."); //$NON-NLS-1$ - tg1.fragments().add(tx4); - } - - cu.types().add(td); - assertTrue(td.getRoot() == cu); - - // private static boolean DEBUG = true; - VariableDeclarationFragment f1 = localAst.newVariableDeclarationFragment(); - f1.setName(localAst.newSimpleName("DEBUG")); //$NON-NLS-1$ - f1.setInitializer(localAst.newBooleanLiteral(true)); - FieldDeclaration fd = localAst.newFieldDeclaration(f1); - fd.setType(localAst.newPrimitiveType(PrimitiveType.BOOLEAN)); - if (ast.apiLevel() == AST.JLS2) { - fd.setModifiers(Modifier.PRIVATE | Modifier.FINAL); - } else { - fd.modifiers().add(localAst.newModifier(Modifier.ModifierKeyword.PRIVATE_KEYWORD)); - fd.modifiers().add(localAst.newModifier(Modifier.ModifierKeyword.STATIC_KEYWORD)); - } - td.bodyDeclarations().add(fd); - assertTrue(fd.getRoot() == cu); - - // public static void main(); - FunctionDeclaration md = localAst.newFunctionDeclaration(); - if (ast.apiLevel() == AST.JLS2) { - md.setModifiers(Modifier.PUBLIC | Modifier.STATIC); - md.setReturnType(localAst.newPrimitiveType(PrimitiveType.VOID)); - } else { - md.modifiers().add(localAst.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD)); - md.modifiers().add(localAst.newModifier(Modifier.ModifierKeyword.STATIC_KEYWORD)); - md.setReturnType2(localAst.newPrimitiveType(PrimitiveType.VOID)); - } - md.setConstructor(false); - md.setName(localAst.newSimpleName("main")); //$NON-NLS-1$ - td.bodyDeclarations().add(md); - assertTrue(md.getRoot() == cu); - - // String[] args - SingleVariableDeclaration a1 = localAst.newSingleVariableDeclaration(); - a1.setType(localAst.newArrayType( - localAst.newSimpleType(localAst.newSimpleName("String")))); //$NON-NLS-1$ - a1.setName(localAst.newSimpleName("args")); //$NON-NLS-1$ - md.parameters().add(a1); - assertTrue(a1.getRoot() == cu); - - // {} - Block b = localAst.newBlock(); - md.setBody(b); - assertTrue(b.getRoot() == cu); - - // System.out.println("hello world"); - FunctionInvocation e = localAst.newFunctionInvocation(); - e.setExpression(localAst.newName(new String[] {"System", "out"})); //$NON-NLS-1$ //$NON-NLS-2$ - e.setName(localAst.newSimpleName("println")); //$NON-NLS-1$ - StringLiteral h = localAst.newStringLiteral(); - h.setLiteralValue("hello world"); //$NON-NLS-1$ - e.arguments().add(h); - - b.statements().add(localAst.newExpressionStatement(e)); - assertTrue(e.getRoot() == cu); - assertTrue(h.getRoot() == cu); - - // new String[len]; - ArrayCreation ac1 = localAst.newArrayCreation(); - ac1.setType( - localAst.newArrayType( - localAst.newSimpleType(localAst.newSimpleName("String")))); //$NON-NLS-1$ - ac1.dimensions().add(localAst.newSimpleName("len")); //$NON-NLS-1$ - b.statements().add(localAst.newExpressionStatement(ac1)); - assertTrue(ac1.getRoot() == cu); - - // new double[7][24][]; - ArrayCreation ac2 = localAst.newArrayCreation(); - ac2.setType( - localAst.newArrayType( - localAst.newPrimitiveType(PrimitiveType.DOUBLE), 3)); - ac2.dimensions().add(localAst.newNumberLiteral("7")); //$NON-NLS-1$ - ac2.dimensions().add(localAst.newNumberLiteral("24")); //$NON-NLS-1$ - b.statements().add(localAst.newExpressionStatement(ac2)); - assertTrue(ac2.getRoot() == cu); - - // new int[] {1, 2}; - ArrayCreation ac3 = localAst.newArrayCreation(); - ac3.setType( - localAst.newArrayType( - localAst.newPrimitiveType(PrimitiveType.INT))); - ArrayInitializer ai = localAst.newArrayInitializer(); - ac3.setInitializer(ai); - ai.expressions().add(localAst.newNumberLiteral("1")); //$NON-NLS-1$ - ai.expressions().add(localAst.newNumberLiteral("2")); //$NON-NLS-1$ - b.statements().add(localAst.newExpressionStatement(ac3)); - assertTrue(ac3.getRoot() == cu); - assertTrue(ai.getRoot() == cu); - - // new String(10); - ClassInstanceCreation cr1 = localAst.newClassInstanceCreation(); - if (ast.apiLevel() == AST.JLS2) { - cr1.setName(localAst.newSimpleName("String")); //$NON-NLS-1$ - } else { - cr1.setType(localAst.newSimpleType(localAst.newSimpleName("String"))); //$NON-NLS-1$ - } - cr1.arguments().add(localAst.newNumberLiteral("10")); //$NON-NLS-1$ - b.statements().add(localAst.newExpressionStatement(cr1)); - assertTrue(cr1.getRoot() == cu); - - // new Listener() {public void handleEvent() {} }; - ClassInstanceCreation cr2 = localAst.newClassInstanceCreation(); - AnonymousClassDeclaration ad1 = localAst.newAnonymousClassDeclaration(); - cr2.setAnonymousClassDeclaration(ad1); - if (ast.apiLevel() == AST.JLS2) { - cr2.setName(localAst.newSimpleName("Listener")); //$NON-NLS-1$ - } else { - cr2.setType(localAst.newSimpleType(localAst.newSimpleName("Listener"))); //$NON-NLS-1$ - } - FunctionDeclaration md0 = localAst.newFunctionDeclaration(); - if (ast.apiLevel() == AST.JLS2) { - md0.setModifiers(Modifier.PUBLIC); - } else { - md0.modifiers().add(localAst.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD)); - } - md0.setName(localAst.newSimpleName("handleEvent")); //$NON-NLS-1$ - md0.setBody(localAst.newBlock()); - ad1.bodyDeclarations().add(md0); - b.statements().add(localAst.newExpressionStatement(cr2)); - assertTrue(cr2.getRoot() == cu); - assertTrue(md0.getRoot() == cu); - assertTrue(ad1.getRoot() == cu); - - } - } - - abstract class Property { - - /** - * Indicates whether this property is compulsory, in that every node - * must have a value at all times. - */ - private boolean compulsory; - - private Class nodeType; - private String propertyName; - - /** - * Creates a new property with the given name. - */ - Property(String propertyName, boolean compulsory, Class nodeType) { - this.propertyName = propertyName; - this.compulsory = compulsory; - this.nodeType = nodeType; - } - - /** - * Returns a sample node of a type suitable for storing - * in this property. - * - * @param targetAST the target AST - * @param parented true if the sample should be - * parented, and false if unparented - * @return a sample node - */ - public abstract ASTNode sample(AST targetAST, boolean parented); - - /** - * Returns examples of node of types unsuitable for storing - * in this property. - *

- * This implementation returns an empty list. Subclasses - * should reimplement to specify counter-examples. - *

- * - * @param targetAST the target AST - * @return a list of counter-example nodes - */ - public ASTNode[] counterExamples(AST targetAST) { - return new ASTNode[] {}; - } - - /** - * Returns a sample node of a type suitable for storing - * in this property. The sample embeds the node itself. - *

- * For instance, for an Expression-valued property of a given - * Statement, this method returns an Expression that embeds - * this Statement node (as a descendent). - *

- *

- * Returns null if such an embedding is impossible. - * For instance, for an Name-valued property of a given - * Statement, this method returns null because - * an Expression cannot be embedded in a Name. - *

- *

- * This implementation returns null. Subclasses - * should reimplement to specify an embedding. - *

- * - * @return a sample node that embeds the given node, - * and null if such an embedding is impossible - */ - public ASTNode wrap() { - return null; - } - - /** - * Undoes the effects of a previous wrap. - *

- * This implementation does nothing. Subclasses - * should reimplement if they reimplement wrap. - *

- */ - public void unwrap() { - } - - /** - * Returns whether this property is compulsory, in that every node - * must have a value at all times. - * - * @return true if the property is compulsory, - * and false if the property may be null - */ - public final boolean isCompulsory() { - return compulsory; - } - - /** - * Returns the value of this property. - *

- * This implementation throws an unchecked exception. Subclasses - * should reimplement. - *

- * - * @return the property value, or null if no value - */ - public ASTNode get() { - throw new RuntimeException("get not implemented"); //$NON-NLS-1$ - } - - /** - * Sets or clears the value of this property. - *

- * This implementation throws an unchecked exception. Subclasses - * should reimplement. - *

- * - * @param value the property value, or null if no value - */ - public void set(ASTNode value) { - throw new RuntimeException("get(" + value + ") not implemented"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - public String toString() { - return "Property(" + this.propertyName + ", " + this.compulsory + ", " + this.nodeType + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - } - } - - /** - * Exercises the given property of the given node. - * - * @param node the node to test - * @param prop the property descriptor - */ - void genericPropertyTest(ASTNode node, Property prop) { - - ASTNode x1 = prop.sample(node.getAST(), false); - prop.set(x1); - assertTrue(prop.get() == x1); - assertTrue(x1.getParent() == node); - - // check handling of null - if (prop.isCompulsory()) { - try { - prop.set(null); - } catch (RuntimeException e) { - // pass - } - } else { - long previousCount = node.getAST().modificationCount(); - prop.set(null); - assertTrue(prop.get() == null); - assertTrue(node.getAST().modificationCount() > previousCount); - } - - // check that a child from a different AST is detected - try { - AST newAST = AST.newAST(node.getAST().apiLevel()); - prop.set(prop.sample(newAST, false)); - assertTrue(false); - } catch (RuntimeException e) { - // pass - } - - // check that a child with a parent is detected - try { - ASTNode b1 = prop.sample(node.getAST(), true); - prop.set(b1); // bogus: already has parent - assertTrue(false); - } catch (RuntimeException e) { - // pass - } - - // check that a cycle is detected - assertTrue(node.getParent() == null); - ASTNode s1 = null; - try { - s1 = prop.wrap(); - if (s1 != null) { - prop.set(s1); // bogus: creates a cycle - assertTrue(false); - } - } catch (RuntimeException e) { - // pass - } finally { - if (s1 != null) { - prop.unwrap(); - assertTrue(node.getParent() == null); - } - } - - // check that a child of the wrong type is detected - ASTNode b1[] = prop.counterExamples(node.getAST()); - for (int i = 0; i < b1.length; i++) { - try { - prop.set(b1[i]); // bogus: wrong type - assertTrue(false); - } catch (RuntimeException e) { - // pass - } - } - - } - - /** - * Exercises the given property of the given node. - * - * @param node the node to test - * @param children the node to test - * @param prop the property descriptor - */ - void genericPropertyListTest(ASTNode node, List children, Property prop) { - - // wipe the slate clean - children.clear(); - assertTrue(children.size() == 0); - - // add a child - ASTNode x1 = prop.sample(node.getAST(), false); - long previousCount = node.getAST().modificationCount(); - children.add(x1); - assertTrue(node.getAST().modificationCount() > previousCount); - assertTrue(children.size() == 1); - assertTrue(children.get(0) == x1); - assertTrue(x1.getParent() == node); - - // add a second child - ASTNode x2 = prop.sample(node.getAST(), false); - previousCount = node.getAST().modificationCount(); - children.add(x2); - assertTrue(node.getAST().modificationCount() > previousCount); - assertTrue(children.size() == 2); - assertTrue(children.get(0) == x1); - assertTrue(children.get(1) == x2); - assertTrue(x1.getParent() == node); - assertTrue(x2.getParent() == node); - - // remove the first child - previousCount = node.getAST().modificationCount(); - children.remove(0); - assertTrue(node.getAST().modificationCount() > previousCount); - assertTrue(children.size() == 1); - assertTrue(children.get(0) == x2); - assertTrue(x1.getParent() == null); - assertTrue(x2.getParent() == node); - - // remove the remaining child - previousCount = node.getAST().modificationCount(); - children.remove(x2); - assertTrue(node.getAST().modificationCount() > previousCount); - assertTrue(children.size() == 0); - assertTrue(x1.getParent() == null); - assertTrue(x2.getParent() == null); - - // check that null is never allowed - try { - children.add(null); - } catch (RuntimeException e) { - // pass - } - - // check that a child from a different AST is detected - try { - AST newAST = AST.newAST(node.getAST().apiLevel()); - children.add(prop.sample(newAST, false)); - assertTrue(false); - } catch (RuntimeException e) { - // pass - } - - // check that a child with a parent is detected - try { - ASTNode b1 = prop.sample(node.getAST(), true); - children.add(b1); // bogus: already has parent - assertTrue(false); - } catch (RuntimeException e) { - // pass - } - - // check that a cycle is detected - assertTrue(node.getParent() == null); - ASTNode s1 = null; - try { - s1 = prop.wrap(); - if (s1 != null) { - children.add(s1); // bogus: creates a cycle - assertTrue(false); - } - } catch (RuntimeException e) { - // pass - } finally { - if (s1 != null) { - prop.unwrap(); - assertTrue(node.getParent() == null); - } - } - - // check that a child of the wrong type is detected - ASTNode b1[] = prop.counterExamples(node.getAST()); - for (int i = 0; i < b1.length; i++) { - try { - children.add(b1[i]); // bogus: wrong type - assertTrue(false); - } catch (RuntimeException e) { - // pass - } - } - - } - - /** @deprecated using deprecated code */ - public void testAST() { - - assertTrue(AST.JLS2 == 2); - assertTrue(AST.JLS3 == 3); - - AST a0 = new AST(); // deprecated, but still 2.0 - assertTrue(a0.apiLevel() == AST.JLS2); - AST a1 = new AST(new HashMap()); // deprecated, but still 2.0 - assertTrue(a1.apiLevel() == AST.JLS2); - AST a2 = AST.newAST(AST.JLS2); - assertTrue(a2.apiLevel() == AST.JLS2); - AST a3 = AST.newAST(AST.JLS3); - assertTrue(a3.apiLevel() == AST.JLS3); - - - // modification count is always non-negative - assertTrue(ast.modificationCount() >= 0); - - // modification count increases for node creations - long previousCount = ast.modificationCount(); - SimpleName x = ast.newSimpleName("first"); //$NON-NLS-1$ - assertTrue(ast.modificationCount() > previousCount); - - // modification count does not increase for reading node attributes - previousCount = ast.modificationCount(); - x.getIdentifier(); - x.getParent(); - x.getRoot(); - x.getAST(); - x.getFlags(); - x.getStartPosition(); - x.getLength(); - x.equals(x); - assertTrue(ast.modificationCount() == previousCount); - - // modification count does not increase for reading or writing properties - previousCount = ast.modificationCount(); - x.getProperty("any"); //$NON-NLS-1$ - x.setProperty("any", "value"); // N.B. //$NON-NLS-1$ //$NON-NLS-2$ - x.properties(); - assertTrue(ast.modificationCount() == previousCount); - - // modification count increases for changing node attributes - previousCount = ast.modificationCount(); - x.setIdentifier("second"); //$NON-NLS-1$ - assertTrue(ast.modificationCount() > previousCount); - - previousCount = ast.modificationCount(); - x.setFlags(0); - assertTrue(ast.modificationCount() > previousCount); - - previousCount = ast.modificationCount(); - x.setSourceRange(-1,0); - assertTrue(ast.modificationCount() > previousCount); - } - - public void testWellKnownBindings() { - - // well known bindings - String[] wkbs = { - "byte", "char", "short", "int", "long", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - "boolean", "float", "double", "void", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - "java.lang.Class", //$NON-NLS-1$ - "java.lang.Cloneable", //$NON-NLS-1$ - "java.lang.Error", //$NON-NLS-1$ - "java.lang.Exception", //$NON-NLS-1$ - "java.lang.Object", //$NON-NLS-1$ - "java.lang.RuntimeException", //$NON-NLS-1$ - "java.lang.String", //$NON-NLS-1$ - "java.lang.StringBuffer", //$NON-NLS-1$ - "java.lang.Throwable", //$NON-NLS-1$ - "java.io.Serializable", //$NON-NLS-1$ - "java.lang.Boolean", //$NON-NLS-1$ - "java.lang.Byte", //$NON-NLS-1$ - "java.lang.Character", //$NON-NLS-1$ - "java.lang.Double", //$NON-NLS-1$ - "java.lang.Float", //$NON-NLS-1$ - "java.lang.Integer", //$NON-NLS-1$ - "java.lang.Long", //$NON-NLS-1$ - "java.lang.Short", //$NON-NLS-1$ - "java.lang.Void", //$NON-NLS-1$ - }; - - // no-so-well-known bindings - String[] nwkbs = { - "verylong", //$NON-NLS-1$ - "java.lang.Math", //$NON-NLS-1$ - "com.example.MyCode", //$NON-NLS-1$ - }; - - // none of the well known bindings resolve in a plain AST - for (int i = 0; i previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue("foo".equals(x.getIdentifier())); //$NON-NLS-1$ - assertTrue("foo".equals(x.getFullyQualifiedName())); //$NON-NLS-1$ - assertTrue(x.getNodeType() == ASTNode.SIMPLE_NAME); - assertTrue(x.isDeclaration() == false); - assertTrue(x.structuralPropertiesForType() == SimpleName.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - previousCount = ast.modificationCount(); - x.setIdentifier("bar"); //$NON-NLS-1$ - assertTrue(ast.modificationCount() > previousCount); - assertTrue("bar".equals(x.getIdentifier())); //$NON-NLS-1$ - assertTrue("bar".equals(x.getFullyQualifiedName())); //$NON-NLS-1$ - - // check that property cannot be set to null - try { - x.setIdentifier(null); - assertTrue(false); - } catch (RuntimeException e) { - // pass - } - - // check that property cannot be set to keyword or reserved work - String[] reserved = - new String[] { - "true", "false", "null", // literals //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - "abstract", "default", "if", "private", "this", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - "boolean", "do", "implements", "protected", "throw", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - "break", "double", "import", "public", "throws", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - "byte", "else", "instanceof", "return", "transient", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - "case", "extends", "int", "short", "try", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - "catch", "final", "interface", "static", "void", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - "char", "finally", "long", "strictfp", "volatile", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - "class", "float", "native", "super", "while", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - "const", "for", "new", "switch", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - "continue", "goto", "package", "synchronized"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - for (int i=0; i", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - "", " ", "a.b"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - for (int i=0; i previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getQualifier().getParent() == x); - assertTrue(x.getName().getParent() == x); - assertTrue(x.getName().isDeclaration() == false); - assertTrue(x.getNodeType() == ASTNode.QUALIFIED_NAME); - assertTrue("q.i".equals(x.getFullyQualifiedName())); //$NON-NLS-1$ - assertTrue(x.structuralPropertiesForType() == QualifiedName.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - genericPropertyTest(x, new Property("Qualifier", true, Name.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - QualifiedName result = targetAst.newQualifiedName( - targetAst.newSimpleName("a"), //$NON-NLS-1$ - targetAst.newSimpleName("b")); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - QualifiedName s1 = ast.newQualifiedName(x, ast.newSimpleName("z")); //$NON-NLS-1$ - return s1; - } - public void unwrap() { - QualifiedName s1 = (QualifiedName) x.getParent(); - s1.setQualifier(ast.newSimpleName("z")); //$NON-NLS-1$ - } - public ASTNode get() { - return x.getQualifier(); - } - public void set(ASTNode value) { - x.setQualifier((Name) value); - } - }); - - genericPropertyTest(x, new Property("Name", true, SimpleName.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode get() { - return x.getName(); - } - public void set(ASTNode value) { - x.setName((SimpleName) value); - } - }); - - // test fullyQualifiedName on nested names - Name q0 = ast.newName(new String[] {"a", "bb", "ccc", "dddd", "eeeee", "ffffff"}); - assertTrue("a.bb.ccc.dddd.eeeee.ffffff".equals(q0.getFullyQualifiedName())); //$NON-NLS-1$ - - } - - public void testNameFactories() { - long previousCount = ast.modificationCount(); - Name x = ast.newName("foo"); //$NON-NLS-1$ - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue("foo".equals(x.getFullyQualifiedName())); //$NON-NLS-1$ - assertTrue(x.getNodeType() == ASTNode.SIMPLE_NAME); - - previousCount = ast.modificationCount(); - x = ast.newName("foo.bar"); //$NON-NLS-1$ - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue("foo.bar".equals(x.getFullyQualifiedName())); //$NON-NLS-1$ - assertTrue(x.getNodeType() == ASTNode.QUALIFIED_NAME); - QualifiedName q = (QualifiedName) x; - assertTrue("bar".equals(q.getName().getFullyQualifiedName())); //$NON-NLS-1$ - assertTrue("foo".equals(q.getQualifier().getFullyQualifiedName())); //$NON-NLS-1$ - - // check that simple and qualified names work - String[] legal = - new String[] { - "a", "abcdef", "XYZZY", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - "a.b", "java.lang.Object", "a.b.c.d.e"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - for (int i=0; i previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getNodeType() == ASTNode.NULL_LITERAL); - assertTrue(x.structuralPropertiesForType() == NullLiteral.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - } - - public void testBooleanLiteral() { - long previousCount = ast.modificationCount(); - BooleanLiteral x = ast.newBooleanLiteral(true); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.booleanValue() == true); - assertTrue(x.getNodeType() == ASTNode.BOOLEAN_LITERAL); - assertTrue(x.structuralPropertiesForType() == BooleanLiteral.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - previousCount = ast.modificationCount(); - x.setBooleanValue(false); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.booleanValue() == false); - - previousCount = ast.modificationCount(); - x.setBooleanValue(true); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.booleanValue() == true); - } - - public void testStringLiteral() { - long previousCount = ast.modificationCount(); - // check 0-arg factory first - StringLiteral x = ast.newStringLiteral(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue("\"\"".equals(x.getEscapedValue())); //$NON-NLS-1$ - assertTrue("".equals(x.getLiteralValue())); //$NON-NLS-1$ - assertTrue(x.getNodeType() == ASTNode.STRING_LITERAL); - assertTrue(x.structuralPropertiesForType() == StringLiteral.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - previousCount = ast.modificationCount(); - x.setEscapedValue("\"bye\""); //$NON-NLS-1$ - assertTrue(ast.modificationCount() > previousCount); - assertTrue("\"bye\"".equals(x.getEscapedValue())); //$NON-NLS-1$ - assertTrue("bye".equals(x.getLiteralValue())); //$NON-NLS-1$ - - previousCount = ast.modificationCount(); - x.setLiteralValue("hi"); //$NON-NLS-1$ - assertTrue(ast.modificationCount() > previousCount); - assertTrue("\"hi\"".equals(x.getEscapedValue())); //$NON-NLS-1$ - assertTrue("hi".equals(x.getLiteralValue())); //$NON-NLS-1$ - - previousCount = ast.modificationCount(); - x.setLiteralValue("\\012\\015"); //$NON-NLS-1$ - assertTrue(ast.modificationCount() > previousCount); - assertEquals("different", "\"\\\\012\\\\015\"", x.getEscapedValue()); //$NON-NLS-1$ - assertTrue("\\012\\015".equals(x.getLiteralValue())); //$NON-NLS-1$ - - previousCount = ast.modificationCount(); - x.setLiteralValue("\012\015"); //$NON-NLS-1$ - assertTrue(ast.modificationCount() > previousCount); - assertTrue("\n\r".equals(x.getLiteralValue())); //$NON-NLS-1$ - assertEquals("different", "\"\\n\\r\"", x.getEscapedValue()); //$NON-NLS-1$ - - // check that property cannot be set to null - try { - x.setEscapedValue(null); - assertTrue(false); - } catch (RuntimeException e) { - // pass - } - - // check that property cannot be set to null - try { - x.setLiteralValue(null); - assertTrue(false); - } catch (RuntimeException e) { - // pass - } - } - - public void testStringLiteralUnicode() { - AST localAst = AST.newAST(ast.apiLevel()); - StringLiteral literal = localAst.newStringLiteral(); - literal.setEscapedValue("\"hello\\u0026\\u0050worl\\u0064\""); //$NON-NLS-1$ - assertTrue(literal.getLiteralValue().equals("hello&Pworld")); //$NON-NLS-1$ - - localAst = AST.newAST(ast.apiLevel()); - literal = localAst.newStringLiteral(); - literal.setEscapedValue("\"hello\\nworld\""); //$NON-NLS-1$ - assertTrue(literal.getLiteralValue().equals("hello\nworld")); //$NON-NLS-1$ - - localAst = AST.newAST(ast.apiLevel()); - literal = localAst.newStringLiteral(); - literal.setLiteralValue("hello\nworld"); //$NON-NLS-1$ - assertTrue(literal.getLiteralValue().equals("hello\nworld")); //$NON-NLS-1$ - - localAst = AST.newAST(ast.apiLevel()); - literal = localAst.newStringLiteral(); - literal.setLiteralValue("\n"); //$NON-NLS-1$ - assertTrue(literal.getEscapedValue().equals("\"\\n\"")); //$NON-NLS-1$ - assertTrue(literal.getLiteralValue().equals("\n")); //$NON-NLS-1$ - - localAst = AST.newAST(ast.apiLevel()); - literal = localAst.newStringLiteral(); - literal.setEscapedValue("\"hello\\\"world\""); //$NON-NLS-1$ - assertTrue(literal.getLiteralValue().equals("hello\"world")); //$NON-NLS-1$ - - localAst = AST.newAST(ast.apiLevel()); - literal = localAst.newStringLiteral(); - literal.setLiteralValue("hello\\u0026world"); //$NON-NLS-1$ - assertTrue(literal.getLiteralValue().equals("hello\\u0026world")); //$NON-NLS-1$ - - localAst = AST.newAST(ast.apiLevel()); - literal = localAst.newStringLiteral(); - literal.setLiteralValue("hello\\u0026world"); //$NON-NLS-1$ - assertTrue(literal.getEscapedValue().equals("\"hello\\\\u0026world\"")); //$NON-NLS-1$ - - localAst = AST.newAST(ast.apiLevel()); - literal = localAst.newStringLiteral(); - literal.setLiteralValue("\\u0001"); //$NON-NLS-1$ - assertTrue(literal.getEscapedValue().equals("\"\\\\u0001\"")); //$NON-NLS-1$ - } - - public void testCharacterLiteral() { - long previousCount = ast.modificationCount(); - CharacterLiteral x = ast.newCharacterLiteral(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getEscapedValue().startsWith("\'")); //$NON-NLS-1$ - assertTrue(x.getEscapedValue().endsWith("\'")); //$NON-NLS-1$ - assertTrue(x.getNodeType() == ASTNode.CHARACTER_LITERAL); - assertTrue(x.structuralPropertiesForType() == CharacterLiteral.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - previousCount = ast.modificationCount(); - x.setEscapedValue("\'z\'"); //$NON-NLS-1$ - assertTrue(ast.modificationCount() > previousCount); - assertTrue("\'z\'".equals(x.getEscapedValue())); //$NON-NLS-1$ - assertTrue(x.charValue() == 'z'); - - // test other factory method - previousCount = ast.modificationCount(); - CharacterLiteral y = ast.newCharacterLiteral(); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(y.getAST() == ast); - assertTrue(y.getParent() == null); - String v = y.getEscapedValue(); - assertTrue(v.length() >= 3 && v.charAt(0) == '\'' & v.charAt(v.length()-1 ) == '\''); - - // check that property cannot be set to null - try { - x.setEscapedValue(null); - assertTrue(false); - } catch (RuntimeException e) { - // pass - } - - // test escaped characters - // b, t, n, f, r, ", ', \, 0, 1, 2, 3, 4, 5, 6, or 7 - try { - x.setEscapedValue("\'\\b\'"); //$NON-NLS-1$ - x.setEscapedValue("\'\\t\'"); //$NON-NLS-1$ - x.setEscapedValue("\'\\n\'"); //$NON-NLS-1$ - x.setEscapedValue("\'\\f\'"); //$NON-NLS-1$ - x.setEscapedValue("\'\\\"\'"); //$NON-NLS-1$ - x.setEscapedValue("\'\\'\'"); //$NON-NLS-1$ - x.setEscapedValue("\'\\\\\'"); //$NON-NLS-1$ - x.setEscapedValue("\'\\0\'"); //$NON-NLS-1$ - x.setEscapedValue("\'\\1\'"); //$NON-NLS-1$ - x.setEscapedValue("\'\\2\'"); //$NON-NLS-1$ - x.setEscapedValue("\'\\3\'"); //$NON-NLS-1$ - x.setEscapedValue("\'\\4\'"); //$NON-NLS-1$ - x.setEscapedValue("\'\\5\'"); //$NON-NLS-1$ - x.setEscapedValue("\'\\6\'"); //$NON-NLS-1$ - x.setEscapedValue("\'\\7\'"); //$NON-NLS-1$ - x.setEscapedValue("\'\\u0041\'"); //$NON-NLS-1$ - assertTrue(x.charValue() == 'A'); - } catch(IllegalArgumentException e) { - assertTrue(false); - } - - x.setCharValue('\u0041'); - assertTrue(x.getEscapedValue().equals("\'A\'")); //$NON-NLS-1$ - x.setCharValue('\t'); - assertTrue(x.getEscapedValue().equals("\'\\t\'")); //$NON-NLS-1$ - x.setEscapedValue("\'\\\\\'"); //$NON-NLS-1$ - assertTrue(x.getEscapedValue().equals("\'\\\\\'")); //$NON-NLS-1$ - assertTrue(x.charValue() == '\\'); - x.setEscapedValue("\'\\\'\'"); //$NON-NLS-1$ - assertTrue(x.getEscapedValue().equals("\'\\\'\'")); //$NON-NLS-1$ - assertTrue(x.charValue() == '\''); - x.setCharValue('\''); - assertTrue(x.getEscapedValue().equals("\'\\\'\'")); //$NON-NLS-1$ - assertTrue(x.charValue() == '\''); - x.setCharValue('\\'); - assertTrue(x.getEscapedValue().equals("\'\\\\\'")); //$NON-NLS-1$ - assertTrue(x.charValue() == '\\'); - } - - public void testNumberLiteral() { - long previousCount = ast.modificationCount(); - NumberLiteral x = ast.newNumberLiteral("1234"); //$NON-NLS-1$ - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue("1234".equals(x.getToken())); //$NON-NLS-1$ - assertTrue(x.getNodeType() == ASTNode.NUMBER_LITERAL); - assertTrue(x.structuralPropertiesForType() == NumberLiteral.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - // test other factory method - previousCount = ast.modificationCount(); - NumberLiteral y = ast.newNumberLiteral(); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(y.getAST() == ast); - assertTrue(y.getParent() == null); - assertTrue("0".equals(y.getToken())); //$NON-NLS-1$ - - final String[] samples = - { "0", "1", "1234567890", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - "0L", "1L", "1234567890L", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - "0l", "1l", "1234567890l", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - "077", "0177", "012345670", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - "077L", "0177L", "012345670L", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - "077l", "0177l", "012345670l", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - "0x00", "0x1", "0x0123456789ABCDEF", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - "0x00L", "0x1L", "0x0123456789ABCDEFL", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - "0x00l", "0x1l", "0x0123456789ABCDEFl", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - "1e1f", "2.f", ".3f", "0f", "3.14f", "6.022137e+23f", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ - "1e1", "2.", ".3", "0.0", "3.14", "1e-9d", "1e137", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ - }; - for (int i = 0; i < samples.length; i++) { - previousCount = ast.modificationCount(); - x.setToken(samples[i]); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(samples[i].equals(x.getToken())); - } - - // check that property cannot be set to null - try { - x.setToken(null); - assertTrue(false); - } catch (RuntimeException e) { - // pass - } - - } - - public void testSimpleType() { - long previousCount = ast.modificationCount(); - final SimpleType x = ast.newSimpleType(ast.newSimpleName("String")); //$NON-NLS-1$ - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getName().getParent() == x); - assertTrue(x.isSimpleType()); - assertTrue(!x.isArrayType()); - assertTrue(!x.isPrimitiveType()); - assertTrue(!x.isQualifiedType()); - assertTrue(x.getNodeType() == ASTNode.SIMPLE_TYPE); - assertTrue(x.structuralPropertiesForType() == SimpleType.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - genericPropertyTest(x, new Property("Name", true, Name.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("a"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode get() { - return x.getName(); - } - public void set(ASTNode value) { - x.setName((Name) value); - } - }); - } - - public void testPrimitiveType() { - long previousCount = ast.modificationCount(); - PrimitiveType x = ast.newPrimitiveType(PrimitiveType.INT); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getPrimitiveTypeCode().equals(PrimitiveType.INT)); - assertTrue(!x.isSimpleType()); - assertTrue(!x.isArrayType()); - assertTrue(x.isPrimitiveType()); - assertTrue(!x.isQualifiedType()); - assertTrue(x.getNodeType() == ASTNode.PRIMITIVE_TYPE); - assertTrue(x.structuralPropertiesForType() == PrimitiveType.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - // check the names of the primitive type codes - assertTrue(PrimitiveType.BYTE.toString().equals("byte")); //$NON-NLS-1$ - assertTrue(PrimitiveType.INT.toString().equals("int")); //$NON-NLS-1$ - assertTrue(PrimitiveType.BOOLEAN.toString().equals("boolean")); //$NON-NLS-1$ - assertTrue(PrimitiveType.CHAR.toString().equals("char")); //$NON-NLS-1$ - assertTrue(PrimitiveType.SHORT.toString().equals("short")); //$NON-NLS-1$ - assertTrue(PrimitiveType.LONG.toString().equals("long")); //$NON-NLS-1$ - assertTrue(PrimitiveType.FLOAT.toString().equals("float")); //$NON-NLS-1$ - assertTrue(PrimitiveType.DOUBLE.toString().equals("double")); //$NON-NLS-1$ - assertTrue(PrimitiveType.VOID.toString().equals("void")); //$NON-NLS-1$ - - - PrimitiveType.Code[] known = { - PrimitiveType.BOOLEAN, - PrimitiveType.BYTE, - PrimitiveType.CHAR, - PrimitiveType.INT, - PrimitiveType.SHORT, - PrimitiveType.LONG, - PrimitiveType.FLOAT, - PrimitiveType.DOUBLE, - PrimitiveType.VOID, - }; - - // check all primitive type codes are distinct - for (int i = 0; i < known.length; i++) { - for (int j = 0; j < known.length; j++) { - assertTrue(i == j || !known[i].equals(known[j])); - } - } - - // check all primitive type codes work - for (int i = 0; i < known.length; i++) { - previousCount = ast.modificationCount(); - x.setPrimitiveTypeCode(known[i]); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getPrimitiveTypeCode().equals(known[i])); - } - // ensure null does not work as a primitive type code - try { - x.setPrimitiveTypeCode(null); - assertTrue(false); - } catch (RuntimeException e) { - // pass - } - - // check toCode lookup of primitive type code by name - for (int i = 0; i < known.length; i++) { - String name = known[i].toString(); - assertTrue(PrimitiveType.toCode(name).equals(known[i])); - } - assertTrue(PrimitiveType.toCode("not-a-type") == null); //$NON-NLS-1$ - } - - public void testArrayType() { - SimpleName x1 = ast.newSimpleName("String"); //$NON-NLS-1$ - SimpleType x2 = ast.newSimpleType(x1); - long previousCount = ast.modificationCount(); - final ArrayType x = ast.newArrayType(x2); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getComponentType().getParent() == x); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - assertTrue(!x.isSimpleType()); - assertTrue(x.isArrayType()); - assertTrue(!x.isPrimitiveType()); - assertTrue(!x.isQualifiedType()); - assertTrue(x.getNodeType() == ASTNode.ARRAY_TYPE); - assertTrue(x.structuralPropertiesForType() == ArrayType.propertyDescriptors(ast.apiLevel())); - - assertTrue(x.getDimensions() == 1); - assertTrue(x.getElementType() == x2); - - genericPropertyTest(x, new Property("ComponentType", true, Type.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleType result = targetAst.newSimpleType( - targetAst.newSimpleName("a")); //$NON-NLS-1$ - if (parented) { - targetAst.newArrayType(result); - } - return result; - } - public ASTNode wrap() { - ArrayType result = ast.newArrayType(x); - return result; - } - public void unwrap() { - ArrayType a = (ArrayType) x.getParent(); - a.setComponentType(ast.newPrimitiveType(PrimitiveType.INT)); - } - public ASTNode get() { - return x.getComponentType(); - } - public void set(ASTNode value) { - x.setComponentType((Type) value); - } - }); - - x.setComponentType( - ast.newArrayType(ast.newPrimitiveType(PrimitiveType.INT), 4)); - - assertTrue(x.getDimensions() == 5); - assertTrue(x.getElementType().isPrimitiveType()); - } - - /** @deprecated using deprecated code */ - public void testQualifiedType() { - if (ast.apiLevel() == AST.JLS2) { - // node type introduced in 3.0 API - try { - ast.newQualifiedType( - ast.newSimpleType(ast.newSimpleName("q")), //$NON-NLS-1$ - ast.newSimpleName("i")); //$NON-NLS-1$ - assertTrue(false); - } catch (UnsupportedOperationException e) { - // pass - } - return; - } - long previousCount = ast.modificationCount(); - final QualifiedType x = ast.newQualifiedType( - ast.newSimpleType(ast.newSimpleName("q")), //$NON-NLS-1$ - ast.newSimpleName("i")); //$NON-NLS-1$ - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getQualifier().getParent() == x); - assertTrue(x.getName().getParent() == x); - assertTrue(x.getName().isDeclaration() == false); - assertTrue(x.getNodeType() == ASTNode.QUALIFIED_TYPE); - assertTrue(!x.isSimpleType()); - assertTrue(!x.isArrayType()); - assertTrue(!x.isPrimitiveType()); - assertTrue(x.isQualifiedType()); - assertTrue(x.structuralPropertiesForType() == QualifiedType.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - genericPropertyTest(x, new Property("Qualifier", true, Type.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleType result = - targetAst.newSimpleType( - targetAst.newSimpleName("a")); //$NON-NLS-1$ - if (parented) { - targetAst.newArrayType(result); - } - return result; - } - public ASTNode wrap() { - QualifiedType s1 = ast.newQualifiedType(x, ast.newSimpleName("z")); //$NON-NLS-1$ - return s1; - } - public void unwrap() { - QualifiedType s1 = (QualifiedType) x.getParent(); - s1.setQualifier(ast.newSimpleType(ast.newSimpleName("z"))); //$NON-NLS-1$ - } - public ASTNode get() { - return x.getQualifier(); - } - public void set(ASTNode value) { - x.setQualifier((Type) value); - } - }); - - genericPropertyTest(x, new Property("Name", true, SimpleName.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode get() { - return x.getName(); - } - public void set(ASTNode value) { - x.setName((SimpleName) value); - } - }); - } - - public void testPackageDeclaration() { - long previousCount = ast.modificationCount(); - final PackageDeclaration x = ast.newPackageDeclaration(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - if (ast.apiLevel() >= AST.JLS3) { - assertTrue(x.getJavadoc() == null); - assertTrue(x.annotations().isEmpty()); - } - assertTrue(x.getName().getParent() == x); - assertTrue(x.getNodeType() == ASTNode.PACKAGE_DECLARATION); - assertTrue(x.structuralPropertiesForType() == PackageDeclaration.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - if (ast.apiLevel() >= AST.JLS3) { - genericPropertyTest(x, new Property("Javadoc", false, JSdoc.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - JSdoc result = targetAst.newJSdoc(); - if (parented) { - targetAst.newInitializer().setJavadoc(result); - } - return result; - } - public ASTNode get() { - return x.getJavadoc(); - } - public void set(ASTNode value) { - x.setJavadoc((JSdoc) value); - } - }); - - - } - - genericPropertyTest(x, new Property("Name", true, Name.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("a"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode get() { - return x.getName(); - } - public void set(ASTNode value) { - x.setName((Name) value); - } - }); - } - - public void testImportDeclaration() { - long previousCount = ast.modificationCount(); - final ImportDeclaration x = ast.newImportDeclaration(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.isOnDemand() == false); - if (ast.apiLevel() >= AST.JLS3) { - assertTrue(x.isStatic() == false); - } - assertTrue(x.getName().getParent() == x); - assertTrue(x.getNodeType() == ASTNode.IMPORT_DECLARATION); - assertTrue(x.structuralPropertiesForType() == ImportDeclaration.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - genericPropertyTest(x, new Property("Name", true, Name.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("a"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode get() { - return x.getName(); - } - public void set(ASTNode value) { - x.setName((Name) value); - } - }); - - previousCount = ast.modificationCount(); - x.setOnDemand(false); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.isOnDemand() == false); - previousCount = ast.modificationCount(); - x.setOnDemand(true); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.isOnDemand() == true); - - if (ast.apiLevel() >= AST.JLS3) { - x.setStatic(true); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.isStatic() == true); - } - } - - public void testCompilationUnit() { - long previousCount = ast.modificationCount(); - final JavaScriptUnit x = ast.newJavaScriptUnit(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getPackage() == null); - assertTrue(x.imports().size() == 0); - assertTrue(x.types().size() == 0); - assertTrue(x.getNodeType() == ASTNode.JAVASCRIPT_UNIT); - assertTrue(x.structuralPropertiesForType() == JavaScriptUnit.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - tClientProperties(x); - - genericPropertyTest(x, new Property("Package", false, PackageDeclaration.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - PackageDeclaration result = targetAst.newPackageDeclaration(); - if (parented) { - JavaScriptUnit cu = targetAst.newJavaScriptUnit(); - cu.setPackage(result); - } - return result; - } - public ASTNode get() { - return x.getPackage(); - } - public void set(ASTNode value) { - x.setPackage((PackageDeclaration) value); - } - }); - - genericPropertyListTest(x, x.imports(), new Property("Imports", true, ImportDeclaration.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - ImportDeclaration result = targetAst.newImportDeclaration(); - if (parented) { - JavaScriptUnit cu = targetAst.newJavaScriptUnit(); - cu.imports().add(result); - } - return result; - } - }); - - genericPropertyListTest(x, x.types(), new Property("Types", true, AbstractTypeDeclaration.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - TypeDeclaration result = targetAst.newTypeDeclaration(); - if (parented) { - JavaScriptUnit cu = targetAst.newJavaScriptUnit(); - cu.types().add(result); - } - return result; - } - }); - - // check that TypeDeclarations in body are classified correctly - TypeDeclaration t1 = ast.newTypeDeclaration(); - x.types().add(t1); - assertTrue(t1.isLocalTypeDeclaration() == false); - assertTrue(t1.isMemberTypeDeclaration() == false); - assertTrue(t1.isPackageMemberTypeDeclaration() == true); - - } - - public void testCompilationUnitLineNumberTable() { -// TO RUN THIS TEST YOU MUST TEMPORARILY MAKE PUBLIC -// THE METHOD JavaScriptUnit.setLineEndTable - -// final JavaScriptUnit x = ast.newCompilationUnit(); -// -// // table starts off empty -// for (int i= -10; i < 10; i++) { -// assertTrue(x.lineNumber(i) == 1); -// } -// -// // supply a simple line table to test -// String s = "AA\nBBB\nCC\nDDDD\nEEE"; -// assertTrue(s.length() == 18); // cross check -// int le[] = new int[5]; -// le[0] = s.indexOf('\n'); -// le[1] = s.indexOf('\n', le[0] + 1); -// le[2] = s.indexOf('\n', le[1] + 1); -// le[3] = s.indexOf('\n', le[2] + 1); -// le[4] = s.length() - 1; -// long previousCount = ast.modificationCount(); -// x.setLineEndTable(le); -// assertTrue(ast.modificationCount() > previousCount); -// -// assertTrue(x.lineNumber(0) == 1); -// assertTrue(x.lineNumber(1) == 1); -// assertTrue(x.lineNumber(2) == 1); -// assertTrue(x.lineNumber(3) == 2); -// assertTrue(x.lineNumber(4) == 2); -// assertTrue(x.lineNumber(5) == 2); -// assertTrue(x.lineNumber(6) == 2); -// assertTrue(x.lineNumber(7) == 3); -// assertTrue(x.lineNumber(8) == 3); -// assertTrue(x.lineNumber(9) == 3); -// assertTrue(x.lineNumber(10) == 4); -// assertTrue(x.lineNumber(11) == 4); -// assertTrue(x.lineNumber(12) == 4); -// assertTrue(x.lineNumber(13) == 4); -// assertTrue(x.lineNumber(14) == 4); -// assertTrue(x.lineNumber(15) == 5); -// assertTrue(x.lineNumber(16) == 5); -// assertTrue(x.lineNumber(17) == 5); -// -// assertTrue(x.lineNumber(18) == 1); -// assertTrue(x.lineNumber(100) == 1); -// assertTrue(x.lineNumber(1000000) == 1); -// assertTrue(x.lineNumber(-1) == 1); -// assertTrue(x.lineNumber(-100) == 1); -// assertTrue(x.lineNumber(-1000000) == 1); -// -// // slam table back to none -// x.setLineEndTable(new int[0]); -// for (int i= -10; i < 10; i++) { -// assertTrue(x.lineNumber(i) == 1); -// } - } - - /** @deprecated using deprecated code */ - public void testTypeDeclaration() { - long previousCount = ast.modificationCount(); - final TypeDeclaration x = ast.newTypeDeclaration(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - if (ast.apiLevel() == AST.JLS2) { - assertTrue(x.getModifiers() == Modifier.NONE); - assertTrue(x.getSuperclass() == null); - } else { - assertTrue(x.modifiers().size() == 0); - assertTrue(x.getSuperclassType() == null); - } - assertTrue(x.getName().getParent() == x); - assertTrue(x.getName().isDeclaration() == true); - assertTrue(x.getJavadoc() == null); - assertTrue(x.bodyDeclarations().size()== 0); - assertTrue(x.getNodeType() == ASTNode.TYPE_DECLARATION); - assertTrue(x.structuralPropertiesForType() == TypeDeclaration.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - previousCount = ast.modificationCount(); - - if (ast.apiLevel() == AST.JLS2) { - int legal = Modifier.PUBLIC | Modifier.PROTECTED - | Modifier.PRIVATE | Modifier.ABSTRACT | Modifier.STATIC - | Modifier.FINAL | Modifier.STRICTFP; - previousCount = ast.modificationCount(); - x.setModifiers(legal); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getModifiers() == legal); - - previousCount = ast.modificationCount(); - x.setModifiers(Modifier.NONE); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getModifiers() == Modifier.NONE); - } - - tJavadocComment(x); - - genericPropertyTest(x, new Property("Name", true, SimpleName.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode get() { - return x.getName(); - } - public void set(ASTNode value) { - x.setName((SimpleName) value); - } - }); - - if (ast.apiLevel() == AST.JLS2) { - genericPropertyTest(x, new Property("Superclass", false, Name.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode get() { - return x.getSuperclass(); - } - public void set(ASTNode value) { - x.setSuperclass((Name) value); - } - }); - } - - if (ast.apiLevel() >= AST.JLS3) { - genericPropertyTest(x, new Property("SuperclassType", false, Type.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleType result = targetAst.newSimpleType(targetAst.newSimpleName("foo")); //$NON-NLS-1$ - if (parented) { - targetAst.newArrayType(result); - } - return result; - } - public ASTNode get() { - return x.getSuperclassType(); - } - public void set(ASTNode value) { - x.setSuperclassType((Type) value); - } - }); - } - - if (ast.apiLevel() >= AST.JLS3) { - genericPropertyListTest(x, null, - new Property("SuperInterfaceTypes", true, Type.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleType result = targetAst.newSimpleType(targetAst.newSimpleName("foo")); //$NON-NLS-1$ - if (parented) { - targetAst.newArrayType(result); - } - return result; - } - }); - } - - - genericPropertyListTest(x, x.bodyDeclarations(), - new Property("BodyDeclarations", true, BodyDeclaration.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - TypeDeclaration result = targetAst.newTypeDeclaration(); - if (parented) { - JavaScriptUnit cu = targetAst.newJavaScriptUnit(); - cu.types().add(result); - } - return result; - } - public ASTNode wrap() { - TypeDeclaration s1 = x.getAST().newTypeDeclaration(); - s1.bodyDeclarations().add(x); - return s1; - } - public void unwrap() { - TypeDeclaration s1 = (TypeDeclaration) x.getParent(); - s1.bodyDeclarations().remove(x); - } - }); - - // check special bodyDeclaration methods - x.bodyDeclarations().clear(); - FieldDeclaration f1 = ast.newFieldDeclaration(ast.newVariableDeclarationFragment()); - FieldDeclaration f2 = ast.newFieldDeclaration(ast.newVariableDeclarationFragment()); - FunctionDeclaration m1 = ast.newFunctionDeclaration(); - FunctionDeclaration m2 = ast.newFunctionDeclaration(); - TypeDeclaration t1 = ast.newTypeDeclaration(); - TypeDeclaration t2 = ast.newTypeDeclaration(); - - - x.bodyDeclarations().add(ast.newInitializer()); - x.bodyDeclarations().add(f1); - x.bodyDeclarations().add(ast.newInitializer()); - x.bodyDeclarations().add(f2); - x.bodyDeclarations().add(ast.newInitializer()); - x.bodyDeclarations().add(t1); - x.bodyDeclarations().add(ast.newInitializer()); - x.bodyDeclarations().add(m1); - x.bodyDeclarations().add(ast.newInitializer()); - x.bodyDeclarations().add(m2); - x.bodyDeclarations().add(ast.newInitializer()); - x.bodyDeclarations().add(t2); - x.bodyDeclarations().add(ast.newInitializer()); - - List fs = Arrays.asList(x.getFields()); - assertTrue(fs.size() == 2); - assertTrue(fs.contains(f1)); - assertTrue(fs.contains(f2)); - - List ms = Arrays.asList(x.getMethods()); - assertTrue(ms.size() == 2); - assertTrue(ms.contains(m1)); - assertTrue(ms.contains(m2)); - - List ts = Arrays.asList(x.getTypes()); - assertTrue(ts.size() == 2); - assertTrue(ts.contains(t1)); - assertTrue(ts.contains(t2)); - - // check that TypeDeclarations in body are classified correctly - assertTrue(t1.isLocalTypeDeclaration() == false); - assertTrue(t1.isMemberTypeDeclaration() == true); - assertTrue(t1.isPackageMemberTypeDeclaration() == false); - - } - - /** @deprecated using deprecated code */ - public void testSingleVariableDeclaration() { - long previousCount = ast.modificationCount(); - final SingleVariableDeclaration x = ast.newSingleVariableDeclaration(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - if (ast.apiLevel() == AST.JLS2) { - assertTrue(x.getModifiers() == Modifier.NONE); - } else { - assertTrue(x.modifiers().size() == 0); - assertTrue(x.isVarargs() == false); - } - assertTrue(x.getName().getParent() == x); - assertTrue(x.getName().isDeclaration() == true); - assertTrue(x.getType().getParent() == x); - assertTrue(x.getExtraDimensions() == 0); - assertTrue(x.getInitializer() == null); - assertTrue(x.getNodeType() == ASTNode.SINGLE_VARIABLE_DECLARATION); - assertTrue(x.structuralPropertiesForType() == SingleVariableDeclaration.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - if (ast.apiLevel() == AST.JLS2) { - int legal = Modifier.PUBLIC | Modifier.PROTECTED - | Modifier.PRIVATE | Modifier.STATIC | Modifier.FINAL - | Modifier.TRANSIENT | Modifier.VOLATILE; - previousCount = ast.modificationCount(); - x.setModifiers(legal); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getModifiers() == legal); - - previousCount = ast.modificationCount(); - x.setModifiers(Modifier.NONE); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getModifiers() == Modifier.NONE); - } - - previousCount = ast.modificationCount(); - x.setExtraDimensions(1); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getExtraDimensions() == 1); - - previousCount = ast.modificationCount(); - x.setExtraDimensions(0); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getExtraDimensions() == 0); - - if (ast.apiLevel() >= AST.JLS3) { - previousCount = ast.modificationCount(); - x.setVarargs(true); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.isVarargs() == true); - - previousCount = ast.modificationCount(); - x.setVarargs(false); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.isVarargs() == false); - } - - - genericPropertyTest(x, new Property("Name", true, SimpleName.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode get() { - return x.getName(); - } - public void set(ASTNode value) { - x.setName((SimpleName) value); - } - }); - - genericPropertyTest(x, new Property("Type", true, Type.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleType result = targetAst.newSimpleType( - targetAst.newSimpleName("foo")); //$NON-NLS-1$ - if (parented) { - targetAst.newArrayType(result); - } - return result; - } - public ASTNode get() { - return x.getType(); - } - public void set(ASTNode value) { - x.setType((Type) value); - } - }); - - genericPropertyTest(x, new Property("Initializer", false, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - // return an Expression that embeds x - CatchClause s1 = ast.newCatchClause(); - s1.setException(x); - return s1; - } - public void unwrap() { - CatchClause s1 = (CatchClause) x.getParent(); - s1.setException(ast.newSingleVariableDeclaration()); - } - public ASTNode get() { - return x.getInitializer(); - } - public void set(ASTNode value) { - x.setInitializer((Expression) value); - } - }); - } - - public void testVariableDeclarationFragment() { - long previousCount = ast.modificationCount(); - final VariableDeclarationFragment x = ast.newVariableDeclarationFragment(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getName().getParent() == x); - assertTrue(x.getName().isDeclaration() == true); - assertTrue(x.getExtraDimensions() == 0); - assertTrue(x.getInitializer() == null); - assertTrue(x.getNodeType() == ASTNode.VARIABLE_DECLARATION_FRAGMENT); - assertTrue(x.structuralPropertiesForType() == - VariableDeclarationFragment.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - previousCount = ast.modificationCount(); - x.setExtraDimensions(1); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getExtraDimensions() == 1); - - previousCount = ast.modificationCount(); - x.setExtraDimensions(0); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getExtraDimensions() == 0); - - // check that property cannot be set negative - try { - x.setExtraDimensions(-1); - assertTrue(false); - } catch (RuntimeException e) { - // pass - } - - genericPropertyTest(x, new Property("Name", true, SimpleName.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode get() { - return x.getName(); - } - public void set(ASTNode value) { - x.setName((SimpleName) value); - } - }); - - genericPropertyTest(x, new Property("Initializer", false, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - // return an Expression that embeds x - VariableDeclarationExpression s1 = - ast.newVariableDeclarationExpression(x); - return s1; - } - public void unwrap() { - VariableDeclarationExpression s1 = - (VariableDeclarationExpression) x.getParent(); - s1.fragments().remove(x); - } - public ASTNode get() { - return x.getInitializer(); - } - public void set(ASTNode value) { - x.setInitializer((Expression) value); - } - }); - } - - /** @deprecated using deprecated code */ - public void testMethodDeclaration() { - long previousCount = ast.modificationCount(); - final FunctionDeclaration x = ast.newFunctionDeclaration(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - if (ast.apiLevel() == AST.JLS2) { - assertTrue(x.getModifiers() == Modifier.NONE); - assertTrue(x.getReturnType().getParent() == x); - assertTrue(x.getReturnType().isPrimitiveType()); - assertTrue(((PrimitiveType) x.getReturnType()).getPrimitiveTypeCode() == PrimitiveType.VOID); - } else { - assertTrue(x.modifiers().size() == 0); - assertTrue(x.getReturnType2().getParent() == x); - assertTrue(x.getReturnType2().isPrimitiveType()); - assertTrue(((PrimitiveType) x.getReturnType2()).getPrimitiveTypeCode() == PrimitiveType.VOID); - } - assertTrue(x.isConstructor() == false); - //assertTrue(x.getName().getParent() == x); - //assertTrue(x.getName().isDeclaration() == true); - assertTrue(x.getExtraDimensions() == 0); - assertTrue(x.getJavadoc() == null); - assertTrue(x.parameters().size() == 0); - assertTrue(x.thrownExceptions().size() == 0); - assertTrue(x.getBody() == null); - assertTrue(x.getNodeType() == ASTNode.FUNCTION_DECLARATION); - assertTrue(x.structuralPropertiesForType() == - FunctionDeclaration.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - previousCount = ast.modificationCount(); - x.setConstructor(true); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.isConstructor() == true); - //assertTrue(x.getName().isDeclaration() == false); - - previousCount = ast.modificationCount(); - x.setConstructor(false); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.isConstructor() == false); - - if (ast.apiLevel() == AST.JLS2) { - previousCount = ast.modificationCount(); - int legal = Modifier.PUBLIC | Modifier.PROTECTED - | Modifier.PRIVATE | Modifier.ABSTRACT | Modifier.STATIC - | Modifier.FINAL | Modifier.SYNCHRONIZED| Modifier.NATIVE - | Modifier.STRICTFP; - x.setModifiers(legal); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getModifiers() == legal); - - previousCount = ast.modificationCount(); - x.setModifiers(Modifier.NONE); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getModifiers() == Modifier.NONE); - } - - previousCount = ast.modificationCount(); - x.setExtraDimensions(1); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getExtraDimensions() == 1); - - previousCount = ast.modificationCount(); - x.setExtraDimensions(0); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getExtraDimensions() == 0); - - tJavadocComment(x); - - genericPropertyTest(x, new Property("Name", true, SimpleName.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode get() { - return x.getName(); - } - public void set(ASTNode value) { - x.setName((SimpleName) value); - } - }); - - if (ast.apiLevel() == AST.JLS2) { - genericPropertyTest(x, new Property("ReturnType", true, Type.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleType result = targetAst.newSimpleType( - targetAst.newSimpleName("foo")); //$NON-NLS-1$ - if (parented) { - targetAst.newArrayType(result); - } - return result; - } - public ASTNode get() { - return x.getReturnType(); - } - public void set(ASTNode value) { - x.setReturnType((Type) value); - } - }); - } - - if (ast.apiLevel() >= AST.JLS3) { - genericPropertyTest(x, new Property("ReturnType2", false, Type.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleType result = targetAst.newSimpleType( - targetAst.newSimpleName("foo")); //$NON-NLS-1$ - if (parented) { - targetAst.newArrayType(result); - } - return result; - } - public ASTNode get() { - return x.getReturnType2(); - } - public void set(ASTNode value) { - x.setReturnType2((Type) value); - } - }); - } - - genericPropertyListTest(x, x.parameters(), - new Property("Parameters", true, SingleVariableDeclaration.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SingleVariableDeclaration result = targetAst.newSingleVariableDeclaration(); - if (parented) { - targetAst.newCatchClause().setException(result); - } - return result; - } - public ASTNode wrap() { - // return a SingleVariableDeclaration that embeds x - SingleVariableDeclaration s1 = ast.newSingleVariableDeclaration(); - ClassInstanceCreation s2 = ast.newClassInstanceCreation(); - AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration(); - s2.setAnonymousClassDeclaration(a1); - s1.setInitializer(s2); - a1.bodyDeclarations().add(x); - return s1; - } - public void unwrap() { - AnonymousClassDeclaration a1 = (AnonymousClassDeclaration) x.getParent(); - a1.bodyDeclarations().remove(x); - } - }); - - genericPropertyListTest(x, x.thrownExceptions(), - new Property("ThrownExceptions", true, Name.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - }); - - genericPropertyTest(x, new Property("Body", false, Block.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - Block result = targetAst.newBlock(); - if (parented) { - Block b2 = targetAst.newBlock(); - b2.statements().add(result); - } - return result; - } - public ASTNode wrap() { - // return a Block that embeds x - Block s1 = ast.newBlock(); - TypeDeclaration s2 = ast.newTypeDeclaration(); - s1.statements().add(ast.newTypeDeclarationStatement(s2)); - s2.bodyDeclarations().add(x); - return s1; - } - public void unwrap() { - TypeDeclaration s2 = (TypeDeclaration) x.getParent(); - s2.bodyDeclarations().remove(x); - } - public ASTNode get() { - return x.getBody(); - } - public void set(ASTNode value) { - x.setBody((Block) value); - } - }); - - if (ast.apiLevel() >= AST.JLS3) { - // check isVariableArity convenience method - x.parameters().clear(); - assertTrue(!x.isVarargs()); // 0 params - x.parameters().add(ast.newSingleVariableDeclaration()); - assertTrue(!x.isVarargs()); // 1 params - SingleVariableDeclaration v = ast.newSingleVariableDeclaration(); - x.parameters().add(v); - assertTrue(!x.isVarargs()); // 2 param fixed arity - v.setVarargs(true); - assertTrue(x.isVarargs()); // 2 param fixed arity - x.parameters().add(ast.newSingleVariableDeclaration()); - assertTrue(!x.isVarargs()); // only last param counts - } - } - - /** @deprecated using deprecated code */ - public void testInitializer() { - long previousCount = ast.modificationCount(); - final Initializer x = ast.newInitializer(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getJavadoc() == null); - if (ast.apiLevel() == AST.JLS2) { - assertTrue(x.getModifiers() == Modifier.NONE); - } else { - assertTrue(x.modifiers().size() == 0); - } - assertTrue(x.getBody().getParent() == x); - assertTrue(x.getBody().statements().size() == 0); - assertTrue(x.getNodeType() == ASTNode.INITIALIZER); - assertTrue(x.structuralPropertiesForType() == - Initializer.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - tJavadocComment(x); - - if (ast.apiLevel() == AST.JLS2) { - int legal = Modifier.STATIC; - previousCount = ast.modificationCount(); - x.setModifiers(legal); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getModifiers() == legal); - - previousCount = ast.modificationCount(); - x.setModifiers(Modifier.NONE); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getModifiers() == Modifier.NONE); - } - - genericPropertyTest(x, new Property("Body", true, Block.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - Block result = targetAst.newBlock(); - if (parented) { - Block b2 = targetAst.newBlock(); - b2.statements().add(result); - } - return result; - } - public ASTNode wrap() { - // return Block that embeds x - Block s1 = ast.newBlock(); - TypeDeclaration s2 = ast.newTypeDeclaration(); - s1.statements().add(ast.newTypeDeclarationStatement(s2)); - s2.bodyDeclarations().add(x); - return s1; - } - public void unwrap() { - TypeDeclaration s2 = (TypeDeclaration) x.getParent(); - s2.bodyDeclarations().remove(x); - } - public ASTNode get() { - return x.getBody(); - } - public void set(ASTNode value) { - x.setBody((Block) value); - } - }); - } - - /** - * @deprecated (not really - its just that Javadoc.get/setComment - * are deprecated, and this suppresses the extra warnings) - */ - public void testJavadoc() { - long previousCount = ast.modificationCount(); - final JSdoc x = ast.newJSdoc(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - if (ast.apiLevel() == AST.JLS2) { - assertTrue(x.getComment().startsWith("/**")); //$NON-NLS-1$ - assertTrue(x.getComment().endsWith("*/")); //$NON-NLS-1$ - } - assertTrue(x.getNodeType() == ASTNode.JSDOC); - assertTrue(!x.isBlockComment()); - assertTrue(!x.isLineComment()); - assertTrue(x.isDocComment()); - assertTrue(x.tags().isEmpty()); - assertTrue(x.getAlternateRoot() == null); - assertTrue(x.structuralPropertiesForType() == - JSdoc.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - // check the constants - assertTrue(TagElement.TAG_AUTHOR.equals("@author")); //$NON-NLS-1$ - assertTrue(TagElement.TAG_DEPRECATED.equals("@deprecated")); //$NON-NLS-1$ - assertTrue(TagElement.TAG_DOCROOT.equals("@docRoot")); //$NON-NLS-1$ - assertTrue(TagElement.TAG_EXCEPTION.equals("@exception")); //$NON-NLS-1$ - assertTrue(TagElement.TAG_INHERITDOC.equals("@inheritDoc")); //$NON-NLS-1$ - assertTrue(TagElement.TAG_LINK.equals("@link")); //$NON-NLS-1$ - assertTrue(TagElement.TAG_LINKPLAIN.equals("@linkplain")); //$NON-NLS-1$ - assertTrue(TagElement.TAG_PARAM.equals("@param")); //$NON-NLS-1$ - assertTrue(TagElement.TAG_RETURN.equals("@return")); //$NON-NLS-1$ - assertTrue(TagElement.TAG_SEE.equals("@see")); //$NON-NLS-1$ - assertTrue(TagElement.TAG_SERIAL.equals("@serial")); //$NON-NLS-1$ - assertTrue(TagElement.TAG_SERIALDATA.equals("@serialData")); //$NON-NLS-1$ - assertTrue(TagElement.TAG_SERIALFIELD.equals("@serialField")); //$NON-NLS-1$ - assertTrue(TagElement.TAG_SINCE.equals("@since")); //$NON-NLS-1$ - assertTrue(TagElement.TAG_THROWS.equals("@throws")); //$NON-NLS-1$ - assertTrue(TagElement.TAG_VALUE.equals("@value")); //$NON-NLS-1$ - assertTrue(TagElement.TAG_VERSION.equals("@version")); //$NON-NLS-1$ - - if (ast.apiLevel() == AST.JLS2) { - final String[] samples = - { - "/** Hello there */", //$NON-NLS-1$ - "/**\n * Line 1\n * Line 2\n */", //$NON-NLS-1$ - "/***/", //$NON-NLS-1$ - }; - for (int i = 0; i < samples.length; i++) { - previousCount = ast.modificationCount(); - x.setComment(samples[i]); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(samples[i].equals(x.getComment())); - } - - final String[] badSamples = - { - null, - "", //$NON-NLS-1$ - "/* */", //$NON-NLS-1$ - "/**", //$NON-NLS-1$ - "*/", //$NON-NLS-1$ - }; - - // check that property cannot be set to clearly illegal things - for (int i = 0; i < badSamples.length; i++) { - try { - x.setComment(badSamples[i]); - assertTrue(false); - } catch (RuntimeException e) { - // pass - } - } - } - - tAlternateRoot(x); - - genericPropertyListTest(x, x.tags(), - new Property("Tags", true, TagElement.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - TagElement result = targetAst.newTagElement(); - if (parented) { - JSdoc parent = targetAst.newJSdoc(); - parent.tags().add(result); - } - return result; - } - public ASTNode[] counterExamples(AST targetAst) { - return new ASTNode[] { - targetAst.newEmptyStatement(), - targetAst.newJavaScriptUnit(), - targetAst.newTypeDeclaration(), - targetAst.newJSdoc(), - targetAst.newTextElement(), - targetAst.newFunctionRef() - }; - } - }); - } - - public void testBlockComment() { - long previousCount = ast.modificationCount(); - final BlockComment x = ast.newBlockComment(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getNodeType() == ASTNode.BLOCK_COMMENT); - assertTrue(x.isBlockComment()); - assertTrue(!x.isLineComment()); - assertTrue(!x.isDocComment()); - assertTrue(x.getAlternateRoot() == null); - assertTrue(x.structuralPropertiesForType() == - BlockComment.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - tAlternateRoot(x); - } - - public void testLineComment() { - long previousCount = ast.modificationCount(); - final LineComment x = ast.newLineComment(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getNodeType() == ASTNode.LINE_COMMENT); - assertTrue(!x.isBlockComment()); - assertTrue(x.isLineComment()); - assertTrue(!x.isDocComment()); - assertTrue(x.getAlternateRoot() == null); - assertTrue(x.structuralPropertiesForType() == - LineComment.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - tAlternateRoot(x); - } - - public void testTagElement() { - long previousCount = ast.modificationCount(); - final TagElement x = ast.newTagElement(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getNodeType() == ASTNode.TAG_ELEMENT); - assertTrue(x.getTagName() == null); - assertTrue(x.fragments().isEmpty()); - assertTrue(x.structuralPropertiesForType() == - TagElement.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - // tagName property - previousCount = ast.modificationCount(); - String s1 = new String("hello"); //$NON-NLS-1$ - x.setTagName(s1); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getTagName() == s1); - previousCount = ast.modificationCount(); - String s2 = new String("bye"); //$NON-NLS-1$ - x.setTagName(s2); - assertTrue(x.getTagName() == s2); - assertTrue(ast.modificationCount() > previousCount); - x.setTagName(null); - assertTrue(x.getTagName() == null); - assertTrue(ast.modificationCount() > previousCount); - - // check that fragments() can handle TagElement - genericPropertyListTest(x, x.fragments(), - new Property("Fragments", true, TagElement.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - TagElement result = targetAst.newTagElement(); - if (parented) { - JSdoc parent = targetAst.newJSdoc(); - parent.tags().add(result); - } - return result; - } - public ASTNode wrap() { - // return TagElement that embeds x - TagElement tagElement = ast.newTagElement(); - tagElement.fragments().add(x); - return tagElement; - } - public void unwrap() { - TagElement tagElement = (TagElement) x.getParent(); - tagElement.fragments().remove(x); - } - public ASTNode[] counterExamples(AST targetAst) { - return new ASTNode[] { - targetAst.newEmptyStatement(), - targetAst.newJavaScriptUnit(), - targetAst.newTypeDeclaration(), - targetAst.newJSdoc(), - }; - } - }); - // check that fragments() can handle Name - genericPropertyListTest(x, x.fragments(), - new Property("Fragments", true, Name.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - }); - // check that fragments() can handle TextElement - genericPropertyListTest(x, x.fragments(), - new Property("Fragments", true, TextElement.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - TextElement result = targetAst.newTextElement(); - if (parented) { - TagElement parent = targetAst.newTagElement(); - parent.fragments().add(result); - } - return result; - } - }); - // check that fragments() can handle FunctionRef - genericPropertyListTest(x, x.fragments(), - new Property("Fragments", true, FunctionRef.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - FunctionRef result = targetAst.newFunctionRef(); - if (parented) { - TagElement parent = targetAst.newTagElement(); - parent.fragments().add(result); - } - return result; - } - }); - // check that fragments() can handle MemberRef - genericPropertyListTest(x, x.fragments(), - new Property("Fragments", true, MemberRef.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - MemberRef result = targetAst.newMemberRef(); - if (parented) { - TagElement parent = targetAst.newTagElement(); - parent.fragments().add(result); - } - return result; - } - }); - } - - public void testTextElement() { - long previousCount = ast.modificationCount(); - final TextElement x = ast.newTextElement(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getNodeType() == ASTNode.TEXT_ELEMENT); - assertTrue(x.getText().length() == 0); - assertTrue(x.structuralPropertiesForType() == - TextElement.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - // text property - previousCount = ast.modificationCount(); - String s1 = new String("hello"); - x.setText(s1); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getText() == s1); - previousCount = ast.modificationCount(); - String s2 = new String(""); - x.setText(s2); - assertTrue(x.getText() == s2); - assertTrue(ast.modificationCount() > previousCount); - // check that property cannot be set to null - previousCount = ast.modificationCount(); - try { - x.setText(null); - assertTrue(false); - } catch (RuntimeException e) { - // pass - } - assertTrue(ast.modificationCount() == previousCount); - // check that property cannot include */ - previousCount = ast.modificationCount(); - try { - x.setText("this would be the */ end of it"); //$NON-NLS-1$ - assertTrue(false); - } catch (RuntimeException e) { - // pass - } - assertTrue(ast.modificationCount() == previousCount); - } - - public void testMemberRef() { - long previousCount = ast.modificationCount(); - final MemberRef x = ast.newMemberRef(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getNodeType() == ASTNode.MEMBER_REF); - assertTrue(x.getQualifier() == null); - assertTrue(x.getName().getParent() == x); - assertTrue(x.structuralPropertiesForType() == - MemberRef.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - genericPropertyTest(x, new Property("Qualifier", false, Name.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - QualifiedName result = targetAst.newQualifiedName( - targetAst.newSimpleName("a"), //$NON-NLS-1$ - targetAst.newSimpleName("b")); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode get() { - return x.getQualifier(); - } - public void set(ASTNode value) { - x.setQualifier((Name) value); - } - }); - - genericPropertyTest(x, new Property("Name", true, SimpleName.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode get() { - return x.getName(); - } - public void set(ASTNode value) { - x.setName((SimpleName) value); - } - }); - } - - public void testMethodRef() { - long previousCount = ast.modificationCount(); - final FunctionRef x = ast.newFunctionRef(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getNodeType() == ASTNode.FUNCTION_REF); - assertTrue(x.getQualifier() == null); - assertTrue(x.getName().getParent() == x); - assertTrue(x.parameters().isEmpty()); - assertTrue(x.structuralPropertiesForType() == - FunctionRef.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - genericPropertyTest(x, new Property("Qualifier", false, Name.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - QualifiedName result = targetAst.newQualifiedName( - targetAst.newSimpleName("a"), //$NON-NLS-1$ - targetAst.newSimpleName("b")); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode get() { - return x.getQualifier(); - } - public void set(ASTNode value) { - x.setQualifier((Name) value); - } - }); - - genericPropertyTest(x, new Property("Name", true, SimpleName.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode get() { - return x.getName(); - } - public void set(ASTNode value) { - x.setName((SimpleName) value); - } - }); - - genericPropertyListTest(x, x.parameters(), - new Property("Parameters", true, FunctionRefParameter.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - FunctionRefParameter result = targetAst.newFunctionRefParameter(); - if (parented) { - FunctionRef parent = targetAst.newFunctionRef(); - parent.parameters().add(result); - } - return result; - } - }); - } - - public void testMethodRefParameter() { - long previousCount = ast.modificationCount(); - final FunctionRefParameter x = ast.newFunctionRefParameter(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getNodeType() == ASTNode.FUNCTION_REF_PARAMETER); - assertTrue(x.getType().getParent() == x); - if (ast.apiLevel() >= AST.JLS3) { - assertTrue(x.isVarargs() == false); - } - assertTrue(x.getName() == null); - assertTrue(x.structuralPropertiesForType() == - FunctionRefParameter.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - if (ast.apiLevel() >= AST.JLS3) { - previousCount = ast.modificationCount(); - x.setVarargs(true); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.isVarargs() == true); - - previousCount = ast.modificationCount(); - x.setVarargs(false); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.isVarargs() == false); - } - - genericPropertyTest(x, new Property("Type", true, Type.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleType result = targetAst.newSimpleType( - targetAst.newSimpleName("foo")); //$NON-NLS-1$ - if (parented) { - targetAst.newArrayType(result); - } - return result; - } - public ASTNode get() { - return x.getType(); - } - public void set(ASTNode value) { - x.setType((Type) value); - } - }); - - genericPropertyTest(x, new Property("Name", false, SimpleName.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode get() { - return x.getName(); - } - public void set(ASTNode value) { - x.setName((SimpleName) value); - } - }); - } - - public void testBlock() { - long previousCount = ast.modificationCount(); - final Block x = ast.newBlock(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.statements().size() == 0); - assertTrue(x.getNodeType() == ASTNode.BLOCK); - assertTrue(x.structuralPropertiesForType() == - Block.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - tLeadingComment(x); - - genericPropertyListTest(x, x.statements(), - new Property("Statements", true, Statement.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - Block result = targetAst.newBlock(); - if (parented) { - Block b2 = targetAst.newBlock(); - b2.statements().add(result); - } - return result; - } - public ASTNode wrap() { - // return a Statement that embeds x - Block s1 = ast.newBlock(); - s1.statements().add(x); - return s1; - } - public void unwrap() { - Block s2 = (Block) x.getParent(); - s2.statements().remove(x); - } - }); - } - - public void testMethodInvocation() { - long previousCount = ast.modificationCount(); - final FunctionInvocation x = ast.newFunctionInvocation(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - if (ast.apiLevel() >= AST.JLS3) { - assertTrue(x.typeArguments().isEmpty()); - } - //assertTrue(x.getName().getParent() == x); - assertTrue(x.getExpression() == null); - assertTrue(x.arguments().size() == 0); - assertTrue(x.getNodeType() == ASTNode.FUNCTION_INVOCATION); - assertTrue(x.structuralPropertiesForType() == - FunctionInvocation.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - genericPropertyTest(x, new Property("Expression", false, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - // return Expression that embeds x - ParenthesizedExpression s1 = ast.newParenthesizedExpression(); - s1.setExpression(x); - return s1; - } - public void unwrap() { - ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent(); - s1.setExpression(ast.newSimpleName("x")); //$NON-NLS-1$ - } - public ASTNode get() { - return x.getExpression(); - } - public void set(ASTNode value) { - x.setExpression((Expression) value); - } - }); - - if (ast.apiLevel() >= AST.JLS3) { - genericPropertyListTest(x, x.typeArguments(), - new Property("TypeArguments", true, Type.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - Type result = targetAst.newSimpleType(targetAst.newSimpleName("X")); //$NON-NLS-1$ - if (parented) { - targetAst.newArrayType(result); - } - return result; - } - }); - } - - genericPropertyTest(x, new Property("Name", true, SimpleName.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode get() { - return x.getName(); - } - public void set(ASTNode value) { - x.setName((SimpleName) value); - } - }); - - genericPropertyListTest(x, x.arguments(), - new Property("Arguments", true, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - // return Expression that embeds x - ParenthesizedExpression s1 = ast.newParenthesizedExpression(); - s1.setExpression(x); - return s1; - } - public void unwrap() { - ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent(); - s1.setExpression(ast.newSimpleName("x")); //$NON-NLS-1$ - } - }); - } - - public void testExpressionStatement() { - long previousCount = ast.modificationCount(); - SimpleName x1 = ast.newSimpleName("foo"); //$NON-NLS-1$ - final ExpressionStatement x = ast.newExpressionStatement(x1); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getExpression() == x1); - assertTrue(x1.getParent() == x); - assertTrue(x.getNodeType() == ASTNode.EXPRESSION_STATEMENT); - assertTrue(x.structuralPropertiesForType() == - ExpressionStatement.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - tLeadingComment(x); - - genericPropertyTest(x, new Property("Expression", true, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - // return Expression that embeds x - ClassInstanceCreation s1 = ast.newClassInstanceCreation(); - AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration(); - s1.setAnonymousClassDeclaration(a1); - FunctionDeclaration s2 = ast.newFunctionDeclaration(); - a1.bodyDeclarations().add(s2); - Block s3 = ast.newBlock(); - s2.setBody(s3); - s3.statements().add(x); - return s1; - } - public void unwrap() { - Block s3 = (Block) x.getParent(); - s3.statements().remove(x); - } - public ASTNode get() { - return x.getExpression(); - } - public void set(ASTNode value) { - x.setExpression((Expression) value); - } - }); - - } - - /** @deprecated using deprecated code */ - public void testVariableDeclarationStatement() { - VariableDeclarationFragment x1 = ast.newVariableDeclarationFragment(); - long previousCount = ast.modificationCount(); - final VariableDeclarationStatement x = - ast.newVariableDeclarationStatement(x1); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - if (ast.apiLevel() == AST.JLS2) { - assertTrue(x.getModifiers() == Modifier.NONE); - } else { - assertTrue(x.modifiers().size() == 0); - } - assertTrue(x.getType() != null); - assertTrue(x.getType().getParent() == x); - assertTrue(x.fragments().size() == 1); - assertTrue(x.fragments().get(0) == x1); - assertTrue(x1.getParent() == x); - assertTrue(x.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); - assertTrue(x.structuralPropertiesForType() == - VariableDeclarationStatement.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - tLeadingComment(x); - - if (ast.apiLevel() == AST.JLS2) { - int legal = Modifier.FINAL; - previousCount = ast.modificationCount(); - x.setModifiers(legal); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getModifiers() == legal); - - previousCount = ast.modificationCount(); - x.setModifiers(Modifier.NONE); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getModifiers() == Modifier.NONE); - } - - - genericPropertyTest(x, new Property("Type", true, Type.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleType result = targetAst.newSimpleType( - targetAst.newSimpleName("foo")); //$NON-NLS-1$ - if (parented) { - targetAst.newArrayType(result); - } - return result; - } - public ASTNode get() { - return x.getType(); - } - public void set(ASTNode value) { - x.setType((Type) value); - } - }); - - genericPropertyListTest(x, x.fragments(), - new Property("VariableSpecifiers", true, VariableDeclarationFragment.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - VariableDeclarationFragment result = targetAst.newVariableDeclarationFragment(); - if (parented) { - targetAst.newVariableDeclarationExpression(result); - } - return result; - } - public ASTNode wrap() { - // return VariableDeclarationFragment that embeds x - VariableDeclarationFragment s1 = ast.newVariableDeclarationFragment(); - ClassInstanceCreation s0 = ast.newClassInstanceCreation(); - AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration(); - s0.setAnonymousClassDeclaration(a1); - s1.setInitializer(s0); - Initializer s2 = ast.newInitializer(); - a1.bodyDeclarations().add(s2); - s2.getBody().statements().add(x); - return s1; - } - public void unwrap() { - Block s3 = (Block) x.getParent(); - s3.statements().remove(x); - } - }); - } - - /** @deprecated using deprecated code */ - public void testTypeDeclarationStatement() { - AbstractTypeDeclaration x1 = ast.newTypeDeclaration(); - long previousCount = ast.modificationCount(); - final TypeDeclarationStatement x = - ast.newTypeDeclarationStatement(x1); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - if (ast.apiLevel() == AST.JLS2) { - assertTrue(x.getTypeDeclaration() == x1); - } else { - assertTrue(x.getDeclaration() == x1); - } - assertTrue(x1.getParent() == x); - assertTrue(x.getNodeType() == ASTNode.TYPE_DECLARATION_STATEMENT); - assertTrue(x.structuralPropertiesForType() == - TypeDeclarationStatement.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - // check that TypeDeclaration inside is classified correctly - assertTrue(x1.isLocalTypeDeclaration() == true); - assertTrue(x1.isMemberTypeDeclaration() == false); - assertTrue(x1.isPackageMemberTypeDeclaration() == false); - - tLeadingComment(x); - - if (ast.apiLevel() == AST.JLS2) { - genericPropertyTest(x, new Property("TypeDeclaration", true, TypeDeclaration.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - TypeDeclaration result = targetAst.newTypeDeclaration(); - if (parented) { - targetAst.newTypeDeclarationStatement(result); - } - return result; - } - public ASTNode wrap() { - // return TypeDeclaration that embeds x - TypeDeclaration s1 = ast.newTypeDeclaration(); - FunctionDeclaration s2 = ast.newFunctionDeclaration(); - s1.bodyDeclarations().add(s2); - Block s3 = ast.newBlock(); - s2.setBody(s3); - s3.statements().add(x); - return s1; - } - public void unwrap() { - Block s3 = (Block) x.getParent(); - s3.statements().remove(x); - } - public ASTNode get() { - return x.getTypeDeclaration(); - } - public void set(ASTNode value) { - x.setTypeDeclaration((TypeDeclaration) value); - } - }); - } - - if (ast.apiLevel() >= AST.JLS3) { - genericPropertyTest(x, new Property("Declaration", true, AbstractTypeDeclaration.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - AbstractTypeDeclaration result = targetAst.newTypeDeclaration(); - if (parented) { - targetAst.newTypeDeclarationStatement(result); - } - return result; - } - public ASTNode wrap() { - // return TypeDeclaration that embeds x - TypeDeclaration s1 = ast.newTypeDeclaration(); - FunctionDeclaration s2 = ast.newFunctionDeclaration(); - s1.bodyDeclarations().add(s2); - Block s3 = ast.newBlock(); - s2.setBody(s3); - s3.statements().add(x); - return s1; - } - public void unwrap() { - Block s3 = (Block) x.getParent(); - s3.statements().remove(x); - } - public ASTNode get() { - return x.getDeclaration(); - } - public void set(ASTNode value) { - x.setDeclaration((AbstractTypeDeclaration) value); - } - }); - } - } - - /** @deprecated using deprecated code */ - public void testVariableDeclarationExpression() { - VariableDeclarationFragment x1 = ast.newVariableDeclarationFragment(); - long previousCount = ast.modificationCount(); - final VariableDeclarationExpression x = - ast.newVariableDeclarationExpression(x1); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - if (ast.apiLevel() == AST.JLS2) { - assertTrue(x.getModifiers() == Modifier.NONE); - } else { - assertTrue(x.modifiers().size() == 0); - } - assertTrue(x.getType() != null); - assertTrue(x.getType().getParent() == x); - assertTrue(x.fragments().size() == 1); - assertTrue(x.fragments().get(0) == x1); - assertTrue(x1.getParent() == x); - assertTrue(x.getNodeType() == ASTNode.VARIABLE_DECLARATION_EXPRESSION); - assertTrue(x.structuralPropertiesForType() == - VariableDeclarationExpression.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - if (ast.apiLevel() == AST.JLS2) { - int legal = Modifier.FINAL; - previousCount = ast.modificationCount(); - x.setModifiers(legal); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getModifiers() == legal); - - previousCount = ast.modificationCount(); - x.setModifiers(Modifier.NONE); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getModifiers() == Modifier.NONE); - } - - - genericPropertyTest(x, new Property("Type", true, Type.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleType result = targetAst.newSimpleType( - targetAst.newSimpleName("foo")); //$NON-NLS-1$ - if (parented) { - targetAst.newArrayType(result); - } - return result; - } - public ASTNode get() { - return x.getType(); - } - public void set(ASTNode value) { - x.setType((Type) value); - } - }); - - genericPropertyListTest(x, x.fragments(), - new Property("VariableSpecifiers", true, VariableDeclarationFragment.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - VariableDeclarationFragment result = targetAst.newVariableDeclarationFragment(); - if (parented) { - targetAst.newVariableDeclarationExpression(result); - } - return result; - } - public ASTNode wrap() { - // return VariableDeclarationFragment that embeds x - VariableDeclarationFragment s1 = ast.newVariableDeclarationFragment(); - ClassInstanceCreation s0 = ast.newClassInstanceCreation(); - AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration(); - s0.setAnonymousClassDeclaration(a1); - s1.setInitializer(s0); - ForStatement s2 = ast.newForStatement(); - s2.initializers().add(x); - Initializer s3 = ast.newInitializer(); - a1.bodyDeclarations().add(s3); - s3.getBody().statements().add(s2); - return s1; - } - public void unwrap() { - ForStatement s2 = (ForStatement) x.getParent(); - s2.initializers().remove(x); - } - }); - } - - /** @deprecated using deprecated code */ - public void testFieldDeclaration() { - VariableDeclarationFragment x1 = ast.newVariableDeclarationFragment(); - long previousCount = ast.modificationCount(); - final FieldDeclaration x = ast.newFieldDeclaration(x1); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getJavadoc() == null); - if (ast.apiLevel() == AST.JLS2) { - assertTrue(x.getModifiers() == Modifier.NONE); - } else { - assertTrue(x.modifiers().size() == 0); - } - assertTrue(x.getType() != null); - assertTrue(x.getType().getParent() == x); - assertTrue(x.fragments().size() == 1); - assertTrue(x.fragments().get(0) == x1); - assertTrue(x1.getParent() == x); - assertTrue(x.getNodeType() == ASTNode.FIELD_DECLARATION); - assertTrue(x.structuralPropertiesForType() == - FieldDeclaration.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - if (ast.apiLevel() == AST.JLS2) { - int legal = Modifier.PUBLIC | Modifier.PROTECTED - | Modifier.PRIVATE | Modifier.STATIC | Modifier.FINAL - | Modifier.TRANSIENT | Modifier.VOLATILE; - previousCount = ast.modificationCount(); - x.setModifiers(legal); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getModifiers() == legal); - - previousCount = ast.modificationCount(); - x.setModifiers(Modifier.NONE); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getModifiers() == Modifier.NONE); - } - - tJavadocComment(x); - - genericPropertyTest(x, new Property("Type", true, Type.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleType result = targetAst.newSimpleType( - targetAst.newSimpleName("foo")); //$NON-NLS-1$ - if (parented) { - targetAst.newArrayType(result); - } - return result; - } - public ASTNode get() { - return x.getType(); - } - public void set(ASTNode value) { - x.setType((Type) value); - } - }); - - genericPropertyListTest(x, x.fragments(), - new Property("VariableSpecifiers", true, VariableDeclarationFragment.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - VariableDeclarationFragment result = targetAst.newVariableDeclarationFragment(); - if (parented) { - targetAst.newVariableDeclarationStatement(result); - } - return result; - } - public ASTNode wrap() { - // return VariableDeclarationFragment that embeds x - VariableDeclarationFragment s1 = ast.newVariableDeclarationFragment(); - ClassInstanceCreation s2 = ast.newClassInstanceCreation(); - AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration(); - s2.setAnonymousClassDeclaration(a1); - s1.setInitializer(s2); - a1.bodyDeclarations().add(x); - return s1; - } - public void unwrap() { - AnonymousClassDeclaration a1 = (AnonymousClassDeclaration) x.getParent(); - a1.bodyDeclarations().remove(x); - } - }); - - } - - public void testAssignment() { - long previousCount = ast.modificationCount(); - final Assignment x = ast.newAssignment(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getOperator() == Assignment.Operator.ASSIGN); - assertTrue(x.getLeftHandSide().getParent() == x); - assertTrue(x.getRightHandSide().getParent() == x); - assertTrue(x.getNodeType() == ASTNode.ASSIGNMENT); - assertTrue(x.structuralPropertiesForType() == - Assignment.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - previousCount = ast.modificationCount(); - x.setOperator(Assignment.Operator.PLUS_ASSIGN); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getOperator() == Assignment.Operator.PLUS_ASSIGN); - assertTrue(Assignment.Operator.PLUS_ASSIGN - != Assignment.Operator.ASSIGN); - - // check the names of the primitive type codes - assertTrue(Assignment.Operator.ASSIGN.toString().equals("=")); //$NON-NLS-1$ - assertTrue(Assignment.Operator.PLUS_ASSIGN.toString().equals("+=")); //$NON-NLS-1$ - assertTrue(Assignment.Operator.MINUS_ASSIGN.toString().equals("-=")); //$NON-NLS-1$ - assertTrue(Assignment.Operator.TIMES_ASSIGN.toString().equals("*=")); //$NON-NLS-1$ - assertTrue(Assignment.Operator.DIVIDE_ASSIGN.toString().equals("/=")); //$NON-NLS-1$ - assertTrue(Assignment.Operator.REMAINDER_ASSIGN.toString().equals("%=")); //$NON-NLS-1$ - assertTrue(Assignment.Operator.LEFT_SHIFT_ASSIGN.toString().equals("<<=")); //$NON-NLS-1$ - assertTrue(Assignment.Operator.RIGHT_SHIFT_SIGNED_ASSIGN.toString().equals(">>=")); //$NON-NLS-1$ - assertTrue(Assignment.Operator.RIGHT_SHIFT_UNSIGNED_ASSIGN.toString().equals(">>>=")); //$NON-NLS-1$ - assertTrue(Assignment.Operator.BIT_AND_ASSIGN.toString().equals("&=")); //$NON-NLS-1$ - assertTrue(Assignment.Operator.BIT_OR_ASSIGN.toString().equals("|=")); //$NON-NLS-1$ - assertTrue(Assignment.Operator.BIT_XOR_ASSIGN.toString().equals("^=")); //$NON-NLS-1$ - - Assignment.Operator[] known = { - Assignment.Operator.ASSIGN, - Assignment.Operator.PLUS_ASSIGN, - Assignment.Operator.MINUS_ASSIGN, - Assignment.Operator.TIMES_ASSIGN, - Assignment.Operator.DIVIDE_ASSIGN, - Assignment.Operator.REMAINDER_ASSIGN, - Assignment.Operator.LEFT_SHIFT_ASSIGN, - Assignment.Operator.RIGHT_SHIFT_SIGNED_ASSIGN, - Assignment.Operator.RIGHT_SHIFT_UNSIGNED_ASSIGN, - Assignment.Operator.BIT_AND_ASSIGN, - Assignment.Operator.BIT_OR_ASSIGN, - Assignment.Operator.BIT_XOR_ASSIGN, - }; - - // check all operators are distinct - for (int i = 0; i < known.length; i++) { - for (int j = 0; j < known.length; j++) { - assertTrue(i == j || !known[i].equals(known[j])); - } - } - - // check all operators work - for (int i = 0; i < known.length; i++) { - previousCount = ast.modificationCount(); - x.setOperator(known[i]); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getOperator().equals(known[i])); - } - // ensure null does not work as a primitive type code - try { - x.setOperator(null); - assertTrue(false); - } catch (RuntimeException e) { - // pass - } - - // check toOperator lookup of operators by name - for (int i = 0; i < known.length; i++) { - String name = known[i].toString(); - assertTrue(Assignment.Operator.toOperator(name).equals(known[i])); - } - assertTrue(Assignment.Operator.toOperator("not-an-op") == null); //$NON-NLS-1$ - - genericPropertyTest(x, new Property("LeftHandSide", true, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - // return Expression that embeds x - ParenthesizedExpression s1 = ast.newParenthesizedExpression(); - s1.setExpression(x); - return s1; - } - public void unwrap() { - ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent(); - s1.setExpression(ast.newSimpleName("x")); //$NON-NLS-1$ - } - public ASTNode get() { - return x.getLeftHandSide(); - } - public void set(ASTNode value) { - x.setLeftHandSide((Expression) value); - } - }); - - genericPropertyTest(x, new Property("RightHandSide", true, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - // return Expression that embeds x - ParenthesizedExpression s1 = ast.newParenthesizedExpression(); - s1.setExpression(x); - return s1; - } - public void unwrap() { - ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent(); - s1.setExpression(ast.newSimpleName("x")); //$NON-NLS-1$ - } - public ASTNode get() { - return x.getRightHandSide(); - } - public void set(ASTNode value) { - x.setRightHandSide((Expression) value); - } - }); - } - - /** - * @deprecated (Uses getLeadingComment() which is deprecated) - */ - public void testBreakStatement() { - long previousCount = ast.modificationCount(); - final BreakStatement x = ast.newBreakStatement(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getLabel() == null); - assertTrue(x.getLeadingComment() == null); - assertTrue(x.getNodeType() == ASTNode.BREAK_STATEMENT); - assertTrue(x.structuralPropertiesForType() == - BreakStatement.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - tLeadingComment(x); - - genericPropertyTest(x, new Property("Label", false, SimpleName.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode get() { - return x.getLabel(); - } - public void set(ASTNode value) { - x.setLabel((SimpleName) value); - } - }); - } - - /** - * @deprecated (Uses getLeadingComment() which is deprecated) - */ - public void testContinueStatement() { - long previousCount = ast.modificationCount(); - final ContinueStatement x = ast.newContinueStatement(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getLabel() == null); - assertTrue(x.getLeadingComment() == null); - assertTrue(x.getNodeType() == ASTNode.CONTINUE_STATEMENT); - assertTrue(x.structuralPropertiesForType() == - ContinueStatement.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - tLeadingComment(x); - - genericPropertyTest(x, new Property("Label", false, SimpleName.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode get() { - return x.getLabel(); - } - public void set(ASTNode value) { - x.setLabel((SimpleName) value); - } - }); - } - - /** - * @deprecated (Uses getLeadingComment() which is deprecated) - */ - public void testIfStatement() { - long previousCount = ast.modificationCount(); - final IfStatement x = ast.newIfStatement(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getLeadingComment() == null); - assertTrue(x.getExpression().getParent() == x); - assertTrue(x.getThenStatement().getParent() == x); - assertTrue(x.getThenStatement() instanceof Block); - assertTrue(((Block) x.getThenStatement()).statements().isEmpty()); - assertTrue(x.getElseStatement() == null); - assertTrue(x.getNodeType() == ASTNode.IF_STATEMENT); - assertTrue(x.structuralPropertiesForType() == - IfStatement.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - tLeadingComment(x); - - genericPropertyTest(x, new Property("Expression", true, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST localAst, boolean parented) { - Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - localAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - // return Expression that embeds x - ClassInstanceCreation s1 = ast.newClassInstanceCreation(); - AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration(); - s1.setAnonymousClassDeclaration(a1); - FunctionDeclaration s2 = ast.newFunctionDeclaration(); - a1.bodyDeclarations().add(s2); - Block s3 = ast.newBlock(); - s2.setBody(s3); - s3.statements().add(x); - return s1; - } - public void unwrap() { - Block s3 = (Block) x.getParent(); - s3.statements().remove(x); - } - public ASTNode get() { - return x.getExpression(); - } - public void set(ASTNode value) { - x.setExpression((Expression) value); - } - }); - - genericPropertyTest(x, new Property("ThenStatement", true, Statement.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - Block result = targetAst.newBlock(); - if (parented) { - Block b2 = targetAst.newBlock(); - b2.statements().add(result); - } - return result; - } - public ASTNode wrap() { - // return a Statement that embeds x - Block s1 = ast.newBlock(); - s1.statements().add(x); - return s1; - } - public void unwrap() { - Block s2 = (Block) x.getParent(); - s2.statements().remove(x); - } - public ASTNode get() { - return x.getThenStatement(); - } - public void set(ASTNode value) { - x.setThenStatement((Statement) value); - } - }); - - genericPropertyTest(x, new Property("ElseStatement", false, Statement.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - Block result = targetAst.newBlock(); - if (parented) { - Block b2 = targetAst.newBlock(); - b2.statements().add(result); - } - return result; - } - public ASTNode wrap() { - // return a Statement that embeds x - Block s1 = ast.newBlock(); - s1.statements().add(x); - return s1; - } - public void unwrap() { - Block s2 = (Block) x.getParent(); - s2.statements().remove(x); - } - public ASTNode get() { - return x.getElseStatement(); - } - public void set(ASTNode value) { - x.setElseStatement((Statement) value); - } - }); - } - - /** - * @deprecated (Uses getLeadingComment() which is deprecated) - */ - public void testWhileStatement() { - long previousCount = ast.modificationCount(); - final WhileStatement x = ast.newWhileStatement(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getLeadingComment() == null); - assertTrue(x.getExpression().getParent() == x); - assertTrue(x.getBody().getParent() == x); - assertTrue(x.getBody() instanceof Block); - assertTrue(((Block) x.getBody()).statements().isEmpty()); - assertTrue(x.getNodeType() == ASTNode.WHILE_STATEMENT); - assertTrue(x.structuralPropertiesForType() == - WhileStatement.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - tLeadingComment(x); - - genericPropertyTest(x, new Property("Expression", true, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST localAst, boolean parented) { - Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - localAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - // return Expression that embeds x - ClassInstanceCreation s1 = ast.newClassInstanceCreation(); - AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration(); - s1.setAnonymousClassDeclaration(a1); - FunctionDeclaration s2 = ast.newFunctionDeclaration(); - a1.bodyDeclarations().add(s2); - Block s3 = ast.newBlock(); - s2.setBody(s3); - s3.statements().add(x); - return s1; - } - public void unwrap() { - Block s3 = (Block) x.getParent(); - s3.statements().remove(x); - } - public ASTNode get() { - return x.getExpression(); - } - public void set(ASTNode value) { - x.setExpression((Expression) value); - } - }); - - genericPropertyTest(x, new Property("Body", true, Statement.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - Block result = targetAst.newBlock(); - if (parented) { - Block b2 = targetAst.newBlock(); - b2.statements().add(result); - } - return result; - } - public ASTNode wrap() { - // return a Statement that embeds x - Block s1 = ast.newBlock(); - s1.statements().add(x); - return s1; - } - public void unwrap() { - Block s2 = (Block) x.getParent(); - s2.statements().remove(x); - } - public ASTNode get() { - return x.getBody(); - } - public void set(ASTNode value) { - x.setBody((Statement) value); - } - }); - } - - /** - * @deprecated (Uses getLeadingComment() which is deprecated) - */ - public void testDoStatement() { - long previousCount = ast.modificationCount(); - final DoStatement x = ast.newDoStatement(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getLeadingComment() == null); - assertTrue(x.getExpression().getParent() == x); - assertTrue(x.getBody().getParent() == x); - assertTrue(x.getBody() instanceof Block); - assertTrue(((Block) x.getBody()).statements().isEmpty()); - assertTrue(x.getNodeType() == ASTNode.DO_STATEMENT); - assertTrue(x.structuralPropertiesForType() == - DoStatement.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - tLeadingComment(x); - - genericPropertyTest(x, new Property("Expression", true, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST localAst, boolean parented) { - Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - localAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - // return Expression that embeds x - ClassInstanceCreation s1 = ast.newClassInstanceCreation(); - AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration(); - s1.setAnonymousClassDeclaration(a1); - FunctionDeclaration s2 = ast.newFunctionDeclaration(); - a1.bodyDeclarations().add(s2); - Block s3 = ast.newBlock(); - s2.setBody(s3); - s3.statements().add(x); - return s1; - } - public void unwrap() { - Block s3 = (Block) x.getParent(); - s3.statements().remove(x); - } - public ASTNode get() { - return x.getExpression(); - } - public void set(ASTNode value) { - x.setExpression((Expression) value); - } - }); - - genericPropertyTest(x, new Property("Body", true, Statement.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - Block result = targetAst.newBlock(); - if (parented) { - Block b2 = targetAst.newBlock(); - b2.statements().add(result); - } - return result; - } - public ASTNode wrap() { - // return a Statement that embeds x - Block s1 = ast.newBlock(); - s1.statements().add(x); - return s1; - } - public void unwrap() { - Block s2 = (Block) x.getParent(); - s2.statements().remove(x); - } - public ASTNode get() { - return x.getBody(); - } - public void set(ASTNode value) { - x.setBody((Statement) value); - } - }); - } - - /** - * @deprecated (Uses getLeadingComment() which is deprecated) - */ - public void testTryStatement() { - long previousCount = ast.modificationCount(); - final TryStatement x = ast.newTryStatement(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getLeadingComment() == null); - assertTrue(x.getBody().getParent() == x); - assertTrue((x.getBody()).statements().isEmpty()); - assertTrue(x.getFinally() == null); - assertTrue(x.catchClauses().size() == 0); - assertTrue(x.getNodeType() == ASTNode.TRY_STATEMENT); - assertTrue(x.structuralPropertiesForType() == - TryStatement.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - tLeadingComment(x); - - genericPropertyTest(x, new Property("Body", true, Block.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - Block result = targetAst.newBlock(); - if (parented) { - Block b2 = targetAst.newBlock(); - b2.statements().add(result); - } - return result; - } - public ASTNode wrap() { - // return a Block that embeds x - Block s1 = ast.newBlock(); - s1.statements().add(x); - return s1; - } - public void unwrap() { - Block s2 = (Block) x.getParent(); - s2.statements().remove(x); - } - public ASTNode get() { - return x.getBody(); - } - public void set(ASTNode value) { - x.setBody((Block) value); - } - }); - - genericPropertyListTest(x, x.catchClauses(), - new Property("CatchClauses", true, CatchClause.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - CatchClause result = targetAst.newCatchClause(); - if (parented) { - TryStatement s1 = targetAst.newTryStatement(); - s1.catchClauses().add(result); - } - return result; - } - public ASTNode wrap() { - // return CatchClause that embeds x - CatchClause s1 = ast.newCatchClause(); - Block s2 = ast.newBlock(); - s1.setBody(s2); - s2.statements().add(x); - return s1; - } - public void unwrap() { - Block s2 = (Block) x.getParent(); - s2.statements().remove(x); - } - }); - - genericPropertyTest(x, new Property("Finally", false, Block.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - Block result = targetAst.newBlock(); - if (parented) { - Block b2 = targetAst.newBlock(); - b2.statements().add(result); - } - return result; - } - public ASTNode wrap() { - // return a Block that embeds x - Block s1 = ast.newBlock(); - s1.statements().add(x); - return s1; - } - public void unwrap() { - Block s2 = (Block) x.getParent(); - s2.statements().remove(x); - } - public ASTNode get() { - return x.getFinally(); - } - public void set(ASTNode value) { - x.setFinally((Block) value); - } - }); - } - - public void testCatchClause() { - long previousCount = ast.modificationCount(); - final CatchClause x = ast.newCatchClause(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getBody().getParent() == x); - assertTrue(x.getBody().statements().isEmpty()); - assertTrue(x.getException().getParent() == x); - assertTrue(x.getNodeType() == ASTNode.CATCH_CLAUSE); - assertTrue(x.structuralPropertiesForType() == - CatchClause.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - genericPropertyTest(x, new Property("Exception", true, SingleVariableDeclaration.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SingleVariableDeclaration result = targetAst.newSingleVariableDeclaration(); - if (parented) { - targetAst.newCatchClause().setException(result); - - } - return result; - } - public ASTNode wrap() { - // return SingleVariableDeclaration that embeds x - SingleVariableDeclaration s1 = ast.newSingleVariableDeclaration(); - ClassInstanceCreation s2 = ast.newClassInstanceCreation(); - AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration(); - s2.setAnonymousClassDeclaration(a1); - s1.setInitializer(s2); - FunctionDeclaration s3 = ast.newFunctionDeclaration(); - a1.bodyDeclarations().add(s3); - Block s4 = ast.newBlock(); - s3.setBody(s4); - TryStatement s5 = ast.newTryStatement(); - s4.statements().add(s5); - s5.catchClauses().add(x); - return s1; - } - public void unwrap() { - TryStatement s5 = (TryStatement) x.getParent(); - s5.catchClauses().remove(x); - } - public ASTNode get() { - return x.getException(); - } - public void set(ASTNode value) { - x.setException((SingleVariableDeclaration) value); - } - }); - - genericPropertyTest(x, new Property("Body", true, Block.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - Block result = targetAst.newBlock(); - if (parented) { - Block b2 = targetAst.newBlock(); - b2.statements().add(result); - } - return result; - } - public ASTNode wrap() { - // return a Block that embeds x - Block s1 = ast.newBlock(); - TryStatement s2 = ast.newTryStatement(); - s1.statements().add(s2); - s2.catchClauses().add(x); - return s1; - } - public void unwrap() { - TryStatement s2 = (TryStatement) x.getParent(); - s2.catchClauses().remove(x); - } - public ASTNode get() { - return x.getBody(); - } - public void set(ASTNode value) { - x.setBody((Block) value); - } - }); - } - - /** - * @deprecated (Uses getLeadingComment() which is deprecated) - */ - public void testEmptyStatement() { - long previousCount = ast.modificationCount(); - final EmptyStatement x = ast.newEmptyStatement(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getLeadingComment() == null); - assertTrue(x.getNodeType() == ASTNode.EMPTY_STATEMENT); - assertTrue(x.structuralPropertiesForType() == - EmptyStatement.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - tLeadingComment(x); - } - - /** - * Exercise the leadingComment property. - * - * @param x the statement to test - * @deprecated (Uses get/setLeadingComment() which is deprecated) - */ - void tLeadingComment(Statement x) { - - // check that null is allowed - long previousCount = ast.modificationCount(); - x.setLeadingComment(null); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getLeadingComment() == null); - - // check that regular comment is allowed - previousCount = ast.modificationCount(); - x.setLeadingComment("/* X */"); //$NON-NLS-1$ - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getLeadingComment() == "/* X */"); //$NON-NLS-1$ - - // check that regular comment with line breaks is allowed - previousCount = ast.modificationCount(); - x.setLeadingComment("/* X\n *Y\n */"); //$NON-NLS-1$ - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getLeadingComment() == "/* X\n *Y\n */"); //$NON-NLS-1$ - - // check that end-of-line comment is allowed - previousCount = ast.modificationCount(); - x.setLeadingComment("// X\n"); //$NON-NLS-1$ - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getLeadingComment() == "// X\n"); //$NON-NLS-1$ - - // check that end-of-line comment without a line break at the end is allowed - previousCount = ast.modificationCount(); - x.setLeadingComment("// X"); //$NON-NLS-1$ - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getLeadingComment() == "// X"); //$NON-NLS-1$ - - // check that end-of-line comment with embedded end of line - // not allowed - try { - x.setLeadingComment("// X\n extra"); //$NON-NLS-1$ - assertTrue(false); - } catch (RuntimeException e) { - // pass - } - - } - - /** - * Exercise the javadoc property. - * - * @param x the body declaration to test - */ - void tJavadocComment(final BodyDeclaration x) { - genericPropertyTest(x, new Property("Javadoc", false, JSdoc.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - JSdoc result = targetAst.newJSdoc(); - if (parented) { - targetAst.newInitializer().setJavadoc(result); - } - return result; - } - public ASTNode get() { - return x.getJavadoc(); - } - public void set(ASTNode value) { - x.setJavadoc((JSdoc) value); - } - }); - } - - /** - * Returns a list of all the different Modifier nodes. - */ - Modifier[] allModifiers() { - Modifier[] allMods = { - ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD), - ast.newModifier(Modifier.ModifierKeyword.PRIVATE_KEYWORD), - ast.newModifier(Modifier.ModifierKeyword.PROTECTED_KEYWORD), - ast.newModifier(Modifier.ModifierKeyword.STATIC_KEYWORD), - ast.newModifier(Modifier.ModifierKeyword.FINAL_KEYWORD), - ast.newModifier(Modifier.ModifierKeyword.ABSTRACT_KEYWORD), - ast.newModifier(Modifier.ModifierKeyword.NATIVE_KEYWORD), - ast.newModifier(Modifier.ModifierKeyword.SYNCHRONIZED_KEYWORD), - ast.newModifier(Modifier.ModifierKeyword.TRANSIENT_KEYWORD), - ast.newModifier(Modifier.ModifierKeyword.VOLATILE_KEYWORD), - ast.newModifier(Modifier.ModifierKeyword.STRICTFP_KEYWORD) - }; - return allMods; - } - - - /** - * Exercise the alternateRoot property of a Comment. - * - * @param x the comment to test - * @since 3.0 - */ - void tAlternateRoot(final Comment x) { - JavaScriptUnit cu = ast.newJavaScriptUnit(); - long previousCount = ast.modificationCount(); - x.setAlternateRoot(cu); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getAlternateRoot() == cu); - previousCount = ast.modificationCount(); - x.setAlternateRoot(null); - assertTrue(x.getAlternateRoot() == null); - assertTrue(ast.modificationCount() > previousCount); - } - - /** - * Exercise the client properties of a node. - * - * @param x the node to test - */ - void tClientProperties(ASTNode x) { - - long previousCount = ast.modificationCount(); - - // a node initially has no properties - assertTrue(x.properties().size() == 0); - assertTrue(x.getProperty("1") == null); //$NON-NLS-1$ - - // clearing an unset property does not add it to list of known ones - x.setProperty("1", null); //$NON-NLS-1$ - assertTrue(x.getProperty("1") == null); //$NON-NLS-1$ - assertTrue(x.properties().size() == 0); - - // setting an unset property does add it to the list of known ones - x.setProperty("1", "a1"); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue(x.getProperty("1") == "a1"); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue(x.properties().size() == 1); - Map.Entry[] m = (Map.Entry[]) x.properties().entrySet().toArray(new Map.Entry[1]); - assertTrue(m[0].getKey() == "1"); //$NON-NLS-1$ - assertTrue(m[0].getValue() == "a1"); //$NON-NLS-1$ - - // setting an already set property just changes its value - x.setProperty("1", "a2"); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue(x.getProperty("1") == "a2"); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue(x.properties().size() == 1); - m = (Map.Entry[]) x.properties().entrySet().toArray(new Map.Entry[1]); - assertTrue(m[0].getKey() == "1"); //$NON-NLS-1$ - assertTrue(m[0].getValue() == "a2"); //$NON-NLS-1$ - - // clearing a set property removes it from list of known ones - x.setProperty("1", null); //$NON-NLS-1$ - assertTrue(x.getProperty("1") == null); //$NON-NLS-1$ - assertTrue(x.properties().size() == 0); - - - // ========= test 2 and 3 properties - x.setProperty("1", "a1"); //$NON-NLS-1$ //$NON-NLS-2$ - x.setProperty("2", "b1"); //$NON-NLS-1$ //$NON-NLS-2$ - x.setProperty("3", "c1"); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue(x.getProperty("1") == "a1"); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue(x.getProperty("2") == "b1"); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue(x.getProperty("3") == "c1"); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue(x.properties().size() == 3); - assertTrue(x.properties().get("1") == "a1"); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue(x.properties().get("2") == "b1"); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue(x.properties().get("3") == "c1"); //$NON-NLS-1$ //$NON-NLS-2$ - x.setProperty("1", "a2"); //$NON-NLS-1$ //$NON-NLS-2$ - x.setProperty("2", "b2"); //$NON-NLS-1$ //$NON-NLS-2$ - x.setProperty("3", "c2"); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue(x.getProperty("1") == "a2"); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue(x.getProperty("2") == "b2"); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue(x.getProperty("3") == "c2"); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue(x.properties().size() == 3); - assertTrue(x.properties().get("1") == "a2"); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue(x.properties().get("2") == "b2"); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue(x.properties().get("3") == "c2"); //$NON-NLS-1$ //$NON-NLS-2$ - x.setProperty("2", null); //$NON-NLS-1$ - assertTrue(x.getProperty("1") == "a2"); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue(x.getProperty("2") == null); //$NON-NLS-1$ - assertTrue(x.getProperty("3") == "c2"); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue(x.properties().size() == 2); - assertTrue(x.properties().get("1") == "a2"); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue(x.properties().get("2") == null); //$NON-NLS-1$ - assertTrue(x.properties().get("3") == "c2"); //$NON-NLS-1$ //$NON-NLS-2$ - x.setProperty("1", null); //$NON-NLS-1$ - assertTrue(x.getProperty("1") == null); //$NON-NLS-1$ - assertTrue(x.getProperty("2") == null); //$NON-NLS-1$ - assertTrue(x.getProperty("3") == "c2"); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue(x.properties().size() == 1); - assertTrue(x.properties().get("1") == null); //$NON-NLS-1$ - assertTrue(x.properties().get("2") == null); //$NON-NLS-1$ - assertTrue(x.properties().get("3") == "c2"); //$NON-NLS-1$ //$NON-NLS-2$ - - // none of this is considered to have affected the AST - assertTrue(ast.modificationCount() == previousCount); - } - - public void testReturnStatement() { - long previousCount = ast.modificationCount(); - final ReturnStatement x = ast.newReturnStatement(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getExpression() == null); - assertTrue(x.getNodeType() == ASTNode.RETURN_STATEMENT); - assertTrue(x.structuralPropertiesForType() == - ReturnStatement.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - tLeadingComment(x); - - genericPropertyTest(x, new Property("Expression", false, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST localAst, boolean parented) { - Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - localAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - // return Expression that embeds x - ClassInstanceCreation s1 = ast.newClassInstanceCreation(); - AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration(); - s1.setAnonymousClassDeclaration(a1); - FunctionDeclaration s2 = ast.newFunctionDeclaration(); - a1.bodyDeclarations().add(s2); - Block s3 = ast.newBlock(); - s2.setBody(s3); - s3.statements().add(x); - return s1; - } - public void unwrap() { - Block s3 = (Block) x.getParent(); - s3.statements().remove(x); - } - public ASTNode get() { - return x.getExpression(); - } - public void set(ASTNode value) { - x.setExpression((Expression) value); - } - }); - } - - /** - * @deprecated (Uses getLeadingComment() which is deprecated) - */ - public void testThrowStatement() { - long previousCount = ast.modificationCount(); - final ThrowStatement x = ast.newThrowStatement(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getExpression().getParent() == x); - assertTrue(x.getLeadingComment() == null); - assertTrue(x.getNodeType() == ASTNode.THROW_STATEMENT); - assertTrue(x.structuralPropertiesForType() == - ThrowStatement.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - tLeadingComment(x); - - genericPropertyTest(x, new Property("Expression", true, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST localAst, boolean parented) { - Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - localAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - // return Expression that embeds x - ClassInstanceCreation s1 = ast.newClassInstanceCreation(); - AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration(); - s1.setAnonymousClassDeclaration(a1); - FunctionDeclaration s2 = ast.newFunctionDeclaration(); - a1.bodyDeclarations().add(s2); - Block s3 = ast.newBlock(); - s2.setBody(s3); - s3.statements().add(x); - return s1; - } - public void unwrap() { - Block s3 = (Block) x.getParent(); - s3.statements().remove(x); - } - public ASTNode get() { - return x.getExpression(); - } - public void set(ASTNode value) { - x.setExpression((Expression) value); - } - }); - } - - /** - * @deprecated (Uses getLeadingComment() which is deprecated) - */ - public void testSwitchStatement() { - long previousCount = ast.modificationCount(); - final SwitchStatement x = ast.newSwitchStatement(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getExpression().getParent() == x); - assertTrue(x.statements().isEmpty()); - assertTrue(x.getLeadingComment() == null); - assertTrue(x.getNodeType() == ASTNode.SWITCH_STATEMENT); - assertTrue(x.structuralPropertiesForType() == - SwitchStatement.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - tLeadingComment(x); - - genericPropertyTest(x, new Property("Expression", true, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST localAst, boolean parented) { - Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - localAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - // return Expression that embeds x - ClassInstanceCreation s1 = ast.newClassInstanceCreation(); - AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration(); - s1.setAnonymousClassDeclaration(a1); - FunctionDeclaration s2 = ast.newFunctionDeclaration(); - a1.bodyDeclarations().add(s2); - Block s3 = ast.newBlock(); - s2.setBody(s3); - s3.statements().add(x); - return s1; - } - public void unwrap() { - Block s3 = (Block) x.getParent(); - s3.statements().remove(x); - } - public ASTNode get() { - return x.getExpression(); - } - public void set(ASTNode value) { - x.setExpression((Expression) value); - } - }); - - genericPropertyListTest(x, x.statements(), - new Property("Statements", true, Statement.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - Block result = targetAst.newBlock(); - if (parented) { - Block b2 = targetAst.newBlock(); - b2.statements().add(result); - } - return result; - } - public ASTNode wrap() { - // return a Statement that embeds x - Block s1 = ast.newBlock(); - s1.statements().add(x); - return s1; - } - public void unwrap() { - Block s2 = (Block) x.getParent(); - s2.statements().remove(x); - } - }); - } - - /** - * @deprecated (Uses getLeadingComment() which is deprecated) - */ - public void testSwitchCase() { - long previousCount = ast.modificationCount(); - final SwitchCase x = ast.newSwitchCase(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getExpression().getParent() == x); - assertTrue(x.getLeadingComment() == null); - assertTrue(!x.isDefault()); - assertTrue(x.getNodeType() == ASTNode.SWITCH_CASE); - assertTrue(x.structuralPropertiesForType() == - SwitchCase.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - genericPropertyTest(x, new Property("Expression", false, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST localAst, boolean parented) { - Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - localAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - // return Expression that embeds x - ClassInstanceCreation s1 = ast.newClassInstanceCreation(); - AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration(); - s1.setAnonymousClassDeclaration(a1); - FunctionDeclaration s2 = ast.newFunctionDeclaration(); - a1.bodyDeclarations().add(s2); - Block s3 = ast.newBlock(); - s2.setBody(s3); - SwitchStatement s4 = ast.newSwitchStatement(); - s3.statements().add(s4); - s4.statements().add(x); - return s1; - } - public void unwrap() { - SwitchStatement s4 = (SwitchStatement) x.getParent(); - s4.statements().remove(x); - } - public ASTNode get() { - return x.getExpression(); - } - public void set(ASTNode value) { - x.setExpression((Expression) value); - } - }); - } - - - /** - * @deprecated (Uses getLeadingComment() which is deprecated) - */ - public void testLabeledStatement() { - long previousCount = ast.modificationCount(); - final LabeledStatement x = ast.newLabeledStatement(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getLabel().getParent() == x); - assertTrue(x.getBody().getParent() == x); - assertTrue(x.getLeadingComment() == null); - assertTrue(x.getNodeType() == ASTNode.LABELED_STATEMENT); - assertTrue(x.structuralPropertiesForType() == - LabeledStatement.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - tLeadingComment(x); - - genericPropertyTest(x, new Property("Label", true, SimpleName.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode get() { - return x.getLabel(); - } - public void set(ASTNode value) { - x.setLabel((SimpleName) value); - } - }); - - genericPropertyTest(x, new Property("Body", true, Statement.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - Block result = targetAst.newBlock(); - if (parented) { - Block b2 = targetAst.newBlock(); - b2.statements().add(result); - } - return result; - } - public ASTNode wrap() { - // return a Statement that embeds x - Block s1 = ast.newBlock(); - s1.statements().add(x); - return s1; - } - public void unwrap() { - Block s2 = (Block) x.getParent(); - s2.statements().remove(x); - } - public ASTNode get() { - return x.getBody(); - } - public void set(ASTNode value) { - x.setBody((Statement) value); - } - }); - } - - /** - * Walks the given AST and assigns properly-nested (but otherwise totally bogus) - * source ranges to all nodes. - */ - void assignSourceRanges(ASTNode target) { - final StringBuffer buffer = new StringBuffer(); - final List stack = new ArrayList(); - // pretend that every construct begins with "(" and ends with ")" - class PositionAssigner extends ASTVisitor { - PositionAssigner() { - // visit Javadoc.tags(); - super(true); - } - public void preVisit(ASTNode node) { - int start = buffer.length(); - buffer.append("("); - // push start position - popped by postVisit for same node - stack.add(new Integer(start)); - } - public void postVisit(ASTNode node) { - // pop start position placed there by preVisit - int start = ((Integer) stack.remove(stack.size() - 1)).intValue(); - buffer.append(")"); - int length = buffer.length() - start; - node.setSourceRange(start, length); - } - } - target.accept(new PositionAssigner()); - } - - public void testClone() { - ASTNode x = SampleASTs.oneOfEach(ast); - assignSourceRanges(x); - assertTrue(x.subtreeMatch(new CheckPositionsMatcher(), x)); - - // same AST clone - ASTNode y = ASTNode.copySubtree(ast, x); - assertTrue(x.subtreeMatch(new CheckPositionsMatcher(), y)); - assertTrue(y.subtreeMatch(new CheckPositionsMatcher(), x)); - - // different AST clone - AST newAST = AST.newAST(ast.apiLevel()); - ASTNode z = ASTNode.copySubtree(newAST, x); - assertTrue(x.subtreeMatch(new CheckPositionsMatcher(), z)); - assertTrue(z.subtreeMatch(new CheckPositionsMatcher(), x)); - } - - public void testNullResolve() { - ASTNode x = SampleASTs.oneOfEach(ast); - - ASTVisitor v = new ASTVisitor(true) { - // NAMES - - public boolean visit(SimpleName node) { - assertTrue(node.resolveBinding() == null); - return true; - } - public boolean visit(QualifiedName node) { - assertTrue(node.resolveBinding() == null); - return true; - } - - // TYPES - - public boolean visit(SimpleType node) { - assertTrue(node.resolveBinding() == null); - return true; - } - public boolean visit(ArrayType node) { - assertTrue(node.resolveBinding() == null); - return true; - } - public boolean visit(PrimitiveType node) { - assertTrue(node.resolveBinding() == null); - return true; - } - public boolean visit(QualifiedType node) { - assertTrue(node.resolveBinding() == null); - return true; - } - - // EXPRESSIONS - - public boolean visit(Assignment node) { - assertTrue(node.resolveTypeBinding() == null); - return true; - } - - public boolean visit(ClassInstanceCreation node) { - assertTrue(node.resolveConstructorBinding() == null); - return true; - } - - public boolean visit(ConstructorInvocation node) { - assertTrue(node.resolveConstructorBinding() == null); - return true; - } - - public boolean visit(SuperConstructorInvocation node) { - assertTrue(node.resolveConstructorBinding() == null); - return true; - } - - // MAJOR DECLARATIONS - - public boolean visit(PackageDeclaration node) { - assertTrue(node.resolveBinding() == null); - return true; - } - public boolean visit(ImportDeclaration node) { - assertTrue(node.resolveBinding() == null); - return true; - } - public boolean visit(FunctionDeclaration node) { - assertTrue(node.resolveBinding() == null); - return true; - } - public boolean visit(TypeDeclaration node) { - assertTrue(node.resolveBinding() == null); - return true; - } - public boolean visit(TypeDeclarationStatement node) { - assertTrue(node.resolveBinding() == null); - return true; - } - public boolean visit(SingleVariableDeclaration node) { - assertTrue(node.resolveBinding() == null); - return true; - } - public boolean visit(VariableDeclarationFragment node) { - assertTrue(node.resolveBinding() == null); - return true; - } - }; - - x.accept(v); - } - - /** - * @deprecated (Uses getLeadingComment() which is deprecated) - */ - public void testForStatement() { - long previousCount = ast.modificationCount(); - final ForStatement x = ast.newForStatement(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.initializers().isEmpty()); - assertTrue(x.getExpression() == null); - assertTrue(x.updaters().isEmpty()); - assertTrue(x.getBody().getParent() == x); - assertTrue(x.getBody() instanceof Block); - assertTrue(((Block) x.getBody()).statements().isEmpty()); - assertTrue(x.getLeadingComment() == null); - assertTrue(x.getNodeType() == ASTNode.FOR_STATEMENT); - assertTrue(x.structuralPropertiesForType() == - ForStatement.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - tLeadingComment(x); - - genericPropertyListTest(x, x.initializers(), - new Property("Initializers", true, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - // return Expression that embeds x - ClassInstanceCreation s1 = ast.newClassInstanceCreation(); - AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration(); - s1.setAnonymousClassDeclaration(a1); - FunctionDeclaration s2 = ast.newFunctionDeclaration(); - a1.bodyDeclarations().add(s2); - Block s3 = ast.newBlock(); - s2.setBody(s3); - s3.statements().add(x); - return s1; - } - public void unwrap() { - Block s3 = (Block) x.getParent(); - s3.statements().remove(x); - } - }); - - genericPropertyTest(x, new Property("Expression", false, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST localAst, boolean parented) { - Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - localAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - // return Expression that embeds x - ClassInstanceCreation s1 = ast.newClassInstanceCreation(); - AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration(); - s1.setAnonymousClassDeclaration(a1); - FunctionDeclaration s2 = ast.newFunctionDeclaration(); - a1.bodyDeclarations().add(s2); - Block s3 = ast.newBlock(); - s2.setBody(s3); - s3.statements().add(x); - return s1; - } - public void unwrap() { - Block s3 = (Block) x.getParent(); - s3.statements().remove(x); - } - public ASTNode get() { - return x.getExpression(); - } - public void set(ASTNode value) { - x.setExpression((Expression) value); - } - }); - - genericPropertyListTest(x, x.updaters(), - new Property("Updaters", true, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - // return Expression that embeds x - ClassInstanceCreation s1 = ast.newClassInstanceCreation(); - AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration(); - s1.setAnonymousClassDeclaration(a1); - FunctionDeclaration s2 = ast.newFunctionDeclaration(); - a1.bodyDeclarations().add(s2); - Block s3 = ast.newBlock(); - s2.setBody(s3); - s3.statements().add(x); - return s1; - } - public void unwrap() { - Block s3 = (Block) x.getParent(); - s3.statements().remove(x); - } - }); - - genericPropertyTest(x, new Property("Body", true, Statement.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - Block result = targetAst.newBlock(); - if (parented) { - Block b2 = targetAst.newBlock(); - b2.statements().add(result); - } - return result; - } - public ASTNode wrap() { - // return a Statement that embeds x - Block s1 = ast.newBlock(); - s1.statements().add(x); - return s1; - } - public void unwrap() { - Block s2 = (Block) x.getParent(); - s2.statements().remove(x); - } - public ASTNode get() { - return x.getBody(); - } - public void set(ASTNode value) { - x.setBody((Statement) value); - } - }); - } - - /** - * @deprecated (Uses getLeadingComment() which is deprecated) - */ - public void testEnhancedForStatement() { - if (ast.apiLevel() == AST.JLS2) { - // node type introduced in 3.0 API - try { - ast.newEnhancedForStatement(); - assertTrue(false); - } catch (UnsupportedOperationException e) { - // pass - } - return; - } - long previousCount = ast.modificationCount(); - final EnhancedForStatement x = ast.newEnhancedForStatement(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getParameter() != null); - assertTrue(x.getParameter().getParent() == x); - assertTrue(x.getExpression() != null); - assertTrue(x.getExpression().getParent() == x); - assertTrue(x.getBody().getParent() == x); - assertTrue(x.getBody() instanceof Block); - assertTrue(((Block) x.getBody()).statements().isEmpty()); - assertTrue(x.getLeadingComment() == null); - assertTrue(x.getNodeType() == ASTNode.ENHANCED_FOR_STATEMENT); - assertTrue(x.structuralPropertiesForType() == - EnhancedForStatement.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - tLeadingComment(x); - - genericPropertyTest(x, new Property("Parameter", true, SingleVariableDeclaration.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SingleVariableDeclaration result = targetAst.newSingleVariableDeclaration(); - if (parented) { - CatchClause parent = targetAst.newCatchClause(); - parent.setException(result); - } - return result; - } - public ASTNode get() { - return x.getParameter(); - } - public void set(ASTNode value) { - x.setParameter((SingleVariableDeclaration) value); - } - }); - - genericPropertyTest(x, new Property("Expression", true, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST target, boolean parented) { - Expression result = target.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - target.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - // return Expression that embeds x - ClassInstanceCreation s1 = ast.newClassInstanceCreation(); - AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration(); - s1.setAnonymousClassDeclaration(a1); - FunctionDeclaration s2 = ast.newFunctionDeclaration(); - a1.bodyDeclarations().add(s2); - Block s3 = ast.newBlock(); - s2.setBody(s3); - s3.statements().add(x); - return s1; - } - public void unwrap() { - Block s3 = (Block) x.getParent(); - s3.statements().remove(x); - } - public ASTNode get() { - return x.getExpression(); - } - public void set(ASTNode value) { - x.setExpression((Expression) value); - } - }); - } - - public void testConstructorInvocation() { - long previousCount = ast.modificationCount(); - final ConstructorInvocation x = ast.newConstructorInvocation(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - if (ast.apiLevel() >= AST.JLS3) { - assertTrue(x.typeArguments().isEmpty()); - } - assertTrue(x.arguments().isEmpty()); - assertTrue(x.getNodeType() == ASTNode.CONSTRUCTOR_INVOCATION); - assertTrue(x.structuralPropertiesForType() == - ConstructorInvocation.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - if (ast.apiLevel() >= AST.JLS3) { - genericPropertyListTest(x, x.typeArguments(), - new Property("TypeArguments", true, Type.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - Type result = targetAst.newSimpleType(targetAst.newSimpleName("X")); //$NON-NLS-1$ - if (parented) { - targetAst.newArrayType(result); - } - return result; - } - }); - } - - genericPropertyListTest(x, x.arguments(), - new Property("Arguments", true, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - // return Expression that embeds x - ClassInstanceCreation s1 = ast.newClassInstanceCreation(); - AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration(); - s1.setAnonymousClassDeclaration(a1); - FunctionDeclaration s2 = ast.newFunctionDeclaration(); - a1.bodyDeclarations().add(s2); - Block s3 = ast.newBlock(); - s2.setBody(s3); - s3.statements().add(x); - return s1; - } - public void unwrap() { - Block s3 = (Block) x.getParent(); - s3.statements().remove(x); - } - }); - } - - public void testSuperConstructorInvocation() { - long previousCount = ast.modificationCount(); - final SuperConstructorInvocation x = ast.newSuperConstructorInvocation(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getExpression() == null); - if (ast.apiLevel() >= AST.JLS3) { - assertTrue(x.typeArguments().isEmpty()); - } - assertTrue(x.arguments().isEmpty()); - assertTrue(x.getNodeType() == ASTNode.SUPER_CONSTRUCTOR_INVOCATION); - assertTrue(x.structuralPropertiesForType() == - SuperConstructorInvocation.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - genericPropertyTest(x, new Property("Expression", false, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - // return Expression that embeds x - ClassInstanceCreation s1 = ast.newClassInstanceCreation(); - AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration(); - s1.setAnonymousClassDeclaration(a1); - FunctionDeclaration s2 = ast.newFunctionDeclaration(); - a1.bodyDeclarations().add(s2); - Block s3 = ast.newBlock(); - s2.setBody(s3); - s3.statements().add(x); - return s1; - } - public void unwrap() { - Block s3 = (Block) x.getParent(); - s3.statements().remove(x); - } - public ASTNode get() { - return x.getExpression(); - } - public void set(ASTNode value) { - x.setExpression((Expression) value); - } - }); - - if (ast.apiLevel() >= AST.JLS3) { - genericPropertyListTest(x, x.typeArguments(), - new Property("TypeArguments", true, Type.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - Type result = targetAst.newSimpleType(targetAst.newSimpleName("X")); //$NON-NLS-1$ - if (parented) { - targetAst.newArrayType(result); - } - return result; - } - }); - } - - genericPropertyListTest(x, x.arguments(), - new Property("Arguments", true, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - // return Expression that embeds x - ClassInstanceCreation s1 = ast.newClassInstanceCreation(); - AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration(); - s1.setAnonymousClassDeclaration(a1); - FunctionDeclaration s2 = ast.newFunctionDeclaration(); - a1.bodyDeclarations().add(s2); - Block s3 = ast.newBlock(); - s2.setBody(s3); - s3.statements().add(x); - return s1; - } - public void unwrap() { - Block s3 = (Block) x.getParent(); - s3.statements().remove(x); - } - }); - } - - public void testThisExpression() { - long previousCount = ast.modificationCount(); - final ThisExpression x = ast.newThisExpression(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getQualifier() == null); - assertTrue(x.getNodeType() == ASTNode.THIS_EXPRESSION); - assertTrue(x.structuralPropertiesForType() == - ThisExpression.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - genericPropertyTest(x, new Property("Qualifier", false, Name.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - QualifiedName result = targetAst.newQualifiedName( - targetAst.newSimpleName("a"), //$NON-NLS-1$ - targetAst.newSimpleName("b")); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode get() { - return x.getQualifier(); - } - public void set(ASTNode value) { - x.setQualifier((Name) value); - } - }); - } - - public void testFieldAccess() { - long previousCount = ast.modificationCount(); - final FieldAccess x = ast.newFieldAccess(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getName().getParent() == x); - assertTrue(x.getExpression().getParent() == x); - assertTrue(x.getNodeType() == ASTNode.FIELD_ACCESS); - assertTrue(x.structuralPropertiesForType() == - FieldAccess.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - genericPropertyTest(x, new Property("Expression", true, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST localAst, boolean parented) { - Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - localAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - ParenthesizedExpression s1 = ast.newParenthesizedExpression(); - s1.setExpression(x); - return s1; - } - public void unwrap() { - ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent(); - s1.setExpression(ast.newSimpleName("fie")); //$NON-NLS-1$ - } - public ASTNode get() { - return x.getExpression(); - } - public void set(ASTNode value) { - x.setExpression((Expression) value); - } - }); - - genericPropertyTest(x, new Property("Name", true, SimpleName.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode get() { - return x.getName(); - } - public void set(ASTNode value) { - x.setName((SimpleName) value); - } - }); - } - - - public void testSuperFieldAccess() { - long previousCount = ast.modificationCount(); - final SuperFieldAccess x = ast.newSuperFieldAccess(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getName().getParent() == x); - assertTrue(x.getQualifier() == null); - assertTrue(x.getNodeType() == ASTNode.SUPER_FIELD_ACCESS); - assertTrue(x.structuralPropertiesForType() == - SuperFieldAccess.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - genericPropertyTest(x, new Property("Qualifier", false, Name.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - QualifiedName result = targetAst.newQualifiedName( - targetAst.newSimpleName("a"), //$NON-NLS-1$ - targetAst.newSimpleName("b")); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode get() { - return x.getQualifier(); - } - public void set(ASTNode value) { - x.setQualifier((Name) value); - } - }); - - genericPropertyTest(x, new Property("Name", true, SimpleName.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode get() { - return x.getName(); - } - public void set(ASTNode value) { - x.setName((SimpleName) value); - } - }); - } - - public void testSuperMethodInvocation() { - long previousCount = ast.modificationCount(); - final SuperMethodInvocation x = ast.newSuperMethodInvocation(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - if (ast.apiLevel() >= AST.JLS3) { - assertTrue(x.typeArguments().isEmpty()); - } - assertTrue(x.getName().getParent() == x); - assertTrue(x.getQualifier() == null); - assertTrue(x.arguments().isEmpty()); - assertTrue(x.getNodeType() == ASTNode.SUPER_METHOD_INVOCATION); - assertTrue(x.structuralPropertiesForType() == - SuperMethodInvocation.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - genericPropertyTest(x, new Property("Qualifier", false, Name.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - QualifiedName result = targetAst.newQualifiedName( - targetAst.newSimpleName("a"), //$NON-NLS-1$ - targetAst.newSimpleName("b")); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode get() { - return x.getQualifier(); - } - public void set(ASTNode value) { - x.setQualifier((Name) value); - } - }); - - if (ast.apiLevel() >= AST.JLS3) { - genericPropertyListTest(x, x.typeArguments(), - new Property("TypeArguments", true, Type.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - Type result = targetAst.newSimpleType(targetAst.newSimpleName("X")); //$NON-NLS-1$ - if (parented) { - targetAst.newArrayType(result); - } - return result; - } - }); - } - - genericPropertyTest(x, new Property("Name", true, SimpleName.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode get() { - return x.getName(); - } - public void set(ASTNode value) { - x.setName((SimpleName) value); - } - }); - - genericPropertyListTest(x, x.arguments(), - new Property("Arguments", true, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - // return Expression that embeds x - ParenthesizedExpression s1 = ast.newParenthesizedExpression(); - s1.setExpression(x); - return s1; - } - public void unwrap() { - ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent(); - s1.setExpression(ast.newSimpleName("x")); //$NON-NLS-1$ - } - }); - } - - public void testTypeLiteral() { - long previousCount = ast.modificationCount(); - final TypeLiteral x = ast.newTypeLiteral(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getType().getParent() == x); - assertTrue(x.getNodeType() == ASTNode.TYPE_LITERAL); - assertTrue(x.structuralPropertiesForType() == - TypeLiteral.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - genericPropertyTest(x, new Property("Type", true, Type.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleType result = targetAst.newSimpleType( - targetAst.newSimpleName("a")); //$NON-NLS-1$ - if (parented) { - targetAst.newArrayType(result); - } - return result; - } - public ASTNode get() { - return x.getType(); - } - public void set(ASTNode value) { - x.setType((Type) value); - } - }); - } - - public void testPrefixExpression() { - long previousCount = ast.modificationCount(); - final PrefixExpression x = ast.newPrefixExpression(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getOperand().getParent() == x); - assertTrue(x.getOperator() != null); - assertTrue(x.getNodeType() == ASTNode.PREFIX_EXPRESSION); - assertTrue(x.structuralPropertiesForType() == - PrefixExpression.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - // Operator property - mandatory typesafe enumeration - // check the names of the operators - assertTrue(PrefixExpression.Operator.INCREMENT.toString().equals("++")); //$NON-NLS-1$ - assertTrue(PrefixExpression.Operator.DECREMENT.toString().equals("--")); //$NON-NLS-1$ - assertTrue(PrefixExpression.Operator.PLUS.toString().equals("+")); //$NON-NLS-1$ - assertTrue(PrefixExpression.Operator.MINUS.toString().equals("-")); //$NON-NLS-1$ - assertTrue(PrefixExpression.Operator.COMPLEMENT.toString().equals("~")); //$NON-NLS-1$ - assertTrue(PrefixExpression.Operator.NOT.toString().equals("!")); //$NON-NLS-1$ - - PrefixExpression.Operator[] known = { - PrefixExpression.Operator.INCREMENT, - PrefixExpression.Operator.DECREMENT, - PrefixExpression.Operator.PLUS, - PrefixExpression.Operator.MINUS, - PrefixExpression.Operator.COMPLEMENT, - PrefixExpression.Operator.NOT, - }; - - // check all operators are distinct - for (int i = 0; i < known.length; i++) { - for (int j = 0; j < known.length; j++) { - assertTrue(i == j || !known[i].equals(known[j])); - } - } - - // check all operators work - for (int i = 0; i < known.length; i++) { - previousCount = ast.modificationCount(); - x.setOperator(known[i]); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getOperator().equals(known[i])); - } - // ensure null does not work as an operator - try { - x.setOperator(null); - assertTrue(false); - } catch (RuntimeException e) { - // pass - } - - // check toOperator lookup of operator by name - for (int i = 0; i < known.length; i++) { - String name = known[i].toString(); - assertTrue(PrefixExpression.Operator.toOperator(name).equals(known[i])); - } - assertTrue(PrefixExpression.Operator.toOperator("huh") == null); //$NON-NLS-1$ - - genericPropertyTest(x, new Property("Operand", true, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST localAst, boolean parented) { - Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - localAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - ParenthesizedExpression s1 = ast.newParenthesizedExpression(); - s1.setExpression(x); - return s1; - } - public void unwrap() { - ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent(); - s1.setExpression(ast.newSimpleName("fie")); //$NON-NLS-1$ - } - public ASTNode get() { - return x.getOperand(); - } - public void set(ASTNode value) { - x.setOperand((Expression) value); - } - }); - } - - public void testPostfixExpression() { - long previousCount = ast.modificationCount(); - final PostfixExpression x = ast.newPostfixExpression(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getOperand().getParent() == x); - assertTrue(x.getOperator() != null); - assertTrue(x.getNodeType() == ASTNode.POSTFIX_EXPRESSION); - assertTrue(x.structuralPropertiesForType() == - PostfixExpression.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - // Operator property - mandatory typesafe enumeration - // check the names of the operators - assertTrue(PostfixExpression.Operator.INCREMENT.toString().equals("++")); //$NON-NLS-1$ - assertTrue(PostfixExpression.Operator.DECREMENT.toString().equals("--")); //$NON-NLS-1$ - - PostfixExpression.Operator[] known = { - PostfixExpression.Operator.INCREMENT, - PostfixExpression.Operator.DECREMENT, - }; - - // check all operators are distinct - for (int i = 0; i < known.length; i++) { - for (int j = 0; j < known.length; j++) { - assertTrue(i == j || !known[i].equals(known[j])); - } - } - - // check all operators work - for (int i = 0; i < known.length; i++) { - previousCount = ast.modificationCount(); - x.setOperator(known[i]); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getOperator().equals(known[i])); - } - // ensure null does not work as an operator - try { - x.setOperator(null); - assertTrue(false); - } catch (RuntimeException e) { - // pass - } - - // check toOperator lookup of operator by name - for (int i = 0; i < known.length; i++) { - String name = known[i].toString(); - assertTrue(PostfixExpression.Operator.toOperator(name).equals(known[i])); - } - assertTrue(PostfixExpression.Operator.toOperator("huh") == null); //$NON-NLS-1$ - - genericPropertyTest(x, new Property("Operand", true, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST localAst, boolean parented) { - Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - localAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - ParenthesizedExpression s1 = ast.newParenthesizedExpression(); - s1.setExpression(x); - return s1; - } - public void unwrap() { - ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent(); - s1.setExpression(ast.newSimpleName("fie")); //$NON-NLS-1$ - } - public ASTNode get() { - return x.getOperand(); - } - public void set(ASTNode value) { - x.setOperand((Expression) value); - } - }); - } - - public void testInfixExpression() { - long previousCount = ast.modificationCount(); - final InfixExpression x = ast.newInfixExpression(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getLeftOperand().getParent() == x); - assertTrue(x.getOperator() != null); - assertTrue(x.getRightOperand().getParent() == x); - assertTrue(x.extendedOperands().isEmpty()); - assertTrue(x.getNodeType() == ASTNode.INFIX_EXPRESSION); - assertTrue(x.structuralPropertiesForType() == - InfixExpression.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - // Operator property - mandatory typesafe enumeration - // check the names of the operators - assertTrue(InfixExpression.Operator.TIMES.toString().equals("*")); //$NON-NLS-1$ - assertTrue(InfixExpression.Operator.DIVIDE.toString().equals("/")); //$NON-NLS-1$ - assertTrue(InfixExpression.Operator.REMAINDER.toString().equals("%")); //$NON-NLS-1$ - assertTrue(InfixExpression.Operator.PLUS.toString().equals("+")); //$NON-NLS-1$ - assertTrue(InfixExpression.Operator.MINUS.toString().equals("-")); //$NON-NLS-1$ - assertTrue(InfixExpression.Operator.LEFT_SHIFT.toString().equals("<<")); //$NON-NLS-1$ - assertTrue(InfixExpression.Operator.RIGHT_SHIFT_SIGNED.toString().equals(">>")); //$NON-NLS-1$ - assertTrue(InfixExpression.Operator.RIGHT_SHIFT_UNSIGNED.toString().equals(">>>")); //$NON-NLS-1$ - assertTrue(InfixExpression.Operator.LESS.toString().equals("<")); //$NON-NLS-1$ - assertTrue(InfixExpression.Operator.GREATER.toString().equals(">")); //$NON-NLS-1$ - assertTrue(InfixExpression.Operator.LESS_EQUALS.toString().equals("<=")); //$NON-NLS-1$ - assertTrue(InfixExpression.Operator.GREATER_EQUALS.toString().equals(">=")); //$NON-NLS-1$ - assertTrue(InfixExpression.Operator.EQUALS.toString().equals("==")); //$NON-NLS-1$ - assertTrue(InfixExpression.Operator.NOT_EQUALS.toString().equals("!=")); //$NON-NLS-1$ - assertTrue(InfixExpression.Operator.XOR.toString().equals("^")); //$NON-NLS-1$ - assertTrue(InfixExpression.Operator.OR.toString().equals("|")); //$NON-NLS-1$ - assertTrue(InfixExpression.Operator.AND.toString().equals("&")); //$NON-NLS-1$ - assertTrue(InfixExpression.Operator.CONDITIONAL_OR.toString().equals("||")); //$NON-NLS-1$ - assertTrue(InfixExpression.Operator.CONDITIONAL_AND.toString().equals("&&")); //$NON-NLS-1$ - - InfixExpression.Operator[] known = { - InfixExpression.Operator.TIMES, - InfixExpression.Operator.DIVIDE, - InfixExpression.Operator.REMAINDER, - InfixExpression.Operator.PLUS, - InfixExpression.Operator.MINUS, - InfixExpression.Operator.LEFT_SHIFT, - InfixExpression.Operator.RIGHT_SHIFT_SIGNED, - InfixExpression.Operator.RIGHT_SHIFT_UNSIGNED, - InfixExpression.Operator.LESS, - InfixExpression.Operator.GREATER, - InfixExpression.Operator.LESS_EQUALS, - InfixExpression.Operator.GREATER_EQUALS, - InfixExpression.Operator.EQUALS, - InfixExpression.Operator.NOT_EQUALS, - InfixExpression.Operator.XOR, - InfixExpression.Operator.OR, - InfixExpression.Operator.AND, - InfixExpression.Operator.CONDITIONAL_OR, - InfixExpression.Operator.CONDITIONAL_AND, - }; - - // check all operators are distinct - for (int i = 0; i < known.length; i++) { - for (int j = 0; j < known.length; j++) { - assertTrue(i == j || !known[i].equals(known[j])); - } - } - - // check all operators work - for (int i = 0; i < known.length; i++) { - previousCount = ast.modificationCount(); - x.setOperator(known[i]); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getOperator().equals(known[i])); - } - // ensure null does not work as an operator - try { - x.setOperator(null); - assertTrue(false); - } catch (RuntimeException e) { - // pass - } - - // check toOperator lookup of operator by name - for (int i = 0; i < known.length; i++) { - String name = known[i].toString(); - assertTrue(InfixExpression.Operator.toOperator(name).equals(known[i])); - } - assertTrue(InfixExpression.Operator.toOperator("huh") == null); //$NON-NLS-1$ - - genericPropertyTest(x, new Property("LeftOperand", true, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST localAst, boolean parented) { - Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - localAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - ParenthesizedExpression s1 = ast.newParenthesizedExpression(); - s1.setExpression(x); - return s1; - } - public void unwrap() { - ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent(); - s1.setExpression(ast.newSimpleName("fie")); //$NON-NLS-1$ - } - public ASTNode get() { - return x.getLeftOperand(); - } - public void set(ASTNode value) { - x.setLeftOperand((Expression) value); - } - }); - - genericPropertyTest(x, new Property("RightOperand", true, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST localAst, boolean parented) { - Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - localAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - ParenthesizedExpression s1 = ast.newParenthesizedExpression(); - s1.setExpression(x); - return s1; - } - public void unwrap() { - ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent(); - s1.setExpression(ast.newSimpleName("fie")); //$NON-NLS-1$ - } - public ASTNode get() { - return x.getRightOperand(); - } - public void set(ASTNode value) { - x.setRightOperand((Expression) value); - } - }); - - genericPropertyListTest(x, x.extendedOperands(), - new Property("ExtendedOperands", true, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - // return Expression that embeds x - ParenthesizedExpression s1 = ast.newParenthesizedExpression(); - s1.setExpression(x); - return s1; - } - public void unwrap() { - ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent(); - s1.setExpression(ast.newSimpleName("x")); //$NON-NLS-1$ - } - }); - } - - public void testInstanceofExpression() { - long previousCount = ast.modificationCount(); - final InstanceofExpression x = ast.newInstanceofExpression(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getLeftOperand().getParent() == x); - assertTrue(x.getRightOperand().getParent() == x); - assertTrue(x.getNodeType() == ASTNode.INSTANCEOF_EXPRESSION); - assertTrue(x.structuralPropertiesForType() == - InstanceofExpression.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - genericPropertyTest(x, new Property("LeftOperand", true, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST localAst, boolean parented) { - Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - localAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - ParenthesizedExpression s1 = ast.newParenthesizedExpression(); - s1.setExpression(x); - return s1; - } - public void unwrap() { - ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent(); - s1.setExpression(ast.newSimpleName("fie")); //$NON-NLS-1$ - } - public ASTNode get() { - return x.getLeftOperand(); - } - public void set(ASTNode value) { - x.setLeftOperand((Expression) value); - } - }); - - genericPropertyTest(x, new Property("RightOperand", true, Type.class) { //$NON-NLS-1$ - public ASTNode sample(AST localAst, boolean parented) { - Type result = localAst.newSimpleType(localAst.newSimpleName("Object")); //$NON-NLS-1$ - if (parented) { - localAst.newArrayType(result); - } - return result; - } - public ASTNode wrap() { - ParenthesizedExpression s1 = ast.newParenthesizedExpression(); - s1.setExpression(x); - return s1; - } - public void unwrap() { - ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent(); - s1.setExpression(ast.newSimpleName("fie")); //$NON-NLS-1$ - } - public ASTNode get() { - return x.getRightOperand(); - } - public void set(ASTNode value) { - x.setRightOperand((Type) value); - } - }); - } - - public void testConditionalExpression() { - long previousCount = ast.modificationCount(); - final ConditionalExpression x = ast.newConditionalExpression(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getExpression().getParent() == x); - assertTrue(x.getThenExpression().getParent() == x); - assertTrue(x.getElseExpression().getParent() == x); - assertTrue(x.getNodeType() == ASTNode.CONDITIONAL_EXPRESSION); - assertTrue(x.structuralPropertiesForType() == - ConditionalExpression.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - genericPropertyTest(x, new Property("Expression", true, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST localAst, boolean parented) { - Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - localAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - ParenthesizedExpression s1 = ast.newParenthesizedExpression(); - s1.setExpression(x); - return s1; - } - public void unwrap() { - ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent(); - s1.setExpression(ast.newSimpleName("fie")); //$NON-NLS-1$ - } - public ASTNode get() { - return x.getExpression(); - } - public void set(ASTNode value) { - x.setExpression((Expression) value); - } - }); - - genericPropertyTest(x, new Property("ThenExpression", true, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST localAst, boolean parented) { - Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - localAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - ParenthesizedExpression s1 = ast.newParenthesizedExpression(); - s1.setExpression(x); - return s1; - } - public void unwrap() { - ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent(); - s1.setExpression(ast.newSimpleName("fie")); //$NON-NLS-1$ - } - public ASTNode get() { - return x.getThenExpression(); - } - public void set(ASTNode value) { - x.setThenExpression((Expression) value); - } - }); - - genericPropertyTest(x, new Property("ElseExpression", true, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST localAst, boolean parented) { - Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - localAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - ParenthesizedExpression s1 = ast.newParenthesizedExpression(); - s1.setExpression(x); - return s1; - } - public void unwrap() { - ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent(); - s1.setExpression(ast.newSimpleName("fie")); //$NON-NLS-1$ - } - public ASTNode get() { - return x.getElseExpression(); - } - public void set(ASTNode value) { - x.setElseExpression((Expression) value); - } - }); - } - - public void testArrayAccess() { - long previousCount = ast.modificationCount(); - final ArrayAccess x = ast.newArrayAccess(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getArray().getParent() == x); - assertTrue(x.getIndex().getParent() == x); - assertTrue(x.getNodeType() == ASTNode.ARRAY_ACCESS); - assertTrue(x.structuralPropertiesForType() == - ArrayAccess.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - genericPropertyTest(x, new Property("Array", true, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST localAst, boolean parented) { - Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - localAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - ParenthesizedExpression s1 = ast.newParenthesizedExpression(); - s1.setExpression(x); - return s1; - } - public void unwrap() { - ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent(); - s1.setExpression(ast.newSimpleName("fie")); //$NON-NLS-1$ - } - public ASTNode get() { - return x.getArray(); - } - public void set(ASTNode value) { - x.setArray((Expression) value); - } - }); - - genericPropertyTest(x, new Property("Index", true, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST localAst, boolean parented) { - Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - localAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - ParenthesizedExpression s1 = ast.newParenthesizedExpression(); - s1.setExpression(x); - return s1; - } - public void unwrap() { - ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent(); - s1.setExpression(ast.newSimpleName("fie")); //$NON-NLS-1$ - } - public ASTNode get() { - return x.getIndex(); - } - public void set(ASTNode value) { - x.setIndex((Expression) value); - } - }); - } - - public void testArrayInitializer() { - long previousCount = ast.modificationCount(); - final ArrayInitializer x = ast.newArrayInitializer(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.expressions().isEmpty()); - assertTrue(x.getNodeType() == ASTNode.ARRAY_INITIALIZER); - assertTrue(x.structuralPropertiesForType() == - ArrayInitializer.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - genericPropertyListTest(x, x.expressions(), - new Property("Expressions", true, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - // return Expression that embeds x - ParenthesizedExpression s1 = ast.newParenthesizedExpression(); - s1.setExpression(x); - return s1; - } - public void unwrap() { - ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent(); - s1.setExpression(ast.newSimpleName("x")); //$NON-NLS-1$ - } - }); - } - - /** @deprecated using deprecated code */ - public void testClassInstanceCreation() { - long previousCount = ast.modificationCount(); - final ClassInstanceCreation x = ast.newClassInstanceCreation(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getExpression() == null); - if (ast.apiLevel() == AST.JLS2) { - assertTrue(x.getName().getParent() == x); - } else { - assertTrue(x.typeArguments().isEmpty()); - assertTrue(x.getType().getParent() == x); - } - assertTrue(x.arguments().isEmpty()); - assertTrue(x.getAnonymousClassDeclaration() == null); - assertTrue(x.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); - assertTrue(x.structuralPropertiesForType() == - ClassInstanceCreation.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - genericPropertyTest(x, new Property("Expression", false, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - // return Expression that embeds x - ParenthesizedExpression s1 = ast.newParenthesizedExpression(); - s1.setExpression(x); - return s1; - } - public void unwrap() { - ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent(); - s1.setExpression(ast.newSimpleName("x")); //$NON-NLS-1$ - } - public ASTNode get() { - return x.getExpression(); - } - public void set(ASTNode value) { - x.setExpression((Expression) value); - } - }); - - if (ast.apiLevel() >= AST.JLS3) { - genericPropertyListTest(x, x.typeArguments(), - new Property("TypeArguments", true, Type.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - Type result = targetAst.newSimpleType(targetAst.newSimpleName("X")); //$NON-NLS-1$ - if (parented) { - targetAst.newArrayType(result); - } - return result; - } - }); - } - - if (ast.apiLevel() == AST.JLS2) { - genericPropertyTest(x, new Property("Name", true, Name.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("a"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode get() { - return x.getName(); - } - public void set(ASTNode value) { - x.setName((Name) value); - } - }); - } - - if (ast.apiLevel() >= AST.JLS3) { - genericPropertyTest(x, new Property("Type", true, Type.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleType result = targetAst.newSimpleType(targetAst.newSimpleName("foo")); //$NON-NLS-1$ - if (parented) { - targetAst.newArrayType(result); - } - return result; - } - public ASTNode get() { - return x.getType(); - } - public void set(ASTNode value) { - x.setType((Type) value); - } - }); - } - - genericPropertyListTest(x, x.arguments(), - new Property("Arguments", true, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - // return Expression that embeds x - ParenthesizedExpression s1 = ast.newParenthesizedExpression(); - s1.setExpression(x); - return s1; - } - public void unwrap() { - ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent(); - s1.setExpression(ast.newSimpleName("x")); //$NON-NLS-1$ - } - }); - - genericPropertyTest(x, new Property("AnonymousClassDeclaration", false, AnonymousClassDeclaration.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - AnonymousClassDeclaration result = targetAst.newAnonymousClassDeclaration(); - if (parented) { - targetAst.newClassInstanceCreation().setAnonymousClassDeclaration(result); - } - return result; - } - public ASTNode wrap() { - // return AnonymousClassDeclaration that embeds x - AnonymousClassDeclaration s0 = x.getAST().newAnonymousClassDeclaration(); - VariableDeclarationFragment s1 = x.getAST().newVariableDeclarationFragment(); - FieldDeclaration s2 = x.getAST().newFieldDeclaration(s1); - s0.bodyDeclarations().add(s2); - s1.setInitializer(x); - return s0; - } - public void unwrap() { - VariableDeclarationFragment s1 = (VariableDeclarationFragment) x.getParent(); - s1.setInitializer(null); - } - public ASTNode get() { - return x.getAnonymousClassDeclaration(); - } - public void set(ASTNode value) { - x.setAnonymousClassDeclaration((AnonymousClassDeclaration) value); - } - }); - - } - - public void testAnonymousClassDeclaration() { - long previousCount = ast.modificationCount(); - final AnonymousClassDeclaration x = ast.newAnonymousClassDeclaration(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.bodyDeclarations().isEmpty()); - assertTrue(x.getNodeType() == ASTNode.ANONYMOUS_CLASS_DECLARATION); - assertTrue(x.structuralPropertiesForType() == - AnonymousClassDeclaration.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - genericPropertyListTest(x, x.bodyDeclarations(), - new Property("BodyDeclarations", true, BodyDeclaration.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - TypeDeclaration result = targetAst.newTypeDeclaration(); - if (parented) { - JavaScriptUnit compilationUnit = targetAst.newJavaScriptUnit(); - compilationUnit.types().add(result); - } - return result; - } - public ASTNode wrap() { - // return BodyDeclaration that embeds x - VariableDeclarationFragment s0 = x.getAST().newVariableDeclarationFragment(); - FieldDeclaration s1 = x.getAST().newFieldDeclaration(s0); - ClassInstanceCreation s2= x.getAST().newClassInstanceCreation(); - s0.setInitializer(s2); - s2.setAnonymousClassDeclaration(x); - return s1; - } - public void unwrap() { - ClassInstanceCreation s2 = (ClassInstanceCreation) x.getParent(); - s2.setAnonymousClassDeclaration(null); - } - }); - - // check that TypeDeclarations in body are classified correctly - TypeDeclaration t1 = ast.newTypeDeclaration(); - x.bodyDeclarations().add(t1); - assertTrue(t1.isLocalTypeDeclaration() == false); - assertTrue(t1.isMemberTypeDeclaration() == true); - assertTrue(t1.isPackageMemberTypeDeclaration() == false); - } - - public void testArrayCreation() { - long previousCount = ast.modificationCount(); - final ArrayCreation x = ast.newArrayCreation(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getType().getParent() == x); - assertTrue(x.dimensions().isEmpty()); - assertTrue(x.getInitializer() == null); - assertTrue(x.getNodeType() == ASTNode.ARRAY_CREATION); - assertTrue(x.structuralPropertiesForType() == - ArrayCreation.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - genericPropertyTest(x, new Property("Type", true, ArrayType.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - ArrayType result = targetAst.newArrayType( - targetAst.newSimpleType(targetAst.newSimpleName("a"))); //$NON-NLS-1$ - if (parented) { - targetAst.newArrayType(result); - } - return result; - } - public ASTNode get() { - return x.getType(); - } - public void set(ASTNode value) { - x.setType((ArrayType) value); - } - }); - - genericPropertyListTest(x, x.dimensions(), - new Property("Dimensions", true, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - // return Expression that embeds x - ParenthesizedExpression s1 = ast.newParenthesizedExpression(); - s1.setExpression(x); - return s1; - } - public void unwrap() { - ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent(); - s1.setExpression(ast.newSimpleName("x")); //$NON-NLS-1$ - } - }); - - genericPropertyTest(x, new Property("Initializer", false, ArrayInitializer.class) { //$NON-NLS-1$ - public ASTNode sample(AST targetAst, boolean parented) { - ArrayInitializer result = targetAst.newArrayInitializer(); - if (parented) { - targetAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - // return ArrayInitializer that embeds x - ArrayInitializer s1 = ast.newArrayInitializer(); - s1.expressions().add(x); - return s1; - } - public void unwrap() { - ArrayInitializer s1 = (ArrayInitializer) x.getParent(); - s1.expressions().remove(x); - } - public ASTNode get() { - return x.getInitializer(); - } - public void set(ASTNode value) { - x.setInitializer((ArrayInitializer) value); - } - }); - } - - public void testParenthesizedExpression() { - long previousCount = ast.modificationCount(); - final ParenthesizedExpression x = ast.newParenthesizedExpression(); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getExpression().getParent() == x); - assertTrue(x.getNodeType() == ASTNode.PARENTHESIZED_EXPRESSION); - assertTrue(x.structuralPropertiesForType() == - ParenthesizedExpression.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - genericPropertyTest(x, new Property("Expression", true, Expression.class) { //$NON-NLS-1$ - public ASTNode sample(AST localAst, boolean parented) { - Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$ - if (parented) { - localAst.newExpressionStatement(result); - } - return result; - } - public ASTNode wrap() { - ParenthesizedExpression s1 = ast.newParenthesizedExpression(); - s1.setExpression(x); - return s1; - } - public void unwrap() { - ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent(); - s1.setExpression(ast.newSimpleName("fie")); //$NON-NLS-1$ - } - public ASTNode get() { - return x.getExpression(); - } - public void set(ASTNode value) { - x.setExpression((Expression) value); - } - }); - } - - - /** @deprecated using deprecated code */ - public void testModifiers() { - - // check all modifiers match their JVM spec values - assertTrue(Modifier.ABSTRACT == 0x0400); - assertTrue(Modifier.FINAL == 0x0010); - assertTrue(Modifier.NATIVE == 0x0100); - assertTrue(Modifier.NONE == 0x0000); - assertTrue(Modifier.PRIVATE == 0x0002); - assertTrue(Modifier.PROTECTED == 0x0004); - assertTrue(Modifier.PUBLIC == 0x0001); - assertTrue(Modifier.STATIC == 0x0008); - assertTrue(Modifier.STRICTFP == 0x0800); - assertTrue(Modifier.SYNCHRONIZED == 0x0020); - assertTrue(Modifier.TRANSIENT == 0x0080); - assertTrue(Modifier.VOLATILE == 0x0040); - - // check that all - final int[] mods = - { - Modifier.ABSTRACT, - Modifier.FINAL, - Modifier.NATIVE, - Modifier.PRIVATE, - Modifier.PROTECTED, - Modifier.PUBLIC, - Modifier.STATIC, - Modifier.STRICTFP, - Modifier.SYNCHRONIZED, - Modifier.TRANSIENT, - Modifier.VOLATILE, - }; - - for (int i=0; i< mods.length; i++) { - int m = mods[i]; - assertTrue(Modifier.isAbstract(m) == (m == Modifier.ABSTRACT)); - assertTrue(Modifier.isFinal(m) == (m == Modifier.FINAL)); - assertTrue(Modifier.isNative(m) == (m == Modifier.NATIVE)); - assertTrue(Modifier.isPrivate(m) == (m == Modifier.PRIVATE)); - assertTrue(Modifier.isProtected(m) == (m == Modifier.PROTECTED)); - assertTrue(Modifier.isPublic(m) == (m == Modifier.PUBLIC)); - assertTrue(Modifier.isStatic(m) == (m == Modifier.STATIC)); - assertTrue(Modifier.isStrictfp(m) == (m == Modifier.STRICTFP)); - assertTrue(Modifier.isSynchronized(m) == (m == Modifier.SYNCHRONIZED)); - assertTrue(Modifier.isTransient(m) == (m == Modifier.TRANSIENT)); - assertTrue(Modifier.isVolatile(m) == (m == Modifier.VOLATILE)); - } - - if (ast.apiLevel() == AST.JLS2) { - // node type introduced in 3.0 API - try { - ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD); - assertTrue(false); - } catch (UnsupportedOperationException e) { - // pass - } - try { - ast.newModifiers(Modifier.NONE); - assertTrue(false); - } catch (UnsupportedOperationException e) { - // pass - } - // skip rest of tests - return; - } - - // JLS3 only - long previousCount = ast.modificationCount(); - final Modifier x = ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD); - assertTrue(ast.modificationCount() > previousCount); - previousCount = ast.modificationCount(); - assertTrue(x.getAST() == ast); - assertTrue(x.getParent() == null); - assertTrue(x.getKeyword() == Modifier.ModifierKeyword.PUBLIC_KEYWORD); - assertTrue(x.getNodeType() == ASTNode.MODIFIER); - assertTrue(x.structuralPropertiesForType() == - Modifier.propertyDescriptors(ast.apiLevel())); - // make sure that reading did not change modification count - assertTrue(ast.modificationCount() == previousCount); - - // ModifierKeyword property - mandatory typesafe enumeration - // check the names of the modifiers - assertTrue(Modifier.ModifierKeyword.PUBLIC_KEYWORD.toString().equals("public")); //$NON-NLS-1$ - assertTrue(Modifier.ModifierKeyword.PROTECTED_KEYWORD.toString().equals("protected")); //$NON-NLS-1$ - assertTrue(Modifier.ModifierKeyword.PRIVATE_KEYWORD.toString().equals("private")); //$NON-NLS-1$ - assertTrue(Modifier.ModifierKeyword.STATIC_KEYWORD.toString().equals("static")); //$NON-NLS-1$ - assertTrue(Modifier.ModifierKeyword.ABSTRACT_KEYWORD.toString().equals("abstract")); //$NON-NLS-1$ - assertTrue(Modifier.ModifierKeyword.FINAL_KEYWORD.toString().equals("final")); //$NON-NLS-1$ - assertTrue(Modifier.ModifierKeyword.SYNCHRONIZED_KEYWORD.toString().equals("synchronized")); //$NON-NLS-1$ - assertTrue(Modifier.ModifierKeyword.NATIVE_KEYWORD.toString().equals("native")); //$NON-NLS-1$ - assertTrue(Modifier.ModifierKeyword.TRANSIENT_KEYWORD.toString().equals("transient")); //$NON-NLS-1$ - assertTrue(Modifier.ModifierKeyword.VOLATILE_KEYWORD.toString().equals("volatile")); //$NON-NLS-1$ - assertTrue(Modifier.ModifierKeyword.STRICTFP_KEYWORD.toString().equals("strictfp")); //$NON-NLS-1$ - - final Modifier.ModifierKeyword[] known = { - Modifier.ModifierKeyword.PUBLIC_KEYWORD, - Modifier.ModifierKeyword.PROTECTED_KEYWORD, - Modifier.ModifierKeyword.PRIVATE_KEYWORD, - Modifier.ModifierKeyword.STATIC_KEYWORD, - Modifier.ModifierKeyword.ABSTRACT_KEYWORD, - Modifier.ModifierKeyword.FINAL_KEYWORD, - Modifier.ModifierKeyword.SYNCHRONIZED_KEYWORD, - Modifier.ModifierKeyword.NATIVE_KEYWORD, - Modifier.ModifierKeyword.TRANSIENT_KEYWORD, - Modifier.ModifierKeyword.VOLATILE_KEYWORD, - Modifier.ModifierKeyword.STRICTFP_KEYWORD, - }; - - // check all modifiers are distinct - for (int i = 0; i < known.length; i++) { - for (int j = 0; j < known.length; j++) { - assertTrue(i == j || !known[i].equals(known[j])); - } - } - - // check all modifiers work - for (int i = 0; i < known.length; i++) { - previousCount = ast.modificationCount(); - x.setKeyword(known[i]); - assertTrue(ast.modificationCount() > previousCount); - assertTrue(x.getKeyword().equals(known[i])); - } - // ensure null does not work as an operator - try { - x.setKeyword(null); - assertTrue(false); - } catch (RuntimeException e) { - // pass - } - - // check toKeyword lookup of modifier by name - for (int i = 0; i < known.length; i++) { - String name = known[i].toString(); - assertTrue(Modifier.ModifierKeyword.toKeyword(name).equals(known[i])); - } - assertTrue(Modifier.ModifierKeyword.toKeyword("huh") == null); //$NON-NLS-1$ - - // check AST.newModifiers(flags) - for (int i = 0; i < mods.length; i++) { - int m = mods[i]; - List result = ast.newModifiers(m); - assertEquals(1, result.size()); - Modifier modNode = (Modifier) result.get(0); - assertEquals(m, modNode.getKeyword().toFlagValue()); - } - - // check AST.newModifiers ordering - final Modifier.ModifierKeyword[] expectedOrder = { - Modifier.ModifierKeyword.PUBLIC_KEYWORD, - Modifier.ModifierKeyword.PROTECTED_KEYWORD, - Modifier.ModifierKeyword.PRIVATE_KEYWORD, - Modifier.ModifierKeyword.ABSTRACT_KEYWORD, - Modifier.ModifierKeyword.STATIC_KEYWORD, - Modifier.ModifierKeyword.FINAL_KEYWORD, - Modifier.ModifierKeyword.SYNCHRONIZED_KEYWORD, - Modifier.ModifierKeyword.NATIVE_KEYWORD, - Modifier.ModifierKeyword.STRICTFP_KEYWORD, - Modifier.ModifierKeyword.TRANSIENT_KEYWORD, - Modifier.ModifierKeyword.VOLATILE_KEYWORD, - }; - int all = 0; - for (int i = 0; i < mods.length; i++) { - all |= mods[i]; - } - List result = ast.newModifiers(all); - assertEquals(expectedOrder.length, result.size()); - for (int i = 0; i< expectedOrder.length; i++) { - final Modifier modifier = ((Modifier) result.get(i)); - assertEquals(expectedOrder[i], modifier.getKeyword()); - if (modifier.isAbstract()) { - assertEquals(Modifier.ModifierKeyword.ABSTRACT_KEYWORD, modifier.getKeyword()); - } else if (modifier.isFinal()) { - assertEquals(Modifier.ModifierKeyword.FINAL_KEYWORD, modifier.getKeyword()); - } else if (modifier.isNative()) { - assertEquals(Modifier.ModifierKeyword.NATIVE_KEYWORD, modifier.getKeyword()); - } else if (modifier.isPrivate()) { - assertEquals(Modifier.ModifierKeyword.PRIVATE_KEYWORD, modifier.getKeyword()); - } else if (modifier.isProtected()) { - assertEquals(Modifier.ModifierKeyword.PROTECTED_KEYWORD, modifier.getKeyword()); - } else if (modifier.isPublic()) { - assertEquals(Modifier.ModifierKeyword.PUBLIC_KEYWORD, modifier.getKeyword()); - } else if (modifier.isStatic()) { - assertEquals(Modifier.ModifierKeyword.STATIC_KEYWORD, modifier.getKeyword()); - } else if (modifier.isStrictfp()) { - assertEquals(Modifier.ModifierKeyword.STRICTFP_KEYWORD, modifier.getKeyword()); - } else if (modifier.isSynchronized()) { - assertEquals(Modifier.ModifierKeyword.SYNCHRONIZED_KEYWORD, modifier.getKeyword()); - } else if (modifier.isTransient()) { - assertEquals(Modifier.ModifierKeyword.TRANSIENT_KEYWORD, modifier.getKeyword()); - } else { - assertEquals(Modifier.ModifierKeyword.VOLATILE_KEYWORD, modifier.getKeyword()); - } - } - } - - public void testSubtreeBytes() { - ASTNode x = SampleASTs.oneOfEach(ast); - final int subtreeBytes = x.subtreeBytes(); - assertTrue(subtreeBytes > 0); - } - - public void testNodeTypeConstants() { - // it would be a breaking API change to change the numeric values of - // public static final ints - assertTrue(ASTNode.ANONYMOUS_CLASS_DECLARATION == 1); - assertTrue(ASTNode.ARRAY_ACCESS == 2); - assertTrue(ASTNode.ARRAY_CREATION == 3); - assertTrue(ASTNode.ARRAY_INITIALIZER == 4); - assertTrue(ASTNode.ARRAY_TYPE == 5); - assertTrue(ASTNode.ASSIGNMENT == 7); - assertTrue(ASTNode.BLOCK == 8); - assertTrue(ASTNode.BOOLEAN_LITERAL == 9); - assertTrue(ASTNode.BREAK_STATEMENT == 10); - assertTrue(ASTNode.CATCH_CLAUSE == 12); - assertTrue(ASTNode.CHARACTER_LITERAL == 13); - assertTrue(ASTNode.CLASS_INSTANCE_CREATION == 14); - assertTrue(ASTNode.JAVASCRIPT_UNIT == 15); - assertTrue(ASTNode.CONDITIONAL_EXPRESSION == 16); - assertTrue(ASTNode.CONSTRUCTOR_INVOCATION == 17); - assertTrue(ASTNode.CONTINUE_STATEMENT == 18); - assertTrue(ASTNode.DO_STATEMENT == 19); - assertTrue(ASTNode.EMPTY_STATEMENT == 20); - assertTrue(ASTNode.EXPRESSION_STATEMENT == 21); - assertTrue(ASTNode.FIELD_ACCESS == 22); - assertTrue(ASTNode.FIELD_DECLARATION == 23); - assertTrue(ASTNode.FOR_STATEMENT == 24); - assertTrue(ASTNode.IF_STATEMENT == 25); - assertTrue(ASTNode.IMPORT_DECLARATION == 26); - assertTrue(ASTNode.INFIX_EXPRESSION == 27); - assertTrue(ASTNode.INITIALIZER == 28); - assertTrue(ASTNode.JSDOC == 29); - assertTrue(ASTNode.LABELED_STATEMENT == 30); - assertTrue(ASTNode.FUNCTION_DECLARATION == 31); - assertTrue(ASTNode.FUNCTION_INVOCATION == 32); - assertTrue(ASTNode.NULL_LITERAL == 33); - assertTrue(ASTNode.NUMBER_LITERAL == 34); - assertTrue(ASTNode.PACKAGE_DECLARATION == 35); - assertTrue(ASTNode.PARENTHESIZED_EXPRESSION == 36); - assertTrue(ASTNode.POSTFIX_EXPRESSION == 37); - assertTrue(ASTNode.PREFIX_EXPRESSION == 38); - assertTrue(ASTNode.PRIMITIVE_TYPE == 39); - assertTrue(ASTNode.QUALIFIED_NAME == 40); - assertTrue(ASTNode.RETURN_STATEMENT == 41); - assertTrue(ASTNode.SIMPLE_NAME == 42); - assertTrue(ASTNode.SIMPLE_TYPE == 43); - assertTrue(ASTNode.SINGLE_VARIABLE_DECLARATION == 44); - assertTrue(ASTNode.STRING_LITERAL == 45); - assertTrue(ASTNode.SUPER_CONSTRUCTOR_INVOCATION == 46); - assertTrue(ASTNode.SUPER_FIELD_ACCESS == 47); - assertTrue(ASTNode.SUPER_METHOD_INVOCATION == 48); - assertTrue(ASTNode.SWITCH_CASE == 49); - assertTrue(ASTNode.SWITCH_STATEMENT == 50); - assertTrue(ASTNode.THIS_EXPRESSION == 52); - assertTrue(ASTNode.THROW_STATEMENT == 53); - assertTrue(ASTNode.TRY_STATEMENT == 54); - assertTrue(ASTNode.TYPE_DECLARATION == 55); - assertTrue(ASTNode.TYPE_DECLARATION_STATEMENT == 56); - assertTrue(ASTNode.TYPE_LITERAL == 57); - assertTrue(ASTNode.VARIABLE_DECLARATION_EXPRESSION == 58); - assertTrue(ASTNode.VARIABLE_DECLARATION_FRAGMENT == 59); - assertTrue(ASTNode.VARIABLE_DECLARATION_STATEMENT == 60); - assertTrue(ASTNode.WHILE_STATEMENT == 61); - assertTrue(ASTNode.INSTANCEOF_EXPRESSION == 62); - assertTrue(ASTNode.LINE_COMMENT == 63); - assertTrue(ASTNode.BLOCK_COMMENT == 64); - assertTrue(ASTNode.TAG_ELEMENT == 65); - assertTrue(ASTNode.TEXT_ELEMENT == 66); - assertTrue(ASTNode.MEMBER_REF == 67); - assertTrue(ASTNode.FUNCTION_REF == 68); - assertTrue(ASTNode.FUNCTION_REF_PARAMETER == 69); - assertTrue(ASTNode.ENHANCED_FOR_STATEMENT == 70); - assertTrue(ASTNode.QUALIFIED_TYPE == 75); - assertTrue(ASTNode.MODIFIER == 100); - - // ensure that all constants are distinct, positive, and small - // (this may seem paranoid, but this test did uncover a stupid bug!) - int[] all= { - ASTNode.ANONYMOUS_CLASS_DECLARATION, - ASTNode.ARRAY_ACCESS, - ASTNode.ARRAY_CREATION, - ASTNode.ARRAY_INITIALIZER, - ASTNode.ARRAY_TYPE, - ASTNode.ASSIGNMENT, - ASTNode.BLOCK, - ASTNode.BLOCK_COMMENT, - ASTNode.BOOLEAN_LITERAL, - ASTNode.BREAK_STATEMENT, - ASTNode.CATCH_CLAUSE, - ASTNode.CHARACTER_LITERAL, - ASTNode.CLASS_INSTANCE_CREATION, - ASTNode.JAVASCRIPT_UNIT, - ASTNode.CONDITIONAL_EXPRESSION, - ASTNode.CONSTRUCTOR_INVOCATION, - ASTNode.CONTINUE_STATEMENT, - ASTNode.DO_STATEMENT, - ASTNode.EMPTY_STATEMENT, - ASTNode.ENHANCED_FOR_STATEMENT, - ASTNode.EXPRESSION_STATEMENT, - ASTNode.FIELD_ACCESS, - ASTNode.FIELD_DECLARATION, - ASTNode.FOR_STATEMENT, - ASTNode.IF_STATEMENT, - ASTNode.IMPORT_DECLARATION, - ASTNode.INFIX_EXPRESSION, - ASTNode.INSTANCEOF_EXPRESSION, - ASTNode.INITIALIZER, - ASTNode.JSDOC, - ASTNode.LABELED_STATEMENT, - ASTNode.LINE_COMMENT, - ASTNode.MEMBER_REF, - ASTNode.FUNCTION_DECLARATION, - ASTNode.FUNCTION_INVOCATION, - ASTNode.FUNCTION_REF, - ASTNode.FUNCTION_REF_PARAMETER, - ASTNode.MODIFIER, - ASTNode.NULL_LITERAL, - ASTNode.NUMBER_LITERAL, - ASTNode.PACKAGE_DECLARATION, - ASTNode.PARENTHESIZED_EXPRESSION, - ASTNode.POSTFIX_EXPRESSION, - ASTNode.PREFIX_EXPRESSION, - ASTNode.PRIMITIVE_TYPE, - ASTNode.QUALIFIED_NAME, - ASTNode.QUALIFIED_TYPE, - ASTNode.RETURN_STATEMENT, - ASTNode.SIMPLE_NAME, - ASTNode.SIMPLE_TYPE, - ASTNode.SINGLE_VARIABLE_DECLARATION, - ASTNode.STRING_LITERAL, - ASTNode.SUPER_CONSTRUCTOR_INVOCATION, - ASTNode.SUPER_FIELD_ACCESS, - ASTNode.SUPER_METHOD_INVOCATION, - ASTNode.SWITCH_CASE, - ASTNode.SWITCH_STATEMENT, - ASTNode.TAG_ELEMENT, - ASTNode.TEXT_ELEMENT, - ASTNode.THIS_EXPRESSION, - ASTNode.THROW_STATEMENT, - ASTNode.TRY_STATEMENT, - ASTNode.TYPE_DECLARATION, - ASTNode.TYPE_DECLARATION_STATEMENT, - ASTNode.TYPE_LITERAL, - ASTNode.VARIABLE_DECLARATION_EXPRESSION, - ASTNode.VARIABLE_DECLARATION_FRAGMENT, - ASTNode.VARIABLE_DECLARATION_STATEMENT, - ASTNode.WHILE_STATEMENT, - }; - int MIN = 1; - int MAX = 100; - Set s = new HashSet(); - for (int i=0; i= AST.JLS3) { - PT1S = "[(tM[(tS[(nSZZnS)]tS)]tM)]"; //$NON-NLS-1$ - - TP1S = "[(tTP[(nSxxnS)]tTP)]"; //$NON-NLS-1$ - - TP2S = "[(tTP[(nSyynS)]tTP)]"; //$NON-NLS-1$ - - - MOD1 = ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD); - MOD1S = "[(MODpublicpublicMOD)]"; //$NON-NLS-1$ - MOD2 = ast.newModifier(Modifier.ModifierKeyword.FINAL_KEYWORD); - MOD2S = "[(MODfinalfinalMOD)]"; //$NON-NLS-1$ - - } - - } - - protected void tearDown() throws Exception { - ast = null; - super.tearDown(); - } - - /** @deprecated using deprecated code */ - public String getName() { - String name = super.getName(); - switch (this.API_LEVEL) { - case AST.JLS2: - name = "JLS2 - " + name; - break; - case AST.JLS3: - name = "JLS3 - " + name; - break; - } - return name; - } - - class TestVisitor extends ASTVisitor { - - boolean visitTheKids = true; - - boolean visitDocTags; - - TestVisitor() { - this(false); - } - - TestVisitor(boolean visitDocTags) { - super(visitDocTags); - this.visitDocTags = visitDocTags; - } - - public boolean isVisitingChildren() { - return visitTheKids; - } - - public void setVisitingChildren(boolean visitChildren) { - visitTheKids = visitChildren; - } - - // NAMES - - public boolean visit(SimpleName node) { - b.append("(nS"); //$NON-NLS-1$ - b.append(node.getIdentifier()); - return isVisitingChildren(); - } - public void endVisit(SimpleName node) { - b.append(node.getIdentifier()); - b.append("nS)"); //$NON-NLS-1$ - } - public boolean visit(QualifiedName node) { - b.append("(nQ"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(QualifiedName node) { - b.append("nQ)"); //$NON-NLS-1$ - } - - // TYPES - - public boolean visit(SimpleType node) { - b.append("(tS"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(SimpleType node) { - b.append("tS)"); //$NON-NLS-1$ - } - public boolean visit(ArrayType node) { - b.append("(tA"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(ArrayType node) { - b.append("tA)"); //$NON-NLS-1$ - } - public boolean visit(PrimitiveType node) { - b.append("(tP"); //$NON-NLS-1$ - b.append(node.getPrimitiveTypeCode().toString()); - return isVisitingChildren(); - } - public void endVisit(PrimitiveType node) { - b.append(node.getPrimitiveTypeCode().toString()); - b.append("tP)"); //$NON-NLS-1$ - } - public boolean visit(QualifiedType node) { - b.append("(tQ"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(QualifiedType node) { - b.append("tQ)"); //$NON-NLS-1$ - } - - // EXPRESSIONS and STATEMENTS - - - public boolean visit(ArrayAccess node) { - b.append("(eAA"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(ArrayAccess node) { - b.append("eAA)"); //$NON-NLS-1$ - } - - public boolean visit(ArrayCreation node) { - b.append("(eAC"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(ArrayCreation node) { - b.append("eAC)"); //$NON-NLS-1$ - } - - public boolean visit(ArrayInitializer node) { - b.append("(eAI"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(ArrayInitializer node) { - b.append("eAI)"); //$NON-NLS-1$ - } - - public boolean visit(Assignment node) { - b.append("("); //$NON-NLS-1$ - b.append(node.getOperator().toString()); - return isVisitingChildren(); - } - public void endVisit(Assignment node) { - b.append(node.getOperator().toString()); - b.append(")"); //$NON-NLS-1$ - } - - public boolean visit(Block node) { - b.append("(sB"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(Block node) { - b.append("sB)"); //$NON-NLS-1$ - } - - public boolean visit(BooleanLiteral node) { - b.append("(eBL"); //$NON-NLS-1$ - b.append(node.booleanValue() ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$ - return isVisitingChildren(); - } - public void endVisit(BooleanLiteral node) { - b.append(node.booleanValue() ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$ - b.append("eBL)"); //$NON-NLS-1$ - } - - public boolean visit(BreakStatement node) { - b.append("(sBR"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(BreakStatement node) { - b.append("sBR)"); //$NON-NLS-1$ - } - - public boolean visit(CatchClause node) { - b.append("(cc"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(CatchClause node) { - b.append("cc)"); //$NON-NLS-1$ - } - - public boolean visit(CharacterLiteral node) { - b.append("(eCL"); //$NON-NLS-1$ - b.append(node.getEscapedValue()); - return isVisitingChildren(); - } - public void endVisit(CharacterLiteral node) { - b.append(node.getEscapedValue()); - b.append("eCL)"); //$NON-NLS-1$ - } - - public boolean visit(ClassInstanceCreation node) { - b.append("(eCI"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(ClassInstanceCreation node) { - b.append("eCI)"); //$NON-NLS-1$ - } - - public boolean visit(AnonymousClassDeclaration node) { - b.append("(ACD"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(AnonymousClassDeclaration node) { - b.append("ACD)"); //$NON-NLS-1$ - } - - public boolean visit(JavaScriptUnit node) { - b.append("(CU"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(JavaScriptUnit node) { - b.append("CU)"); //$NON-NLS-1$ - } - - public boolean visit(ConditionalExpression node) { - b.append("(eCO"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(ConditionalExpression node) { - b.append("eCO)"); //$NON-NLS-1$ - } - - public boolean visit(ConstructorInvocation node) { - b.append("(sCI"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(ConstructorInvocation node) { - b.append("sCI)"); //$NON-NLS-1$ - } - - public boolean visit(ContinueStatement node) { - b.append("(sCN"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(ContinueStatement node) { - b.append("sCN)"); //$NON-NLS-1$ - } - - public boolean visit(DoStatement node) { - b.append("(sDO"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(DoStatement node) { - b.append("sDO)"); //$NON-NLS-1$ - } - - public boolean visit(EmptyStatement node) { - b.append("(sEM"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(EmptyStatement node) { - b.append("sEM)"); //$NON-NLS-1$ - } - - public boolean visit(EnhancedForStatement node) { - b.append("(sEFR"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(EnhancedForStatement node) { - b.append("sEFR)"); //$NON-NLS-1$ - } - - public boolean visit(ExpressionStatement node) { - b.append("(sEX"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(ExpressionStatement node) { - b.append("sEX)"); //$NON-NLS-1$ - } - - public boolean visit(FieldAccess node) { - b.append("(eFA"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(FieldAccess node) { - b.append("eFA)"); //$NON-NLS-1$ - } - - public boolean visit(FieldDeclaration node) { - b.append("(FD"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(FieldDeclaration node) { - b.append("FD)"); //$NON-NLS-1$ - } - - public boolean visit(ForStatement node) { - b.append("(sFR"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(ForStatement node) { - b.append("sFR)"); //$NON-NLS-1$ - } - - public boolean visit(IfStatement node) { - b.append("(sIF"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(IfStatement node) { - b.append("sIF)"); //$NON-NLS-1$ - } - - public boolean visit(ImportDeclaration node) { - b.append("(ID"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(ImportDeclaration node) { - b.append("ID)"); //$NON-NLS-1$ - } - - public boolean visit(InfixExpression node) { - b.append("(eIN"); //$NON-NLS-1$ - b.append(node.getOperator().toString()); - return isVisitingChildren(); - } - public void endVisit(InfixExpression node) { - b.append(node.getOperator().toString()); - b.append("eIN)"); //$NON-NLS-1$ - } - - public boolean visit(InstanceofExpression node) { - b.append("(eIO"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(InstanceofExpression node) { - b.append("eIO)"); //$NON-NLS-1$ - } - - public boolean visit(Initializer node) { - b.append("(IN"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(Initializer node) { - b.append("IN)"); //$NON-NLS-1$ - } - - /** - * @deprecated (not really - just suppressing the warnings - * that come from testing Javadoc.getComment()) - * - */ - public boolean visit(JSdoc node) { - b.append("(JD"); //$NON-NLS-1$ - - // verify that children of Javadoc nodes are visited only if requested - if (visitDocTags) { - assertTrue(super.visit(node) == true); - } else { - assertTrue(super.visit(node) == false); - } - return isVisitingChildren() && super.visit(node); - } - - /** - * @deprecated (not really - just suppressing the warnings - * that come from testing Javadoc.getComment()) - * - */ - public void endVisit(JSdoc node) { - b.append("JD)"); //$NON-NLS-1$ - } - - public boolean visit(BlockComment node) { - b.append("(/*"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(BlockComment node) { - b.append("*/)"); //$NON-NLS-1$ - } - - public boolean visit(LineComment node) { - b.append("(//"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(LineComment node) { - b.append("//)"); //$NON-NLS-1$ - } - - public boolean visit(TagElement node) { - b.append("(TG"); //$NON-NLS-1$ - b.append(node.getTagName()); - return isVisitingChildren(); - } - public void endVisit(TagElement node) { - b.append(node.getTagName()); - b.append("TG)"); //$NON-NLS-1$ - } - - public boolean visit(TextElement node) { - b.append("(TX"); //$NON-NLS-1$ - b.append(node.getText()); - return isVisitingChildren(); - } - public void endVisit(TextElement node) { - b.append(node.getText()); - b.append("TX)"); //$NON-NLS-1$ - } - - public boolean visit(MemberRef node) { - b.append("(MBREF"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(MemberRef node) { - b.append("MBREF)"); //$NON-NLS-1$ - } - - public boolean visit(FunctionRef node) { - b.append("(MTHREF"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(FunctionRef node) { - b.append("MTHREF)"); //$NON-NLS-1$ - } - - public boolean visit(FunctionRefParameter node) { - b.append("(MPARM"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(FunctionRefParameter node) { - b.append("MPARM)"); //$NON-NLS-1$ - } - - public boolean visit(LabeledStatement node) { - b.append("(sLA"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(LabeledStatement node) { - b.append("sLA)"); //$NON-NLS-1$ - } - - public boolean visit(FunctionDeclaration node) { - b.append("(MD"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(FunctionDeclaration node) { - b.append("MD)"); //$NON-NLS-1$ - } - - public boolean visit(FunctionInvocation node) { - b.append("(eMI"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(FunctionInvocation node) { - b.append("eMI)"); //$NON-NLS-1$ - } - - public boolean visit(NullLiteral node) { - b.append("(eNL"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(NullLiteral node) { - b.append("eNL)"); //$NON-NLS-1$ - } - - public boolean visit(NumberLiteral node) { - b.append("(eNU"); //$NON-NLS-1$ - b.append(node.getToken()); - return isVisitingChildren(); - } - public void endVisit(NumberLiteral node) { - b.append(node.getToken()); - b.append("eNU)"); //$NON-NLS-1$ - } - - public boolean visit(PackageDeclaration node) { - b.append("(PD"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(PackageDeclaration node) { - b.append("PD)"); //$NON-NLS-1$ - } - - public boolean visit(ParenthesizedExpression node) { - b.append("(ePA"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(ParenthesizedExpression node) { - b.append("ePA)"); //$NON-NLS-1$ - } - - public boolean visit(PostfixExpression node) { - b.append("(ePO"); //$NON-NLS-1$ - b.append(node.getOperator().toString()); - return isVisitingChildren(); - } - public void endVisit(PostfixExpression node) { - b.append(node.getOperator().toString()); - b.append("ePO)"); //$NON-NLS-1$ - } - - public boolean visit(PrefixExpression node) { - b.append("(ePR"); //$NON-NLS-1$ - b.append(node.getOperator().toString()); - return isVisitingChildren(); - } - public void endVisit(PrefixExpression node) { - b.append(node.getOperator().toString()); - b.append("ePR)"); //$NON-NLS-1$ - } - - public boolean visit(ReturnStatement node) { - b.append("(sRT"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(ReturnStatement node) { - b.append("sRT)"); //$NON-NLS-1$ - } - - public boolean visit(SingleVariableDeclaration node) { - b.append("(VD"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(SingleVariableDeclaration node) { - b.append("VD)"); //$NON-NLS-1$ - } - - public boolean visit(StringLiteral node) { - b.append("(eSL"); //$NON-NLS-1$ - b.append(node.getLiteralValue()); - return isVisitingChildren(); - } - public void endVisit(StringLiteral node) { - b.append(node.getLiteralValue()); - b.append("eSL)"); //$NON-NLS-1$ - } - - public boolean visit(SuperConstructorInvocation node) { - b.append("(sSC"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(SuperConstructorInvocation node) { - b.append("sSC)"); //$NON-NLS-1$ - } - - public boolean visit(SuperFieldAccess node) { - b.append("(eSF"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(SuperFieldAccess node) { - b.append("eSF)"); //$NON-NLS-1$ - } - - public boolean visit(SuperMethodInvocation node) { - b.append("(eSM"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(SuperMethodInvocation node) { - b.append("eSM)"); //$NON-NLS-1$ - } - - public boolean visit(SwitchCase node) { - b.append("(sSC"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(SwitchCase node) { - b.append("sSC)"); //$NON-NLS-1$ - } - - public boolean visit(SwitchStatement node) { - b.append("(sSW"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(SwitchStatement node) { - b.append("sSW)"); //$NON-NLS-1$ - } - - public boolean visit(ThisExpression node) { - b.append("(eTH"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(ThisExpression node) { - b.append("eTH)"); //$NON-NLS-1$ - } - - public boolean visit(ThrowStatement node) { - b.append("(sTR"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(ThrowStatement node) { - b.append("sTR)"); //$NON-NLS-1$ - } - - public boolean visit(TryStatement node) { - b.append("(sTY"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(TryStatement node) { - b.append("sTY)"); //$NON-NLS-1$ - } - - public boolean visit(TypeDeclaration node) { - b.append("(TD"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(TypeDeclaration node) { - b.append("TD)"); //$NON-NLS-1$ - } - - public boolean visit(TypeDeclarationStatement node) { - b.append("(sTD"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(TypeDeclarationStatement node) { - b.append("sTD)"); //$NON-NLS-1$ - } - - public boolean visit(TypeLiteral node) { - b.append("(eTL"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(TypeLiteral node) { - b.append("eTL)"); //$NON-NLS-1$ - } - - public boolean visit(VariableDeclarationExpression node) { - b.append("(eVD"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(VariableDeclarationExpression node) { - b.append("eVD)"); //$NON-NLS-1$ - } - - public boolean visit(VariableDeclarationFragment node) { - b.append("(VS"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(VariableDeclarationFragment node) { - b.append("VS)"); //$NON-NLS-1$ - } - - public boolean visit(VariableDeclarationStatement node) { - b.append("(sVD"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(VariableDeclarationStatement node) { - b.append("sVD)"); //$NON-NLS-1$ - } - - public boolean visit(WhileStatement node) { - b.append("(sWH"); //$NON-NLS-1$ - return isVisitingChildren(); - } - public void endVisit(WhileStatement node) { - b.append("sWH)"); //$NON-NLS-1$ - } - - - public boolean visit(Modifier node) { - b.append("(MOD"); //$NON-NLS-1$ - b.append(node.getKeyword().toString()); - return isVisitingChildren(); - } - public void endVisit(Modifier node) { - b.append(node.getKeyword().toString()); - b.append("MOD)"); //$NON-NLS-1$ - } - - public void preVisit(ASTNode node) { - b.append("["); //$NON-NLS-1$ - } - - public void postVisit(ASTNode node) { - b.append("]"); //$NON-NLS-1$ - } - - } - // NAMES - public void testSimpleName() { - Name x1 = ast.newName(new String[]{"Z"}); //$NON-NLS-1$ - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue("[(nSZZnS)]".equals(result)); //$NON-NLS-1$ - } - - public void testQualifiedName() { - Name x1 = ast.newName(new String[]{"X", "Y"}); //$NON-NLS-1$ //$NON-NLS-2$ - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue("[(nQ[(nSXXnS)][(nSYYnS)]nQ)]".equals(result)); //$NON-NLS-1$ - } - - - // TYPES - public void testPrimitiveType() { - Type x1 = ast.newPrimitiveType(PrimitiveType.CHAR); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue("[(tPcharchartP)]".equals(result)); //$NON-NLS-1$ - } - - public void testSimpleType() { - Type x1 = ast.newSimpleType(ast.newName(new String[]{"Z"})); //$NON-NLS-1$ - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue("[(tS[(nSZZnS)]tS)]".equals(result)); //$NON-NLS-1$ - } - - public void testArrayType() { - Type x0 = ast.newPrimitiveType(PrimitiveType.CHAR); - Type x1 = ast.newArrayType(x0); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue("[(tA[(tPcharchartP)]tA)]".equals(result)); //$NON-NLS-1$ - } - - /** @deprecated using deprecated code */ - public void testQualifiedType() { - if (ast.apiLevel() == AST.JLS2) { - return; - } - QualifiedType x1 = ast.newQualifiedType(T1, N1); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(tQ"+T1S+N1S+"tQ)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - - // EXPRESSIONS and STATEMENTS - - public void testArrayAccess() { - ArrayAccess x1 = ast.newArrayAccess(); - x1.setArray(E1); - x1.setIndex(E2); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(eAA"+E1S+E2S+"eAA)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - - public void testArrayCreation() { - ArrayCreation x1 = ast.newArrayCreation(); - x1.setType(ast.newArrayType(T1)); - x1.dimensions().add(E1); - x1.dimensions().add(E2); - x1.setInitializer(ast.newArrayInitializer()); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(eAC"+"[(tA"+T1S+"tA)]"+E1S+E2S+"[(eAIeAI)]eAC)]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - } - public void testArrayInitializer() { - ArrayInitializer x1 = ast.newArrayInitializer(); - x1.expressions().add(E1); - x1.expressions().add(E2); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(eAI"+E1S+E2S+"eAI)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - public void testAssignment() { - Assignment x1 = ast.newAssignment(); - x1.setLeftHandSide(E1); - x1.setRightHandSide(E2); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(="+E1S+E2S+"=)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - public void testBlock() { - Block x1 = ast.newBlock(); - x1.statements().add(S1); - x1.statements().add(S2); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(sB"+S1S+S2S+"sB)]")); //$NON-NLS-1$ //$NON-NLS-2$ - - // check that visiting children can be cut off - v1.setVisitingChildren(false); - b.setLength(0); - x1.accept(v1); - result = b.toString(); - assertTrue(result.equals("[(sBsB)]")); //$NON-NLS-1$ - } - - public void testBlockComment() { - BlockComment x1 = ast.newBlockComment(); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue("[(/**/)]".equals(result)); //$NON-NLS-1$ - } - - public void testBooleanLiteral() { - BooleanLiteral x1 = ast.newBooleanLiteral(true); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(eBLtruetrueeBL)]")); //$NON-NLS-1$ - } - public void testBreakStatement() { - BreakStatement x1 = ast.newBreakStatement(); - x1.setLabel(N1); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(sBR"+N1S+"sBR)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - public void testCatchClause() { - CatchClause x1 = ast.newCatchClause(); - x1.setException(V1); - x1.setBody(B1); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(cc"+V1S+B1S+"cc)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - public void testCharacterLiteral() { - CharacterLiteral x1 = ast.newCharacterLiteral(); - x1.setCharValue('q'); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(eCL'q''q'eCL)]")); //$NON-NLS-1$ - } - /** @deprecated using deprecated code */ - public void testClassInstanceCreation() { - ClassInstanceCreation x1 = ast.newClassInstanceCreation(); - x1.setExpression(E1); - if (ast.apiLevel() == AST.JLS2) { - x1.setName(N1); - } else { - x1.setType(T1); - } - x1.setAnonymousClassDeclaration(ACD1); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - if (ast.apiLevel() == AST.JLS2) { - assertTrue(result.equals("[(eCI"+E1S+N1S+ACD1S+"eCI)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } else { - assertTrue(result.equals("[(eCI"+E1S+PT1S+T1S+ACD1S+"eCI)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - public void testAnonymousClassDeclaration() { - AnonymousClassDeclaration x1 = ast.newAnonymousClassDeclaration(); - x1.bodyDeclarations().add(FD1); - x1.bodyDeclarations().add(FD2); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(ACD"+FD1S+FD2S+"ACD)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - public void testCompilationUnit() { - JavaScriptUnit x1 = ast.newJavaScriptUnit(); - x1.setPackage(PD1); - x1.imports().add(ID1); - x1.imports().add(ID2); - x1.types().add(TD1); - x1.types().add(TD2); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(CU"+PD1S+ID1S+ID2S+TD1S+TD2S+"CU)]")); //$NON-NLS-1$ //$NON-NLS-2$ - - // check that visiting children can be cut off - v1.setVisitingChildren(false); - b.setLength(0); - x1.accept(v1); - result = b.toString(); - assertTrue(result.equals("[(CUCU)]")); //$NON-NLS-1$ - } - public void testConditionalExpression() { - ConditionalExpression x1 = ast.newConditionalExpression(); - x1.setExpression(E1); - x1.setThenExpression(E2); - x1.setElseExpression(N1); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(eCO"+E1S+E2S+N1S+"eCO)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - /** @deprecated using deprecated code */ - public void testConstructorInvocation() { - ConstructorInvocation x1 = ast.newConstructorInvocation(); - x1.arguments().add(E1); - x1.arguments().add(E2); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - if (ast.apiLevel() == AST.JLS2) { - assertTrue(result.equals("[(sCI"+E1S+E2S+"sCI)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } else { - assertTrue(result.equals("[(sCI"+PT1S+E1S+E2S+"sCI)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - public void testContinueStatement() { - ContinueStatement x1 = ast.newContinueStatement(); - x1.setLabel(N1); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(sCN"+N1S+"sCN)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - public void testDoStatement() { - DoStatement x1 = ast.newDoStatement(); - x1.setExpression(E1); - x1.setBody(S1); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(sDO"+S1S+E1S+"sDO)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - public void testEmptyStatement() { - EmptyStatement x1 = ast.newEmptyStatement(); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(sEMsEM)]")); //$NON-NLS-1$ - } - public void testExpressionStatement() { - ExpressionStatement x1 = ast.newExpressionStatement(E1); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(sEX"+E1S+"sEX)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - public void testFieldAccess() { - FieldAccess x1 = ast.newFieldAccess(); - x1.setExpression(E1); - x1.setName(N1); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(eFA"+E1S+N1S+"eFA)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - /** @deprecated using deprecated code */ - public void testFieldDeclaration() { - FieldDeclaration x1 = ast.newFieldDeclaration(W1); - x1.setJavadoc(JD1); - if (ast.apiLevel() >= AST.JLS3) { - x1.modifiers().add(MOD1); - x1.modifiers().add(MOD2); - } - x1.setType(T1); - x1.fragments().add(W2); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - if (ast.apiLevel() == AST.JLS2) { - assertTrue(result.equals("[(FD"+JD1S+T1S+W1S+W2S+"FD)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } else { - assertTrue(result.equals("[(FD"+JD1S+MOD1S+MOD2S+T1S+W1S+W2S+"FD)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - public void testForStatement() { - ForStatement x1 = ast.newForStatement(); - x1.initializers().add(E1); - x1.initializers().add(E2); - x1.setExpression(N1); - x1.updaters().add(N2); - x1.updaters().add(N3); - x1.setBody(S1); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(sFR"+E1S+E2S+N1S+N2S+N3S+S1S+"sFR)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - /** @deprecated using deprecated code */ - public void testEnhancedForStatement() { - if (ast.apiLevel() == AST.JLS2) { - return; - } - EnhancedForStatement x1 = ast.newEnhancedForStatement(); - x1.setParameter(V1); - x1.setExpression(E1); - x1.setBody(S1); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(sEFR"+V1S+E1S+S1S+"sEFR)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - public void testIfStatement() { - IfStatement x1 = ast.newIfStatement(); - x1.setExpression(E1); - x1.setThenStatement(S1); - x1.setElseStatement(S2); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(sIF"+E1S+S1S+S2S+"sIF)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - public void testImportDeclaration() { - ImportDeclaration x1 = ast.newImportDeclaration(); - x1.setName(N1); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(ID"+N1S+"ID)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - public void testInfixExpression() { - InfixExpression x1 = ast.newInfixExpression(); - x1.setOperator(InfixExpression.Operator.PLUS); - x1.setLeftOperand(E1); - x1.setRightOperand(E2); - x1.extendedOperands().add(N1); - x1.extendedOperands().add(N2); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(eIN+"+E1S+E2S+N1S+N2S+"+eIN)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - public void testInstanceofExpression() { - InstanceofExpression x1 = ast.newInstanceofExpression(); - x1.setLeftOperand(E1); - x1.setRightOperand(T1); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(eIO"+E1S+T1S+"eIO)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - /** @deprecated using deprecated code */ - public void testInitializer() { - Initializer x1 = ast.newInitializer(); - x1.setJavadoc(JD1); - if (ast.apiLevel() >= AST.JLS3) { - x1.modifiers().add(MOD1); - x1.modifiers().add(MOD2); - } - x1.setBody(B1); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - if (ast.apiLevel() == AST.JLS2) { - assertTrue(result.equals("[(IN"+JD1S+B1S+"IN)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } else { - assertTrue(result.equals("[(IN"+JD1S+MOD1S+MOD2S+B1S+"IN)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * @deprecated (not really - just suppressing the warnings - * that come from testing Javadoc.getComment()) - * - */ - public void testJavadoc() { - JSdoc x1 = ast.newJSdoc(); - x1.tags().add(TAG1); - - // ASTVisitor() does not visit doc tags - { - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(("[(JDJD)]").equals(result)); //$NON-NLS-1$ - } - - // ASTVisitor(false) does not visit doc tags - { - TestVisitor v1 = new TestVisitor(false); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(("[(JDJD)]").equals(result)); //$NON-NLS-1$ - } - - // ASTVisitor(true) does visit doc tags - { - TestVisitor v1 = new TestVisitor(true); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(("[(JD"+TAG1S+"JD)]").equals(result)); //$NON-NLS-1$ - } - } - - public void testLabeledStatement() { - LabeledStatement x1 = ast.newLabeledStatement(); - x1.setLabel(N1); - x1.setBody(S1); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(sLA"+N1S+S1S+"sLA)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - - public void testLineComment() { - LineComment x1 = ast.newLineComment(); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue("[(////)]".equals(result)); //$NON-NLS-1$ - } - - public void testMemberRef() { - MemberRef x1 = ast.newMemberRef(); - x1.setQualifier(N1); - x1.setName(N2); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(MBREF"+N1S+N2S+"MBREF)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** @deprecated using deprecated code */ - public void testMethodDeclaration() { - FunctionDeclaration x1 = ast.newFunctionDeclaration(); - x1.setJavadoc(JD1); - if (ast.apiLevel() == AST.JLS2) { - x1.setReturnType(T1); - } else { - x1.modifiers().add(MOD1); - x1.modifiers().add(MOD2); - x1.setReturnType2(T1); - } - x1.setName(N1); - x1.parameters().add(V1); - x1.parameters().add(V2); - x1.thrownExceptions().add(N2); - x1.thrownExceptions().add(N3); - x1.setBody(B1); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - if (ast.apiLevel() == AST.JLS2) { - assertTrue(result.equals("[(MD"+JD1S+T1S+N1S+V1S+V2S+N2S+N3S+B1S+"MD)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } else { - assertTrue(result.equals("[(MD"+JD1S+MOD1S+MOD2S+TP1S+T1S+N1S+V1S+V2S+N2S+N3S+B1S+"MD)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - /** @deprecated using deprecated code */ - public void testMethodInvocation() { - FunctionInvocation x1 = ast.newFunctionInvocation(); - x1.setExpression(N1); - x1.setName(N2); - x1.arguments().add(E1); - x1.arguments().add(E2); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - if (ast.apiLevel() == AST.JLS2) { - assertTrue(result.equals("[(eMI"+N1S+N2S+E1S+E2S+"eMI)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } else { - assertTrue(result.equals("[(eMI"+N1S+PT1S+N2S+E1S+E2S+"eMI)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - public void testMethodRef() { - FunctionRef x1 = ast.newFunctionRef(); - x1.setQualifier(N1); - x1.setName(N2); - x1.parameters().add(MPARM1); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(MTHREF"+N1S+N2S+MPARM1S+"MTHREF)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - - public void testMethodRefParameter() { - FunctionRefParameter x1 = ast.newFunctionRefParameter(); - x1.setType(T1); - x1.setName(N1); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(MPARM"+T1S+N1S+"MPARM)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** @deprecated using deprecated code */ - public void testModifier() { - if (ast.apiLevel() == AST.JLS2) { - return; - } - Modifier x1 = ast.newModifier(Modifier.ModifierKeyword.PRIVATE_KEYWORD); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(MODprivateprivateMOD)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - - public void testNullLiteral() { - NullLiteral x1 = ast.newNullLiteral(); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(eNLeNL)]")); //$NON-NLS-1$ - } - public void testNumberLiteral() { - NumberLiteral x1 = ast.newNumberLiteral("1.0"); //$NON-NLS-1$ - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(eNU1.01.0eNU)]")); //$NON-NLS-1$ - } - public void testParenthesizedExpression() { - ParenthesizedExpression x1 = ast.newParenthesizedExpression(); - x1.setExpression(E1); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(ePA"+E1S+"ePA)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - public void testPostfixExpression() { - PostfixExpression x1 = ast.newPostfixExpression(); - x1.setOperand(E1); - x1.setOperator(PostfixExpression.Operator.INCREMENT); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(ePO++"+E1S+"++ePO)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - public void testPrefixExpression() { - PrefixExpression x1 = ast.newPrefixExpression(); - x1.setOperand(E1); - x1.setOperator(PrefixExpression.Operator.INCREMENT); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(ePR++"+E1S+"++ePR)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - public void testReturnStatement() { - ReturnStatement x1 = ast.newReturnStatement(); - x1.setExpression(E1); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(sRT"+E1S+"sRT)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - public void testStringLiteral() { - StringLiteral x1 = ast.newStringLiteral(); - x1.setLiteralValue("H"); //$NON-NLS-1$ - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(eSLHHeSL)]")); //$NON-NLS-1$ - } - /** @deprecated using deprecated code */ - public void testSuperConstructorInvocation() { - SuperConstructorInvocation x1 = ast.newSuperConstructorInvocation(); - x1.setExpression(N1); - x1.arguments().add(E1); - x1.arguments().add(E2); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - if (ast.apiLevel() == AST.JLS2) { - assertTrue(result.equals("[(sSC"+N1S+E1S+E2S+"sSC)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } else { - assertTrue(result.equals("[(sSC"+N1S+PT1S+E1S+E2S+"sSC)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - public void testSuperFieldAccess() { - SuperFieldAccess x1 = ast.newSuperFieldAccess(); - x1.setQualifier(N1); - x1.setName(N2); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(eSF"+N1S+N2S+"eSF)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - /** @deprecated using deprecated code */ - public void testSuperMethodInvocation() { - SuperMethodInvocation x1 = ast.newSuperMethodInvocation(); - x1.setQualifier(N1); - x1.setName(N2); - x1.arguments().add(E1); - x1.arguments().add(E2); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - if (ast.apiLevel() == AST.JLS2) { - assertTrue(result.equals("[(eSM"+N1S+N2S+E1S+E2S+"eSM)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } else { - assertTrue(result.equals("[(eSM"+N1S+PT1S+N2S+E1S+E2S+"eSM)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - public void testSwitchCase() { - SwitchCase x1 = ast.newSwitchCase(); - x1.setExpression(E1); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(sSC"+E1S+"sSC)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - public void testSwitchStatement() { - SwitchStatement x1 = ast.newSwitchStatement(); - x1.setExpression(E1); - x1.statements().add(S1); - x1.statements().add(S2); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(sSW"+E1S+S1S+S2S+"sSW)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - - public void testTagElement() { - TagElement x1 = ast.newTagElement(); - x1.setTagName("x"); //$NON-NLS-1$ - x1.fragments().add(TAG1); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(("[(TGx"+TAG1S+"xTG)]").equals(result)); //$NON-NLS-1$ //$NON-NLS-2$ - } - - public void testTextElement() { - TextElement x1 = ast.newTextElement(); - x1.setText("x"); //$NON-NLS-1$ - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue("[(TXxxTX)]".equals(result)); //$NON-NLS-1$ - } - - public void testThisExpression() { - ThisExpression x1 = ast.newThisExpression(); - x1.setQualifier(N1); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(eTH"+N1S+"eTH)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - public void testThrowStatement() { - ThrowStatement x1 = ast.newThrowStatement(); - x1.setExpression(E1); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(sTR"+E1S+"sTR)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - public void testTryStatement() { - TryStatement x1 = ast.newTryStatement(); - x1.setBody(B1); - CatchClause c1 = ast.newCatchClause(); - c1.setException(V1); - c1.setBody(ast.newBlock()); - x1.catchClauses().add(c1); - CatchClause c2 = ast.newCatchClause(); - c2.setException(V2); - c2.setBody(ast.newBlock()); - x1.catchClauses().add(c2); - x1.setFinally(ast.newBlock()); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(sTY"+B1S+"[(cc"+V1S+"[(sBsB)]"+"cc)]"+"[(cc"+V2S+"[(sBsB)]"+"cc)]"+"[(sBsB)]"+"sTY)]")); //$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$ - } - /** @deprecated using deprecated code */ - public void testTypeDeclaration() { - TypeDeclaration x1 = ast.newTypeDeclaration(); - x1.setJavadoc(JD1); - x1.setName(N1); - if (ast.apiLevel() == AST.JLS2) { - x1.setSuperclass(N2); - } else { - x1.modifiers().add(MOD1); - x1.modifiers().add(MOD2); - } - x1.bodyDeclarations().add(FD1); - x1.bodyDeclarations().add(FD2); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - if (ast.apiLevel() == AST.JLS2) { - assertTrue(result.equals("[(TD"+JD1S+N1S+N2S+FD1S+FD2S+"TD)]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } else { - assertTrue(result.equals("[(TD"+JD1S+MOD1S+MOD2S+N1S+TP1S+PT1S+T1S+T2S+FD1S+FD2S+"TD)]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } - } - public void testTypeDeclarationStatement() { - TypeDeclarationStatement x1 = ast.newTypeDeclarationStatement(TD1); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(sTD"+TD1S+"sTD)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - public void testTypeLiteral() { - TypeLiteral x1 = ast.newTypeLiteral(); - x1.setType(T1); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(eTL"+T1S+"eTL)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - /** @deprecated using deprecated code */ - public void testSingleVariableDeclaration() { - SingleVariableDeclaration x1 = ast.newSingleVariableDeclaration(); - if (ast.apiLevel() >= AST.JLS3) { - x1.modifiers().add(MOD1); - x1.modifiers().add(MOD2); - } - x1.setType(T1); - x1.setName(N1); - x1.setInitializer(E1); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - if (ast.apiLevel() == AST.JLS2) { - assertTrue(result.equals("[(VD"+T1S+N1S+E1S+"VD)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } else { - assertTrue(result.equals("[(VD"+MOD1S+MOD2S+T1S+N1S+E1S+"VD)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - public void testVariableDeclarationFragment() { - VariableDeclarationFragment x1 = ast.newVariableDeclarationFragment(); - x1.setName(N1); - x1.setInitializer(E1); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(VS"+N1S+E1S+"VS)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - /** @deprecated using deprecated code */ - public void testVariableDeclarationExpression() { - VariableDeclarationExpression x1 = ast.newVariableDeclarationExpression(W1); - if (ast.apiLevel() >= AST.JLS3) { - x1.modifiers().add(MOD1); - x1.modifiers().add(MOD2); - } - x1.setType(T1); - x1.fragments().add(W2); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - if (ast.apiLevel() == AST.JLS2) { - assertTrue(result.equals("[(eVD"+T1S+W1S+W2S+"eVD)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } else { - assertTrue(result.equals("[(eVD"+MOD1S+MOD2S+T1S+W1S+W2S+"eVD)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - /** @deprecated using deprecated code */ - public void testVariableDeclarationStatement() { - VariableDeclarationStatement x1 = ast.newVariableDeclarationStatement(W1); - if (ast.apiLevel() >= AST.JLS3) { - x1.modifiers().add(MOD1); - x1.modifiers().add(MOD2); - } - x1.setType(T1); - x1.fragments().add(W2); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - if (ast.apiLevel() == AST.JLS2) { - assertTrue(result.equals("[(sVD"+T1S+W1S+W2S+"sVD)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } else { - assertTrue(result.equals("[(sVD"+MOD1S+MOD2S+T1S+W1S+W2S+"sVD)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - public void testWhileStatement() { - WhileStatement x1 = ast.newWhileStatement(); - x1.setExpression(E1); - x1.setBody(S1); - TestVisitor v1 = new TestVisitor(); - b.setLength(0); - x1.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[(sWH"+E1S+S1S+"sWH)]")); //$NON-NLS-1$ //$NON-NLS-2$ - } - - public void testPrePost() { - SimpleName n1 = ast.newSimpleName("a"); //$NON-NLS-1$ - SimpleName n2 = ast.newSimpleName("b"); //$NON-NLS-1$ - QualifiedName q = ast.newQualifiedName(n1, n2); - TestVisitor v1 = new TestVisitor() { - public void preVisit(ASTNode node) { - b.append("["); //$NON-NLS-1$ - switch (node.getNodeType()) { - case ASTNode.QUALIFIED_NAME : - b.append("q"); //$NON-NLS-1$ - break; - case ASTNode.SIMPLE_NAME : - b.append(((SimpleName) node).getIdentifier()); - break; - } - } - - public void postVisit(ASTNode node) { - switch (node.getNodeType()) { - case ASTNode.QUALIFIED_NAME : - b.append("q"); //$NON-NLS-1$ - break; - case ASTNode.SIMPLE_NAME : - b.append(((SimpleName) node).getIdentifier()); - break; - } - b.append("]"); //$NON-NLS-1$ - } - }; - - b.setLength(0); - q.accept(v1); - String result = b.toString(); - assertTrue(result.equals("[q(nQ" + "[a(nSaanS)a]" + "[b(nSbbnS)b]" + "nQ)q]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - } - public void testTraverseAndModify() { - final TypeDeclaration typeDeclaration = ast.newTypeDeclaration(); - typeDeclaration.setName(N1); - FunctionDeclaration methodDeclaration = ast.newFunctionDeclaration(); - methodDeclaration.setName(ast.newSimpleName("M1")); //$NON-NLS-1$ - typeDeclaration.bodyDeclarations().add(0, methodDeclaration); - final FunctionDeclaration methodDeclaration2 = ast.newFunctionDeclaration(); - methodDeclaration2.setName(ast.newSimpleName("M2")); //$NON-NLS-1$ - typeDeclaration.bodyDeclarations().add(1, methodDeclaration2); - FunctionDeclaration methodDeclaration3 = ast.newFunctionDeclaration(); - methodDeclaration3.setName(ast.newSimpleName("M3")); //$NON-NLS-1$ - typeDeclaration.bodyDeclarations().add(2, methodDeclaration3); - // insert a new before the current node during a traverse - TestVisitor v1 = new TestVisitor() { - public boolean visit(FunctionDeclaration node) { - if (node == methodDeclaration2) { - FunctionDeclaration methodDeclaration4 = ast.newFunctionDeclaration(); - methodDeclaration4.setName(ast.newSimpleName("M4")); //$NON-NLS-1$ - typeDeclaration.bodyDeclarations().add(0, methodDeclaration4); - } - return super.visit(node); - } - }; - b.setLength(0); - typeDeclaration.accept(v1); - assertEquals("wrong output", "[(TD[(nSNNnS)][(MD[(tPvoidvoidtP)][(nSM1M1nS)]MD)][(MD[(tPvoidvoidtP)][(nSM2M2nS)]MD)][(MD[(tPvoidvoidtP)][(nSM3M3nS)]MD)]TD)]", b.toString()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - public void testTraverseAndModify_2() { - final TypeDeclaration typeDeclaration = ast.newTypeDeclaration(); - typeDeclaration.setName(N1); - FunctionDeclaration methodDeclaration = ast.newFunctionDeclaration(); - methodDeclaration.setName(ast.newSimpleName("M1")); //$NON-NLS-1$ - typeDeclaration.bodyDeclarations().add(0, methodDeclaration); - final FunctionDeclaration methodDeclaration2 = ast.newFunctionDeclaration(); - methodDeclaration2.setName(ast.newSimpleName("M2")); //$NON-NLS-1$ - typeDeclaration.bodyDeclarations().add(1, methodDeclaration2); - FunctionDeclaration methodDeclaration3 = ast.newFunctionDeclaration(); - methodDeclaration3.setName(ast.newSimpleName("M3")); //$NON-NLS-1$ - typeDeclaration.bodyDeclarations().add(2, methodDeclaration3); - // insert a new after the current node during a traverse - TestVisitor v1 = new TestVisitor() { - public boolean visit(FunctionDeclaration node) { - if (node == methodDeclaration2) { - FunctionDeclaration methodDeclaration4 = ast.newFunctionDeclaration(); - methodDeclaration4.setName(ast.newSimpleName("M4")); //$NON-NLS-1$ - typeDeclaration.bodyDeclarations().add(3, methodDeclaration4); - } - return super.visit(node); - } - }; - b.setLength(0); - typeDeclaration.accept(v1); - assertEquals("wrong output", "[(TD[(nSNNnS)][(MD[(tPvoidvoidtP)][(nSM1M1nS)]MD)][(MD[(tPvoidvoidtP)][(nSM2M2nS)]MD)][(MD[(tPvoidvoidtP)][(nSM3M3nS)]MD)][(MD[(tPvoidvoidtP)][(nSM4M4nS)]MD)]TD)]", b.toString()); //$NON-NLS-1$ //$NON-NLS-2$ - } - public void testTraverseAndModify_3() { - final InfixExpression infixExpression = ast.newInfixExpression(); - infixExpression.setLeftOperand(ast.newSimpleName("i")); //$NON-NLS-1$ - infixExpression.setRightOperand(ast.newNumberLiteral("10")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.PLUS); - // insert a new after the current node during a traverse - TestVisitor v1 = new TestVisitor() { - public boolean visit(SimpleName node) { - infixExpression.setRightOperand(ast.newNumberLiteral("22")); //$NON-NLS-1$ - return super.visit(node); - } - }; - b.setLength(0); - infixExpression.accept(v1); - assertEquals("wrong output", "[(eIN+[(nSiinS)][(eNU2222eNU)]+eIN)]", b.toString()); //$NON-NLS-1$ //$NON-NLS-2$ - } - public void testTraverseAndModify_4() { - final InfixExpression infixExpression = ast.newInfixExpression(); - infixExpression.setLeftOperand(ast.newSimpleName("i")); //$NON-NLS-1$ - infixExpression.setRightOperand(ast.newNumberLiteral("10")); //$NON-NLS-1$ - infixExpression.setOperator(InfixExpression.Operator.PLUS); - // insert a new before the current node during a traverse - TestVisitor v1 = new TestVisitor() { - public boolean visit(NumberLiteral node) { - infixExpression.setLeftOperand(ast.newSimpleName("j")); //$NON-NLS-1$ - return super.visit(node); - } - }; - b.setLength(0); - infixExpression.accept(v1); - assertEquals("wrong output", "[(eIN+[(nSiinS)][(eNU1010eNU)]+eIN)]", b.toString()); //$NON-NLS-1$ //$NON-NLS-2$ - } -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/AbstractASTTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/AbstractASTTests.java deleted file mode 100644 index a4e30de..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/AbstractASTTests.java +++ /dev/null @@ -1,548 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 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.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.wst.jsdt.core.IBuffer; -import org.eclipse.wst.jsdt.core.IClassFile; -import org.eclipse.wst.jsdt.core.IJavaScriptUnit; -import org.eclipse.wst.jsdt.core.IJavaScriptProject; -import org.eclipse.wst.jsdt.core.IProblemRequestor; -import org.eclipse.wst.jsdt.core.JavaScriptModelException; -import org.eclipse.wst.jsdt.core.WorkingCopyOwner; -import org.eclipse.wst.jsdt.core.compiler.CharOperation; -import org.eclipse.wst.jsdt.core.compiler.IProblem; -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.ASTRequestor; -import org.eclipse.wst.jsdt.core.dom.ASTVisitor; -import org.eclipse.wst.jsdt.core.dom.AnonymousClassDeclaration; -import org.eclipse.wst.jsdt.core.dom.ArrayType; -import org.eclipse.wst.jsdt.core.dom.Assignment; -import org.eclipse.wst.jsdt.core.dom.JavaScriptUnit; -import org.eclipse.wst.jsdt.core.dom.IBinding; -import org.eclipse.wst.jsdt.core.dom.IFunctionBinding; -import org.eclipse.wst.jsdt.core.dom.ITypeBinding; -import org.eclipse.wst.jsdt.core.dom.IVariableBinding; -import org.eclipse.wst.jsdt.core.dom.FunctionDeclaration; -import org.eclipse.wst.jsdt.core.dom.FunctionInvocation; -import org.eclipse.wst.jsdt.core.dom.PackageDeclaration; -import org.eclipse.wst.jsdt.core.dom.QualifiedName; -import org.eclipse.wst.jsdt.core.dom.SimpleName; -import org.eclipse.wst.jsdt.core.dom.SimpleType; -import org.eclipse.wst.jsdt.core.dom.TypeDeclaration; -import org.eclipse.wst.jsdt.core.dom.TypeDeclarationStatement; -import org.eclipse.wst.jsdt.core.tests.model.ModifyingResourceTests; -import org.eclipse.wst.jsdt.core.tests.util.Util; - -public class AbstractASTTests extends ModifyingResourceTests { - - public AbstractASTTests(String name) { - super(name); - } - - /* - * Removes the *start* and *end* markers from the given source and remembers - * the positions. - */ - public class MarkerInfo { - String path; - String source; - int[] astStarts, astEnds; - - public MarkerInfo(String source) { - this(null, source); - } - - public MarkerInfo(String path, String source) { - this.path = path; - this.source = source; - - int markerIndex = 1; - while (source.indexOf("/*start" + markerIndex + "*/") != -1) { - markerIndex++; - } - int astNumber = source.indexOf("/*start*/") != -1 ? markerIndex - : markerIndex - 1; - this.astStarts = new int[astNumber]; - this.astEnds = new int[astNumber]; - - for (int i = 1; i < markerIndex; i++) - setStartAndEnd(i); - if (astNumber == markerIndex) - setStartAndEnd(-1); - } - - public int indexOfASTStart(int astStart) { - for (int i = 0, length = this.astStarts.length; i < length; i++) - if (this.astStarts[i] == astStart) - return i; - return -1; - } - - private void removeMarkerFromSource(String marker, int sourceIndex, - int astNumber) { - char[] markerChars = marker.toCharArray(); - this.source = new String(CharOperation.replace(this.source - .toCharArray(), markerChars, CharOperation.NO_CHAR)); - // shift previously recorded positions - int markerLength = markerChars.length; - for (int i = 0; i < astNumber; i++) { - if (this.astStarts[i] > sourceIndex) - this.astStarts[i] -= markerLength; - if (this.astEnds[i] > sourceIndex) - this.astEnds[i] -= markerLength; - } - } - - private void setStartAndEnd(int markerIndex) { - String markerNumber; - if (markerIndex == -1) { - markerNumber = ""; - markerIndex = this.astStarts.length; // *start* is always last - } else - markerNumber = Integer.toString(markerIndex); - - String markerStart = "/*start" + markerNumber + "*/"; - String markerEnd = "/*end" + markerNumber + "*/"; - int astStart = source.indexOf(markerStart); // start of AST - // inclusive - this.astStarts[markerIndex - 1] = astStart; - removeMarkerFromSource(markerStart, astStart, markerIndex - 1); - int astEnd = this.source.indexOf(markerEnd); // end of AST exclusive - this.astEnds[markerIndex - 1] = astEnd; - removeMarkerFromSource(markerEnd, astEnd, markerIndex - 1); - } - - } - - public class BindingRequestor extends ASTRequestor { - HashMap bindings = new HashMap(); - - public void acceptBinding(String bindingKey, IBinding binding) { - this.bindings.put(bindingKey, binding); - } - - public IBinding[] getBindings(String[] bindingKeys) { - int length = this.bindings.size(); - IBinding[] result = new IBinding[length]; - for (int i = 0; i < length; i++) { - result[i] = (IBinding) this.bindings.get(bindingKeys[i]); - } - return result; - } - } - - protected void assertASTNodeEquals(String expected, ASTNode node) { - String actual = node.toString(); - if (!expected.equals(actual)) { - System.out.println(displayString(actual, 3) + ","); - } - assertEquals("Unexpected ast node", expected, actual); - } - - protected void assertASTNodesEqual(String expected, List nodes) { - StringBuffer buffer = new StringBuffer(); - Iterator iterator = nodes.iterator(); - while (iterator.hasNext()) { - ASTNode node = (ASTNode) iterator.next(); - buffer.append(node); - if (node instanceof JavaScriptUnit) { - IProblem[] problems = ((JavaScriptUnit) node).getProblems(); - if (problems != null) { - for (int i = 0, length = problems.length; i < length; i++) { - IProblem problem = problems[i]; - buffer.append('\n'); - buffer.append(problem); - } - } - } - buffer.append('\n'); - } - String actual = buffer.toString(); - if (!expected.equals(actual)) { - System.out.println(displayString(actual, 4) + ","); - } - assertEquals("Unexpected ast nodes", expected, actual); - } - - protected void assertBindingKeyEquals(String expected, String actual) { - assertBindingKeysEqual(expected, new String[] { actual }); - } - - protected void assertBindingKeysEqual(String expected, String[] actualKeys) { - StringBuffer buffer = new StringBuffer(); - for (int i = 0, length = actualKeys.length; i < length; i++) { - if (i > 0) - buffer.append('\n'); - buffer.append(actualKeys[i]); - } - String actual = buffer.toString(); - if (!expected.equals(actual)) { - System.out.print(displayString(actual, 4)); - System.out.println(','); - } - assertEquals("Unexpected binding keys", expected, actual); - } - - protected void assertBindingEquals(String expected, IBinding binding) { - assertBindingsEqual(expected, new IBinding[] { binding }); - } - - protected void assertBindingsEqual(String expected, - IBinding[] actualBindings) { - StringBuffer buffer = new StringBuffer(); - for (int i = 0, length = actualBindings.length; i < length; i++) { - if (i > 0) - buffer.append('\n'); - if (actualBindings[i] == null) - buffer.append(""); - else - buffer.append(actualBindings[i].getKey()); - } - String actual = buffer.toString(); - if (!expected.equals(actual)) { - System.out.print(displayString(actual, 3)); - System.out.println(','); - } - assertEquals("Unexpected bindings", expected, actual); - } - - /* - * Builds an AST from the info source (which is assumed to be the source - * attached to the given class file), and returns the AST node that was - * delimited by the astStart and astEnd of the marker info. - */ - protected ASTNode buildAST(MarkerInfo markerInfo, IClassFile classFile, - boolean reportErrors) throws JavaScriptModelException { - ASTParser parser = ASTParser.newParser(AST.JLS3); - parser.setSource(classFile); - parser.setResolveBindings(true); - JavaScriptUnit unit = (JavaScriptUnit) parser.createAST(null); - - if (reportErrors) { - StringBuffer buffer = new StringBuffer(); - IProblem[] problems = unit.getProblems(); - for (int i = 0, length = problems.length; i < length; i++) - Util.appendProblem(buffer, problems[i], markerInfo.source - .toCharArray(), i + 1); - if (buffer.length() > 0) - System.err.println(buffer.toString()); - } - - return findNode(unit, markerInfo); - } - - protected ASTNode buildAST(IJavaScriptUnit cu) - throws JavaScriptModelException { - return buildAST(null/* use existing contents */, cu, true/* report errors */); - } - - protected ASTNode buildAST(String newContents, IJavaScriptUnit cu) - throws JavaScriptModelException { - return buildAST(newContents, cu, true/* report errors */); - } - - protected ASTNode buildAST(MarkerInfo markerInfo, IClassFile classFile) - throws JavaScriptModelException { - return buildAST(markerInfo, classFile, true/* report errors */); - } - - /* - * Removes the marker comments "*start*" and "*end*" from the given - * contents, builds an AST from the resulting source, and returns the AST - * node that was delimited by "*start*" and "*end*". - */ - protected ASTNode buildAST(String newContents, IJavaScriptUnit cu, - boolean reportErrors) throws JavaScriptModelException { - return buildAST(newContents, cu, reportErrors, false/* - * no statement - * recovery - */); - } - - protected ASTNode buildAST(String newContents, IJavaScriptUnit cu, - boolean reportErrors, boolean enableStatementRecovery) - throws JavaScriptModelException { - ASTNode[] nodes = buildASTs(newContents, cu, reportErrors, - enableStatementRecovery); - if (nodes.length == 0) - return null; - return nodes[0]; - } - - protected ASTNode[] buildASTs(String contents, IJavaScriptUnit cu) - throws JavaScriptModelException { - return buildASTs(contents, cu, true); - } - - /* - * Removes the marker comments "*start?*" and "*end?*" from the given new - * contents (where ? is either empty or a number), or use the current - * contents if the given new contents is null. Builds an AST from the - * resulting source. For each of the pairs, returns the AST node that was - * delimited by "*start?*" and "*end?*". - */ - protected ASTNode[] buildASTs(String newContents, IJavaScriptUnit cu, - boolean reportErrors) throws JavaScriptModelException { - return buildASTs(newContents, cu, reportErrors, false); - } - - protected ASTNode[] buildASTs(String newContents, IJavaScriptUnit cu, - boolean reportErrors, boolean enableStatementRecovery) - throws JavaScriptModelException { - MarkerInfo markerInfo; - if (newContents == null) { - markerInfo = new MarkerInfo(cu.getSource()); - } else { - markerInfo = new MarkerInfo(newContents); - } - newContents = markerInfo.source; - - JavaScriptUnit unit; - if (cu.isWorkingCopy()) { - cu.getBuffer().setContents(newContents); - unit = cu.reconcile(AST.JLS3, reportErrors, - enableStatementRecovery, null, null); - } else { - IBuffer buffer = cu.getBuffer(); - buffer.setContents(newContents); - buffer.save(null, false); - - ASTParser parser = ASTParser.newParser(AST.JLS3); - parser.setSource(cu); - parser.setResolveBindings(true); - parser.setStatementsRecovery(enableStatementRecovery); - unit = (JavaScriptUnit) parser.createAST(null); - } - - if (reportErrors) { - StringBuffer buffer = new StringBuffer(); - IProblem[] problems = unit.getProblems(); - for (int i = 0, length = problems.length; i < length; i++) - Util.appendProblem(buffer, problems[i], newContents - .toCharArray(), i + 1); - if (buffer.length() > 0) - System.err.println(buffer.toString()); - } - - ASTNode[] nodes = findNodes(unit, markerInfo); - if (nodes.length == 0) - return new ASTNode[] { unit }; - return nodes; - } - - protected MarkerInfo[] createMarkerInfos(String[] pathAndSources) { - MarkerInfo[] markerInfos = new MarkerInfo[pathAndSources.length / 2]; - int index = 0; - for (int i = 0, length = pathAndSources.length; i < length; i++) { - String path = pathAndSources[i]; - String source = pathAndSources[++i]; - markerInfos[index++] = new MarkerInfo(path, source); - } - return markerInfos; - } - - protected IVariableBinding[] createVariableBindings( - String[] pathAndSources, String[] bindingKeys) - throws JavaScriptModelException { - WorkingCopyOwner owner = new WorkingCopyOwner() { - }; - this.workingCopies = createWorkingCopies(pathAndSources, owner); - IBinding[] bindings = resolveBindings(bindingKeys, getJavaProject("P"), - owner); - int length = bindings.length; - IVariableBinding[] result = new IVariableBinding[length]; - System.arraycopy(bindings, 0, result, 0, length); - return result; - } - - protected IFunctionBinding[] createMethodBindings(String[] pathAndSources, - String[] bindingKeys) throws JavaScriptModelException { - return createMethodBindings(pathAndSources, bindingKeys, - getJavaProject("P")); - } - - protected IFunctionBinding[] createMethodBindings(String[] pathAndSources, - String[] bindingKeys, IJavaScriptProject project) - throws JavaScriptModelException { - WorkingCopyOwner owner = new WorkingCopyOwner() { - }; - this.workingCopies = createWorkingCopies(pathAndSources, owner); - IBinding[] bindings = resolveBindings(bindingKeys, project, owner); - int length = bindings.length; - IFunctionBinding[] result = new IFunctionBinding[length]; - System.arraycopy(bindings, 0, result, 0, length); - return result; - } - - protected ITypeBinding[] createTypeBindings(String[] pathAndSources, - String[] bindingKeys) throws JavaScriptModelException { - return createTypeBindings(pathAndSources, bindingKeys, - getJavaProject("P")); - } - - protected ITypeBinding[] createTypeBindings(String[] pathAndSources, - String[] bindingKeys, IJavaScriptProject project) - throws JavaScriptModelException { - WorkingCopyOwner owner = new WorkingCopyOwner() { - }; - this.workingCopies = createWorkingCopies(pathAndSources, owner); - IBinding[] bindings = resolveBindings(bindingKeys, project, owner); - int length = bindings.length; - ITypeBinding[] result = new ITypeBinding[length]; - System.arraycopy(bindings, 0, result, 0, length); - return result; - } - - protected IJavaScriptUnit[] createWorkingCopies(String[] pathAndSources, - WorkingCopyOwner owner) throws JavaScriptModelException { - MarkerInfo[] markerInfos = createMarkerInfos(pathAndSources); - return createWorkingCopies(markerInfos, owner); - } - - protected IJavaScriptUnit[] createWorkingCopies(MarkerInfo[] markerInfos, - WorkingCopyOwner owner) throws JavaScriptModelException { - return createWorkingCopies(markerInfos, owner, null); - } - - protected IJavaScriptUnit[] createWorkingCopies(MarkerInfo[] markerInfos, - WorkingCopyOwner owner, IProblemRequestor problemRequestor) - throws JavaScriptModelException { - int length = markerInfos.length; - IJavaScriptUnit[] copies = new IJavaScriptUnit[length]; - for (int i = 0; i < length; i++) { - MarkerInfo markerInfo = markerInfos[i]; - IJavaScriptUnit workingCopy = getCompilationUnit(markerInfo.path) - .getWorkingCopy(owner, null); - workingCopy.getBuffer().setContents(markerInfo.source); - workingCopy.makeConsistent(null); - copies[i] = workingCopy; - } - return copies; - } - - protected ASTNode findNode(JavaScriptUnit unit, final MarkerInfo markerInfo) { - ASTNode[] nodes = findNodes(unit, markerInfo); - if (nodes.length == 0) - return unit; - return nodes[0]; - } - - protected ASTNode[] findNodes(JavaScriptUnit unit, - final MarkerInfo markerInfo) { - class Visitor extends ASTVisitor { - ArrayList found = new ArrayList(); - - public void preVisit(ASTNode node) { - if (node instanceof JavaScriptUnit) - return; - int index = markerInfo.indexOfASTStart(node.getStartPosition()); - if (index != -1 - && node.getStartPosition() + node.getLength() == markerInfo.astEnds[index]) { - this.found.add(node); - markerInfo.astStarts[index] = -1; // so that 2 nodes with - // the same start and - // end will not be found - } - } - } - Visitor visitor = new Visitor(); - unit.accept(visitor); - int size = visitor.found.size(); - ASTNode[] result = new ASTNode[size]; - visitor.found.toArray(result); - return result; - } - - protected void resolveASTs(IJavaScriptUnit[] cus, String[] bindingKeys, - ASTRequestor requestor, IJavaScriptProject project, - WorkingCopyOwner owner) { - ASTParser parser = ASTParser.newParser(AST.JLS3); - parser.setResolveBindings(true); - parser.setProject(project); - parser.setWorkingCopyOwner(owner); - parser.createASTs(cus, bindingKeys, requestor, null); - } - - protected IBinding resolveBinding(ASTNode node) { - switch (node.getNodeType()) { - case ASTNode.PACKAGE_DECLARATION: - return ((PackageDeclaration) node).resolveBinding(); - case ASTNode.TYPE_DECLARATION: - return ((TypeDeclaration) node).resolveBinding(); - case ASTNode.ANONYMOUS_CLASS_DECLARATION: - return ((AnonymousClassDeclaration) node).resolveBinding(); - case ASTNode.TYPE_DECLARATION_STATEMENT: - return ((TypeDeclarationStatement) node).resolveBinding(); - case ASTNode.FUNCTION_DECLARATION: - return ((FunctionDeclaration) node).resolveBinding(); - case ASTNode.FUNCTION_INVOCATION: - return ((FunctionInvocation) node).resolveMethodBinding(); - case ASTNode.SIMPLE_NAME: - return ((SimpleName) node).resolveBinding(); - case ASTNode.ARRAY_TYPE: - return ((ArrayType) node).resolveBinding(); - case ASTNode.ASSIGNMENT: - return ((Assignment) node).getRightHandSide().resolveTypeBinding(); - case ASTNode.SIMPLE_TYPE: - return ((SimpleType) node).resolveBinding(); - case ASTNode.QUALIFIED_NAME: - return ((QualifiedName) node).resolveBinding(); - default: - throw new Error("Not yet implemented for this type of node: " - + node); - } - } - - protected IBinding[] resolveBindings(String[] bindingKeys, - IJavaScriptProject project, WorkingCopyOwner owner) { - BindingRequestor requestor = new BindingRequestor(); - resolveASTs(new IJavaScriptUnit[0], bindingKeys, requestor, project, - owner); - return requestor.getBindings(bindingKeys); - } - - /* - * Resolve the bindings of the nodes marked with *start?* and *end?*. - */ - protected IBinding[] resolveBindings(String contents, IJavaScriptUnit cu) - throws JavaScriptModelException { - return resolveBindings(contents, cu, true/* report errors */); - } - - /* - * Resolve the bindings of the nodes marked with *start?* and *end?*. - */ - protected IBinding[] resolveBindings(String contents, IJavaScriptUnit cu, - boolean reportErrors) throws JavaScriptModelException { - ASTNode[] nodes = buildASTs(contents, cu, reportErrors); - if (nodes == null) - return null; - int length = nodes.length; - IBinding[] result = new IBinding[length]; - for (int i = 0; i < length; i++) { - result[i] = resolveBinding(nodes[i]); - } - return result; - } - - // protected void tearDown() throws Exception { - // discardWorkingCopies(this.workingCopies); - // this.workingCopies = null; - // } - -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/BatchASTCreationTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/BatchASTCreationTests.java deleted file mode 100644 index ea147ef..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/BatchASTCreationTests.java +++ /dev/null @@ -1,1670 +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.io.IOException; -import java.util.ArrayList; - -import junit.framework.Test; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.wst.jsdt.core.BindingKey; -import org.eclipse.wst.jsdt.core.IJavaScriptUnit; -import org.eclipse.wst.jsdt.core.IJavaScriptProject; -import org.eclipse.wst.jsdt.core.IProblemRequestor; -import org.eclipse.wst.jsdt.core.JavaScriptModelException; -import org.eclipse.wst.jsdt.core.WorkingCopyOwner; -import org.eclipse.wst.jsdt.core.compiler.IProblem; -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.ASTRequestor; -import org.eclipse.wst.jsdt.core.dom.JavaScriptUnit; -import org.eclipse.wst.jsdt.core.dom.IBinding; -import org.eclipse.wst.jsdt.core.dom.IFunctionBinding; -import org.eclipse.wst.jsdt.core.dom.ITypeBinding; -import org.eclipse.wst.jsdt.core.dom.IVariableBinding; -import org.eclipse.wst.jsdt.core.dom.Type; -import org.eclipse.wst.jsdt.core.dom.TypeDeclaration; - -public class BatchASTCreationTests extends AbstractASTTests { - - public class TestASTRequestor extends ASTRequestor { - public ArrayList asts = new ArrayList(); - public void acceptAST(IJavaScriptUnit source, JavaScriptUnit ast) { - this.asts.add(ast); - } - public void acceptBinding(String bindingKey, IBinding binding) { - } - } - - class BindingResolver extends TestASTRequestor { - private ArrayList bindingKeys = new ArrayList(); - int index = -1; - private ArrayList foundKeys = new ArrayList(); - MarkerInfo[] markerInfos; - public BindingResolver(MarkerInfo[] markerInfos) { - this.markerInfos = markerInfos; - } - public void acceptAST(IJavaScriptUnit source, JavaScriptUnit cu) { - super.acceptAST(source, cu); - ASTNode[] nodes = findNodes(cu, this.markerInfos[++this.index]); - for (int i = 0, length = nodes.length; i < length; i++) { - IBinding binding = resolveBinding(nodes[i]); - String bindingKey = binding == null ? "null" : binding.getKey(); - - // case of a capture binding - if (bindingKey.indexOf('!') != -1 && binding.getKind() == IBinding.METHOD) { - bindingKey = ((IFunctionBinding) binding).getReturnType().getKey(); - } - - this.bindingKeys.add(bindingKey); - } - } - public void acceptBinding(String key, IBinding binding) { - super.acceptBinding(key, binding); - this.foundKeys.add(binding == null ? "null" : binding.getKey()); - } - - public String[] getBindingKeys() { - int length = this.bindingKeys.size(); - String[] result = new String[length]; - this.bindingKeys.toArray(result); - return result; - } - - public String[] getFoundKeys() { - int length = this.foundKeys.size(); - String[] result = new String[length]; - this.foundKeys.toArray(result); - return result; - } - } - - public WorkingCopyOwner owner = new WorkingCopyOwner() {}; - - public BatchASTCreationTests(String name) { - super(name); - } - - public static Test suite() { - return buildModelTestSuite(BatchASTCreationTests.class); - } - - // Use this static initializer to specify subset for tests - // All specified tests which do not belong to the class are skipped... - static { -// TESTS_PREFIX = "testBug86380"; -// TESTS_NAMES = new String[] { "test056" }; -// TESTS_NUMBERS = new int[] { 78, 79, 80 }; - TESTS_RANGE = new int[] { 0, 2 }; - } - - public void setUpSuite() throws Exception { - super.setUpSuite(); - createJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "", "1.5"); - } - - public void tearDownSuite() throws Exception { - deleteProject("P"); - super.tearDownSuite(); - } - - /* - * Resolves the given cus and binding key as a batch. - * While resolving, for the ASTNode that is marked, ensures that its binding key is the expected one. - * Ensures that the returned binding corresponds to the expected key. - */ - private void assertRequestedBindingFound(String[] pathAndSources, final String expectedKey) throws JavaScriptModelException { - assertRequestedBindingsFound(pathAndSources, new String[] {expectedKey}); - } - - /* - * Resolves the given cus and binding key as a batch. - * While resolving, for the ASTNode that is marked, ensures that its binding key is the expected one. - * Ensures that the returned binding corresponds to the expected key. - */ - private void assertRequestedBindingsFound(String[] pathAndSources, final String[] expectedKeys) throws JavaScriptModelException { - BindingResolver resolver = requestBindings(pathAndSources, expectedKeys); - - assertStringsEqual("Unexpected binding for marked node", expectedKeys, resolver.getBindingKeys()); - - assertStringsEqual("Unexpected binding found by acceptBinding", expectedKeys, resolver.getFoundKeys()); - } - - /* - * Creates working copies from the given path and sources. - * Resolves a dummy cu as a batch and on the first accept, create a binding with the expected key using ASTRequestor#createBindings. - * Ensures that the returned binding corresponds to the expected key. - */ - private void assertBindingCreated(String[] pathAndSources, final String expectedKey) throws JavaScriptModelException { - assertBindingsCreated(pathAndSources, new String[] {expectedKey}); - } - /* - * Creates working copies from the given path and sources. - * Resolves a dummy cu as a batch and on the first accept, create a binding with the expected key using ASTRequestor#createBindings. - * Ensures that the returned binding corresponds to the expected key. - */ - private void assertBindingsCreated(String[] pathAndSources, final String[] expectedKeys) throws JavaScriptModelException { - IJavaScriptUnit[] copies = null; - try { - copies = createWorkingCopies(pathAndSources); - class Requestor extends TestASTRequestor { - ArrayList createdBindingKeys = new ArrayList(); - public void acceptAST(IJavaScriptUnit source, JavaScriptUnit cu) { - super.acceptAST(source, cu); - IBinding[] bindings = createBindings(expectedKeys); - if (bindings != null && bindings.length > 0 && bindings[0] != null) - this.createdBindingKeys.add(bindings[0].getKey()); - } - public String getCreatedKeys() { - StringBuffer buffer = new StringBuffer(); - for (int i = 0, length = this.createdBindingKeys.size(); i < length; i++) { - buffer.append(this.createdBindingKeys.get(i)); - if (i < length - 1) - buffer.append('\n'); - } - return buffer.toString(); - } - } - Requestor requestor = new Requestor(); - IJavaScriptUnit[] dummyWorkingCopies = null; - try { - dummyWorkingCopies = createWorkingCopies(new String[] { - "/P/Test.js", - "public class Test {\n" + - "}" - }); - resolveASTs(dummyWorkingCopies, new String[] {}, requestor, getJavaProject("P"), this.owner); - } finally { - discardWorkingCopies(dummyWorkingCopies); - } - - String expectedKey = toString(expectedKeys); - String actualKey = requestor.getCreatedKeys(); - if (!expectedKey.equals(actualKey)) { - BindingResolver resolver = requestBindings(pathAndSources, null); - String[] markedKeys = resolver.getBindingKeys(); - if (markedKeys.length > 0) { - assertStringsEqual("Inconsistent expected key ", expectedKeys, markedKeys); - } - } - assertEquals("Unexpected created binding", expectedKey, actualKey); - } finally { - discardWorkingCopies(copies); - } - } - - private void createASTs(IJavaScriptUnit[] cus, TestASTRequestor requestor) { - ASTParser parser = ASTParser.newParser(AST.JLS3); - parser.createASTs(cus, new String[] {}, requestor, null); - } - - protected IJavaScriptUnit[] createWorkingCopies(String[] pathAndSources) throws JavaScriptModelException { - return createWorkingCopies(pathAndSources, this.owner); - } - - protected IJavaScriptUnit[] createWorkingCopies(String[] pathAndSources, boolean resolve) throws JavaScriptModelException { - IProblemRequestor problemRequestor = resolve - ? new IProblemRequestor() { - public void acceptProblem(IProblem problem) {} - public void beginReporting() {} - public void endReporting() {} - public boolean isActive() { - return true; - } - } - : null; - MarkerInfo[] markerInfos = createMarkerInfos(pathAndSources); - return createWorkingCopies(markerInfos, this.owner, problemRequestor); - } - - private void resolveASTs(IJavaScriptUnit[] cus, TestASTRequestor requestor) { - resolveASTs(cus, new String[0], requestor, getJavaProject("P"), this.owner); - } - - private BindingResolver requestBindings(String[] pathAndSources, final String[] expectedKeys) throws JavaScriptModelException { - IJavaScriptUnit[] copies = null; - try { - MarkerInfo[] markerInfos = createMarkerInfos(pathAndSources); - copies = createWorkingCopies(markerInfos, this.owner); - BindingResolver resolver = new BindingResolver(markerInfos); - resolveASTs(copies, expectedKeys == null ? new String[0] : expectedKeys, resolver, copies.length > 0 ? copies[0].getJavaScriptProject() : getJavaProject("P"), this.owner); - return resolver; - } finally { - discardWorkingCopies(copies); - } - } - - - /* - * Tests the batch creation of 2 ASTs without resolving. - */ - public void test001() throws CoreException { - this.workingCopies = createWorkingCopies(new String[] { - "/P/X.js", - "function X(){}\n" + - "X.prototype = new Y();", - "/P/Y.js", - "function Y() {}" - }); - TestASTRequestor requestor = new TestASTRequestor(); - createASTs(this.workingCopies, requestor); - assertASTNodesEqual( - "function X(){\n}\n" + - "X.prototype=new Y();\n" + - "\n" + - "function Y(){\n}\n" + - "\n", - requestor.asts - ); - } - - /* - * Tests the batch creation of 2 ASTs with resolving. - */ - public void test002() throws CoreException { - MarkerInfo[] markerInfos = createMarkerInfos(new String[] { - "/P/X.js", - "function X/*start*/()/*end*/ {\n}\n" + - "X.prototype = new Y();", - "/P/Y.js", - "/*start*/function Y() {\n" + - "}/*end*/", - }); - this.workingCopies = createWorkingCopies(markerInfos, this.owner); - TestASTRequestor requestor = new TestASTRequestor(); - resolveASTs(this.workingCopies, requestor); - assertASTNodesEqual( - "function X(){\n}\n" + - "X.prototype=new Y();\n" + - "\n" + - "function Y(){\n}\n" + - "\n", - requestor.asts - ); - - // compare the bindings coming from the 2 ASTs - Type superX = (Type) findNode((JavaScriptUnit) requestor.asts.get(0), markerInfos[0]); - TypeDeclaration typeY = (TypeDeclaration) findNode((JavaScriptUnit) requestor.asts.get(1), markerInfos[1]); - IBinding superXBinding = superX.resolveBinding(); - IBinding typeYBinding = typeY.resolveBinding(); - assertTrue("Super of X and Y should be the same", superXBinding == typeYBinding); - } - - /* - * Ensures that ASTs that are required by original source but were not asked for are not handled. - */ - public void test003() throws CoreException { - IJavaScriptUnit[] otherWorkingCopies = null; - try { - this.workingCopies = createWorkingCopies(new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X extends Y {\n" + - "}", - }); - otherWorkingCopies = createWorkingCopies(new String[] { - "/P/p1/Y.js", - "package p1;\n" + - "public class Y {\n" + - "}", - }); - TestASTRequestor requestor = new TestASTRequestor(); - resolveASTs(this.workingCopies, requestor); - - assertASTNodesEqual( - "package p1;\n" + - "public class X extends Y {\n" + - "}\n" + - "\n", - requestor.asts - ); - } finally { - // Note: this.workingCopies are discarded in tearDown - discardWorkingCopies(otherWorkingCopies); - } - } - - /* - * Ensures that a package binding can be retrieved using its key. - */ - public void test004() throws CoreException { - assertRequestedBindingFound( - new String[] { - "/P/p1/X.js", - "/*start*/package p1;/*end*/\n" + - "public class X {\n" + - "}", - }, - "p1"); - } - - /* - * Ensures that a type binding can be retrieved using its key. - */ - public void test005() throws CoreException { - assertRequestedBindingFound( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "/*start*/public class X extends Y {\n" + - "}/*end*/", - "/P/p1/Y.js", - "package p1;\n" + - "public class Y {\n" + - "}", - }, - "Lp1/X;"); - } - - /* - * Ensures that a type binding can be retrieved using its key. - */ - public void test006() throws CoreException { - assertRequestedBindingFound( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X extends Y {\n" + - "}", - "/P/p1/Y.js", - "package p1;\n" + - "/*start*/public class Y {\n" + - "}/*end*/", - }, - "Lp1/Y;"); - } - - /* - * Ensures that a member type binding can be retrieved using its key. - */ - public void test007() throws CoreException { - assertRequestedBindingFound( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " /*start*/class Member {\n" + - " }/*end*/" + - "}", - }, - "Lp1/X$Member;"); - } - - /* - * Ensures that a member type binding can be retrieved using its key. - */ - public void test008() throws CoreException { - assertRequestedBindingFound( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " class Member1 {\n" + - " /*start*/class Member2 {\n" + - " }/*end*/" + - " }\n" + - "}", - }, - "Lp1/X$Member1$Member2;"); - } - /* - * Ensures that an anonymous type binding can be retrieved using its key. - */ - public void test009() throws CoreException { - assertRequestedBindingFound( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " void foo() {\n" + - " new X() /*start*/{\n" + - " }/*end*/;" + - " }\n" + - "}", - }, - "Lp1/X$52;"); - } - /* - * Ensures that a local type binding can be retrieved using its key. - */ - public void test010() throws CoreException { - assertRequestedBindingFound( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " void foo() {\n" + - " /*start*/class Y {\n" + - " }/*end*/;" + - " }\n" + - "}", - }, - "Lp1/X$54$Y;"); - } - - /* - * Ensures that a package binding can be created using its key in ASTRequestor#createBindings. - */ - public void test011() throws CoreException { - assertBindingCreated( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}", - }, - "p1"); - } - - /* - * Ensures that a type binding can be created using its key in ASTRequestor#createBindings. - */ - public void test012() throws CoreException { - assertBindingCreated( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X extends Y {\n" + - "}", - "/P/p1/Y.js", - "package p1;\n" + - "public class Y {\n" + - "}", - }, - "Lp1/X;"); - } - - /* - * Ensures that a type binding can be created using its key in ASTRequestor#createBindings. - */ - public void test013() throws CoreException { - assertBindingCreated( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X extends Y {\n" + - "}", - "/P/p1/Y.js", - "package p1;\n" + - "public class Y {\n" + - "}", - }, - "Lp1/Y;"); - } - - /* - * Ensures that a member type binding can be created using its key in ASTRequestor#createBindings. - */ - public void test014() throws CoreException { - assertBindingCreated( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " class Member {\n" + - " }" + - "}", - }, - "Lp1/X$Member;"); - } - - /* - * Ensures that a member type binding can be created using its key in ASTRequestor#createBindings. - */ - public void test015() throws CoreException { - assertBindingCreated( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " class Member1 {\n" + - " class Member2 {\n" + - " }" + - " }\n" + - "}", - }, - "Lp1/X$Member1$Member2;"); - } - - /* - * Ensures that an anonymous type binding can be created using its key in ASTRequestor#createBindings. - */ - public void test016() throws CoreException { - assertBindingCreated( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " void foo() {\n" + - " new X() /*start*/{\n" + - " }/*end*/;" + - " }\n" + - "}", - }, - "Lp1/X$52;"); - } - - /* - * Ensures that a local type binding can be created using its key in ASTRequestor#createBindings. - */ - public void test017() throws CoreException { - assertBindingCreated( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " void foo() {\n" + - " /*start*/class Y {\n" + - " }/*end*/;" + - " }\n" + - "}", - }, - "Lp1/X$54$Y;"); - } - - /* - * Ensures that a method binding can be created using its key in ASTRequestor#createBindings. - */ - public void test018() throws CoreException { - assertBindingCreated( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " void foo() {\n" + - " }\n" + - "}", - }, - "Lp1/X;.foo()V"); - } - - /* - * Ensures that a method binding can be created using its key in ASTRequestor#createBindings. - */ - public void test019() throws CoreException { - assertBindingCreated( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " void foo(Object o) {\n" + - " }\n" + - "}", - }, - "Lp1/X;.foo(Ljava/lang/Object;)V"); - } - - /* - * Ensures that a method binding can be created using its key in ASTRequestor#createBindings. - */ - public void test020() throws CoreException { - assertBindingCreated( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " X(Object o) {\n" + - " }\n" + - "}", - }, - "Lp1/X;.(Ljava/lang/Object;)V"); - } - - /* - * Ensures that a field binding can be created using its key in ASTRequestor#createBindings. - */ - public void test021() throws CoreException { - assertBindingCreated( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " int field;\n" + - "}", - }, - "Lp1/X;.field)I"); - } - - /* - * Ensures that a base type binding can be created using its key in ASTRequestor#createBindings. - */ - public void test022() throws CoreException { - assertBindingCreated(new String[0],"I"); - } - - /* - * Ensures that an array binding can be created using its key in ASTRequestor#createBindings. - */ - public void test023() throws CoreException { - assertBindingCreated( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}", - }, - "[Lp1/X;"); - } - - /* - * Ensures that an array binding can be created using its key in ASTRequestor#createBindings. - */ - public void test024() throws CoreException { - assertBindingCreated(new String[0],"[[I"); - } - - /* - * Ensures that a method binding in an anonymous type with several kind of parameters can be created using its key in ASTRequestor#createBindings - */ - public void test025() throws CoreException { - assertBindingCreated( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " class Y {\n" + - " }\n" + - " void foo() {\n" + - " new X() {\n" + - " /*start*/void bar(int i, X x, String[][] s, Y[] args, boolean b, Object o) {\n" + - " }/*end*/\n" + - " };\n" + - " }\n" + - "}", - }, - "Lp1/X$68;.bar(ILp1/X;[[Ljava/lang/String;[Lp1/X$Y;ZLjava/lang/Object;)V" - ); - } - - /* - * Ensures that a generic type binding can be created using its key in ASTRequestor#createBindings. - */ - public void test026() throws CoreException { - assertBindingCreated( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}", - }, - "Lp1/X;"); - } - - /* - * Ensures that a generic type binding can be created using its key in ASTRequestor#createBindings. - */ - public void test027() throws CoreException { - assertBindingCreated( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}", - "/P/p1/Y.js", - "package p1;\n" + - "public class Y {\n" + - "}", - "/P/p1/I.js", - "package p1;\n" + - "public interface I {\n" + - "}", - }, - "Lp1/X;"); - } - - /* - * Ensures that a parameterized type binding can be created using its key in ASTRequestor#createBindings. - */ - public void test028() throws CoreException { - assertBindingCreated( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " X field;\n" + - "}", - }, - "Lp1/X;"); - } - - /* - * Ensures that a member parameterized type binding can be created using its key in ASTRequestor#createBindings. - */ - public void test029() throws CoreException { - assertBindingCreated( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " class Y {\n" + - " X.Y field;\n" + - " }\n" + - "}", - }, - "Lp1/X.Y;"); - } - - /* - * Ensures that a raw type binding can be created using its key in ASTRequestor#createBindings. - */ - public void test030() throws CoreException { - assertBindingCreated( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " X field;\n" + - "}", - }, - "Lp1/X<>;"); - } - - /* - * Ensures that a member raw type binding can be created using its key in ASTRequestor#createBindings. - */ - public void test031() throws CoreException { - assertBindingCreated( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " class Y {\n" + - " X.Y field;\n" + - " }\n" + - "}", - }, - "Lp1/X.Y<>;"); - } - - /* - * Ensures that a parameterized method binding can be created using its key in ASTRequestor#createBindings - */ - public void test032() throws CoreException { - assertBindingCreated( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " void foo() {\n" + - " }\n" + - "}", - }, - "Lp1/X;.foo()V"); - } - - /* - * Ensures that a local variable binding can be created using its key in ASTRequestor#createBindings - */ - public void test033() throws CoreException { - assertBindingCreated( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " void foo() {\n" + - " int i;\n" + - " }\n" + - "}", - }, - "Lp1/X;.foo()V#i"); - } - - /* - * Ensures that a local variable binding can be created using its key in ASTRequestor#createBindings - */ - public void test034() throws CoreException { - assertBindingCreated( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " void foo() {\n" + - " int i = 1;\n" + - " if (i == 0) {\n" + - " int a;\n" + - " } else {\n" + - " int b;\n" + - " }\n" + - " }\n" + - "}", - }, - "Lp1/X;.foo()V#1#b"); - } - - /* - * Ensures that a parameterized method binding can be created using its key in ASTRequestor#createBindings. - */ - public void test035() throws CoreException { - assertBindingCreated( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " void foo(T t) {\n" + - " }\n" + - " void bar() {\n" + - " new X().foo(\"\");\n" + - " }\n" + - "}", - }, - "Lp1/X;.foo(Ljava/lang/String;)V"); - } - - /* - * Ensures that a parameterized generic method binding can be created using its key in ASTRequestor#createBindings. - */ - public void test036() throws CoreException { - assertBindingCreated( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " void foo(T t, U u) {\n" + - " }\n" + - " void bar() {\n" + - " /*start*/new X().foo(\"\", this)/*end*/;\n" + - " }\n" + - "}", - }, - "Lp1/X;.foo(Ljava/lang/String;TU;)V%" - ); - } - - /* - * Ensures that a raw generic method binding can be created using its key in ASTRequestor#createBindings. - */ - public void test037() throws CoreException { - assertBindingCreated( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " void foo(T t, U u) {\n" + - " }\n" + - " void bar() {\n" + - " /*start*/new X().foo(\"\", this)/*end*/;\n" + - " }\n" + - "}", - }, - "Lp1/X;.foo(TT;TU;)V%<>"); - } - - /* - * Ensures that a parameterized method binding (where the parameter is an unbound wildcard) can be created using its key in ASTRequestor#createBindings. - */ - public void test038() throws CoreException { - assertBindingCreated( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " void foo() {\n" + - " }\n" + - " void bar(X x) {\n" + - " x.foo();\n" + - " }\n" + - "}", - }, - "Lp1/X;.foo()V"); - } - - /* - * Ensures that a parameterized method binding (where the parameter is an extends wildcard) can be created using its key in ASTRequestor#createBindings. - */ - public void test039() throws CoreException { - assertBindingCreated( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " void foo() {\n" + - " }\n" + - " void bar(X x) {\n" + - " x.foo();\n" + - " }\n" + - "}", - }, - "Lp1/X;.foo()V"); - } - - /* - * Ensures that a parameterized method binding (where the parameter is a super wildcard) can be created using its key in ASTRequestor#createBindings. - */ - public void test040() throws CoreException { - assertBindingCreated( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " void foo() {\n" + - " }\n" + - " void bar(X x) {\n" + - " x.foo();\n" + - " }\n" + - "}", - }, - "Lp1/X;.foo()V"); - } - - /* - * Ensures that a parameterized method binding (where the parameters contain wildcards) can be created using its key in ASTRequestor#createBindings. - */ - public void test041() throws CoreException { - assertBindingCreated( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " void foo() {\n" + - " }\n" + - " void bar(X x) {\n" + - " x.foo();\n" + - " }\n" + - "}", - }, - "Lp1/X;.foo()V"); - } - - /* - * Ensures that requesting 2 bindings and an AST for the same compilation unit reports the 2 bindings. - */ - public void test042() throws CoreException { - IJavaScriptUnit workingCopy = null; - try { - workingCopy = getWorkingCopy( - "/P/X.js", - "public class X {\n" + - " int field;\n" + - "}" - ); - BindingRequestor requestor = new BindingRequestor(); - String[] bindingKeys = - new String[] { - "LX;", - "LX;.field)I" - }; - resolveASTs( - new IJavaScriptUnit[] {workingCopy}, - bindingKeys, - requestor, - getJavaProject("P"), - workingCopy.getOwner() - ); - assertBindingsEqual( - "LX;\n" + - "LX;.field)I", - requestor.getBindings(bindingKeys)); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /* - * Ensures that a source parameterized type binding (where the parameters contain wildcard with a super bound) can be created using its key in ASTRequestor#createBindings. - */ - public void test043() throws CoreException { - assertBindingCreated( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " X field;\n" + - "}", - }, - "Lp1/X;"); - } - - /* - * Ensures that a binary parameterized type binding (where the parameters contain wildcard with a super bound) can be created using its key in ASTRequestor#createBindings. - * (regression test for 83499 ClassCastException when restoring ITypeBinding from key) - */ - public void test044() throws CoreException { - assertBindingCreated( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " Class field;\n" + - "}", - }, - "Ljava/lang/Class;"); - } - - /* - * Ensures that restoring a second key that references a type in a first key doesn't throw a NPE - * (regression test for bug 83499 NPE when restoring ITypeBinding from key) - */ - public void test045() throws CoreException { - ITypeBinding[] bindings = createTypeBindings( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}", - "/P/p1/Y.js", - "package p1;\n" + - "public class Y {\n" + - "}" - }, - new String[] { - "Lp1/X;", - "Lp1/Y;" - } - ); - assertBindingsEqual( - "Lp1/X;\n" + - "Lp1/Y;", - bindings); - } - - /* - * Ensures that a binary array parameterized type binding can be created using its key in ASTRequestor#createBindings. - */ - public void test046() throws CoreException { - assertBindingCreated( - new String[] {}, - "[Ljava/lang/Class;"); - } - - /* - * Ensures that the null type binding can be created using its key in batch creation. - */ - public void test047() throws CoreException { - ITypeBinding[] bindings = createTypeBindings( - new String[] {}, - new String[] {"N"}); - assertBindingsEqual( - "N", - bindings); - } - - /* - * Ensures that a binary array type binding can be created using its key in batch creation. - */ - public void test048() throws CoreException { - ITypeBinding[] bindings = createTypeBindings( - new String[] {}, - new String[] {"[Ljava/lang/Object;"}); - assertBindingsEqual( - "[Ljava/lang/Object;", - bindings); - } - - /* - * Ensures that a type variable binding can be created using its key in batch creation. - */ - public void test049() throws CoreException { - ITypeBinding[] bindings = createTypeBindings( - new String[] {}, - new String[] {"Ljava/lang/Class;:TT;"}); - assertBindingsEqual( - "Ljava/lang/Class;:TT;", - bindings); - } - - /* - * Ensures that a parameterized type binding with a wildcard that extends an array the can be created using its key in batch creation. - */ - public void test050() throws CoreException { - ITypeBinding[] bindings = createTypeBindings( - new String[] {}, - new String[] {"Ljava/lang/Class;+[Ljava/lang/Object;>;"}); - assertBindingsEqual( - "Ljava/lang/Class;", - bindings); - } - - /* - * Ensures that attempting to create a top level type that doesn't exist using its key i in batch creation. - * returns null. - */ - public void test051() throws CoreException { - ITypeBinding[] bindings = createTypeBindings( - new String[] {}, - new String[] {"Lp1/DoesNotExist;"}); - assertBindingsEqual( - "", - bindings); - } - - /* - * Ensures that a secondary type binding can be created using its key in ASTRequestor#createBindings. - */ - public void test052() throws CoreException { - try { - createFolder("/P/p1"); - createFile( - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}\n" + - "class Y {\n" + - "}" - ); - assertBindingCreated(new String[] {}, "Lp1/X~Y;"); - } finally { - deleteFolder("/P/p1"); - } - } - - /* - * Ensures that an anonymous type binding coming from secondary type can be created using its key in ASTRequestor#createBindings. - */ - public void test053() throws CoreException { - try { - createFolder("/P/p1"); - createFile( - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}\n" + - "class Y {\n" + - " void foo() {\n" + - " new Y() {};\n" + - " }\n" + - "}" - ); - assertBindingCreated(new String[] {}, "Lp1/X~Y$64;"); - } finally { - deleteFolder("/P/p1"); - } - } - - /* - * Ensures that an anonymous type binding inside a local type can be retrieved using its key. - */ - public void test054() throws CoreException { - assertRequestedBindingFound( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " void foo() {\n" + - " class Y {\n" + - " void bar() {\n" + - " new X() /*start*/{\n" + - " }/*end*/;" + - " }\n" + - " }\n" + - " }\n" + - "}", - }, - "Lp1/X$89;" - ); - } - - /* - * Ensures that a parameterized generic method binding can be created using its key in ASTRequestor#createBindings. - */ - public void test055() throws CoreException { - assertBindingCreated( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " void foo(U u) {\n" + - " }\n" + - " void bar() {\n" + - " /*start*/new X().foo(new X() {})/*end*/;\n" + - " }\n" + - "}", - }, - "Lp1/X;.foo(TU;)V%" - ); - } - - /* - * Ensures that creating a binary member type binding returns the correct binding - * (regression test for bug 86967 [1.5][dom] NPE in BindingKeyResolver for multi-level parameterized type binding) - */ - public void test056() throws CoreException, IOException { - try { - IJavaScriptProject project = createJavaProject("BinaryProject", new String[0], new String[] {"JCL15_LIB"}, "", "1.5"); - addLibrary(project, "lib.jar", "src.zip", new String[] { - "/BinaryProject/p/X.js", - "package p;\n" + - "public class X {\n" + - " public class Y {\n" + - " }\n" + - "}" - }, "1.5"); - ITypeBinding[] bindings = createTypeBindings(new String[0], new String[] { - "Lp/X<>.Y;" - }, project); - assertBindingsEqual( - "Lp/X<>.Y;", - bindings); - } finally { - deleteProject("BinaryProject"); - } - } - - /* - * Ensures that creating a missing binary member type binding doesn't throw a NPE - * (regression test for bug 86967 [1.5][dom] NPE in BindingKeyResolver for multi-level parameterized type binding) - */ - public void test057() throws CoreException { - ITypeBinding[] bindings = createTypeBindings( - new String[] {}, - new String[] {"Lp/Missing$Member;"}); - assertBindingsEqual( - "", - bindings); - } - - /* - * Ensures that a type parameter binding can be created using its key in batch creation. - * (regression test for bug 87050 ASTParser#createASTs(..) cannot resolve method type parameter binding from key) - */ - public void test058() throws CoreException { - assertRequestedBindingFound( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " void foo(T t) {\n" + - " }" + - "}", - }, - "Lp1/X;.foo(TT;)V:TT;"); - } - - /* - * Ensures that a capture binding can be created using its key in batch creation. - */ - public void test059() throws CoreException { - assertRequestedBindingFound( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " Object foo(X list) {\n" + - " return /*start*/list.get()/*end*/;\n" + - " }\n" + - " T get() {\n" + - " return null;\n" + - " }\n" + - "}", - }, - "Lp1/X;&!Lp1/X;*77;" - ); - } - - /* - * Ensures that a capture binding can be created using its key in batch creation. - */ - public void test060() throws CoreException { - assertRequestedBindingFound( - new String[] { - "/P/xy/Cap.js", - "package xy;\n" + - "import java.util.Vector;\n" + - "public class Cap {\n" + - " {\n" + - " Vector v= null;\n" + - " /*start*/v.get(0)/*end*/;\n" + - " }\n" + - "}", - "/P/java/util/Vector.js", - "package java.util;\n" + - "public class Vector {\n" + - " public T get(int i) {\n" + - " return null;\n" + - " }\n" + - "}" - }, - "Lxy/Cap;&!Ljava/util/Vector;*82;" - ); - } - - /* - * Ensures that a generic constructor binding can be created using its key in batch creation. - */ - public void test061() throws CoreException { - assertRequestedBindingFound( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " /*start*/ X() {\n" + - " }/*end*/\n" + - "}", - }, - "Lp1/X;.()V" - ); - } - - /* - * Ensures that an array binding whose leaf type is a type variable binding can be created using its key in batch creation. - * (regression test for bug 94206 CCE in BindingKeyResolver when restoring array type of method type parameter) - */ - public void test062() throws CoreException { - assertRequestedBindingFound( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " /*start*/T[]/*end*/ foo(T[] a) {\n" + - " return null;\n" + - " }\n" + - "}", - }, - "[Lp1/X;.foo([TT;)[TT;:TT;" - ); - } - - /* - * Ensures that a raw method binding can be created using its key in batch creation. - * (regression test for bug 87749 different IMethodBindings of generic method have equal getKey()) - */ - public void test063() throws CoreException { - assertRequestedBindingFound( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " public static > void foo(Z z) {\n" + - " }\n" + - " /**\n" + - " * @see #foo(Z)\n" + - " */\n" + - " void bar() {\n" + - " /*start*/foo(new W())/*end*/;\n" + - " }\n" + - "}\n" + - "class Y {\n" + - "}\n" + - "class Z {\n" + - "}\n" + - "class W extends Z {\n" + - "}", - }, - "Lp1/X;.foo;>(Lp1/Z;)V%<>" - ); - } - - /* - * Ensures that a parameterized type binding with a capture binding in its arguments can be created using its key in batch creation. - * (regression test for bug 94092 ASTParser#createASTs(..) restores wrong bindings from capture keys) - */ - public void test064() throws CoreException { - assertRequestedBindingsFound( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "/*start1*/public class X {\n" + - " Object o= null;\n" + - " Y field;\n" + - " void foo() {\n" + - " /*start2*/o = field/*end2*/;\n" + - " }\n" + - "}/*end1*/\n", - "/P/p1/Y.js", - "package p1;\n" + - "public class Y {\n" + - "}", - }, - new String[] { - "Lp1/X;", - "Lp1/X;&Lp1/Y;", - } - ); - } - - /* - * Ensures that a parameterized type binding with a type variable of the current's method in its arguments can be created using its key in batch creation. - * (regression test for bug 97902 NPE on Open Declaration on reference to generic type) - */ - public void test065() throws CoreException { - assertRequestedBindingFound( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " void foo(/*start*/Y/*end*/ y) {\n" + - " }\n" + - "}\n" + - "class Y {\n" + - "}", - }, - "Lp1/X~Y;" - ); - } - - /* - * Ensures that the compilation with a owner is used instead of a primary working copy when looking up a type. - * (regression test for bug 97542 ASTParser#createASTs does not correctly resolve bindings in working copies) - */ - public void test066() throws CoreException { - IJavaScriptUnit primaryWorkingCopy = null; - IJavaScriptUnit ownedWorkingcopy = null; - try { - // primary working copy with no method foo() - primaryWorkingCopy = getCompilationUnit("/P/p1/X.js"); - primaryWorkingCopy.becomeWorkingCopy(null/*no progress*/); - primaryWorkingCopy.getBuffer().setContents( - "package p1;\n" + - "public class X {\n" + - "}" - ); - primaryWorkingCopy.reconcile(IJavaScriptUnit.NO_AST, false, null, null); - - // working copy for the test's owner with a method foo() - ownedWorkingcopy = getWorkingCopy( - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " void foo() {}\n" + - "}", - this.owner, - false/*don't compute problems*/ - ); - - // create bindings - assertRequestedBindingFound( - new String[] { - "/P/p1/Y.js", - "package p1;\n" + - "public class Y {\n" + - " void bar() {\n" + - " /*start*/new X().foo()/*end*/;\n" + - "}", - }, - "Lp1/X;.foo()V" - ); - } finally { - if (primaryWorkingCopy != null) - primaryWorkingCopy.discardWorkingCopy(); - if (ownedWorkingcopy != null) - ownedWorkingcopy.discardWorkingCopy(); - } - } - - /* - * Ensures that the declaring class of a member parameterized type binding with a raw enclosing type is correct - */ - public void test067() throws CoreException { - ITypeBinding[] bindings = createTypeBindings( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " public class Y {\n" + - " }\n" + - " /*start*/Y/*end*/ field;\n" + - "}" - }, - new String[] {"Lp1/X$Y;"} - ); - assertBindingEquals( - "Lp1/X<>;", - bindings.length == 0 ? null : bindings[0].getDeclaringClass() - ); - } - - /* - * Ensures that a raw member type can be created using its key in batch creation. - */ - public void test068() throws CoreException, IOException { - try { - IJavaScriptProject project = createJavaProject("P1", new String[] {""}, new String[] {"JCL15_LIB"}, "", "1.5"); - addLibrary(project, "lib.jar", "src.zip", new String[] { - "/P1/p/X.js", - "package p;\n" + - "public class X {\n" + - " public static class Member {\n" + - " }\n" + - "}", - "/P1/p/Y.js", - "package p;\n" + - "public class Y {\n" + - " void foo(X.Member x) {\n" + - " }\n" + - "}", - }, "1.5"); - assertRequestedBindingFound( - new String[] { - "/P1/p1/Z.js", - "package p1;\n" + - "public class Z extends p.Y {\n" + - " /*start*/p.X.Member/*end*/ field;\n" + - "}" - }, - "Lp/X$Member<>;" - ); - } finally { - deleteProject("P1"); - } - } - - /* - * Ensures that requesting a CU needing a constant in a previously processed CU doesn't throw an NPE - * (regression test for bug 111822 DOMParser.createASTs() NPE at FieldReference.getConstantFor(FieldReference.java:408)) - */ - public void test069() throws CoreException { - this.workingCopies = createWorkingCopies(new String[] { - "/P/pkg/RefAnnoAndClassWithAnno.js", - "package pkg;\n" + - "public class RefMyAnnoAndClassWithAnno {\n" + - " final Class anno = MyAnno.class;\n" + - " final Class withAnno = ClassWithAnnotation.class;\n" + - "}", - "/P/pkg/MyAnno.js", - "package pkg;\n" + - "public @interface MyAnno {\n" + - " public enum EnumColor{\n" + - " BLUE, RED, WHITE;\n" + - " }\n" + - " EnumColor aEnum();\n" + - "}", - "/P/pkg/ClassWithAnnotation.js", - "package pkg;\n" + - "import pkg.MyAnno.EnumColor;\n" + - "@MyAnno(aEnum = EnumColor.BLUE)\n" + - "public class ClassWithAnnotation {}" - }); - String key = BindingKey.createTypeBindingKey("pkg.RefMyAnnoAndClassWithAnno"); - BindingResolver resolver = new BindingResolver(new MarkerInfo[0]); - resolveASTs(new IJavaScriptUnit[0], new String[] {key}, resolver, getJavaProject("P"), this.owner); - assertStringsEqual( - "Unexpected bindings", - "Lpkg/RefAnnoAndClassWithAnno~RefMyAnnoAndClassWithAnno;\n", - resolver.getFoundKeys()); - } - - /* - * Ensures that unrequested compilation units are not resolved - * (regression test for bug 114935 ASTParser.createASTs parses more CUs then required) - */ - public void test070() throws CoreException { - MarkerInfo[] markerInfos = createMarkerInfos(new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X extends /*start*/Y/*end*/ {\n" + - "}", - "/P/p1/Y.js", - "package p1;\n" + - "public class Y {\n" + - " static final int CONST = 2 + 3;\n" + - "}", - }); - this.workingCopies = createWorkingCopies(markerInfos, this.owner); - TestASTRequestor requestor = new TestASTRequestor(); - resolveASTs(new IJavaScriptUnit[] {this.workingCopies[0]}, requestor); - - // get the binding for Y - Type y = (Type) findNode((JavaScriptUnit) requestor.asts.get(0), markerInfos[0]); - ITypeBinding yBinding = y.resolveBinding(); - - // ensure that the fields for Y are not resolved - assertBindingsEqual("", yBinding.getDeclaredFields()); - } - - /* - * Ensures that unrequested compilation units are not resolved - * (regression test for bug 117018 IVariableBinding#getConstantValue() could be lazy resolved) - */ - public void test071() throws CoreException { - final MarkerInfo[] markerInfos = createMarkerInfos(new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X extends /*start*/Y/*end*/ {\n" + - "}", - "/P/p1/Y.js", - "package p1;\n" + - "public class Y {\n" + - " static final int CONST = 2 + 3;\n" + - "}", - }); - this.workingCopies = createWorkingCopies(markerInfos, this.owner); - class Requestor extends TestASTRequestor { - Object constantValue = null; - public void acceptAST(IJavaScriptUnit source, JavaScriptUnit ast) { - super.acceptAST(source, ast); - Type y = (Type) findNode(ast, markerInfos[0]); - ITypeBinding typeBinding = y.resolveBinding(); - IVariableBinding fieldBinding = typeBinding.getDeclaredFields()[0]; - this.constantValue = fieldBinding.getConstantValue(); - } - } - Requestor requestor = new Requestor(); - resolveASTs(new IJavaScriptUnit[] {this.workingCopies[0]}, requestor); - - assertEquals("Unexpected constant value", new Integer(5), requestor.constantValue); - } - - /* - * Ensures that the declaring method of a local variable binding retrieved using its key - * is not null - * (regression test for bug 129804 Local variable bindings from ASTParser#createASTs(.., String[], .., ..) have no declaring method) - */ - public void _test072() throws CoreException { - IVariableBinding[] bindings = createVariableBindings( - new String[] { - "/P/X.js", - "public class X {\n" + - " void m() {\n" + - " Object o;\n" + - " }\n" + - "}" - }, - new String[] { - "LX;.m()V#o" - } - ); - assertBindingEquals( - "LX;.m()V", - bindings[0].getDeclaringMethod()); - } -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/BindingsCollectorVisitor.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/BindingsCollectorVisitor.java deleted file mode 100644 index b4426d0..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/BindingsCollectorVisitor.java +++ /dev/null @@ -1,429 +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.util.HashMap; -import java.util.HashSet; - -import org.eclipse.wst.jsdt.core.dom.ASTNode; -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.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.ConstructorInvocation; -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.IBinding; -import org.eclipse.wst.jsdt.core.dom.IFunctionBinding; -import org.eclipse.wst.jsdt.core.dom.IPackageBinding; -import org.eclipse.wst.jsdt.core.dom.ITypeBinding; -import org.eclipse.wst.jsdt.core.dom.IVariableBinding; -import org.eclipse.wst.jsdt.core.dom.ImportDeclaration; -import org.eclipse.wst.jsdt.core.dom.InfixExpression; -import org.eclipse.wst.jsdt.core.dom.InstanceofExpression; -import org.eclipse.wst.jsdt.core.dom.ListExpression; -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.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.ThisExpression; -import org.eclipse.wst.jsdt.core.dom.TypeDeclaration; -import org.eclipse.wst.jsdt.core.dom.TypeLiteral; -import org.eclipse.wst.jsdt.core.dom.VariableDeclarationExpression; -import org.eclipse.wst.jsdt.core.dom.VariableDeclarationFragment; -/** - * @author oliviert - * - * To change this generated comment edit the template variable "typecomment": - * Window>Preferences>Java>Templates. - * To enable and disable the creation of type comments go to - * Window>Preferences>Java>Code Generation. - */ -class BindingsCollectorVisitor extends ASTVisitor { - - private HashMap hashMap; - private HashSet set; - - BindingsCollectorVisitor() { - // visit Javadoc.tags() as well - super(true); - this.hashMap = new HashMap(); - this.set = new HashSet(); - } - - private void collectBindings( - ASTNode node, - IBinding binding) { - if (binding != null) { - hashMap.put(node, binding); - } else { - set.add(node); - } - } - - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(AnonymousClassDeclaration) - */ - public void endVisit(AnonymousClassDeclaration node) { - ITypeBinding typeBinding = node.resolveBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(ArrayAccess) - */ - public void endVisit(ArrayAccess node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(ArrayCreation) - */ - public void endVisit(ArrayCreation node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(ArrayInitializer) - */ - public void endVisit(ArrayInitializer node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(ArrayType) - */ - public void endVisit(ArrayType node) { - ITypeBinding typeBinding = node.resolveBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(Assignment) - */ - public void endVisit(Assignment node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(BooleanLiteral) - */ - public void endVisit(BooleanLiteral node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(CharacterLiteral) - */ - public void endVisit(CharacterLiteral node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(ClassInstanceCreation) - */ - public void endVisit(ClassInstanceCreation node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(ConditionalExpression) - */ - public void endVisit(ConditionalExpression node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(ConstructorInvocation) - */ - public void endVisit(ConstructorInvocation node) { - IFunctionBinding methodBinding = node.resolveConstructorBinding(); - collectBindings(node, methodBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(FieldAccess) - */ - public void endVisit(FieldAccess node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(ImportDeclaration) - */ - public void endVisit(ImportDeclaration node) { - IBinding binding = node.resolveBinding(); - collectBindings(node, binding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(InfixExpression) - */ - public void endVisit(InfixExpression node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(InstanceofExpression) - */ - public void endVisit(InstanceofExpression node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see ASTVisitor#endVisit(MemberRef) - * @since 3.0 - */ - public void endVisit(MemberRef node) { - IBinding binding = node.resolveBinding(); - collectBindings(node, binding); - } - - public void endVisit(ListExpression node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(FunctionDeclaration) - */ - public void endVisit(FunctionDeclaration node) { - IFunctionBinding methodBinding = node.resolveBinding(); - collectBindings(node, methodBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(FunctionInvocation) - */ - public void endVisit(FunctionInvocation node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see ASTVisitor#endVisit(FunctionRef ) - * @since 3.0 - */ - public void endVisit(FunctionRef node) { - IBinding binding = node.resolveBinding(); - collectBindings(node, binding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(NullLiteral) - */ - public void endVisit(NullLiteral node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(NumberLiteral) - */ - public void endVisit(NumberLiteral node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(PackageDeclaration) - */ - public void endVisit(PackageDeclaration node) { - IPackageBinding packageBinding = node.resolveBinding(); - collectBindings(node, packageBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(ParenthesizedExpression) - */ - public void endVisit(ParenthesizedExpression node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(PostfixExpression) - */ - public void endVisit(PostfixExpression node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(PrefixExpression) - */ - public void endVisit(PrefixExpression node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(PrimitiveType) - */ - public void endVisit(PrimitiveType node) { - ITypeBinding typeBinding = node.resolveBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(QualifiedName) - */ - public void endVisit(QualifiedName node) { - IBinding binding = node.resolveBinding(); - collectBindings(node, binding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(SimpleName) - */ - public void endVisit(SimpleName node) { - IBinding binding = node.resolveBinding(); - collectBindings(node, binding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(SimpleType) - */ - public void endVisit(SimpleType node) { - ITypeBinding typeBinding = node.resolveBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(SingleVariableDeclaration) - */ - public void endVisit(SingleVariableDeclaration node) { - IVariableBinding variableBinding = node.resolveBinding(); - collectBindings(node, variableBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(StringLiteral) - */ - public void endVisit(StringLiteral node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(SuperConstructorInvocation) - */ - public void endVisit(SuperConstructorInvocation node) { - IFunctionBinding methodBinding = node.resolveConstructorBinding(); - collectBindings(node, methodBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(SuperFieldAccess) - */ - public void endVisit(SuperFieldAccess node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(SuperMethodInvocation) - */ - public void endVisit(SuperMethodInvocation node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(ThisExpression) - */ - public void endVisit(ThisExpression node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(TypeDeclaration) - */ - public void endVisit(TypeDeclaration node) { - ITypeBinding typeBinding = node.resolveBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(TypeLiteral) - */ - public void endVisit(TypeLiteral node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(VariableDeclarationExpression) - */ - public void endVisit(VariableDeclarationExpression node) { - ITypeBinding typeBinding = node.resolveTypeBinding(); - collectBindings(node, typeBinding); - } - - /** - * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(VariableDeclarationFragment) - */ - public void endVisit(VariableDeclarationFragment node) { - IVariableBinding variableBinding = node.resolveBinding(); - collectBindings(node, variableBinding); - } - - /** - * Returns the hashMap. - * @return HashMap - */ - public HashMap getBindingsMap() { - return hashMap; - } - - /** - * Returns the set. - * @return HashSet - */ - public HashSet getUnresolvedNodesSet() { - return set; - } - -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/CompatibilityRulesTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/CompatibilityRulesTests.java deleted file mode 100644 index bd91f13..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/CompatibilityRulesTests.java +++ /dev/null @@ -1,787 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 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 org.eclipse.core.runtime.CoreException; -import org.eclipse.wst.jsdt.core.IJavaScriptUnit; -import org.eclipse.wst.jsdt.core.IJavaScriptProject; -import org.eclipse.wst.jsdt.core.JavaScriptModelException; -import org.eclipse.wst.jsdt.core.dom.ASTNode; -import org.eclipse.wst.jsdt.core.dom.IFunctionBinding; -import org.eclipse.wst.jsdt.core.dom.ITypeBinding; -import org.eclipse.wst.jsdt.core.dom.FunctionDeclaration; - -import junit.framework.Test; - -public class CompatibilityRulesTests extends AbstractASTTests { - - public CompatibilityRulesTests(String name) { - super(name); - } - - public static Test suite() { - return buildModelTestSuite(CompatibilityRulesTests.class); - } - - // Use this static initializer to specify subset for tests - // All specified tests which do not belong to the class are skipped... - static { -// TESTS_PREFIX = "testBug86380"; -// TESTS_NAMES = new String[] { "test032" }; -// TESTS_NUMBERS = new int[] { 83230 }; -// TESTS_RANGE = new int[] { 83304, -1 }; - } - - public void setUpSuite() throws Exception { - super.setUpSuite(); - createJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "", "1.5"); - } - - public void tearDownSuite() throws Exception { - deleteProject("P"); - super.tearDownSuite(); - } - - /* - * Ensures that a subtype is subtype compatible with its super type - */ - public void test001() throws JavaScriptModelException { - ITypeBinding[] bindings = createTypeBindings( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}", - "/P/p1/Y.js", - "package p1;\n" + - "public class Y extends X {\n" + - "}", - }, - new String[] { - "Lp1/X;", - "Lp1/Y;" - }); - assertTrue("X should be subtype compatible with Y", bindings[1].isSubTypeCompatible(bindings[0])); - } - - /* - * Ensures that a type is subtype compatible with itself - */ - public void test002() throws JavaScriptModelException { - ITypeBinding[] bindings = createTypeBindings( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}", - }, - new String[] { - "Lp1/X;", - }); - assertTrue("X should be subtype compatible with itself", bindings[0].isSubTypeCompatible(bindings[0])); - } - - /* - * Ensures that a supertype is not subtype compatible with its subtype - */ - public void test003() throws JavaScriptModelException { - ITypeBinding[] bindings = createTypeBindings( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}", - "/P/p1/Y.js", - "package p1;\n" + - "public class Y extends X {\n" + - "}", - }, - new String[] { - "Lp1/X;", - "Lp1/Y;" - }); - assertTrue("X should not be subtype compatible with Y", !bindings[0].isSubTypeCompatible(bindings[1])); - } - - /* - * Ensures that a type is not subtype compatible with an unrelated type. - */ - public void test004() throws JavaScriptModelException { - ITypeBinding[] bindings = createTypeBindings( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}", - "/P/p1/Y.js", - "package p1;\n" + - "public class Y {\n" + - "}", - }, - new String[] { - "Lp1/X;", - "Lp1/Y;" - }); - assertTrue("X should not be subtype compatible with Y", !bindings[0].isSubTypeCompatible(bindings[1])); - } - - /* - * Ensures that the int base type is not subtype compatible with the long base type - */ - public void test005() throws JavaScriptModelException { - ITypeBinding[] bindings = createTypeBindings( - new String[] {}, - new String[] { - "I", - "J" - }); - assertTrue("int should not be subtype compatible with long", !bindings[0].isSubTypeCompatible(bindings[1])); - } - - /* - * Ensures that the int base type is not subtype compatible with the java.lang.Object type - */ - public void test006() throws JavaScriptModelException { - ITypeBinding[] bindings = createTypeBindings( - new String[] {}, - new String[] { - "I", - "Ljava/lang/Object;" - }); - assertTrue("int should not be subtype compatible with Object", !bindings[0].isSubTypeCompatible(bindings[1])); - } - - /* - * Ensures that a subtype is assignment compatible with its super type - */ - public void test007() throws JavaScriptModelException { - ITypeBinding[] bindings = createTypeBindings( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}", - "/P/p1/Y.js", - "package p1;\n" + - "public class Y extends X {\n" + - "}", - }, - new String[] { - "Lp1/X;", - "Lp1/Y;" - }); - assertTrue("X should be assignment compatible with Y", bindings[1].isAssignmentCompatible(bindings[0])); - } - - /* - * Ensures that a type is assignment compatible with itself - */ - public void test008() throws JavaScriptModelException { - ITypeBinding[] bindings = createTypeBindings( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}", - }, - new String[] { - "Lp1/X;", - }); - assertTrue("X should be assignment compatible with itself", bindings[0].isAssignmentCompatible(bindings[0])); - } - - /* - * Ensures that a supertype is not assignment compatible with its subtype - */ - public void test009() throws JavaScriptModelException { - ITypeBinding[] bindings = createTypeBindings( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}", - "/P/p1/Y.js", - "package p1;\n" + - "public class Y extends X {\n" + - "}", - }, - new String[] { - "Lp1/X;", - "Lp1/Y;" - }); - assertTrue("X should not be assignment compatible with Y", !bindings[0].isAssignmentCompatible(bindings[1])); - } - - /* - * Ensures that a type is not assigment compatible with an unrelated type. - */ - public void test010() throws JavaScriptModelException { - ITypeBinding[] bindings = createTypeBindings( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}", - "/P/p1/Y.js", - "package p1;\n" + - "public class Y {\n" + - "}", - }, - new String[] { - "Lp1/X;", - "Lp1/Y;" - }); - assertTrue("X should not be assigment compatible with Y", !bindings[0].isAssignmentCompatible(bindings[1])); - } - - /* - * Ensures that the int base type is assignment compatible with the long base type - */ - public void test011() throws JavaScriptModelException { - ITypeBinding[] bindings = createTypeBindings( - new String[] {}, - new String[] { - "I", - "J" - }); - assertTrue("int should be assignment compatible with long", bindings[0].isAssignmentCompatible(bindings[1])); - } - - /* - * Ensures that the int base type is not assignment compatible with the java.lang.Object type in 1.4 mode. - */ - public void test012() throws CoreException { - try { - IJavaScriptProject project = createJavaProject("P14", new String[] {""}, new String[] {"JCL_LIB"}, "", "1.4"); - ITypeBinding[] bindings = createTypeBindings( - new String[] {}, - new String[] { - "I", - "Ljava/lang/Object;" - }, - project); - assertTrue("int should not be assignment compatible with Object", !bindings[0].isAssignmentCompatible(bindings[1])); - } finally { - deleteProject("P14"); - } - } - - /* - * Ensures that a subtype is cast compatible with its super type - */ - public void test013() throws JavaScriptModelException { - ITypeBinding[] bindings = createTypeBindings( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}", - "/P/p1/Y.js", - "package p1;\n" + - "public class Y extends X {\n" + - "}", - }, - new String[] { - "Lp1/X;", - "Lp1/Y;" - }); - assertTrue("X should be cast compatible with Y", bindings[1].isCastCompatible(bindings[0])); - } - - /* - * Ensures that a type is cast compatible with itself - */ - public void test014() throws JavaScriptModelException { - ITypeBinding[] bindings = createTypeBindings( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}", - }, - new String[] { - "Lp1/X;", - }); - assertTrue("X should be cast compatible with itself", bindings[0].isCastCompatible(bindings[0])); - } - - /* - * Ensures that a supertype is cast compatible with its subtype - */ - public void test015() throws JavaScriptModelException { - ITypeBinding[] bindings = createTypeBindings( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}", - "/P/p1/Y.js", - "package p1;\n" + - "public class Y extends X {\n" + - "}", - }, - new String[] { - "Lp1/X;", - "Lp1/Y;" - }); - assertTrue("X should be cast compatible with Y", bindings[0].isCastCompatible(bindings[1])); - } - - /* - * Ensures that a type is not cast compatible with an unrelated type. - */ - public void test016() throws JavaScriptModelException { - ITypeBinding[] bindings = createTypeBindings( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}", - "/P/p1/Y.js", - "package p1;\n" + - "public class Y {\n" + - "}", - }, - new String[] { - "Lp1/X;", - "Lp1/Y;" - }); - assertTrue("X should not be cast compatible with Y", !bindings[0].isCastCompatible(bindings[1])); - } - - /* - * Ensures that the int base type is cast compatible with the long base type - */ - public void test017() throws JavaScriptModelException { - ITypeBinding[] bindings = createTypeBindings( - new String[] {}, - new String[] { - "I", - "J" - }); - assertTrue("int should be cast compatible with long", bindings[0].isCastCompatible(bindings[1])); - } - - /* - * Ensures that the int base type is not cast compatible with the java.lang.Object type - */ - public void test018() throws JavaScriptModelException { - ITypeBinding[] bindings = createTypeBindings( - new String[] {}, - new String[] { - "I", - "Ljava/lang/Object;" - }); - assertTrue("int should not be cast compatible with Object", !bindings[0].isCastCompatible(bindings[1])); - } - - /* - * Ensures that a method in a subtype overrides the corresponding method in the super type. - */ - public void test019() throws JavaScriptModelException { - IFunctionBinding[] bindings = createMethodBindings( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " 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 override X#foo()", bindings[0].overrides(bindings[1])); - } - - /* - * Ensures that a method in a super type doesn't override the corresponding method in a subtype. - */ - public void test020() throws JavaScriptModelException { - IFunctionBinding[] bindings = createMethodBindings( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " void foo() {\n" + - " }\n" + - "}", - "/P/p1/Y.js", - "package p1;\n" + - "public class Y extends X {\n" + - " void foo() {\n" + - " }\n" + - "}", - }, - new String[] { - "Lp1/X;.foo()V", - "Lp1/Y;.foo()V" - }); - assertTrue("X#foo() should not override Y#foo()", !bindings[0].overrides(bindings[1])); - } - - /* - * Ensures that a method doesn't override the corresponding method in an unrelated type. - */ - public void test021() throws JavaScriptModelException { - IFunctionBinding[] bindings = createMethodBindings( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " void foo() {\n" + - " }\n" + - "}", - "/P/p1/Y.js", - "package p1;\n" + - "public class Y {\n" + - " void foo() {\n" + - " }\n" + - "}", - }, - new String[] { - "Lp1/X;.foo()V", - "Lp1/Y;.foo()V" - }); - assertTrue("X#foo() should not override Y#foo()", !bindings[0].overrides(bindings[1])); - } - - /* - * Ensures that IFunctionBinding#ovverides(IFunctionBinding) doesn't throw a NullPointerException if - * the method was not built in a batch. - * (regression test for bug 79635 NPE when asking an IFunctionBinding whether it overrides itself) - */ - public void test022() throws JavaScriptModelException { - IJavaScriptUnit workingCopy = null; - try { - workingCopy = getWorkingCopy("/P/p1/X.js", true/*compute problems to get bindings*/); - ASTNode node = buildAST( - "package p1;\n" + - "public class X {\n" + - " /*start*/void foo() {\n" + - " }/*end*/\n" + - "}", - workingCopy); - IFunctionBinding methodBinding = ((FunctionDeclaration) node).resolveBinding(); - assertTrue("X#foo() should not override itself", !methodBinding.overrides(methodBinding)); - } finally { - if (workingCopy != null) - workingCopy.discardWorkingCopy(); - } - } - - /* - * Ensures that a base type is assignment compatible with its wrapper type - * (regression test for bug 80455 [5.0] ITypeBinding.canAssign not aware of type boxing) - */ - public void test023() throws JavaScriptModelException { - ITypeBinding[] bindings = createTypeBindings( - new String[] { - "/P/java/lang/Integer.js", - "package java.lang;\n" + - "public class Integer {\n" + - "}", - }, - new String[] { - "I", - "Ljava/lang/Integer;", - }); - assertTrue("int should be assignment compatible with Integer", bindings[0].isAssignmentCompatible(bindings[1])); - } - - /* - * Ensures that a base type is assignment compatible with Object - */ - public void test024() throws JavaScriptModelException { - ITypeBinding[] bindings = createTypeBindings( - new String[] {}, - new String[] { - "I", - "Ljava/lang/Object;", - }); - assertTrue("int should be assignment compatible with Object", bindings[0].isAssignmentCompatible(bindings[1])); - } - - /* - * Ensures that a method is subsignature of itself. - */ - public void test025() throws JavaScriptModelException { - IFunctionBinding[] bindings = createMethodBindings( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " void foo() {\n" + - " }\n" + - "}", - }, - new String[] { - "Lp1/X;.foo()V" - }); - assertTrue("X#foo() should be a subsignature of X#foo()", bindings[0].isSubsignature(bindings[0])); - } - - /* - * Ensures that a method is subsignature of its super method. - */ - public void test026() throws JavaScriptModelException { - IFunctionBinding[] bindings = createMethodBindings( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " String foo(Object o) {\n" + - " }\n" + - "}", - "/P/p1/Y.js", - "package p1;\n" + - "public class Y extends X {\n" + - " String foo(Object o) {\n" + - " }\n" + - "}", - }, - new String[] { - "Lp1/X;.foo(Ljava/lang/Object;)Ljava/lang/String;", - "Lp1/Y;.foo(Ljava/lang/Object;)Ljava/lang/String;", - }); - assertTrue("Y#foo(Object) should be a subsignature of X#foo(Object)", bindings[1].isSubsignature(bindings[0])); - } - - /* - * Ensures that a method is subsignature of its super generic method. - */ - public void test027() throws JavaScriptModelException { - IFunctionBinding[] bindings = createMethodBindings( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " Z foo(Z o) {\n" + - " }\n" + - "}", - "/P/p1/Y.js", - "package p1;\n" + - "public class Y extends X {\n" + - " Z foo(Z o) {\n" + - " }\n" + - "}", - "/P/p1/Z.js", - "package p1;\n" + - "public class Z {\n" + - "}", - }, - new String[] { - "Lp1/X;.foo(Lp1/Z;)Lp1/Z;", - "Lp1/Y;.foo(Lp1/Z;)Lp1/Z;", - }); - assertTrue("Y#foo(Z) should be a subsignature of X#foo(Z)", bindings[1].isSubsignature(bindings[0])); - } - - /* - * Ensures that a method is not the subsignature of an unrelated method. - */ - public void test028() throws JavaScriptModelException { - IFunctionBinding[] bindings = createMethodBindings( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " void foo() {\n" + - " }\n" + - "}", - "/P/p1/Y.js", - "package p1;\n" + - "public class Y {\n" + - " void bar() {\n" + - " }\n" + - "}", - }, - new String[] { - "Lp1/X;.foo()V", - "Lp1/Y;.bar()V", - }); - assertTrue("Y#bar() should not be a subsignature of X#foo()", !bindings[1].isSubsignature(bindings[0])); - } - - /* - * Ensures that a method in a subtype doesn't override the a method with same parameters but with different name in the super type. - */ - public void test029() throws JavaScriptModelException { - IFunctionBinding[] bindings = createMethodBindings( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " void foo() {\n" + - " }\n" + - "}", - "/P/p1/Y.js", - "package p1;\n" + - "public class Y extends X {\n" + - " void bar() {\n" + - " }\n" + - "}", - }, - new String[] { - "Lp1/Y;.bar()V", - "Lp1/X;.foo()V" - }); - assertTrue("Y#bar() should not override X#foo()", !bindings[0].overrides(bindings[1])); - } - - /* - * Ensures that a method in a subtype overrides a method in the super parameterized type. - * (regression test for bug 99608 IFunctionBinding#overrides returns false on overridden method) - */ - public void test030() throws JavaScriptModelException { - IFunctionBinding[] bindings = createMethodBindings( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " void foo(T t) {\n" + - " }\n" + - "}", - "/P/p1/Y.js", - "package p1;\n" + - "public class Y extends X {\n" + - " void foo(String s) {\n" + - " }\n" + - "}", - }, - new String[] { - "Lp1/Y;.foo(Ljava/lang/String;)V", - "Lp1/X;.foo(TT;)V" - }); - assertTrue("Y#foo(String) should override X#foo(T)", bindings[0].overrides(bindings[1])); - } - - /* - * Ensures that a method with the same parameter types but with different type parameters is not a subsignature of its super method. - * (regression test for bug 107110 IFunctionBinding.isSubsignature not yet correctly implemented) - */ - public void test031() throws JavaScriptModelException { - IFunctionBinding[] bindings = createMethodBindings( - new String[] { - "/P/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " void foo() {\n" + - " }\n" + - "}\n" + - "class Y extends X {\n" + - " void foo() {\n" + - " }\n" + - "}", - }, - new String[] { - "Lp1/X;.foo()V", - "Lp1/Y;.foo()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 + "Objects 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= "Objs" + 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 x) {\n" + - " }\n" + - " void foo(float f, X x) {\n" + - " }\n" + - " void foo(Y 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 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 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 foo(X x) throws RuntimeException, U {\n" + - " return null;\n" + - " }\n" + - " V foo(K key, V value) throws Exception {\n" + - " return value;\n" + - " }\n" + - "}", - "generic/Y.js", - "package generic;\n" + - "public class Y {\n" + - "}", - "generic/Z.js", - "package generic;\n" + - "public class Z> {\n" + - "}", - "generic/I.js", - "package generic;\n" + - "public interface I {\n" + - "}", - "generic/W.js", - "package generic;\n" + - "public class W , U extends T> {\n" + - "}", - "generic/V.js", - "package generic;\n" + - "public class V extends X implements I {\n" + - "}", - "varargs/X.js", - "package varargs;\n" + - "public class X {\n" + - " void foo(String s, Object ... others) {\n" + - " }\n" + - "}", - "workingcopy/X.js", - "package workingcopy;\n" + - "public class X {\n" + - " void foo() {\n" + - " System.out.println();\n" + - " }\n" + - "}", - "workingcopy/Y.js", - "package workingcopy;\n" + - "public class Y {\n" + - " T foo(T t, String... args) {\n" + - " return t;\n" + - " }\n" + - "}", - }; - addLibrary(javaProject, "lib.jar", "libsrc.zip", pathAndContents, JavaScriptCore.VERSION_1_5); - this.jarRoot = javaProject.getPackageFragmentRoot(getFile("/P/lib.jar")); -} - -public void tearDownSuite() throws Exception { - super.tearDownSuite(); - deleteProject("P"); -} - -protected void tearDown() throws Exception { - if (this.workingCopy != null) - this.workingCopy.discardWorkingCopy(); - if (this.classFile != null) { - removeLibrary(getJavaProject("P"), "lib2.jar", "src2.zip"); - this.classFile = null; - } - super.tearDown(); -} - -private IClassFile createClassFile(String contents) throws CoreException, IOException { - IJavaScriptProject project = getJavaProject("P"); - addLibrary(project, "lib2.jar", "src2.zip", new String[] {"p/X.js", contents}, "1.5"); - this.classFile = project.getPackageFragmentRoot(getFile("/P/lib2.jar")).getPackageFragment("p").getClassFile("X.class"); - return this.classFile; -} - -/* - * Ensures that no exception is thrown for a .class file name with a dot - * (regression test for bug 114140 assertion failed when opening a class file not not the classpath) - */ -public void testDotName() throws JavaScriptModelException { - IType type = getClassFile("/P/X.Y.class").getType(); - assertEquals("X.Y", type.getElementName()); -} - -/* - * Ensure that the categories for a class are correct. - */ -public void testGetCategories01() throws CoreException, IOException { - createClassFile( - "package p;\n" + - "/**\n" + - " * @category test\n" + - " */\n" + - "public class X {\n" + - "}" - ); - String[] categories = this.classFile.getType().getCategories(); - assertStringsEqual( - "Unexpected categories", - "test\n", - categories); -} -public void testGetCategories02() throws CoreException, IOException { - createClassFile( - "package p;\n" + - "/**\n" + - " * @category test1 test2 test3 test4 test5 test6 test7 test8 test9 test10\n" + - " */\n" + - "public class X {\n" + - "}" - ); - String[] categories = this.classFile.getType().getCategories(); - assertStringsEqual( - "Unexpected categories", - "test1\ntest2\ntest3\ntest4\ntest5\ntest6\ntest7\ntest8\ntest9\ntest10\n", - categories); -} - -/* - * Ensure that the categories for a field are correct. - */ -public void testGetCategories03() throws CoreException, IOException { - createClassFile( - "package p;\n" + - "public class X {\n" + - " /**\n" + - " * @category test\n" + - " */\n" + - " int field;\n" + - "}" - ); - String[] categories = this.classFile.getType().getField("field").getCategories(); - assertStringsEqual( - "Unexpected categories", - "test\n", - categories); -} -public void testGetCategories04() throws CoreException, IOException { - createClassFile( - "package p;\n" + - "public class X {\n" + - " /**\n" + - " * @category test1 test2\n" + - " */\n" + - " int field;\n" + - "}" - ); - String[] categories = this.classFile.getType().getField("field").getCategories(); - assertStringsEqual( - "Unexpected categories", - "test1\ntest2\n", - categories); -} - -/* - * Ensure that the categories for a method are correct. - */ -public void testGetCategories05() throws CoreException, IOException { - createClassFile( - "package p;\n" + - "public class X {\n" + - " /**\n" + - " * @category test\n" + - " */\n" + - " void foo() {}\n" + - "}" - ); - String[] categories = this.classFile.getType().getFunction("foo", new String[0]).getCategories(); - assertStringsEqual( - "Unexpected categories", - "test\n", - categories); -} -public void testGetCategories06() throws CoreException, IOException { - createClassFile( - "package p;\n" + - "public class X {\n" + - " /**\n" + - " * @category test1 test2 test3 test4 test5\n" + - " */\n" + - " void foo() {}\n" + - "}" - ); - String[] categories = this.classFile.getType().getFunction("foo", new String[0]).getCategories(); - assertStringsEqual( - "Unexpected categories", - "test1\ntest2\ntest3\ntest4\ntest5\n", - categories); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=125676 -public void testGetCategories07() throws CoreException, IOException { - createClassFile( - "package p;\n" + - "public class X {\n" + - " /**\n" + - " * @category " + - " * test\n" + - " */\n" + - " void foo() {}\n" + - "}" - ); - String[] categories = this.classFile.getType().getFunction("foo", new String[0]).getCategories(); - assertStringsEqual( - "Unexpected categories", - "", - categories); -} -public void testGetCategories08() throws CoreException, IOException { - createClassFile( - "package p;\n" + - "public class X {\n" + - " /**\n" + - " * @category" + - " * test\n" + - " */\n" + - " void foo() {}\n" + - "}" - ); - String[] categories = this.classFile.getType().getFunction("foo", new String[0]).getCategories(); - assertStringsEqual( - "Unexpected categories", - "", - categories); -} -public void testGetCategories09() throws CoreException, IOException { - createClassFile( - "package p;\n" + - "public class X {\n" + - " /**\n" + - " * @category test1" + - " * test2\n" + - " */\n" + - " void foo() {}\n" + - "}" - ); - String[] categories = this.classFile.getType().getFunction("foo", new String[0]).getCategories(); - assertStringsEqual( - "Unexpected categories", - "test1\n", - categories); -} - -/* - * Ensure that the categories for a member that has no categories when another member defines some are correct. - */ -public void testGetCategories10() throws CoreException, IOException { - createClassFile( - "package p;\n" + - "public class X {\n" + - " int field1;\n" + - " /**\n" + - " * @category test\n" + - " */\n" + - " int field2;\n" + - "}" - ); - String[] categories = this.classFile.getType().getField("field1").getCategories(); - assertStringsEqual( - "Unexpected categories", - "", - categories); -} - -/* - * Ensures that the children of a type for a given category are correct. - */ -public void testGetChildrenForCategory01() throws CoreException, IOException { - createClassFile( - "package p;\n" + - "public class X {\n" + - " /**\n" + - " * @category test\n" + - " */\n" + - " int field;\n" + - " /**\n" + - " * @category test\n" + - " */\n" + - " void foo1() {}\n" + - " /**\n" + - " * @category test\n" + - " */\n" + - " void foo2() {}\n" + - " /**\n" + - " * @category other\n" + - " */\n" + - " void foo3() {}\n" + - "}" - ); - IJavaScriptElement[] children = this.classFile.getType().getChildrenForCategory("test"); - assertElementsEqual( - "Unexpected children", - "field [in X [in X.class [in p [in lib2.jar [in P]]]]]\n" + - "foo1() [in X [in X.class [in p [in lib2.jar [in P]]]]]\n" + - "foo2() [in X [in X.class [in p [in lib2.jar [in P]]]]]", - children); -} -public void testGetChildrenForCategory02() throws CoreException, IOException { - createClassFile( - "package p;\n" + - "public class X {\n" + - " /**\n" + - " * @category fields test all\n" + - " */\n" + - " int field;\n" + - " /**\n" + - " * @category methods test all\n" + - " */\n" + - " void foo1() {}\n" + - " /**\n" + - " * @category methods test all\n" + - " */\n" + - " void foo2() {}\n" + - " /**\n" + - " * @category methods other all\n" + - " */\n" + - " void foo3() {}\n" + - "}" - ); - IJavaScriptElement[] tests = this.classFile.getType().getChildrenForCategory("test"); - assertElementsEqual( - "Unexpected children", - "field [in X [in X.class [in p [in lib2.jar [in P]]]]]\n" + - "foo1() [in X [in X.class [in p [in lib2.jar [in P]]]]]\n" + - "foo2() [in X [in X.class [in p [in lib2.jar [in P]]]]]", - tests); - IJavaScriptElement[] methods = this.classFile.getType().getChildrenForCategory("methods"); - assertElementsEqual( - "Unexpected children", - "foo1() [in X [in X.class [in p [in lib2.jar [in P]]]]]\n" + - "foo2() [in X [in X.class [in p [in lib2.jar [in P]]]]]\n" + - "foo3() [in X [in X.class [in p [in lib2.jar [in P]]]]]", - methods); - IJavaScriptElement[] others = this.classFile.getType().getChildrenForCategory("other"); - assertElementsEqual( - "Unexpected children", - "foo3() [in X [in X.class [in p [in lib2.jar [in P]]]]]", - others); - IJavaScriptElement[] all = this.classFile.getType().getChildrenForCategory("all"); - assertElementsEqual( - "Unexpected children", - "field [in X [in X.class [in p [in lib2.jar [in P]]]]]\n" + - "foo1() [in X [in X.class [in p [in lib2.jar [in P]]]]]\n" + - "foo2() [in X [in X.class [in p [in lib2.jar [in P]]]]]\n" + - "foo3() [in X [in X.class [in p [in lib2.jar [in P]]]]]", - all); -} - -/* - * Ensures that IType#getSuperclassTypeSignature() is correct for a binary type. - * (regression test for bug 78520 [model] IType#getSuperInterfaceTypeSignatures() doesn't include type arguments) - */ -public void testGetSuperclassTypeSignature() throws JavaScriptModelException { - IType type = this.jarRoot.getPackageFragment("generic").getClassFile("V.class").getType(); - assertEquals( - "Unexpected signature", - "Lgeneric.X;", - type.getSuperclassTypeSignature()); -} - -/* - * Ensures that the parameter names of a binary method with source attached are correct. - */ -public void testParameterNames01() throws CoreException { - IFunction method = this.jarRoot.getPackageFragment("generic").getClassFile("X.class").getType().getFunction("foo", new String[] {"TK;", "TV;"}); - String[] parameterNames = method.getParameterNames(); - assertStringsEqual( - "Unexpected parameter names", - "key\n" + - "value\n", - parameterNames); -} - -/* - * Ensures that the parameter names of a binary method without source attached are correct. - */ -public void testParameterNames02() throws CoreException { - IPath sourceAttachmentPath = this.jarRoot.getSourceAttachmentPath(); - try { - attachSource(this.jarRoot, null, null); - IFunction method = this.jarRoot.getPackageFragment("generic").getClassFile("X.class").getType().getFunction("foo", new String[] {"TK;", "TV;"}); - String[] parameterNames = method.getParameterNames(); - assertStringsEqual( - "Unexpected parameter names", - "arg0\n" + - "arg1\n", - parameterNames); - } finally { - attachSource(this.jarRoot, sourceAttachmentPath.toString(), null); - } -} - -/* - * Ensures that the raw parameter names of a binary method with source attached are correct. - */ -public void testRawParameterNames01() throws CoreException { - IFunction method = this.jarRoot.getPackageFragment("generic").getClassFile("X.class").getType().getFunction("foo", new String[] {"TK;", "TV;"}); - String[] parameterNames = method.getRawParameterNames(); - assertStringsEqual( - "Unexpected parameter names", - "arg0\n" + - "arg1\n", - parameterNames); -} - -/* - * Ensures that the raw parameter names of a binary method without source attached are correct. - */ -public void testRawParameterNames02() throws CoreException { - IPath sourceAttachmentPath = this.jarRoot.getSourceAttachmentPath(); - try { - attachSource(this.jarRoot, null, null); - IFunction method = this.jarRoot.getPackageFragment("generic").getClassFile("X.class").getType().getFunction("foo", new String[] {"TK;", "TV;"}); - String[] parameterNames = method.getParameterNames(); - assertStringsEqual( - "Unexpected parameter names", - "arg0\n" + - "arg1\n", - parameterNames); - } finally { - attachSource(this.jarRoot, sourceAttachmentPath.toString(), null); - } -} - -/* - * Ensure that the return type of a binary method is correct. - */ -public void testReturnType1() throws JavaScriptModelException { - IType type = this.jarRoot.getPackageFragment("generic").getClassFile("X.class").getType(); - IFunction method = type.getFunction("foo", new String[] {"TK;", "TV;"}); - assertEquals( - "Unexpected return type", - "TV;", - method.getReturnType()); -} - -/* - * Ensure that the return type of a binary method is correct. - */ -public void testReturnType2() throws JavaScriptModelException { - IType type = this.jarRoot.getPackageFragment("generic").getClassFile("X.class").getType(); - IFunction method = type.getFunction("foo", new String[] {"Lgeneric.X;"}); - assertEquals( - "Unexpected return type", - "Lgeneric.X;", - method.getReturnType()); -} - -/* - * Ensures that asking for the source range of a IClassFile in a non-Java project throws a JavaScriptModelException - * (regression test for bug 132494 JavaScriptModelException opening up class file in non java project) - */ -public void testSourceRangeNonJavaProject() throws CoreException { - try { - createProject("Simple"); - createFile("/Simple/X.class", ""); - IClassFile classX = getClassFile("/Simple/X.class"); - JavaScriptModelException exception = null; - try { - classX.getSourceRange(); - } catch (JavaScriptModelException e) { - exception = e; - } - assertExceptionEquals("Unexpected exception", "Simple does not exist", exception); - } finally { - deleteProject("Simple"); - } -} - -/* - * Ensures that asking for the source range of a IClassFile not on the classpath of a Java project doesn't throw a JavaScriptModelException - * (regression test for bug 138507 exception in .class file editor for classes imported via plug-in import) - */ -public void testSourceRangeNotOnClasspath() throws CoreException { - try { - createJavaProject("P2", new String[] {"src"}); - createFile("/P2/bin/X.class", ""); - IClassFile classX = getClassFile("/P2/bin/X.class"); - assertNull("Unxepected source range", classX.getSourceRange()); - } finally { - deleteProject("P2"); - } -} - -/* - * Ensure that a method with varargs has the AccVarargs flag set. - */ -public void testVarargs() throws JavaScriptModelException { - IType type = this.jarRoot.getPackageFragment("varargs").getClassFile("X.class").getType(); - IFunction method = type.getFunction("foo", new String[]{"Ljava.lang.String;", "[Ljava.lang.Object;"}); - assertTrue("Should have the AccVarargs flag set", Flags.isVarargs(method.getFlags())); -} - -/* - * Ensures that a class file can be turned into a working copy and that its children are correct. - */ -public void testWorkingCopy01() throws CoreException { - IClassFile clazz = this.jarRoot.getPackageFragment("workingcopy").getClassFile("X.class"); - this.workingCopy = clazz.getWorkingCopy(null, null); - assertElementDescendants( - "Unexpected children", - "[Working copy] X.class\n" + - " package workingcopy\n" + - " class X\n" + - " void foo()", - this.workingCopy); -} - -/* - * Ensures that a class file without source attached can be turned into a working copy and that its children are correct. - */ -public void testWorkingCopy02() throws CoreException { - IPath sourceAttachmentPath = this.jarRoot.getSourceAttachmentPath(); - try { - attachSource(this.jarRoot, null, null); - IClassFile clazz = this.jarRoot.getPackageFragment("workingcopy").getClassFile("X.class"); - assertNull("Should not have source attached", clazz.getSource()); - this.workingCopy = clazz.getWorkingCopy(null, null); - assertElementDescendants( - "Unexpected children", - "[Working copy] X.class\n" + - " package workingcopy\n" + - " class X\n" + - " X()\n" + - " void foo()", - this.workingCopy); - } finally { - attachSource(this.jarRoot, sourceAttachmentPath.toString(), null); - } -} - -/* - * Ensures that a class file can be turned into a working copy, modified and that its children are correct. - */ -public void testWorkingCopy03() throws CoreException { - IClassFile clazz = this.jarRoot.getPackageFragment("workingcopy").getClassFile("X.class"); - this.workingCopy = clazz.getWorkingCopy(null, null); - this.workingCopy.getBuffer().setContents( - "package workingcopy;\n" + - "public class X {\n" + - " void bar() {\n" + - " }\n" + - "}" - ); - this.workingCopy.reconcile(IJavaScriptUnit.NO_AST, false/*don't force problems*/, null/*primary owner*/, null/*no progress*/); - assertElementDescendants( - "Unexpected children", - "[Working copy] X.class\n" + - " package workingcopy\n" + - " class X\n" + - " void bar()", - this.workingCopy); -} - -/* - * Ensures that a class file working copy cannot be commited - */ -public void testWorkingCopy04() throws CoreException { - IClassFile clazz = this.jarRoot.getPackageFragment("workingcopy").getClassFile("X.class"); - this.workingCopy = clazz.getWorkingCopy(null, null); - this.workingCopy.getBuffer().setContents( - "package workingcopy;\n" + - "public class X {\n" + - " void bar() {\n" + - " }\n" + - "}" - ); - JavaScriptModelException exception = null; - try { - this.workingCopy.commitWorkingCopy(false/*don't force*/, null); - } catch (JavaScriptModelException e) { - exception = e; - } - assertEquals( - "Unxepected JavaScriptModelException", - "JavaScript Model Exception: JavaScript Model Status [Operation not supported for specified element type(s):[Working copy] X.class [in workingcopy [in lib.jar [in P]]]]", - exception.toString()); -} - -/* - * Ensures that a type can be created in class file working copy. - */ -public void testWorkingCopy05() throws CoreException { - IClassFile clazz = this.jarRoot.getPackageFragment("workingcopy").getClassFile("X.class"); - this.workingCopy = clazz.getWorkingCopy(null, null); - this.workingCopy.createType( - "class Y {\n" + - "}", - null, - false/*don't force*/, - null); - assertElementDescendants( - "Unexpected children", - "[Working copy] X.class\n" + - " package workingcopy\n" + - " class X\n" + - " void foo()\n" + - " class Y", - this.workingCopy); -} - -/* - * Ensures that the primary compilation unit of class file working copy is correct. - */ -public void testWorkingCopy06() throws CoreException { - IClassFile clazz = this.jarRoot.getPackageFragment("workingcopy").getClassFile("X.class"); - WorkingCopyOwner owner = new WorkingCopyOwner() {}; - this.workingCopy = clazz.getWorkingCopy(owner, null); - IJavaScriptUnit primary = this.workingCopy.getPrimary(); - assertEquals("Unexpected owner of primary working copy", null, primary.getOwner()); -} - -/* - * Ensures that a class file working copy can be restored from the original source. - */ -public void testWorkingCopy07() throws CoreException { - IClassFile clazz = this.jarRoot.getPackageFragment("workingcopy").getClassFile("X.class"); - WorkingCopyOwner owner = new WorkingCopyOwner() {}; - this.workingCopy = clazz.getWorkingCopy(owner, null); - this.workingCopy.getBuffer().setContents( - "package workingcopy;\n" + - "public class X {\n" + - " void bar() {\n" + - " }\n" + - "}" - ); - this.workingCopy.reconcile(IJavaScriptUnit.NO_AST, false/*don't force problems*/, null/*primary owner*/, null/*no progress*/); - this.workingCopy.restore(); - assertElementDescendants( - "Unexpected children", - "[Working copy] X.class\n" + - " package workingcopy\n" + - " class X\n" + - " void foo()", - this.workingCopy); -} - -/* - * Ensures that a class file working copy can be reconciled against. - */ -public void testWorkingCopy08() throws CoreException { - IClassFile clazz = this.jarRoot.getPackageFragment("workingcopy").getClassFile("X.class"); - WorkingCopyOwner owner = new WorkingCopyOwner() {}; - this.workingCopy = clazz.getWorkingCopy(owner, null); - this.workingCopy.getBuffer().setContents( - "package workingcopy;\n" + - "public class X {\n" + - " public void bar() {\n" + - " }\n" + - "}" - ); - this.workingCopy.makeConsistent(null); - - IJavaScriptUnit cu = getCompilationUnit("/P/Y.js"); - IJavaScriptUnit copy = null; - try { - ProblemRequestor problemRequestor = new ProblemRequestor(); - copy = cu.getWorkingCopy(owner, null/*no prpgress*/); - copy.getBuffer().setContents( - "public class Y {\n" + - " void foo(workingcopy.X x) {\n" + - " x.bar();\n" + - " }\n" + - "}" - ); - problemRequestor.problems = new StringBuffer(); - copy.reconcile(IJavaScriptUnit.NO_AST, false/*don't force problems*/, owner, null/*no progress*/); - assertProblems( - "Unexpected problems", - "----------\n" + - "----------\n", - problemRequestor); - } finally { - if (copy != null) - copy.discardWorkingCopy(); - } -} - -/* - * Ensures that types in a class file are hidden when reconciling against if the class file working copy is empty. - */ -public void testWorkingCopy09() throws CoreException { - IClassFile clazz = this.jarRoot.getPackageFragment("workingcopy").getClassFile("X.class"); - WorkingCopyOwner owner = new WorkingCopyOwner() {}; - this.workingCopy = clazz.getWorkingCopy(owner, null); - this.workingCopy.getBuffer().setContents( ""); - this.workingCopy.makeConsistent(null); - - IJavaScriptUnit cu = getCompilationUnit("/P/Y.js"); - IJavaScriptUnit copy = null; - try { - ProblemRequestor problemRequestor = new ProblemRequestor(); - copy = cu.getWorkingCopy(owner, null/*no prpgress*/); - copy.getBuffer().setContents( - "public class Y {\n" + - " workingcopy.X x;\n" + - "}" - ); - problemRequestor.problems = new StringBuffer(); - copy.reconcile(IJavaScriptUnit.NO_AST, false/*don't force problems*/, owner, null/*no progress*/); - assertProblems( - "Unexpected problems", - "----------\n" + - "1. ERROR in /P/Y.java\n" + - "workingcopy.X cannot be resolved to a type\n" + - "----------\n", - problemRequestor); - } finally { - if (copy != null) - copy.discardWorkingCopy(); - } -} - -/* - * Ensures that a 1.5 class file without source attached can be turned into a working copy and that its source is correct. - */ -public void testWorkingCopy10() throws CoreException { - IPath sourceAttachmentPath = this.jarRoot.getSourceAttachmentPath(); - try { - attachSource(this.jarRoot, null, null); - IClassFile clazz = this.jarRoot.getPackageFragment("workingcopy").getClassFile("Y.class"); - assertNull("Should not have source attached", clazz.getSource()); - this.workingCopy = clazz.getWorkingCopy(null, null); - assertSourceEquals( - "Unexpected source", - "package workingcopy;\n" + - "public class Y {\n" + - " \n" + - " public Y() {\n" + - " }\n" + - " \n" + - " T foo(T t, java.lang.String... args) {\n" + - " return null;\n" + - " }\n" + - "}", - this.workingCopy.getSource()); - } finally { - attachSource(this.jarRoot, sourceAttachmentPath.toString(), null); - } -} - -/* - * Ensures that types in a class file are not found by a search if the class file working copy is empty. - */ -public void testWorkingCopy11() throws CoreException { - IPackageFragment pkg = this.jarRoot.getPackageFragment("workingcopy"); - IClassFile clazz = pkg.getClassFile("X.class"); - this.workingCopy = clazz.getWorkingCopy(null, null); - this.workingCopy.getBuffer().setContents( ""); - this.workingCopy.makeConsistent(null); - - IJavaScriptSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaScriptElement[] {pkg}); - AbstractJavaSearchTests.JavaSearchResultCollector requestor = new AbstractJavaSearchTests.JavaSearchResultCollector(); - search("*", IJavaScriptSearchConstants.TYPE, IJavaScriptSearchConstants.DECLARATIONS, scope, requestor); - assertSearchResults( - "lib.jar workingcopy.Y", - requestor); -} -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ClassNameTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ClassNameTests.java deleted file mode 100644 index 8c93245..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ClassNameTests.java +++ /dev/null @@ -1,1169 +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 junit.framework.Test; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.wst.jsdt.core.*; -import org.eclipse.wst.jsdt.internal.core.SourceType; - -/** - * Test retrieving types by their name. - */ -public class ClassNameTests extends ModifyingResourceTests { - - static IJavaScriptProject TEST_PROJECT; - final static int SF_LENGTH = 5; - static int TESTS_COUNT; - -public ClassNameTests(String name) { - super(name); -} - -static { -// org.eclipse.wst.jsdt.internal.core.NameLookup.VERBOSE = true; -// TESTS_NAMES = new String[] { "testFindSecondaryType_Bug72179" }; -// TESTS_PREFIX = "testReconcile"; -} -public static Test suite() { - Test suite = buildModelTestSuite(ClassNameTests.class); - TESTS_COUNT = suite.countTestCases(); - return suite; -} - -/* (non-Javadoc) - * @see org.eclipse.wst.jsdt.core.tests.model.AbstractJavaModelTests#setUp() - */ -protected void setUp() throws Exception { - super.setUp(); - if (TEST_PROJECT == null) { - String[] sourceFolders = new String[SF_LENGTH]; - for (int i=0; i [in P]]]]]", - type == null ? "null" : type.toString() - ); - } finally { - deleteProject("P"); - } -} - -/** - * Tests that a type in a jar with a name ending with $ can be retrieved. - */ -public void testSearchTypeNameInJars() throws JavaScriptModelException, CoreException { - try { - byte[] tab = new byte[478]; - tab[0]=80; - tab[1]=75; - tab[2]=3; - tab[3]=4; - tab[4]=20; - tab[5]=0; - tab[6]=8; - tab[7]=0; - tab[8]=8; - tab[9]=0; - tab[10]=19; - tab[11]=87; - tab[12]=-95; - tab[13]=44; - tab[14]=0; - tab[15]=0; - tab[16]=0; - tab[17]=0; - tab[18]=0; - tab[19]=0; - tab[20]=0; - tab[21]=0; - tab[22]=0; - tab[23]=0; - tab[24]=0; - tab[25]=0; - tab[26]=9; - tab[27]=0; - tab[28]=0; - tab[29]=0; - tab[30]=112; - tab[31]=49; - tab[32]=47; - tab[33]=112; - tab[34]=50; - tab[35]=47; - tab[36]=112; - tab[37]=51; - tab[38]=47; - tab[39]=3; - tab[40]=0; - tab[41]=80; - tab[42]=75; - tab[43]=7; - tab[44]=8; - tab[45]=0; - tab[46]=0; - tab[47]=0; - tab[48]=0; - tab[49]=2; - tab[50]=0; - tab[51]=0; - tab[52]=0; - tab[53]=0; - tab[54]=0; - tab[55]=0; - tab[56]=0; - tab[57]=80; - tab[58]=75; - tab[59]=3; - tab[60]=4; - tab[61]=20; - tab[62]=0; - tab[63]=8; - tab[64]=0; - tab[65]=8; - tab[66]=0; - tab[67]=19; - tab[68]=87; - tab[69]=-95; - tab[70]=44; - tab[71]=0; - tab[72]=0; - tab[73]=0; - tab[74]=0; - tab[75]=0; - tab[76]=0; - tab[77]=0; - tab[78]=0; - tab[79]=0; - tab[80]=0; - tab[81]=0; - tab[82]=0; - tab[83]=16; - tab[84]=0; - tab[85]=0; - tab[86]=0; - tab[87]=112; - tab[88]=49; - tab[89]=47; - tab[90]=112; - tab[91]=50; - tab[92]=47; - tab[93]=112; - tab[94]=51; - tab[95]=47; - tab[96]=88; - tab[97]=46; - tab[98]=99; - tab[99]=108; - tab[100]=97; - tab[101]=115; - tab[102]=115; - tab[103]=93; - tab[104]=79; - tab[105]=-53; - tab[106]=78; - tab[107]=-61; - tab[108]=64; - tab[109]=12; - tab[110]=28; - tab[111]=55; - tab[112]=-81; - tab[113]=-110; - tab[114]=6; - tab[115]=8; - tab[116]=-3; - tab[117]=3; - tab[118]=110; - tab[119]=60; - tab[120]=-44; - tab[121]=-82; - tab[122]=10; - tab[123]=71; - tab[124]=16; - tab[125]=23; - tab[126]=36; - tab[127]=78; - tab[128]=81; - tab[129]=57; - tab[130]=20; - tab[131]=69; - tab[132]=-67; - tab[133]=110; - tab[134]=-62; - tab[135]=-74; - tab[136]=108; - tab[137]=-107; - tab[138]=102; - tab[139]=-93; - tab[140]=52; - tab[141]=-27; - tab[142]=-65; - tab[143]=56; - tab[144]=33; - tab[145]=113; - tab[146]=-32; - tab[147]=3; - tab[148]=-8; - tab[149]=40; - tab[150]=-124; - tab[151]=55; - tab[152]=-115; - tab[153]=0; - tab[154]=117; - tab[155]=37; - tab[156]=-49; - tab[157]=-56; - tab[158]=-10; - tab[159]=-116; - tab[160]=-19; - tab[161]=-3; - tab[162]=-6; - tab[163]=-2; - tab[164]=-8; - tab[165]=-124; - tab[166]=-125; - tab[167]=17; - tab[168]=78; - tab[169]=8; - tab[170]=97; - tab[171]=53; - tab[172]=17; - tab[173]=-43; - tab[174]=-107; - tab[175]=-88; - tab[176]=-82; - tab[177]=-59; - tab[178]=60; - tab[179]=0; - tab[180]=17; - tab[181]=-30; - tab[182]=-107; - tab[183]=124; - tab[184]=-107; - tab[185]=-94; - tab[186]=-112; - tab[187]=-27; - tab[188]=82; - tab[189]=60; - tab[190]=102; - tab[191]=43; - tab[192]=-107; - tab[193]=55; - tab[194]=1; - tab[195]=28; - tab[196]=-126; - tab[197]=127; - tab[198]=-85; - tab[199]=75; - tab[200]=-35; - tab[201]=-36; - tab[202]=17; - tab[203]=-100; - tab[204]=-77; - tab[205]=-13; - tab[206]=-108; - tab[207]=-32; - tab[208]=-34; - tab[209]=-101; - tab[210]=103; - tab[211]=21; - tab[212]=-63; - tab[213]=-125; - tab[214]=31; - tab[215]=-62; - tab[216]=69; - tab[217]=-97; - tab[218]=112; - tab[219]=-100; - tab[220]=-24; - tab[221]=82; - tab[222]=77; - tab[223]=-73; - tab[224]=-21; - tab[225]=76; - tab[226]=-43; - tab[227]=79; - tab[228]=50; - tab[229]=43; - tab[230]=20; - tab[231]=97; - tab[232]=-104; - tab[233]=-104; - tab[234]=92; - tab[235]=22; - tab[236]=-87; - tab[237]=-84; - tab[238]=-75; - tab[239]=-51; - tab[240]=-69; - tab[241]=-94; - tab[242]=-37; - tab[243]=-68; - tab[244]=-24; - tab[245]=13; - tab[246]=33; - tab[247]=74; - tab[248]=-2; - tab[249]=-106; - tab[250]=-34; - tab[251]=-16; - tab[252]=-52; - tab[253]=-123; - tab[254]=49; - tab[255]=124; - tab[256]=-56; - tab[257]=-52; - tab[258]=108; - tab[259]=-21; - tab[260]=92; - tab[261]=61; - tab[262]=104; - tab[263]=43; - tab[264]=-12; - tab[265]=-25; - tab[266]=99; - tab[267]=123; - tab[268]=7; - tab[269]=78; - tab[270]=-47; - tab[271]=-29; - tab[272]=5; - tab[273]=-10; - tab[274]=-11; - tab[275]=64; - tab[276]=118; - tab[277]=31; - tab[278]=99; - tab[279]=-64; - tab[280]=-103; - tab[281]=96; - tab[282]=38; - tab[283]=102; - tab[284]=-17; - tab[285]=-30; - tab[286]=29; - tab[287]=7; - tab[288]=111; - tab[289]=109; - tab[290]=59; - tab[291]=100; - tab[292]=-12; - tab[293]=-37; - tab[294]=-94; - tab[295]=-125; - tab[296]=1; - tab[297]=99; - tab[298]=-76; - tab[299]=19; - tab[300]=48; - tab[301]=31; - tab[302]=-74; - tab[303]=3; - tab[304]=-114; - tab[305]=126; - tab[306]=-51; - tab[307]=-105; - tab[308]=28; - tab[309]=-74; - tab[310]=71; - tab[311]=-5; - tab[312]=70; - tab[313]=-9; - tab[314]=-97; - tab[315]=-111; - tab[316]=58; - tab[317]=35; - tab[318]=-1; - tab[319]=-83; - tab[320]=85; - tab[321]=-59; - tab[322]=63; - tab[323]=80; - tab[324]=75; - tab[325]=7; - tab[326]=8; - tab[327]=-99; - tab[328]=105; - tab[329]=77; - tab[330]=-38; - tab[331]=-36; - tab[332]=0; - tab[333]=0; - tab[334]=0; - tab[335]=53; - tab[336]=1; - tab[337]=0; - tab[338]=0; - tab[339]=80; - tab[340]=75; - tab[341]=1; - tab[342]=2; - tab[343]=20; - tab[344]=0; - tab[345]=20; - tab[346]=0; - tab[347]=8; - tab[348]=0; - tab[349]=8; - tab[350]=0; - tab[351]=19; - tab[352]=87; - tab[353]=-95; - tab[354]=44; - tab[355]=0; - tab[356]=0; - tab[357]=0; - tab[358]=0; - tab[359]=2; - tab[360]=0; - tab[361]=0; - tab[362]=0; - tab[363]=0; - tab[364]=0; - tab[365]=0; - tab[366]=0; - tab[367]=9; - tab[368]=0; - tab[369]=0; - tab[370]=0; - tab[371]=0; - tab[372]=0; - tab[373]=0; - tab[374]=0; - tab[375]=0; - tab[376]=0; - tab[377]=0; - tab[378]=0; - tab[379]=0; - tab[380]=0; - tab[381]=0; - tab[382]=0; - tab[383]=0; - tab[384]=0; - tab[385]=112; - tab[386]=49; - tab[387]=47; - tab[388]=112; - tab[389]=50; - tab[390]=47; - tab[391]=112; - tab[392]=51; - tab[393]=47; - tab[394]=80; - tab[395]=75; - tab[396]=1; - tab[397]=2; - tab[398]=20; - tab[399]=0; - tab[400]=20; - tab[401]=0; - tab[402]=8; - tab[403]=0; - tab[404]=8; - tab[405]=0; - tab[406]=19; - tab[407]=87; - tab[408]=-95; - tab[409]=44; - tab[410]=-99; - tab[411]=105; - tab[412]=77; - tab[413]=-38; - tab[414]=-36; - tab[415]=0; - tab[416]=0; - tab[417]=0; - tab[418]=53; - tab[419]=1; - tab[420]=0; - tab[421]=0; - tab[422]=16; - tab[423]=0; - tab[424]=0; - tab[425]=0; - tab[426]=0; - tab[427]=0; - tab[428]=0; - tab[429]=0; - tab[430]=0; - tab[431]=0; - tab[432]=0; - tab[433]=0; - tab[434]=0; - tab[435]=0; - tab[436]=57; - tab[437]=0; - tab[438]=0; - tab[439]=0; - tab[440]=112; - tab[441]=49; - tab[442]=47; - tab[443]=112; - tab[444]=50; - tab[445]=47; - tab[446]=112; - tab[447]=51; - tab[448]=47; - tab[449]=88; - tab[450]=46; - tab[451]=99; - tab[452]=108; - tab[453]=97; - tab[454]=115; - tab[455]=115; - tab[456]=80; - tab[457]=75; - tab[458]=5; - tab[459]=6; - tab[460]=0; - tab[461]=0; - tab[462]=0; - tab[463]=0; - tab[464]=2; - tab[465]=0; - tab[466]=2; - tab[467]=0; - tab[468]=117; - tab[469]=0; - tab[470]=0; - tab[471]=0; - tab[472]=83; - tab[473]=1; - tab[474]=0; - tab[475]=0; - tab[476]=0; - tab[477]=0; - IJavaScriptProject javaProject = createJavaProject("P1", new String[] {"src"}); - IFile jarFile = createFile("P1/lib.jar", tab); - javaProject.setRawIncludepath(new IIncludePathEntry[] {JavaScriptCore.newLibraryEntry(jarFile.getFullPath(), null, null, false)}, new NullProgressMonitor()); - assertNotNull(javaProject.findType("p1.p2.p3.X")); - } catch(JavaScriptModelException e) { - e.printStackTrace(); - assertTrue(false); - } catch (CoreException e) { - e.printStackTrace(); - assertTrue(false); - } finally { - deleteProject("P1"); - } -} - -/** - * Bug 36032: JavaProject.findType() fails to find second type in source file - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=36032" - */ -public void testFindSecondaryType_Exist01() throws JavaScriptModelException, CoreException { - int length = SF_LENGTH - 1; - assertTypeFound( - "org.eclipse.wst.jsdt.core.test"+length+".Foo", - "Foo [in Foo.java [in org.eclipse.wst.jsdt.core.test"+length+" [in src"+length+" [in TestProject]]]]" - ); -} -public void testFindSecondaryType_Exist02() throws JavaScriptModelException, CoreException { - int length = SF_LENGTH - 1; - assertTypeFound( - "org.eclipse.wst.jsdt.core.test"+length+".Secondary", - "Secondary [in Foo.java [in org.eclipse.wst.jsdt.core.test"+length+" [in src"+length+" [in TestProject]]]]" - ); -} -public void testFindSecondaryType_Exist03() throws JavaScriptModelException, CoreException { - assertTypeFound( - "org.eclipse.wst.jsdt.core.test0.Foo.InFoo", - "InFoo [in Foo [in Foo.java [in org.eclipse.wst.jsdt.core.test0 [in src0 [in TestProject]]]]]" - ); -} -public void testFindSecondaryType_Exist04() throws JavaScriptModelException, CoreException { - assertTypeFound( - "org.eclipse.wst.jsdt.core.test0.Secondary.InSecondary", - "InSecondary [in Secondary [in Foo.java [in org.eclipse.wst.jsdt.core.test0 [in src0 [in TestProject]]]]]" - ); -} -public void testFindSecondaryType_Exist05() throws JavaScriptModelException, CoreException { - assertTypeFound( - "Foo", - "Foo [in Foo.java [in [in src1 [in TestProject]]]]" - ); -} -public void testFindSecondaryType_Exist06() throws JavaScriptModelException, CoreException { - assertTypeFound( - "Secondary", - "Secondary [in Foo.java [in [in src1 [in TestProject]]]]" - ); -} -// duplicate bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=72179 -public void testFindSecondaryType_Bug72179() throws JavaScriptModelException, CoreException { - try { - IJavaScriptProject javaProject = createJavaProject("P", new String[] {""}); - createFolder("/P/p1"); - createFile( - "/P/p1/jc.js", - "package p1;\n" + - "class jc008{}\n" + - "class jc009{}\n" + - "class jc010 extends jc009 {\n" + - " jc008 a;\n" + - "}\n" - ); - IType type = javaProject.findType("p1", "jc008", new NullProgressMonitor()); - assertTrue("type 'jc008' should exist!", type != null && type.exists()); - assertEquals("Expected type 'jc008' NOT found!", - "class jc008 [in jc.java [in p1 [in [in P]]]]", - type.toString() - ); - type = javaProject.findType("p1", "jc009", new NullProgressMonitor()); - assertTrue("type 'jc009' should exist!", type != null && type.exists()); - assertEquals("Expected type 'jc009' NOT found!", - "class jc009 [in jc.java [in p1 [in [in P]]]]", - type.toString() - ); - type = javaProject.findType("p1", "jc010", new NullProgressMonitor()); - assertTrue("type 'jc010' should exist!", type != null && type.exists()); - assertEquals("Expected type 'jc010' NOT found!", - "class jc010 [in jc.java [in p1 [in [in P]]]]\n" + - " jc008 a", - type.toString() - ); - } finally { - deleteProject("P"); - } -} -public void testFindSecondaryType_NotFound01() throws JavaScriptModelException, CoreException { - assertTypeUnknown("test.Foo"); -} -public void testFindSecondaryType_NotFound02() throws JavaScriptModelException, CoreException { - assertTypeUnknown("InFoo"); -} -public void testFindSecondaryType_NotFound03() throws JavaScriptModelException, CoreException { - assertTypeUnknown("InSecondary"); -} -public void testFindSecondaryType_NotFound04() throws JavaScriptModelException, CoreException { - assertTypeUnknown("Foo.inFoo"); -} -public void testFindSecondaryType_NotFound05() throws JavaScriptModelException, CoreException { - assertTypeUnknown("Secondary.inBar"); -} -public void testFindSecondaryType_Unknown01() throws JavaScriptModelException, CoreException { - assertTypeUnknown("Unknown"); -} -public void testFindSecondaryType_Unknown02() throws JavaScriptModelException, CoreException { - assertTypeUnknown("Foo.Unknown"); -} -public void testFindSecondaryType_Unknown03() throws JavaScriptModelException, CoreException { - assertTypeUnknown("org.eclipse.wst.jsdt.core.test.Unknown"); -} -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ClasspathInitializerTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ClasspathInitializerTests.java deleted file mode 100644 index f9fe958..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ClasspathInitializerTests.java +++ /dev/null @@ -1,1306 +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.HashMap; -import java.util.Map; - -import org.eclipse.core.resources.*; -import org.eclipse.core.runtime.*; -import org.eclipse.core.runtime.preferences.IEclipsePreferences; -import org.eclipse.wst.jsdt.core.*; -import org.eclipse.wst.jsdt.core.compiler.CharOperation; -import org.eclipse.wst.jsdt.internal.core.JavaModelManager; -import org.eclipse.wst.jsdt.internal.core.JavaModelStatus; -import org.eclipse.wst.jsdt.internal.core.UserLibraryJsGlobalScopeContainer; -import org.eclipse.wst.jsdt.internal.core.UserLibraryManager; - -import junit.framework.Test; - -public class ClasspathInitializerTests extends ModifyingResourceTests { - -public static class DefaultVariableInitializer implements VariablesInitializer.ITestInitializer { - Map variableValues; - - /* - * values is [, ]* - */ - public DefaultVariableInitializer(String[] values) { - variableValues = new HashMap(); - for (int i = 0; i < values.length; i+=2) { - variableValues.put(values[i], new Path(values[i+1])); - } - } - - public void initialize(String variable) throws JavaScriptModelException { - if (variableValues == null) return; - JavaScriptCore.setIncludepathVariable( - variable, - (IPath)variableValues.get(variable), - null); - } -} - -public static class DefaultContainerInitializer implements ContainerInitializer.ITestInitializer { - - public static class DefaultContainer implements IJsGlobalScopeContainer { - char[][] libPaths; - public DefaultContainer(char[][] libPaths) { - this.libPaths = libPaths; - } - /** - * @deprecated Use {@link #getIncludepathEntries()} instead - */ - public IIncludePathEntry[] getClasspathEntries() { - return getIncludepathEntries(); - } - public IIncludePathEntry[] getIncludepathEntries() { - int length = this.libPaths.length; - IIncludePathEntry[] entries = new IIncludePathEntry[length]; - for (int j = 0; j < length; j++) { - IPath path = new Path(new String(this.libPaths[j])); - if (path.segmentCount() == 1) { - entries[j] = JavaScriptCore.newProjectEntry(path); - } else { - entries[j] = JavaScriptCore.newLibraryEntry(path, null, null); - } - } - return entries; - } - public String getDescription() { - return "Test container"; - } - public int getKind() { - return IJsGlobalScopeContainer.K_APPLICATION; - } - public IPath getPath() { - return new Path("org.eclipse.wst.jsdt.core.tests.model.TEST_CONTAINER"); - } - /* (non-Javadoc) - * @see org.eclipse.wst.jsdt.core.IJsGlobalScopeContainer#resolvedLibraryImport(java.lang.String) - */ - public String[] resolvedLibraryImport(String a) { - return new String[] {a}; - } - } - - Map containerValues; - CoreException exception; - - /* - * values is [, [,]* ]* - */ - public DefaultContainerInitializer(String[] values) { - containerValues = new HashMap(); - for (int i = 0; i < values.length; i+=2) { - final String projectName = values[i]; - final char[][] libPaths = CharOperation.splitOn(',', values[i+1].toCharArray()); - containerValues.put( - projectName, - newContainer(libPaths) - ); - } - } - protected DefaultContainer newContainer(final char[][] libPaths) { - return new DefaultContainer(libPaths); - } - public boolean allowFailureContainer() { - return true; - } - public void initialize(IPath containerPath, IJavaScriptProject project) throws CoreException { - if (containerValues == null) return; - try { - JavaScriptCore.setJsGlobalScopeContainer( - containerPath, - new IJavaScriptProject[] {project}, - new IJsGlobalScopeContainer[] {(IJsGlobalScopeContainer)containerValues.get(project.getElementName())}, - null); - } catch (CoreException e) { - this.exception = e; - throw e; - } - } -} -// Simple container initializer, which keeps setting container to null -// (30920 - stackoverflow when setting container to null) -public class NullContainerInitializer implements ContainerInitializer.ITestInitializer { - public boolean hasRun = false; - public boolean allowFailureContainer() { - return false; // allow the initializer to run again - } - public void initialize(IPath containerPath, IJavaScriptProject project) throws CoreException { - hasRun = true; - JavaScriptCore.setJsGlobalScopeContainer( - containerPath, - new IJavaScriptProject[] {project}, - new IJsGlobalScopeContainer[] { null }, - null); - } -} - -public ClasspathInitializerTests(String name) { - super(name); -} -public static Test suite() { - return buildModelTestSuite(ClasspathInitializerTests.class); -} -// Use this static initializer to specify subset for tests -// All specified tests which do not belong to the class are skipped... -static { - // Names of tests to run: can be "testBugXXXX" or "BugXXXX") -// TESTS_NAMES = new String[] { "testContainerInitializer12" }; - // Numbers of tests to run: "test" will be run for each number of this array -// TESTS_NUMBERS = new int[] { 2, 12 }; - // Range numbers of tests to run: all tests between "test" and "test" will be run for { first, last } -// TESTS_RANGE = new int[] { 16, -1 }; -} -protected void tearDown() throws Exception { - // Cleanup caches - JavaModelManager manager = JavaModelManager.getJavaModelManager(); - manager.containers = new HashMap(5); - manager.variables = new HashMap(5); - - super.tearDown(); -} -public void testContainerInitializer01() throws CoreException { - try { - createProject("P1"); - createFile("/P1/lib.jar", ""); - ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P2", "/P1/lib.jar"})); - IJavaScriptProject p2 = createJavaProject( - "P2", - new String[] {}, - new String[] {"org.eclipse.wst.jsdt.core.tests.model.TEST_CONTAINER"}); - IPackageFragmentRoot root = p2.getPackageFragmentRoot(getFile("/P1/lib.jar")); - assertTrue("/P1/lib.jar should exist", root.exists()); - } finally { - stopDeltas(); - deleteProject("P1"); - deleteProject("P2"); - } -} -public void testContainerInitializer02() throws CoreException { - try { - createProject("P1"); - createFile("/P1/lib.jar", ""); - ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P2", "/P1/lib.jar"})); - IJavaScriptProject p2 = createJavaProject( - "P2", - new String[] {}, - new String[] {"org.eclipse.wst.jsdt.core.tests.model.TEST_CONTAINER"}); - - // simulate state on startup - simulateExitRestart(); - - startDeltas(); - p2.getResolvedIncludepath(true); - - assertDeltas( - "Unexpected delta on startup", - "" - ); - } finally { - stopDeltas(); - deleteProject("P1"); - deleteProject("P2"); - } -} -public void testContainerInitializer03() throws CoreException { - try { - createProject("P1"); - createFile("/P1/lib.jar", ""); - ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P2", "/P1/lib.jar"})); - createJavaProject( - "P2", - new String[] {}, - new String[] {"org.eclipse.wst.jsdt.core.tests.model.TEST_CONTAINER"}); - - // change value of TEST_CONTAINER - createFile("/P1/lib2.jar", ""); - ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P2", "/P1/lib2.jar"})); - - // simulate state on startup - simulateExitRestart(); - - startDeltas(); - getJavaProject("P2").getResolvedIncludepath(true); - - assertDeltas( - "Unexpected delta on startup", - "P2[*]: {CHILDREN}\n" + - " /P1/lib.jar[*]: {REMOVED FROM CLASSPATH}\n" + - " /P1/lib2.jar[*]: {ADDED TO CLASSPATH}" - ); - } finally { - stopDeltas(); - deleteProject("P1"); - deleteProject("P2"); - } -} -/* Ensure that initializer is not callled when resource tree is locked. - * (regression test for bug 29585 Core Exception as resource tree is locked initializing classpath container) - */ -public void testContainerInitializer04() throws CoreException { - try { - createProject("P1"); - createFile("/P1/lib.jar", ""); - DefaultContainerInitializer initializer = new DefaultContainerInitializer(new String[] {"P2", "/P1/lib.jar"}); - ContainerInitializer.setInitializer(initializer); - createJavaProject( - "P2", - new String[] {""}, - new String[] {"org.eclipse.wst.jsdt.core.tests.model.TEST_CONTAINER"}); - - // simulate state on startup - simulateExitRestart(); - - startDeltas(); - createFile("/P2/X.js", "public class X {}"); - - assertEquals("Should not get exception", null, initializer.exception); - - assertDeltas( - "Unexpected delta on startup", - "P2[*]: {CHILDREN}\n" + - " [*]: {CHILDREN}\n" + - " [*]: {CHILDREN}\n" + - " X.java[+]: {}" - ); - } finally { - stopDeltas(); - deleteProject("P1"); - deleteProject("P2"); - } -} -/* - * 30920 - Stack overflow when container resolved to null - */ -public void testContainerInitializer05() throws CoreException { - try { - NullContainerInitializer nullInitializer = new NullContainerInitializer(); - ContainerInitializer.setInitializer(nullInitializer); - createJavaProject( - "P1", - new String[] {""}, - new String[] {"org.eclipse.wst.jsdt.core.tests.model.TEST_CONTAINER"}); - - // simulate state on startup - simulateExitRestart(); - - startDeltas(); - - // will trigger classpath resolution (with null container value) - createFile("/P1/X.js", "public class X {}"); - assertDeltas( - "Unexpected delta on startup", - "P1[*]: {CHILDREN}\n" + - " [*]: {CHILDREN}\n" + - " [*]: {CHILDREN}\n" + - " X.java[+]: {}" - ); - assertTrue("initializer did not run", nullInitializer.hasRun); - - // next cp resolution request will rerun the initializer - waitForAutoBuild(); - nullInitializer.hasRun = false; // reset - getJavaProject("P1").getResolvedIncludepath(true); - assertTrue("initializer did not run", nullInitializer.hasRun); // initializer should have run again (since keep setting to null) - - // assigning new (non-null) value to container - waitForAutoBuild(); - createFile("/P1/lib.jar", ""); - ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P1", "/P1/lib.jar"})); - clearDeltas(); - getJavaProject("P1").getResolvedIncludepath(true); - assertDeltas( - "Unexpected delta after setting container", - "P1[*]: {CHILDREN}\n" + - " lib.jar[*]: {ADDED TO CLASSPATH}" - ); - - } catch (StackOverflowError e) { - e.printStackTrace(); - assertTrue("stack overflow assigning container", false); - } finally { - stopDeltas(); - deleteProject("P1"); - } -} -/* - * Ensures that running the initializer during a reconcile operation just after workspace startup - * doesn't throw a NPE - * (regression test for bug 48818 NPE in delta processor) - */ -public void testContainerInitializer06() throws CoreException { - IJavaScriptUnit workingCopy = null; - try { - createProject("P1"); - ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P2", ""})); - createJavaProject( - "P2", - new String[] {"src"}, - new String[] {"org.eclipse.wst.jsdt.core.tests.model.TEST_CONTAINER"}); - createFile( - "/P2/src/X,java", - "public class X {\n" + - "}" - ); - - // change value of TEST_CONTAINER - ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P2", "/P1"})); - - // simulate state on startup - simulateExitRestart(); - - startDeltas(); - workingCopy = getCompilationUnit("/P2/src/X.js"); - workingCopy.becomeWorkingCopy(null); - - assertDeltas( - "Unexpected delta on startup", - "P2[*]: {CHILDREN}\n" + - " src[*]: {CHILDREN}\n" + - " [*]: {CHILDREN}\n" + - " [Working copy] X.java[+]: {PRIMARY WORKING COPY}" - ); - } finally { - stopDeltas(); - if (workingCopy != null) workingCopy.discardWorkingCopy(); - deleteProject("P1"); - deleteProject("P2"); - } -} -/* - * Ensure that an OperationCanceledException goes through - * (regression test for bug 59363 Should surface cancellation exceptions) - */ -public void testContainerInitializer07() throws CoreException { - try { - boolean gotException = false; - try { - ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P1", "/P1/lib.jar"}) { - public void initialize(IPath containerPath, IJavaScriptProject project) throws CoreException { - throw new OperationCanceledException("test"); - }}); - IJavaScriptProject p1 = createJavaProject( - "P1", - new String[] {}, - new String[] {"org.eclipse.wst.jsdt.core.tests.model.TEST_CONTAINER"}); - p1.getResolvedIncludepath(true); - } catch (OperationCanceledException e) { - gotException = true; - } - assertTrue("Should get an OperationCanceledException", gotException); - } finally { - stopDeltas(); - deleteProject("P1"); - } -} -/* - * Ensure that the stack doesn't blow up if initializer is missbehaving - * (regression test for bug 61052 Flatten cp container initialization) - */ -public void testContainerInitializer08() throws CoreException { - final int projectLength = 10; - final String[] projects = new String[projectLength]; - for (int i = 0; i < projectLength; i++) { - projects[i] = "P" + i; - } - try { - String[] projectRefs = new String[(projectLength-1) * 2]; - for (int i = 0; i < projectLength-1; i++) { - projectRefs[i*2] = "P" + i; - projectRefs[(i*2)+1] = "/P" + i + "/test.jar"; - } - ContainerInitializer.setInitializer(new DefaultContainerInitializer(projectRefs) { - void foo(int n) { - if (n > 0) { - foo(n-1); - return; - } - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - for (int i = 0; i < projectLength-1; i++) { - try { - JavaScriptCore.create(root.getProject(projects[i])).getResolvedIncludepath(true); - } catch (JavaScriptModelException e) { - // project doesn't exist: ignore - } - } - } - public void initialize(IPath containerPath, IJavaScriptProject project) throws CoreException { - foo(500); - super.initialize(containerPath, project); - } - }); - JavaScriptCore.run(new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { - for (int i = 0; i < projectLength; i++) { - createProject(projects[i]); - editFile( - "/" + projects[i] + "/.project", - "\n" + - "\n" + - " " + projects[i] + "\n" + - " \n" + - " \n" + - (i == 0 ? "" : "" + projects[i-1] + "\n") + - " \n" + - " \n" + - " \n" + - " org.eclipse.wst.jsdt.core.javabuilder\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " org.eclipse.wst.jsdt.core.javanature\n" + - " \n" + - "" - ); - createFile( - "/" + projects[i] + "/.classpath", - "\n" + - "\n" + - (i == 0 ? "" : "\n") + - " \n" + - " \n" + - "" - ); - } - } - }, null); - getJavaProject("P0").getResolvedIncludepath(true); - } finally { - stopDeltas(); - deleteProjects(projects); - } -} -/* - * Ensure that a StackOverFlowError is not thrown if the initializer asks for the resolved classpath - * that is being resolved. - * (regression test for bug 61040 Should add protect for reentrance to #getResolvedClasspath) - */ -public void testContainerInitializer09() throws CoreException { - try { - ClasspathInitializerTests.DefaultContainerInitializer initializer = new ClasspathInitializerTests.DefaultContainerInitializer(new String[] {"P1", "/P1/lib.jar"}) { - protected DefaultContainer newContainer(char[][] libPaths) { - return new DefaultContainer(libPaths) { - /** - * @deprecated Use {@link #getIncludepathEntries()} instead - */ - public IIncludePathEntry[] getClasspathEntries() { - return getIncludepathEntries(); - } - - public IIncludePathEntry[] getIncludepathEntries() { - try { - getJavaProject("P1").getResolvedIncludepath(true); - } catch (JavaScriptModelException e) { - // project doesn't exist: ignore - } - return super.getIncludepathEntries(); - } - }; - } - }; - ContainerInitializer.setInitializer(initializer); - JavaScriptCore.run(new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { - createProject("P1"); - editFile( - "/P1/.project", - "\n" + - "\n" + - " P1\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " org.eclipse.wst.jsdt.core.javabuilder\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " org.eclipse.wst.jsdt.core.javanature\n" + - " \n" + - "" - ); - createFile( - "/P1/.classpath", - "\n" + - "\n" + - " \n" + - " \n" + - "" - ); - } - }, null); - getJavaProject("P1").getResolvedIncludepath(true); - } finally { - stopDeltas(); - ContainerInitializer.setInitializer(null); - deleteProject("P1"); - } -} -/* - * Ensure that creating a Java project initializes a container and refreshes the external jar at the same time - * without throwing a ConcurrentModificationException - * (regression test for bug 63534 ConcurrentModificationException after "catching up") - */ -public void testContainerInitializer10() throws CoreException { - class LogListener implements ILogListener { - IStatus log; - public void logging(IStatus status, String plugin) { - this.log = status; - } - } - LogListener listener = new LogListener(); - try { - Platform.addLogListener(listener); - final IJavaScriptProject p1 = createJavaProject("P1"); - final IJavaScriptProject p2 = createJavaProject("P2"); - ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P3", "/P1"}) { - public void initialize(IPath containerPath, IJavaScriptProject project) throws CoreException { - super.initialize(containerPath, project); - getJavaModel().refreshExternalArchives(new IJavaScriptElement[] {p1}, null); - } - }); - getWorkspace().run(new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { - p2.setRawIncludepath(new IIncludePathEntry[] {JavaScriptCore.newSourceEntry(new Path("/P2/src"))}, null); - createProject("P3"); - editFile( - "/P3/.project", - "\n" + - "\n" + - " P3\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " org.eclipse.wst.jsdt.core.javabuilder\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " org.eclipse.wst.jsdt.core.javanature\n" + - " \n" + - "\n" - ); - createFile( - "/P3/.classpath", - "\n" + - "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - "" - ); - } - }, null); - - assertEquals("Should not get any exception in log", null, listener.log); - } finally { - Platform.removeLogListener(listener); - deleteProject("P1"); - deleteProject("P2"); - deleteProject("P3"); - } -} -/* - * Ensure that a classpath initializer is not run on shutdown - * (regression test for bug 93941 Classpath initialization on shutdown) - */ -public void testContainerInitializer11() throws CoreException { - boolean hasExited = false; - try { - ContainerInitializer.setInitializer(null); - createJavaProject( - "P", - new String[] {}, - new String[] {"org.eclipse.wst.jsdt.core.tests.model.TEST_CONTAINER"}); - simulateExitRestart(); - ClasspathInitializerTests.DefaultContainerInitializer initializer = new ClasspathInitializerTests.DefaultContainerInitializer(new String[] {}) { - public void initialize(IPath containerPath,IJavaScriptProject project) throws CoreException { - assertTrue("Should not initialize container on shutdown", false); - } - }; - ContainerInitializer.setInitializer(initializer); - simulateExit(); - hasExited = true; - } finally { - ContainerInitializer.setInitializer(null); - if (hasExited) - simulateRestart(); - deleteProject("P"); - } -} - -/* - * Ensure that the initializer is removed from the cache when the project is deleted - * (regression test for bug 116072 cached classpath containers not removed when project deleted) - */ -public void testContainerInitializer12() throws CoreException { - try { - ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P1", "/P1/lib.jar"})); - IJavaScriptProject project = createJavaProject( - "P1", - new String[] {}, - new String[] {"org.eclipse.wst.jsdt.core.tests.model.TEST_CONTAINER"}); - createFile("/P1/lib.jar", ""); - IPackageFragmentRoot root = project.getPackageFragmentRoot(getFile("/P1/lib.jar")); - assertTrue("/P1/lib.jar should exist", root.exists()); - deleteProject("P1"); - - class Initializer extends DefaultContainerInitializer { - boolean initialized; - public Initializer(String[] args) { - super(args); - } - public void initialize(IPath containerPath, IJavaScriptProject p) throws CoreException { - super.initialize(containerPath, p); - this.initialized = true; - } - } - Initializer initializer = new Initializer(new String[] {"P1", "/P1/lib.jar"}); - ContainerInitializer.setInitializer(initializer); - createJavaProject( - "P1", - new String[] {}, - new String[] {"org.eclipse.wst.jsdt.core.tests.model.TEST_CONTAINER"}); - createFile("/P1/lib.jar", ""); - assertTrue("/P1/lib.jar should exist", root.exists()); - assertTrue("Should have been initialized", initializer.initialized); - } finally { - stopDeltas(); - deleteProject("P1"); - } -} - -/* - * Ensures that no resource deta is reported if a container that was not initialized is initialized with null - * (regression test for bug 149043 Unresolvable classpath container leads to lots of scheduled jobs) - */ -public void testContainerInitializer13() throws CoreException { - IResourceChangeListener listener = new IResourceChangeListener() { - StringBuffer buffer = new StringBuffer(); - public void resourceChanged(IResourceChangeEvent event) { - this.buffer.append(event.getDelta().findMember(new Path("/P1"))); - } - public String toString() { - return this.buffer.toString(); - } - }; - try { - NullContainerInitializer nullInitializer = new NullContainerInitializer(); - ContainerInitializer.setInitializer(nullInitializer); - IJavaScriptProject project = createJavaProject( - "P1", - new String[] {}, - new String[] {"org.eclipse.wst.jsdt.core.tests.model.TEST_CONTAINER"}); - - // simulate state on startup - simulateExitRestart(); - - getWorkspace().addResourceChangeListener(listener, IResourceChangeEvent.POST_CHANGE); - - // force resolution of container - project.findPackageFragmentRoots(project.getRawIncludepath()[0]); - - assertEquals( - "Unexpected resource delta on startup", - "", - listener.toString() - ); - } finally { - getWorkspace().removeResourceChangeListener(listener); - deleteProject("P1"); - } -} - -/* - * Ensures that a misbehaving container (that initializes another project than the one asked for) doesn't cause - * the container to be initialized again - * (regression test for bug 160005 Add protection about misbehaving container initializer) - */ -public void testContainerInitializer14() throws CoreException { - try { - createProject("P1"); - createFile("/P1/lib.jar", ""); - class Container extends DefaultContainerInitializer { - int initializeCount = 0; - Container(String[] values) { - super(values); - } - public void initialize(IPath containerPath, IJavaScriptProject project) throws CoreException { - this.initializeCount++; - super.initialize(containerPath, getJavaProject("P1")); - } - } - Container container = new Container(new String[] {"P2", "/P1/lib.jar"}); - ContainerInitializer.setInitializer(container); - IJavaScriptProject p2 = createJavaProject( - "P2", - new String[] {}, - new String[] {"org.eclipse.wst.jsdt.core.tests.model.TEST_CONTAINER"}); - p2.getResolvedIncludepath(true); - assertEquals("Unexpected number of initalizations", 1, container.initializeCount); - } finally { - stopDeltas(); - deleteProject("P1"); - deleteProject("P2"); - } -} - -/* - * Ensures that if a container is misbehaving (it doesn't initialize a project when asked for), - * then the resulting container's classpath is not null - * (regression test for bug 161846 Expanding a java project with invalid classpath container entries in Project Explorer causes CPU to stay at 100%) - */ -public void testContainerInitializer15() throws CoreException { - try { - class Container extends DefaultContainerInitializer { - Container(String[] values) { - super(values); - } - public void initialize(IPath containerPath, IJavaScriptProject project) throws CoreException { - } - } - Container container = new Container(new String[] {"P1", "/P1/lib.jar"}); - ContainerInitializer.setInitializer(container); - IJavaScriptProject p1 = createJavaProject( - "P1", - new String[] {}, - new String[] {"org.eclipse.wst.jsdt.core.tests.model.TEST_CONTAINER"}); - IJsGlobalScopeContainer JsGlobalScopeContainer = JavaScriptCore.getJsGlobalScopeContainer(new Path("org.eclipse.wst.jsdt.core.tests.model.TEST_CONTAINER"), p1); - assertClasspathEquals(JsGlobalScopeContainer.getIncludepathEntries(), ""); - } finally { - stopDeltas(); - deleteProject("P1"); - } -} -/* - * Ensure that an initializer cannot return a project entry that points to the project of the container (cycle). - */ -public void testContainerInitializer16() throws CoreException { - try { - ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P1", "/P1"})); - JavaScriptModelException exception = null; - try { - IJavaScriptProject p1 = createJavaProject( - "P1", - new String[] {}, - new String[] {"org.eclipse.wst.jsdt.core.tests.model.TEST_CONTAINER"}); - p1.getResolvedIncludepath(true); - } catch (JavaScriptModelException e) { - exception = e; - } - assertExceptionEquals( - "Unexpected expection", - "Project cannot reference itself: P1", - exception); - } finally { - stopDeltas(); - deleteProject("P1"); - } -} -public void testVariableInitializer01() throws CoreException { - try { - createProject("P1"); - createFile("/P1/lib.jar", ""); - VariablesInitializer.setInitializer(new DefaultVariableInitializer(new String[] {"TEST_LIB", "/P1/lib.jar"})); - IJavaScriptProject p2 = createJavaProject("P2", new String[] {}, new String[] {"TEST_LIB"}); - IPackageFragmentRoot root = p2.getPackageFragmentRoot(getFile("/P1/lib.jar")); - assertTrue("/P1/lib.jar should exist", root.exists()); - } finally { - deleteProject("P1"); - deleteProject("P2"); - VariablesInitializer.reset(); - } -} -public void testVariableInitializer02() throws CoreException { - try { - createProject("P1"); - createFile("/P1/lib.jar", ""); - createFile("/P1/src.zip", ""); - VariablesInitializer.setInitializer(new DefaultVariableInitializer(new String[] { - "TEST_LIB", "/P1/lib.jar", - "TEST_SRC", "/P1/src.zip", - "TEST_ROOT", "src", - })); - IJavaScriptProject p2 = createJavaProject("P2", new String[] {}, new String[] {"TEST_LIB,TEST_SRC,TEST_ROOT"}); - IPackageFragmentRoot root = p2.getPackageFragmentRoot(getFile("/P1/lib.jar")); - assertEquals("Unexpected source attachment path", "/P1/src.zip", root.getSourceAttachmentPath().toString()); - assertEquals("Unexpected source attachment root path", "src", root.getSourceAttachmentRootPath().toString()); - } finally { - deleteProject("P1"); - deleteProject("P2"); - VariablesInitializer.reset(); - } -} -public void testVariableInitializer03() throws CoreException { - try { - createProject("P1"); - createFile("/P1/lib.jar", ""); - createFile("/P1/src.zip", ""); - String[] variableValues = new String[] { - "TEST_LIB", "/P1/lib.jar", - "TEST_SRC", "/P1/src.zip", - "TEST_ROOT", "src", - }; - VariablesInitializer.setInitializer(new DefaultVariableInitializer(variableValues)); - createJavaProject("P2", new String[] {}, new String[] {"TEST_LIB,TEST_SRC,TEST_ROOT"}); - - // simulate state on startup - simulateExitRestart(); - - startDeltas(); - //JavaModelManager.CP_RESOLVE_VERBOSE=true; - getJavaProject("P2").getResolvedIncludepath(true); - - assertDeltas( - "Unexpected delta on startup", - "" - ); - } finally { - //JavaModelManager.CP_RESOLVE_VERBOSE=false; - stopDeltas(); - deleteProject("P1"); - deleteProject("P2"); - VariablesInitializer.reset(); - } -} -public void testVariableInitializer04() throws CoreException { - try { - final StringBuffer buffer = new StringBuffer(); - VariablesInitializer.setInitializer(new VariablesInitializer.ITestInitializer() { - public void initialize(String variable) throws JavaScriptModelException { - buffer.append("Initializing " + variable + "\n"); - IPath path = new Path(variable.toLowerCase()); - buffer.append("Setting variable " + variable + " to " + path + "\n"); - JavaScriptCore.setIncludepathVariable(variable, path, null); - } - }); - createJavaProject("P", new String[] {}, new String[] {"TEST_LIB,TEST_SRC,TEST_ROOT"}); - assertEquals( - "Initializing TEST_LIB\n" + - "Setting variable TEST_LIB to test_lib\n", - buffer.toString()); - } finally { - deleteProject("P"); - VariablesInitializer.reset(); - } -} -public void testVariableInitializer05() throws CoreException { - try { - final StringBuffer buffer = new StringBuffer(); - VariablesInitializer.setInitializer(new VariablesInitializer.ITestInitializer() { - public void initialize(String variable) throws JavaScriptModelException { - buffer.append("Initializing " + variable + "\n"); - IPath path = new Path(variable.toLowerCase()); - JavaScriptCore.getIncludepathVariable("TEST_SRC"); - buffer.append("Setting variable " + variable + " to " + path + "\n"); - JavaScriptCore.setIncludepathVariable(variable, path, null); - } - }); - createJavaProject("P", new String[] {}, new String[] {"TEST_LIB,TEST_SRC,TEST_ROOT"}); - assertEquals( - "Initializing TEST_LIB\n" + - "Initializing TEST_SRC\n" + - "Setting variable TEST_SRC to test_src\n" + - "Setting variable TEST_LIB to test_lib\n", - buffer.toString()); - } finally { - deleteProject("P"); - VariablesInitializer.reset(); - } -} -/* - * Ensures that if the initializer doesn't initialize a variable, it can be - * initialized later on. - */ -public void testVariableInitializer06() throws CoreException { - try { - final StringBuffer buffer = new StringBuffer(); - VariablesInitializer.setInitializer(new VariablesInitializer.ITestInitializer() { - public void initialize(String variable) { - // do nothing - buffer.append("Ignoring request to initialize"); - } - }); - IPath path = JavaScriptCore.getIncludepathVariable("TEST_SRC"); - assertEquals( - "Unexpected value of TEST_SRC after initializer was called", - null, - path); - IPath varValue = new Path("src.zip"); - JavaScriptCore.setIncludepathVariable("TEST_SRC", varValue, null); - path = JavaScriptCore.getIncludepathVariable("TEST_SRC"); - assertEquals( - "Unexpected value of TEST_SRC after setting it", - varValue, - path); - } finally { - VariablesInitializer.reset(); - } -} -public void testVariableInitializer07() throws CoreException { - try { - createProject("P1"); - createFile("/P1/lib.jar", ""); - createFile("/P1/src.zip", ""); - String[] variableValues = new String[] { - "TEST_LIB", "/P1/lib.jar", - "TEST_SRC", "/P1/src.zip", - "TEST_ROOT", "src", - }; - VariablesInitializer.setInitializer(new DefaultVariableInitializer(variableValues)); - createJavaProject("P2", new String[] {}, new String[] {"TEST_LIB,TEST_SRC,TEST_ROOT"}); - - // change value of TEST_LIB - createFile("/P1/lib2.jar", ""); - VariablesInitializer.setInitializer(new DefaultVariableInitializer(new String[] { - "TEST_LIB", "/P1/lib2.jar", - "TEST_SRC", "/P1/src.zip", - "TEST_ROOT", "src", - })); - - // simulate state on startup - simulateExitRestart(); - - startDeltas(); - //JavaModelManager.CP_RESOLVE_VERBOSE=true; - getJavaProject("P2").getResolvedIncludepath(true); - - assertDeltas( - "Unexpected delta on startup", - "P2[*]: {CHILDREN}\n" + - " /P1/lib.jar[*]: {REMOVED FROM CLASSPATH}\n" + - " /P1/lib2.jar[*]: {ADDED TO CLASSPATH}" - ); - } finally { - //JavaModelManager.CP_RESOLVE_VERBOSE=false; - stopDeltas(); - deleteProject("P1"); - deleteProject("P2"); - VariablesInitializer.reset(); - } -} -/* - * Ensure that an OperationCanceledException goes through - * (regression test for bug 59363 Should surface cancellation exceptions) - */ - -public void testVariableInitializer08() throws CoreException { - try { - boolean gotException = false; - try { - VariablesInitializer.setInitializer(new DefaultVariableInitializer(new String[] {"TEST_LIB", "/P1/lib.jar"}) { - public void initialize(String variable) throws JavaScriptModelException { - throw new OperationCanceledException("test"); - } - }); - IJavaScriptProject p1 = createJavaProject("P1", new String[] {}, new String[] {"TEST_LIB"}); - p1.getResolvedIncludepath(true); - } catch (OperationCanceledException e) { - gotException = true; - } - assertTrue("Should get an OperationCanceledException", gotException); - } finally { - deleteProject("P1"); - VariablesInitializer.reset(); - } -} - -/* - * Ensure that removing a classpath variable while initializing it doesn't throw a StackOverFlowError - * (regression test for bug 112609 StackOverflow when initializing Java Core) - */ -public void testVariableInitializer09() throws CoreException { - try { - VariablesInitializer.setInitializer(new DefaultVariableInitializer(new String[] {"TEST_LIB", "/P1/lib.jar"}) { - public void initialize(String variable) throws JavaScriptModelException { - JavaScriptCore.removeIncludepathVariable("TEST_LIB", null); - } - }); - IJavaScriptProject p1 = createJavaProject("P1", new String[] {}, new String[] {"TEST_LIB"}); - IIncludePathEntry[] resolvedClasspath = p1.getResolvedIncludepath(true); - assertClasspathEquals( - resolvedClasspath, - "" - ); - } finally { - deleteProject("P1"); - VariablesInitializer.reset(); - } -} -/* - * Ensures that not initializing a classpath variable and asking for its value returns null - * (regression test for bug 113110 TestFailures in DebugSuite) - */ -public void testVariableInitializer10() throws CoreException { - try { - VariablesInitializer.setInitializer(new DefaultVariableInitializer(new String[] {"TEST_LIB", "/P1/lib.jar"}) { - public void initialize(String variable) throws JavaScriptModelException { - // don't initialize - } - }); - // force resolution - JavaScriptCore.getIncludepathVariable("TEST_LIB"); - // second call should still be null - assertEquals("TEST_LIB should be null", null, JavaScriptCore.getIncludepathVariable("TEST_LIB")); - } finally { - deleteProject("P1"); - VariablesInitializer.reset(); - } -} -/** - * Bug 125965: [prefs] "Export/Import preferences" should let user to choose wich preference to export/import - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=125965" - */ -public void testVariableInitializer11() throws CoreException { - try { - // Create initializer - String varName = "TEST_LIB"; - String initialValue = "/P1/lib.jar"; - String newValue = "/tmp/file.jar"; - VariablesInitializer.setInitializer(new DefaultVariableInitializer(new String[] {varName, initialValue})); - assertEquals("JavaScriptCore classpath value should have been initialized", JavaScriptCore.getIncludepathVariable(varName).toString(), initialValue); - - // Modify preference - JavaModelManager manager = JavaModelManager.getJavaModelManager(); - IEclipsePreferences preferences = manager.getInstancePreferences(); - preferences.put(JavaModelManager.CP_VARIABLE_PREFERENCES_PREFIX+varName, newValue); - - // verify that JavaScriptCore preferences have been reset - assertEquals("JavaScriptCore classpath value should be unchanged", JavaScriptCore.getIncludepathVariable(varName).toString(), initialValue); - assertEquals("JavaScriptCore preferences value should be unchanged", preferences.get(varName, "X"), initialValue); - } finally { - VariablesInitializer.reset(); - } -} - -/** - * @bug 138599: [model][classpath] Need a way to mark a classpath variable as deprecated - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=138599" - */ -public void testVariableInitializerDeprecated() throws CoreException { - try { - // Create initializer - String varName = "TEST_DEPRECATED"; - String filePath = "/P1/lib.jar"; - VariablesInitializer.setInitializer(new DefaultVariableInitializer(new String[] {varName, filePath})); - assertEquals("JavaScriptCore classpath value should have been initialized", JavaScriptCore.getIncludepathVariable(varName).toString(), filePath); - - // Verify that Classpath Variable is deprecated - assertEquals("JavaScriptCore classpath variable should be deprecated", "Test deprecated flag", JavaScriptCore.getIncludepathVariableDeprecationMessage(varName)); - - // Create project - IJavaScriptProject project = createJavaProject("P1"); - createFile("/P1/lib.jar", ""); - IIncludePathEntry variable = JavaScriptCore.newVariableEntry(new Path("TEST_DEPRECATED"), null, null); - IJavaScriptModelStatus status = JavaScriptConventions.validateClasspathEntry(project, variable, false); - assertStatus("Classpath variable 'TEST_DEPRECATED' in project P1 is deprecated: 'Test deprecated flag'", status); - assertFalse("Status should not be OK", status.isOK()); - assertEquals("Status should have WARNING severity", IStatus.WARNING, status.getSeverity()); - assertEquals("Status should have deprecated code", IJavaScriptModelStatusConstants.DEPRECATED_VARIABLE, status.getCode()); - } finally { - VariablesInitializer.reset(); - deleteProject("P1"); - } -} -public void testVariableInitializerUnboundAndDeprecated() throws CoreException { - try { - // Create initializer - String varName = "TEST_DEPRECATED"; - String filePath = "/P1/lib.jar"; - VariablesInitializer.setInitializer(new DefaultVariableInitializer(new String[] {varName, filePath})); - assertEquals("JavaScriptCore classpath value should have been initialized", JavaScriptCore.getIncludepathVariable(varName).toString(), filePath); - - // Verify that Classpath Variable is deprecated - assertEquals("JavaScriptCore classpath variable should be deprecated", "Test deprecated flag", JavaScriptCore.getIncludepathVariableDeprecationMessage(varName)); - - // Create project - IJavaScriptProject project = createJavaProject("P1"); - IIncludePathEntry variable = JavaScriptCore.newVariableEntry(new Path("TEST_DEPRECATED"), null, null); - IJavaScriptModelStatus status = JavaScriptConventions.validateClasspathEntry(project, variable, false); - assertStatus("Project P1 is missing required library: 'lib.jar'", status); - assertFalse("Status should not be OK", status.isOK()); - assertEquals("Status should have WARNING severity", IStatus.ERROR, status.getSeverity()); - assertEquals("Status should have deprecated code", IJavaScriptModelStatusConstants.INVALID_INCLUDEPATH, status.getCode()); - } finally { - VariablesInitializer.reset(); - deleteProject("P1"); - } -} - -/** - * @bug 156226: [model][classpath] Allow classpath variable to be marked as non modifiable - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=156226" - */ -public void testVariableInitializerReadOnly() throws CoreException { - try { - // Create initializer - String varName = "TEST_READ_ONLY"; - String path = "/P1/lib.jar"; - VariablesInitializer.setInitializer(new DefaultVariableInitializer(new String[] { varName, path })); - assertEquals("JavaScriptCore classpath value should have been initialized", JavaScriptCore.getIncludepathVariable(varName).toString(), path); - - // verify that Classpath Variable is read-only - assertTrue("JavaScriptCore classpath variable should be read-only", JavaScriptCore.isIncludepathVariableReadOnly(varName)); - - // Create project - IJavaScriptProject project = createJavaProject("P1"); - createFile("/P1/lib.jar", ""); - IIncludePathEntry variable = JavaScriptCore.newVariableEntry(new Path("TEST_READ_ONLY"), null, null); - IJavaScriptModelStatus status = JavaScriptConventions.validateClasspathEntry(project, variable, false); - assertStatus("OK", status); - assertTrue("Status should be OK", status.isOK()); - assertEquals("Status should be VERIFIED_OK", JavaModelStatus.VERIFIED_OK, status); - } finally { - VariablesInitializer.reset(); - deleteProject("P1"); - } -} -public void testVariableInitializerDeprecatedAndReadOnly() throws CoreException { - try { - // Create initializer - String varName = "TEST_DEPRECATED_READ_ONLY"; - String path = "/P1/lib.jar"; - VariablesInitializer.setInitializer(new DefaultVariableInitializer(new String[] { varName, path })); - assertEquals("JavaScriptCore classpath value should have been initialized", JavaScriptCore.getIncludepathVariable(varName).toString(), path); - - // verify that Classpath Variable is read-only - assertEquals("JavaScriptCore classpath variable should be deprecated", "A deprecated and read-only initializer", JavaScriptCore.getIncludepathVariableDeprecationMessage(varName)); - assertTrue("JavaScriptCore classpath variable should be read-only", JavaScriptCore.isIncludepathVariableReadOnly(varName)); - - // Create project - IJavaScriptProject project = createJavaProject("P1"); - createFile("/P1/lib.jar", ""); - IIncludePathEntry variable = JavaScriptCore.newVariableEntry(new Path("TEST_DEPRECATED_READ_ONLY"), null, null); - IJavaScriptModelStatus status = JavaScriptConventions.validateClasspathEntry(project, variable, false); - assertStatus("Classpath variable 'TEST_DEPRECATED_READ_ONLY' in project P1 is deprecated: 'A deprecated and read-only initializer'", status); - assertFalse("Status should not be OK", status.isOK()); - assertEquals("Status should have WARNING severity", IStatus.WARNING, status.getSeverity()); - assertEquals("Status should have deprecated code", IJavaScriptModelStatusConstants.DEPRECATED_VARIABLE, status.getCode()); - } finally { - VariablesInitializer.reset(); - deleteProject("P1"); - } -} - -/** - * @bug 172207: [model] Marker for deprecated classpath variable should always have WARNING severity - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=172207" - */ -public void testVariableInitializerBug172207() throws CoreException { - try { - // Create initializer - String varName = "TEST_DEPRECATED_READ_ONLY"; - String path = "/P1/lib.jar"; - VariablesInitializer.setInitializer(new DefaultVariableInitializer(new String[] { varName, path })); - assertEquals("JavaScriptCore classpath value should have been initialized", JavaScriptCore.getIncludepathVariable(varName).toString(), path); - - // verify that Classpath Variable is read-only - assertEquals("JavaScriptCore classpath variable should be deprecated", "A deprecated and read-only initializer", JavaScriptCore.getIncludepathVariableDeprecationMessage(varName)); - assertTrue("JavaScriptCore classpath variable should be read-only", JavaScriptCore.isIncludepathVariableReadOnly(varName)); - - // Create project - IJavaScriptProject project = createJavaProject("P1"); - createFile("/P1/lib.jar", ""); - IIncludePathEntry variable = JavaScriptCore.newVariableEntry(new Path("TEST_DEPRECATED_READ_ONLY"), null, null); - IIncludePathEntry[] entries = project.getRawIncludepath(); - int length = entries.length; - System.arraycopy(entries, 0, entries = new IIncludePathEntry[length+1], 0, length); - entries[length] = variable; - project.setRawIncludepath(entries, null); - - // verify markers - waitForAutoBuild(); - IMarker[] markers = project.getProject().findMarkers(IJavaScriptModelMarker.BUILDPATH_PROBLEM_MARKER, false, IResource.DEPTH_ZERO); - sortMarkers(markers); - assertMarkers("Unexpected marker(s)", - "Classpath variable 'TEST_DEPRECATED_READ_ONLY' in project P1 is deprecated: 'A deprecated and read-only initializer'", - markers); - assertEquals("Marker on deprecated variable should be a WARNING", IMarker.SEVERITY_WARNING, markers[0].getAttribute(IMarker.SEVERITY, -1)); - } finally { - VariablesInitializer.reset(); - deleteProject("P1"); - } -} - -/** - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=61872" - */ -public void testUserLibraryInitializer1() throws CoreException { - try { - // Create new user library "SWT" - JsGlobalScopeContainerInitializer initializer= JavaScriptCore.getJsGlobalScopeContainerInitializer(JavaScriptCore.USER_LIBRARY_CONTAINER_ID); - String libraryName = "SWT"; - IPath containerPath = new Path(JavaScriptCore.USER_LIBRARY_CONTAINER_ID); - UserLibraryJsGlobalScopeContainer containerSuggestion = new UserLibraryJsGlobalScopeContainer(libraryName); - initializer.requestJsGlobalScopeContainerUpdate(containerPath.append(libraryName), null, containerSuggestion); - - // Create java project - createJavaProject("p61872"); - IFile jarFile = createFile("/p61872/swt.jar", ""); - IFile srcFile = createFile("/p61872/swtsrc.zip", ""); - - // Modify user library - Preferences preferences = JavaScriptCore.getPlugin().getPluginPreferences(); - String propertyName = UserLibraryManager.CP_USERLIBRARY_PREFERENCES_PREFIX+"SWT"; - StringBuffer propertyValue = new StringBuffer("\r\n\r\n\r\n\r\n"); - preferences.setValue(propertyName, propertyValue.toString()); - JavaScriptCore.getPlugin().savePluginPreferences(); - - // Modify project classpath - editFile( - "/p61872/.classpath", - "\n" + - "\n" + - " \n" + - " \n" + - "" - ); - - // Verify - IIncludePathEntry[] entries = getJavaProject("p61872").getResolvedIncludepath(true); - assertEquals("Invalid entries number in resolved classpath for project p61872!", 1, entries.length); - assertEquals("Invalid path for project 61872 classpath entry!", jarFullPath.toLowerCase(), entries[0].getPath().toString().toLowerCase()); - assertNull("Project 61872 classpath entry should not have any source attached!", entries[0].getSourceAttachmentPath()); - - // Modify user library - propertyValue = new StringBuffer("\r\n\r\n\r\n\r\n"); - preferences.setValue(propertyName, propertyValue.toString()); - JavaScriptCore.getPlugin().savePluginPreferences(); - - // Verify - entries = getJavaProject("p61872").getResolvedIncludepath(true); - assertEquals("Invalid entries number in resolved classpath for project p61872!", 1, entries.length); - assertEquals("Invalid path for project 61872 classpath entry!", jarFullPath.toLowerCase(), entries[0].getPath().toString().toLowerCase()); - assertEquals("Invalid source attachement path for project 61872 classpath entry!", srcFullPath.toLowerCase(), entries[0].getSourceAttachmentPath().toString().toLowerCase()); - } finally { - deleteProject("p61872"); - } -} -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ClasspathTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ClasspathTests.java deleted file mode 100644 index 7c936a0..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ClasspathTests.java +++ /dev/null @@ -1,3032 +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.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.Hashtable; -import java.util.Map; - -import junit.framework.Test; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.IWorkspaceRunnable; -import org.eclipse.core.resources.IncrementalProjectBuilder; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.wst.jsdt.core.IAccessRule; -import org.eclipse.wst.jsdt.core.IIncludePathAttribute; -import org.eclipse.wst.jsdt.core.IIncludePathEntry; -import org.eclipse.wst.jsdt.core.IJavaScriptElementDelta; -import org.eclipse.wst.jsdt.core.IJavaScriptModelMarker; -import org.eclipse.wst.jsdt.core.IJavaScriptModelStatus; -import org.eclipse.wst.jsdt.core.IJavaScriptProject; -import org.eclipse.wst.jsdt.core.IJavaScriptUnit; -import org.eclipse.wst.jsdt.core.IJsGlobalScopeContainer; -import org.eclipse.wst.jsdt.core.IPackageFragment; -import org.eclipse.wst.jsdt.core.IPackageFragmentRoot; -import org.eclipse.wst.jsdt.core.JavaScriptConventions; -import org.eclipse.wst.jsdt.core.JavaScriptCore; -import org.eclipse.wst.jsdt.core.JavaScriptModelException; -import org.eclipse.wst.jsdt.core.tests.util.Util; -import org.eclipse.wst.jsdt.internal.core.ClasspathEntry; -import org.eclipse.wst.jsdt.internal.core.JavaModelManager; -import org.eclipse.wst.jsdt.internal.core.JavaProject; - -public class ClasspathTests extends ModifyingResourceTests { - - public class TestContainer implements IJsGlobalScopeContainer { - IPath path; - IIncludePathEntry[] entries; - TestContainer(IPath path, IIncludePathEntry[] entries){ - this.path = path; - this.entries = entries; - } - public IPath getPath() { return this.path; } - /** - * @deprecated Use {@link #getIncludepathEntries()} instead - */ - public IIncludePathEntry[] getClasspathEntries() { - return getIncludepathEntries(); - } - public IIncludePathEntry[] getIncludepathEntries() { return this.entries; } - public String getDescription() { return this.path.toString(); } - public int getKind() { return 0; } - /* (non-Javadoc) - * @see org.eclipse.wst.jsdt.core.IJsGlobalScopeContainer#resolvedLibraryImport(java.lang.String) - */ - public String[] resolvedLibraryImport(String a) { - return new String[] {a}; - } - } - -public ClasspathTests(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 { - // Names of tests to run: can be "testBugXXXX" or "BugXXXX") -// TESTS_PREFIX = "testClasspathDuplicateExtraAttribute"; -// TESTS_NAMES = new String[] {"testClasspathValidation42"}; -// TESTS_NUMBERS = new int[] { 23, 28, 38 }; -// TESTS_RANGE = new int[] { 21, 38 }; -} -public static Test suite() { - return buildModelTestSuite(ClasspathTests.class); -} -public void setUpSuite() throws Exception { - super.setUpSuite(); - - setupExternalJCL("jclMin"); -} -protected void assertCycleMarkers(IJavaScriptProject project, IJavaScriptProject[] p, int[] expectedCycleParticipants) throws CoreException { - waitForAutoBuild(); - StringBuffer expected = new StringBuffer("{"); - int expectedCount = 0; - StringBuffer computed = new StringBuffer("{"); - int computedCount = 0; - for (int j = 0; j < p.length; j++){ - int markerCount = this.numberOfCycleMarkers(p[j]); - if (markerCount > 0){ - if (computedCount++ > 0) computed.append(", "); - computed.append(p[j].getElementName()); - //computed.append(" (" + markerCount + ")"); - } - markerCount = expectedCycleParticipants[j]; - if (markerCount > 0){ - if (expectedCount++ > 0) expected.append(", "); - expected.append(p[j].getElementName()); - //expected.append(" (" + markerCount + ")"); - } - } - expected.append("}"); - computed.append("}"); - assertEquals("Invalid cycle detection after setting classpath for: "+project.getElementName(), expected.toString(), computed.toString()); -} -private void assertEncodeDecodeEntry(String projectName, String expectedEncoded, IIncludePathEntry entry) { - IJavaScriptProject project = getJavaProject(projectName); - String encoded = project.encodeIncludepathEntry(entry); - assertSourceEquals( - "Unexpected encoded entry", - expectedEncoded, - encoded); - IIncludePathEntry decoded = project.decodeIncludepathEntry(encoded); - assertEquals( - "Unexpected decoded entry", - entry, - decoded); -} -protected File createFile(File parent, String name, String content) throws IOException { - File file = new File(parent, name); - FileOutputStream out = new FileOutputStream(file); - out.write(content.getBytes()); - out.close(); - /* - * Need to change the time stamp to realize that the file has been modified - */ - file.setLastModified(System.currentTimeMillis() + 2000); - return file; -} -protected File createFolder(File parent, String name) { - File file = new File(parent, name); - file.mkdirs(); - return file; -} -protected int numberOfCycleMarkers(IJavaScriptProject javaProject) throws CoreException { - IMarker[] markers = javaProject.getProject().findMarkers(IJavaScriptModelMarker.BUILDPATH_PROBLEM_MARKER, false, IResource.DEPTH_ZERO); - int result = 0; - for (int i = 0, length = markers.length; i < length; i++) { - IMarker marker = markers[i]; - String cycleAttr = (String)marker.getAttribute(IJavaScriptModelMarker.CYCLE_DETECTED); - if (cycleAttr != null && cycleAttr.equals("true")){ //$NON-NLS-1$ - result++; - } - } - return result; -} - -/** - * Add an entry to the classpath for a non-existent root. Then create - * the root and ensure that it comes alive. - */ -public void testAddRoot1() throws CoreException { - IJavaScriptProject project = this.createJavaProject("P", new String[] {"src"}); - IIncludePathEntry[] originalCP= project.getRawIncludepath(); - - try { - IIncludePathEntry newEntry= JavaScriptCore.newSourceEntry(project.getProject().getFullPath().append("extra")); - - IIncludePathEntry[] newCP= new IIncludePathEntry[originalCP.length + 1]; - System.arraycopy(originalCP, 0 , newCP, 0, originalCP.length); - newCP[originalCP.length]= newEntry; - - project.setRawIncludepath(newCP, null); - - // now create the actual resource for the root and populate it - project.getProject().getFolder("extra").create(false, true, null); - - IPackageFragmentRoot newRoot= getPackageFragmentRoot("P", "extra"); - assertTrue("New root should now be visible", newRoot != null); - } finally { - // cleanup - this.deleteProject("P"); - } -} - -/* - * Adds an entry to the classpath for a non-existent root. Then creates - * the root and ensures that the marker is removed. - * (regression test for bug 161581 Adding a missing folder doesn't remove classpath marker) - */ -public void testAddRoot2() throws CoreException { - try { - IJavaScriptProject project = createJavaProject("P", new String[] {}); - project.setRawIncludepath(createClasspath("P", new String[] {"/P/src", ""}), null); - waitForAutoBuild(); - - // now create the actual resource for the root - project.getProject().getFolder("src").create(false, true, null); - assertMarkers("Unexpected markers", "", project); - } finally { - // cleanup - this.deleteProject("P"); - } -} - -/** - * Ensures that the reordering external resources in the classpath - * generates the correct deltas. - */ -public void testClasspathChangeExternalResources() throws CoreException { - try { - IJavaScriptProject proj = this.createJavaProject("P", new String[] {"src"}); - - IIncludePathEntry[] newEntries = new IIncludePathEntry[2]; - newEntries[0] = JavaScriptCore.newLibraryEntry(getSystemJsPath(), null, null, false); - newEntries[1] = JavaScriptCore.newLibraryEntry(getExternalJCLSourcePath(), null, null, false); - setClasspath(proj, newEntries); - startDeltas(); - IIncludePathEntry[] swappedEntries = new IIncludePathEntry[2]; - swappedEntries[0] = newEntries[1]; - swappedEntries[1] = newEntries[0]; - setClasspath(proj, swappedEntries); - assertDeltas( - "Unexpected delta", - "P[*]: {CHILDREN | CONTENT | CLASSPATH CHANGED}\n" + - " "+ getSystemJsPathString() +"[*]: {REORDERED}\n" + - " "+ getExternalJCLSourcePathString() +"[*]: {REORDERED}\n" + - " ResourceDelta(/P/.settings)[*]" - ); - } finally { - stopDeltas(); - this.deleteProject("P"); - } -} - -/* - * Test classpath corruption (23977) - */ -public void testClasspathCorruption() throws CoreException { - try { - JavaProject p1 = (JavaProject)this.createJavaProject("P1", new String[]{""}, new String[]{}, new String[]{}); - this.createJavaProject("P2", new String[]{""}, new String[]{}, new String[]{}); - this.createFile("P2/foo.txt", "not a project"); - String newCPContent = - " \n" - +" \n" - +" \n" - +" \n" // corruption here: target isn't a project - +" \n"; - - IFile fileRsc = p1.getProject().getFile(JavaProject.SHARED_PROPERTIES_DIRECTORY + "/" + JavaProject.CLASSPATH_FILENAME); - fileRsc.setContents(new ByteArrayInputStream(newCPContent.getBytes()), true, false, null); - - p1.close(); - JavaModelManager.PerProjectInfo perProjectInfo = JavaModelManager.getJavaModelManager().getPerProjectInfo(p1.getProject(), true/*create if missing*/); - perProjectInfo.setClasspath(null, null, null, null, null, null, null); - - // shouldn't fail - p1.getExpandedClasspath(); - - // if could reach that far, then all is fine - - } catch(ClassCastException e){ - assertTrue("internal ClassCastException on corrupted classpath file", false); - } finally { - // cleanup - this.deleteProject("P1"); - this.deleteProject("P2"); - } -} - -/* - * Test classpath read for non-javascript project or javascript project not opened yet (40658) - */ -public void testClasspathFileRead() throws CoreException { - try { - final IProject proj = this.createProject("P1"); - String newCPContent = - " \n" - +" \n" - +" \n" - +" \n"; - - this.createFolder("/P1/.settings/"); - this.createFile("/P1/.settings/"+JavaProject.CLASSPATH_FILENAME, newCPContent); - final IJavaScriptProject jproj = JavaScriptCore.create(proj); - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - workspace.run(new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) { - - IIncludePathEntry[] entries = jproj.readRawIncludepath(); // force to read classpath - IIncludePathEntry entry = entries[0]; - assertEquals("first classpath entry should have been read", "/P1/src", entry.getPath().toString()); - } - }, null); - } finally { - // cleanup - this.deleteProject("P1"); - } -} - -/* - * Test classpath forced reload (20931) and new way to read classpath file (40658) - */ -public void testClasspathForceReload() throws CoreException { - try { - final JavaProject p1 = (JavaProject)this.createJavaProject("P1", new String[]{""}, new String[]{}, new String[]{}); - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - workspace.run(new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { - - p1.getRawIncludepath(); // force to read classpath - createFolder("P1/src"); - String newCPContent = - " \n" - +" \n" - +" \n" - +" \n"; - - IFile fileRsc = p1.getProject().getFile(JavaProject.SHARED_PROPERTIES_DIRECTORY + "/" + JavaProject.CLASSPATH_FILENAME); - fileRsc.setContents(new ByteArrayInputStream(newCPContent.getBytes()), true, false, null); - - p1.close(); - IIncludePathEntry[] entries = p1.readRawIncludepath(); // force to read classpath - assertEquals("source location should not have been refreshed", "/P1", entries[0].getPath().toString()); - } - }, null); - } finally { - // cleanup - this.deleteProject("P1"); - } -} - -/** - * Ensures that the setting the classpath with a library entry - * changes the kind of the root from K_SOURCE to K_BINARY. - */ -public void testClasspathCreateLibraryEntry() throws CoreException { - try { - IJavaScriptProject proj = this.createJavaProject("P", new String[] {"src"}); - this.createFile("P/src/X.js", "function X() {}"); - - IFolder rootFolder = proj.getProject().getFolder(new Path("src")); - IPackageFragmentRoot root = proj.getPackageFragmentRoot(rootFolder); - - assertEquals( - "Unexpected root kind 1", - IPackageFragmentRoot.K_SOURCE, - root.getKind()); - IPackageFragment pkg = root.getPackageFragment(""); - assertEquals( - "Unexpected numbers of compilation units", - 1, - pkg.getJavaScriptUnits().length); - - this.setClasspath( - proj, - new IIncludePathEntry[] { - JavaScriptCore.newLibraryEntry(rootFolder.getFullPath(), null, null, false) - }); - assertEquals( - "Unexpected root kind 2", - IPackageFragmentRoot.K_BINARY, - root.getKind()); - assertEquals( - "Unexpected numbers of compilation units", - 0, - pkg.getJavaScriptUnits().length); - - //ensure that the new kind has been persisted in the classpath file - proj.close(); - assertEquals( - "Unexpected root kind 3", - IPackageFragmentRoot.K_BINARY, - root.getKind()); - - } finally { - this.deleteProject("P"); - } -} - -/** - * Tests the cross project classpath setting - */ -public void testClasspathCrossProject() throws CoreException { - IJavaScriptProject project = this.createJavaProject("P1", new String[] {""}); - this.createJavaProject("P2", new String[] {}); - try { - startDeltas(); - IPackageFragmentRoot oldRoot= getPackageFragmentRoot("P1", ""); - IIncludePathEntry projectEntry= JavaScriptCore.newProjectEntry(new Path("/P2"), false); - IIncludePathEntry[] newClasspath= new IIncludePathEntry[]{projectEntry}; - project.setRawIncludepath(newClasspath, null); - project.getAllPackageFragmentRoots(); - IJavaScriptElementDelta removedDelta= getDeltaFor(oldRoot, true); - assertDeltas( - "Unexpected delta", - "[*]: {REMOVED FROM CLASSPATH}", - removedDelta); - } finally { - stopDeltas(); - this.deleteProjects(new String[] {"P1", "P2"}); - } -} -/** - * Delete a root and ensure the classpath is not updated (i.e. entry isn't removed). - */ -public void testClasspathDeleteNestedRoot() throws CoreException { - IJavaScriptProject project = this.createJavaProject("P", new String[] {"nested/src"}, new String[] {}); - IPackageFragmentRoot root= getPackageFragmentRoot("P", "nested/src"); - IIncludePathEntry[] originalCP= project.getRawIncludepath(); - - // delete the root - deleteResource(root.getUnderlyingResource()); - - IIncludePathEntry[] newCP= project.getRawIncludepath(); - - try { - // should still be an entry for the "src" folder - assertTrue("classpath should not have been updated", - newCP.length == 2 && - newCP[0].equals(originalCP[0]) && - newCP[1].equals(originalCP[1])); - } finally { - this.deleteProject("P"); - } -} -/* - * Test classpath diamond (23979) - */ -public void testClasspathDiamond() throws CoreException { - try { - this.createJavaProject("P1", new String[]{""}); - this.createJavaProject("P2", new String[]{""}, new String[]{}, new String[]{"/P1"}); - this.createJavaProject("P3", new String[]{""}, new String[]{}, new String[]{"/P1", "/P2"}); - IJavaScriptProject p4 = this.createJavaProject("P4", new String[]{""}, new String[]{}, new String[]{"/P2", "/P3"}); - - assertTrue("Should not detect cycle", !p4.hasIncludepathCycle(null)); - - } finally { - // cleanup - this.deleteProjects(new String[] {"P1", "P2", "P3", "P4"}); - } -} - -/** - * Delete a nested root's parent folder and ensure the classpath is - * not updated (i.e. entry isn't removed). - */ -public void testClasspathDeleteNestedRootParent() throws CoreException { - IJavaScriptProject project = this.createJavaProject("P", new String[] {"nested/src"}, new String[] {}); - IPackageFragmentRoot root= getPackageFragmentRoot("P", "nested/src"); - IIncludePathEntry[] originalCP= project.getRawIncludepath(); - - // delete the root's parent folder - IFolder folder= (IFolder)root.getUnderlyingResource().getParent(); - deleteResource(folder); - - IIncludePathEntry[] newCP= project.getRawIncludepath(); - - try { - - // should still be an entry for the "src" folder - assertTrue("classpath should not have been updated", - newCP.length == 2 && - newCP[0].equals(originalCP[0]) && - newCP[1].equals(originalCP[1])); - } finally { - this.deleteProject("P"); - } -} -/** - * Test that a classpath entry for an external jar is externalized - * properly. - */ -public void testClasspathExternalize() throws CoreException { - try { - IJavaScriptProject project= this.createJavaProject("P", new String[] {}, new String[] {getSystemJsPathString()}); - IIncludePathEntry[] classpath= project.getRawIncludepath(); - IIncludePathEntry jar= null; - for (int i= 0; i < classpath.length; i++) { - if (classpath[i].getEntryKind() == IIncludePathEntry.CPE_LIBRARY) { - jar= classpath[i]; - break; - } - } - project.close(); - project.open(null); - - classpath= project.getRawIncludepath(); - for (int i= 0; i < classpath.length; i++) { - if (classpath[i].getEntryKind() == IIncludePathEntry.CPE_LIBRARY) { - assertTrue("Paths must be the same", classpath[i].getPath().equals(jar.getPath())); - break; - } - } - } finally { - this.deleteProject("P"); - } -} -/** - * Move a root and ensure the classpath is not updated (i.e. entry not renamed). - */ -public void testClasspathMoveNestedRoot() throws CoreException { - IJavaScriptProject project = this.createJavaProject("P", new String[] {"nested/src"}, new String[] {}); - IPackageFragmentRoot root= getPackageFragmentRoot("P", "nested/src"); - IIncludePathEntry[] originalCP= project.getRawIncludepath(); - - // delete the root - IFolder folder= (IFolder)root.getUnderlyingResource(); - IPath originalPath= folder.getFullPath(); - IPath newPath= originalPath.removeLastSegments(1); - newPath= newPath.append(new Path("newsrc")); - - startDeltas(); - - folder.move(newPath, true, null); - - IIncludePathEntry[] newCP= project.getRawIncludepath(); - - IPackageFragmentRoot newRoot= project.getPackageFragmentRoot(project.getProject().getFolder("nested").getFolder("newsrc")); - - try { - // entry for the "src" folder wasn't replaced - assertTrue("classpath not automatically updated", newCP.length == 2 && - newCP[1].equals(originalCP[1]) && - newCP[0].equals(originalCP[0])); - - IJavaScriptElementDelta rootDelta = getDeltaFor(root, true); - IJavaScriptElementDelta projectDelta = getDeltaFor(newRoot.getParent(), true); - assertTrue("should get delta for moved root", rootDelta != null && - rootDelta.getKind() == IJavaScriptElementDelta.REMOVED && - rootDelta.getFlags() == 0); - assertTrue("should get delta indicating content changed for project", this.deltaContentChanged(projectDelta)); - - } finally { - stopDeltas(); - this.deleteProject("P"); - } -} - -/** - * Move a parent of a nested root and ensure the classpath is not updated (i.e. entry not renamed). - */ -public void testClasspathMoveNestedRootParent() throws CoreException { - try { - IJavaScriptProject project =this.createJavaProject("P", new String[] {"nested/src"}, new String[] {}); - IPackageFragmentRoot root= getPackageFragmentRoot("P", "nested/src"); - IIncludePathEntry[] originalCP= project.getRawIncludepath(); - - // delete the root - IFolder folder= (IFolder)root.getUnderlyingResource().getParent(); - IPath originalPath= folder.getFullPath(); - IPath newPath= originalPath.removeLastSegments(1); - newPath= newPath.append(new Path("newsrc")); - folder.move(newPath, true, null); - - IIncludePathEntry[] newCP= project.getRawIncludepath(); - - // entry for the "src" folder wasn't replaced - // entry for the "src" folder should not be replaced - assertTrue("classpath should not automatically be updated", newCP.length == 2 && - newCP[1].equals(originalCP[1]) && - newCP[0].equals(originalCP[0])); - - } finally { - this.deleteProject("P"); - } -} -/** - * Tests that nothing occurs when setting to the same classpath - */ -public void testClasspathNoChanges() throws CoreException { - try { - IJavaScriptProject p = this.createJavaProject("P", new String[] {""}); - IIncludePathEntry[] oldClasspath= p.getRawIncludepath(); - startDeltas(); - p.setRawIncludepath(oldClasspath, null); - assertDeltas("Unexpected delta", ""); - } finally { - stopDeltas(); - this.deleteProject("P"); - } -} -/** - * Ensures that the setting the classpath with a reordered classpath generates - * the correct deltas. - */ -public void testClasspathReordering() throws CoreException { - IJavaScriptProject proj = this.createJavaProject("P", new String[] {"src"}, new String[] {getSystemJsPathString()}); - IIncludePathEntry[] originalCP = proj.getRawIncludepath(); - IPackageFragmentRoot root = getPackageFragmentRoot("P", "src"); - try { - IIncludePathEntry[] newEntries = new IIncludePathEntry[originalCP.length]; - int index = originalCP.length - 1; - for (int i = 0; i < originalCP.length; i++) { - newEntries[index] = originalCP[i]; - index--; - } - startDeltas(); - setClasspath(proj, newEntries); - assertTrue("should be one delta - two roots reordered", this.deltaListener.deltas.length == 1); - IJavaScriptElementDelta d = null; - assertTrue("root should be reordered in the classpath", (d = getDeltaFor(root, true)) != null - && (d.getFlags() & IJavaScriptElementDelta.F_REORDER) > 0); - } finally { - stopDeltas(); - this.deleteProject("P"); - } -} - -/** - * Should detect duplicate entries on the classpath - */ -public void testClasspathValidation01() throws CoreException { - try { - IJavaScriptProject proj = this.createJavaProject("P", new String[] {"src"}); - IIncludePathEntry[] originalCP = proj.getRawIncludepath(); - - IIncludePathEntry[] newCP = new IIncludePathEntry[originalCP.length+1]; - System.arraycopy(originalCP, 0, newCP, 0, originalCP.length); - newCP[originalCP.length] = newCP[0]; - - IJavaScriptModelStatus status = JavaScriptConventions.validateClasspath(proj, newCP); - - assertStatus( - "should have detected duplicate entries on the classpath", - "Include path contains duplicate entry: \'src\' for project P", - status); - } finally { - this.deleteProject("P"); - } -} - -/** - * Should detect nested source folders on the classpath - */ -public void testClasspathValidation02() throws CoreException { - try { - IJavaScriptProject proj = this.createJavaProject("P", new String[] {"src"}); - IIncludePathEntry[] originalCP = proj.getRawIncludepath(); - - IIncludePathEntry[] newCP = new IIncludePathEntry[originalCP.length+1]; - System.arraycopy(originalCP, 0, newCP, 0, originalCP.length); - newCP[originalCP.length] = JavaScriptCore.newSourceEntry(new Path("/P")); - - IJavaScriptModelStatus status = JavaScriptConventions.validateClasspath(proj, newCP); - - assertStatus( - "should have detected nested source folders on the classpath", - "Cannot nest \'P/src\' inside \'P\'. To enable the nesting exclude \'src/\' from \'P\'", - status); - } finally { - this.deleteProject("P"); - } -} - -/** - * Should detect library folder nested inside source folder on the classpath - */ -public void testClasspathValidation03() throws CoreException { - try { - IJavaScriptProject proj = this.createJavaProject("P", new String[] {"src"}); - IIncludePathEntry[] originalCP = proj.getRawIncludepath(); - - IIncludePathEntry[] newCP = new IIncludePathEntry[originalCP.length+1]; - System.arraycopy(originalCP, 0, newCP, 0, originalCP.length); - newCP[originalCP.length] = JavaScriptCore.newLibraryEntry(new Path("/P/src/lib"), null, null); - - IJavaScriptModelStatus status = JavaScriptConventions.validateClasspath(proj, newCP); - - assertStatus( - "should have detected library folder nested inside source folder on the classpath", - "Cannot nest \'P/src/lib\' inside \'P/src\'. To enable the nesting exclude \'lib/\' from \'P/src\'", - status); - } finally { - this.deleteProject("P"); - } -} - -public void testClasspathValidation04() throws CoreException { - - IJavaScriptProject[] p = null; - try { - - p = new IJavaScriptProject[]{ - this.createJavaProject("P0", new String[] {"src0"}), - this.createJavaProject("P1", new String[] {"src1"}), - }; - - JavaScriptCore.setIncludepathVariable("var", new Path("/P1"), null); - - IIncludePathEntry[] newClasspath = new IIncludePathEntry[]{ - JavaScriptCore.newSourceEntry(new Path("/P0/src0")), - JavaScriptCore.newVariableEntry(new Path("var/src1"), null, null), - }; - - // validate classpath - IJavaScriptModelStatus status = JavaScriptConventions.validateClasspath(p[0], newClasspath); - assertStatus( - "should not detect external source folder through a variable on the classpath", - "OK", - status); - - } finally { - this.deleteProjects(new String[] {"P0", "P1"}); - } -} - -public void testClasspathValidation05() throws CoreException { - - IJavaScriptProject[] p = null; - try { - - p = new IJavaScriptProject[]{ - this.createJavaProject("P0", new String[] {"src0", "src1"}), - this.createJavaProject("P1", new String[] {"src1"}), - }; - - JavaScriptCore.setJsGlobalScopeContainer( - new Path("container/default"), - new IJavaScriptProject[]{ p[0] }, - new IJsGlobalScopeContainer[] { - new TestContainer(new Path("container/default"), - new IIncludePathEntry[]{ - JavaScriptCore.newSourceEntry(new Path("/P0/src0")), - JavaScriptCore.newVariableEntry(new Path("var/src1"), null, null) }) - }, - null); - - IIncludePathEntry[] newClasspath = new IIncludePathEntry[]{ - JavaScriptCore.newSourceEntry(new Path("/P0/src1")), - JavaScriptCore.newContainerEntry(new Path("container/default")), - }; - - // validate classpath - IJavaScriptModelStatus status = JavaScriptConventions.validateClasspath(p[0], newClasspath); - assertStatus( - "should not have detected external source folder through a container on the classpath", - "OK", - status); - - // validate classpath entry - status = JavaScriptConventions.validateClasspathEntry(p[0], newClasspath[1], true); - assertStatus( - "should have detected external source folder through a container on the classpath", - "Invalid classpath container: \'container/default\' in project P0", - status); - - } finally { - this.deleteProjects(new String[] {"P0", "P1"}); - } -} - -public void testClasspathValidation06() throws CoreException { - - IJavaScriptProject[] p = null; - try { - - p = new IJavaScriptProject[]{ - this.createJavaProject("P0", new String[] {"src"}), - }; - - // validate classpath entry - IIncludePathEntry[] newClasspath = new IIncludePathEntry[]{ - JavaScriptCore.newSourceEntry(new Path("/P0")), - JavaScriptCore.newSourceEntry(new Path("/P0/src")), - }; - - IJavaScriptModelStatus status = JavaScriptConventions.validateClasspath(p[0], newClasspath); - assertStatus( - "should have detected nested source folder", - "Cannot nest \'P0/src\' inside \'P0\'. To enable the nesting exclude \'src/\' from \'P0\'", - status); - } finally { - this.deleteProject("P0"); - } -} -/** - * Should allow nested source folders on the classpath as long as the outer - * folder excludes the inner one. - */ -public void testClasspathValidation07() throws CoreException { - try { - IJavaScriptProject proj = this.createJavaProject("P", new String[] {"src"}); - IIncludePathEntry[] originalCP = proj.getRawIncludepath(); - - IIncludePathEntry[] newCP = new IIncludePathEntry[originalCP.length+1]; - System.arraycopy(originalCP, 0, newCP, 0, originalCP.length); - newCP[originalCP.length] = JavaScriptCore.newSourceEntry(new Path("/P"), new IPath[] {new Path("src/")}); - - IJavaScriptModelStatus status = JavaScriptConventions.validateClasspath(proj, newCP); - - assertStatus( - "should have allowed nested source folders with exclusion on the classpath", - "OK", - status); - } finally { - this.deleteProject("P"); - } -} -/** - * Should allow a nested binary folder in a source folder on the classpath as - * long as the outer folder excludes the inner one. - */ -public void testClasspathValidation08() throws CoreException { - try { - IJavaScriptProject proj = this.createJavaProject("P", new String[] {}, new String[] {"lib"}); - IIncludePathEntry[] originalCP = proj.getRawIncludepath(); - - IIncludePathEntry[] newCP = new IIncludePathEntry[originalCP.length+1]; - System.arraycopy(originalCP, 0, newCP, 0, originalCP.length); - newCP[originalCP.length] = JavaScriptCore.newSourceEntry(new Path("/P"), new IPath[] {new Path("lib/")}); - - IJavaScriptModelStatus status = JavaScriptConventions.validateClasspath(proj, newCP); - - assertStatus( - "should have allowed nested lib folders with exclusion on the classpath", - "OK", - status); - } finally { - this.deleteProject("P"); - } -} -/** - * Should not allow nested source folders on the classpath if exclusion filter has no trailing slash. - */ -public void testClasspathValidation15() throws CoreException { - try { - IJavaScriptProject proj = this.createJavaProject("P", new String[] {"src"}); - IIncludePathEntry[] originalCP = proj.getRawIncludepath(); - - IIncludePathEntry[] newCP = new IIncludePathEntry[originalCP.length+1]; - System.arraycopy(originalCP, 0, newCP, 0, originalCP.length); - newCP[originalCP.length] = JavaScriptCore.newSourceEntry(new Path("/P"), new IPath[] {new Path("**/src")}); - - IJavaScriptModelStatus status = JavaScriptConventions.validateClasspath(proj, newCP); - - assertStatus( - "End exclusion filter \'src\' with / to fully exclude \'P/src\'", - status); - } finally { - this.deleteProject("P"); - } -} -/** - * Should detect source folder nested inside library folder on the classpath - */ -public void testClasspathValidation19() throws CoreException { - try { - IJavaScriptProject proj = this.createJavaProject("P", new String[] {}, new String[] {"lib"}); - IIncludePathEntry[] originalCP = proj.getRawIncludepath(); - - IIncludePathEntry[] newCP = new IIncludePathEntry[originalCP.length+1]; - System.arraycopy(originalCP, 0, newCP, 0, originalCP.length); - newCP[originalCP.length] = JavaScriptCore.newSourceEntry(new Path("/P/lib/src")); - - IJavaScriptModelStatus status = JavaScriptConventions.validateClasspath(proj, newCP); - - assertStatus( - "should have detected library folder nested inside source folder on the classpath", - "Cannot nest \'P/lib/src\' inside library \'P/lib\'", - status); - } finally { - this.deleteProject("P"); - } -} -/** - * Should not allow exclusion patterns if project preference disallow them - */ -public void testClasspathValidation21() throws CoreException { - try { - IJavaScriptProject proj = this.createJavaProject("P", new String[] {}); - IIncludePathEntry[] originalCP = proj.getRawIncludepath(); - - IIncludePathEntry[] newCP = new IIncludePathEntry[originalCP.length+1]; - System.arraycopy(originalCP, 0, newCP, 0, originalCP.length); - newCP[originalCP.length] = JavaScriptCore.newSourceEntry(new Path("/P/src"), new IPath[]{new Path("**/src")}, null); - - Map options = new Hashtable(5); - options.put(JavaScriptCore.CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS, JavaScriptCore.DISABLED); - proj.setOptions(options); - IJavaScriptModelStatus status = JavaScriptConventions.validateClasspath(proj, newCP); - - assertStatus( - "Inclusion or exclusion patterns are disabled in project P, cannot selectively include or exclude from entry: \'src\'", - status); - } finally { - this.deleteProject("P"); - } -} -/** - * @bug 159325: Any idea why ClasspathEntry checks for string object reference instead of equals - * @test Ensure that validation is correctly done even for other strings than JavaScriptCore constants... - * Note that it's needed to change JavaScriptCore options as "ignore" is the default value and set option - * to this value on java project will just remove it instead of putting another string object... - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=159325" - */ -public void testClasspathValidation27_Bug159325_project() throws CoreException { - Hashtable javaCoreOptions = JavaScriptCore.getOptions(); - try { - IJavaScriptProject proj1 = this.createJavaProject("P1", new String[] {}); - proj1.setOption(JavaScriptCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaScriptCore.VERSION_1_4); - - Hashtable options = JavaScriptCore.getOptions(); - options.put(JavaScriptCore.CORE_INCOMPATIBLE_JDK_LEVEL, JavaScriptCore.WARNING); - JavaScriptCore.setOptions(options); - IJavaScriptProject proj2 = this.createJavaProject("P2", new String[] {}); - proj2.setOption(JavaScriptCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaScriptCore.VERSION_1_1); - proj2.setOption(JavaScriptCore.CORE_INCOMPATIBLE_JDK_LEVEL, new String("ignore".toCharArray())); - - IJavaScriptModelStatus status = JavaScriptConventions.validateClasspathEntry(proj2, JavaScriptCore.newProjectEntry(new Path("/P1")), false); - assertStatus("OK", status); - } finally { - JavaScriptCore.setOptions(javaCoreOptions); - this.deleteProjects(new String[]{"P1", "P2"}); - } -} -public void testClasspathValidation27_Bug159325_lib() throws CoreException { - Hashtable javaCoreOptions = JavaScriptCore.getOptions(); - try { - IJavaScriptProject proj = this.createJavaProject("P1", new String[] {}); - proj.setOption(JavaScriptCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaScriptCore.VERSION_1_1); - - Hashtable options = JavaScriptCore.getOptions(); - options.put(JavaScriptCore.CORE_INCOMPATIBLE_JDK_LEVEL, JavaScriptCore.WARNING); - JavaScriptCore.setOptions(options); - proj.setOption(JavaScriptCore.CORE_INCOMPATIBLE_JDK_LEVEL, new String("ignore".toCharArray())); - - IIncludePathEntry library = JavaScriptCore.newLibraryEntry(new Path(getExternalJCLPathString(JavaScriptCore.VERSION_1_5)), null, null, ClasspathEntry.NO_ACCESS_RULES, null, false); - IJavaScriptModelStatus status = JavaScriptConventions.validateClasspathEntry(proj, library, false); - assertStatus("OK", status); - } finally { - JavaScriptCore.setOptions(javaCoreOptions); - this.deleteProjects(new String[]{"P1", "P2"}); - } -} -/** - * Should not allow nested source folders on the classpath if the outer - * folder includes the inner one. - */ -public void testClasspathValidation34() throws CoreException { - try { - IJavaScriptProject proj = this.createJavaProject("P", new String[] {"src"}); - IIncludePathEntry[] originalCP = proj.getRawIncludepath(); - - IIncludePathEntry[] newCP = new IIncludePathEntry[originalCP.length+1]; - System.arraycopy(originalCP, 0, newCP, 0, originalCP.length); - newCP[originalCP.length] = JavaScriptCore.newSourceEntry(new Path("/P"), new IPath[] {new Path("src/")}, new IPath[0], null); - - IJavaScriptModelStatus status = JavaScriptConventions.validateClasspath(proj, newCP); - - assertStatus( - "should not have allowed nested source folders with inclusion on the classpath", - "Cannot nest \'P/src\' inside \'P\'. To enable the nesting exclude \'src/\' from \'P\'", - status); - } finally { - this.deleteProject("P"); - } -} - -/** - * Should not allow a nested binary folder in a source folder on the classpath - * if the outer folder includes the inner one. - */ -public void testClasspathValidation35() throws CoreException { - try { - IJavaScriptProject proj = this.createJavaProject("P", new String[] {}, new String[] {"lib"}); - IIncludePathEntry[] originalCP = proj.getRawIncludepath(); - - IIncludePathEntry[] newCP = new IIncludePathEntry[originalCP.length+1]; - System.arraycopy(originalCP, 0, newCP, 0, originalCP.length); - newCP[originalCP.length] = JavaScriptCore.newSourceEntry(new Path("/P"), new IPath[] {new Path("lib/")}, new Path[0], null); - - IJavaScriptModelStatus status = JavaScriptConventions.validateClasspath(proj, newCP); - - assertStatus( - "should not have allowed nested lib folders with inclusion on the classpath", - "Cannot nest \'P/lib\' inside \'P\'. To enable the nesting exclude \'lib/\' from \'P\'", - status); - } finally { - this.deleteProject("P"); - } -} - -/** - * Should allow nested source folders on the classpath if inclusion filter has no trailing slash. - */ -public void testClasspathValidation36() throws CoreException { - try { - IJavaScriptProject proj = this.createJavaProject("P", new String[] {"src"}); - IIncludePathEntry[] originalCP = proj.getRawIncludepath(); - - IIncludePathEntry[] newCP = new IIncludePathEntry[originalCP.length+1]; - System.arraycopy(originalCP, 0, newCP, 0, originalCP.length); - newCP[originalCP.length] = JavaScriptCore.newSourceEntry(new Path("/P"), new IPath[] {new Path("**/src")}, new Path[0], null); - - IJavaScriptModelStatus status = JavaScriptConventions.validateClasspath(proj, newCP); - - assertStatus( - "OK", - status); - } finally { - this.deleteProject("P"); - } -} -/** - * Should not allow inclusion patterns if project preference disallow them - */ -public void testClasspathValidation37() throws CoreException { - try { - IJavaScriptProject proj = this.createJavaProject("P", new String[] {}); - IIncludePathEntry[] originalCP = proj.getRawIncludepath(); - - IIncludePathEntry[] newCP = new IIncludePathEntry[originalCP.length+1]; - System.arraycopy(originalCP, 0, newCP, 0, originalCP.length); - newCP[originalCP.length] = JavaScriptCore.newSourceEntry(new Path("/P/src"), new IPath[]{new Path("**/src")}, new Path[0], null); - - Map options = new Hashtable(5); - options.put(JavaScriptCore.CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS, JavaScriptCore.DISABLED); - proj.setOptions(options); - IJavaScriptModelStatus status = JavaScriptConventions.validateClasspath(proj, newCP); - - assertStatus( - "Inclusion or exclusion patterns are disabled in project P, cannot selectively include or exclude from entry: \'src\'", - status); - } finally { - this.deleteProject("P"); - } -} -/* - * Should detect nested source folders on the classpath and indicate the preference if disabled - * (regression test for bug 122615 validate classpath propose to exlude a source folder even though exlusion patterns are disabled) - */ -public void testClasspathValidation42() throws CoreException { - try { - IJavaScriptProject proj = this.createJavaProject("P", new String[] {"src"}); - proj.setOption(JavaScriptCore.CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS, JavaScriptCore.DISABLED); - IIncludePathEntry[] originalCP = proj.getRawIncludepath(); - - IIncludePathEntry[] newCP = new IIncludePathEntry[originalCP.length+1]; - System.arraycopy(originalCP, 0, newCP, 0, originalCP.length); - newCP[originalCP.length] = JavaScriptCore.newSourceEntry(new Path("/P")); - - IJavaScriptModelStatus status = JavaScriptConventions.validateClasspath(proj, newCP); - - assertStatus( - "should have detected nested source folders on the classpath", - "Cannot nest \'P/src\' inside \'P\'. To allow the nesting enable use of exclusion patterns in the preferences of project \'P\' and exclude \'src/\' from \'P\'", - status); - } finally { - this.deleteProject("P"); - } -} -/** - * Setting the classpath with two entries specifying the same path - * should fail. - */ -public void testClasspathWithDuplicateEntries() throws CoreException { - try { - IJavaScriptProject project = this.createJavaProject("P", new String[] {"src"}); - IIncludePathEntry[] cp= project.getRawIncludepath(); - IIncludePathEntry[] newCp= new IIncludePathEntry[cp.length *2]; - System.arraycopy(cp, 0, newCp, 0, cp.length); - System.arraycopy(cp, 0, newCp, cp.length, cp.length); - try { - project.setRawIncludepath(newCp, null); - } catch (JavaScriptModelException jme) { - return; - } - assertTrue("Setting the classpath with two entries specifying the same path should fail", false); - } finally { - this.deleteProject("P"); - } -} -/** - * Bug 94404: [model] Disallow classpath attributes with same key - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=94404" - */ -public void testClasspathDuplicateExtraAttribute() throws CoreException { - try { - IJavaScriptProject proj = this.createJavaProject("P1", new String[] {}); - IIncludePathAttribute[] extraAttributes = new IIncludePathAttribute[2]; - extraAttributes[0] = JavaScriptCore.newIncludepathAttribute("javadoc_location", "http://www.sample-url.org/doc/"); - extraAttributes[1] = JavaScriptCore.newIncludepathAttribute("javadoc_location", "d:/tmp"); - - // Verify container entry validation - IIncludePathEntry container = JavaScriptCore.newContainerEntry(new Path("JRE_CONTAINER"), ClasspathEntry.NO_ACCESS_RULES, extraAttributes, false); - IJavaScriptModelStatus status = JavaScriptConventions.validateClasspathEntry(proj, container, false); - assertStatus( - "Duplicate extra attribute: \'javadoc_location\' in classpath entry \'JRE_CONTAINER\' for project 'P1'", - status); - - // Verify library entry validation - IIncludePathEntry library = JavaScriptCore.newLibraryEntry(new Path(getSystemJsPathString()), null, null, ClasspathEntry.NO_ACCESS_RULES, extraAttributes, false); - status = JavaScriptConventions.validateClasspathEntry(proj, library, false); - assertStatus( - "Duplicate extra attribute: \'javadoc_location\' in classpath entry \'"+getExternalJCLPath("")+"\' for project 'P1'", - status); - - // Verify project entry validation - createJavaProject("P2"); - IIncludePathEntry projectEntry = JavaScriptCore.newProjectEntry(new Path("/P2"), ClasspathEntry.NO_ACCESS_RULES, false, extraAttributes, false); - status = JavaScriptConventions.validateClasspathEntry(proj, projectEntry, false); - assertStatus( - "Duplicate extra attribute: \'javadoc_location\' in classpath entry \'/P2\' for project 'P1'", - status); - - // Verify source entry validation - createFolder("/P1/src"); - IIncludePathEntry sourceEntry = JavaScriptCore.newSourceEntry(new Path("/P1/src"), new IPath[0], new IPath[0], null, extraAttributes); - status = JavaScriptConventions.validateClasspathEntry(proj, sourceEntry, false); - assertStatus( - "Duplicate extra attribute: \'javadoc_location\' in classpath entry \'src\' for project 'P1'", - status); - - // Verify variable entry validation - IIncludePathEntry variable = JavaScriptCore.newVariableEntry(new Path("JCL_LIB"), new Path("JCL_SRC"), null, ClasspathEntry.NO_ACCESS_RULES, extraAttributes, false); - status = JavaScriptConventions.validateClasspathEntry(proj, variable, false); - assertStatus( - "Duplicate extra attribute: \'javadoc_location\' in classpath entry \'"+getExternalJCLPath("")+"\' for project 'P1'", - status); - } finally { - this.deleteProject("P1"); - this.deleteProject("P2"); - } -} - -/** - * Adding an entry to the classpath for a library that does not exist - * should not break the model. The classpath should contain the - * entry, but the root should not appear in the children. - */ -public void testClasspathWithNonExistentLibraryEntry() throws CoreException { - try { - IJavaScriptProject project= this.createJavaProject("P", new String[] {"src"}); - IIncludePathEntry[] originalPath= project.getRawIncludepath(); - IPackageFragmentRoot[] originalRoots= project.getPackageFragmentRoots(); - - IIncludePathEntry[] newPath= new IIncludePathEntry[originalPath.length + 1]; - System.arraycopy(originalPath, 0, newPath, 0, originalPath.length); - - IIncludePathEntry newEntry= JavaScriptCore.newLibraryEntry(new Path("c:/nothing/nozip.jar").makeAbsolute(), null, null, false); - newPath[originalPath.length]= newEntry; - - project.setRawIncludepath(newPath, null); - - IIncludePathEntry[] getPath= project.getRawIncludepath(); - assertTrue("should be the same length", getPath.length == newPath.length); - for (int i= 0; i < getPath.length; i++) { - assertTrue("entries should be the same", getPath[i].equals(newPath[i])); - } - - IPackageFragmentRoot[] newRoots= project.getPackageFragmentRoots(); - assertTrue("Should be the same number of roots", originalRoots.length == newRoots.length); - for (int i= 0; i < newRoots.length; i++) { - assertTrue("roots should be the same", originalRoots[i].equals(newRoots[i])); - } - } finally { - this.deleteProject("P"); - } -} -/** - * Adding an entry to the classpath for a project that does not exist - * should not break the model. The classpath should contain the - * entry, but the root should not appear in the children. - */ -public void testClasspathWithNonExistentProjectEntry() throws CoreException { - try { - IJavaScriptProject project= this.createJavaProject("P", new String[] {"src"}); - IIncludePathEntry[] originalPath= project.getRawIncludepath(); - IPackageFragmentRoot[] originalRoots= project.getPackageFragmentRoots(); - - IIncludePathEntry[] newPath= new IIncludePathEntry[originalPath.length + 1]; - System.arraycopy(originalPath, 0, newPath, 0, originalPath.length); - - IIncludePathEntry newEntry= JavaScriptCore.newProjectEntry(new Path("/NoProject"), false); - newPath[originalPath.length]= newEntry; - - project.setRawIncludepath(newPath, null); - - IIncludePathEntry[] getPath= project.getRawIncludepath(); - assertTrue("should be the same length", getPath.length == newPath.length); - for (int i= 0; i < getPath.length; i++) { - assertTrue("entries should be the same", getPath[i].equals(newPath[i])); - } - - IPackageFragmentRoot[] newRoots= project.getPackageFragmentRoots(); - assertTrue("Should be the same number of roots", originalRoots.length == newRoots.length); - for (int i= 0; i < newRoots.length; i++) { - assertTrue("roots should be the same", originalRoots[i].equals(newRoots[i])); - } - } finally { - this.deleteProject("P"); - } -} -/** - * Adding an entry to the classpath for a folder that does not exist - * should not break the model. The classpath should contain the - * entry, but the root should not appear in the children. - */ -public void testClasspathWithNonExistentSourceEntry() throws CoreException { - try { - IJavaScriptProject project= this.createJavaProject("P", new String[] {"src"}); - IIncludePathEntry[] originalPath= project.getRawIncludepath(); - IPackageFragmentRoot[] originalRoots= project.getPackageFragmentRoots(); - - IIncludePathEntry[] newPath= new IIncludePathEntry[originalPath.length + 1]; - System.arraycopy(originalPath, 0, newPath, 0, originalPath.length); - - IIncludePathEntry newEntry= JavaScriptCore.newSourceEntry(new Path("/P/moreSource")); - newPath[originalPath.length]= newEntry; - - project.setRawIncludepath(newPath, null); - - IIncludePathEntry[] getPath= project.getRawIncludepath(); - assertTrue("should be the same length", getPath.length == newPath.length); - for (int i= 0; i < getPath.length; i++) { - assertTrue("entries should be the same", getPath[i].equals(newPath[i])); - } - - IPackageFragmentRoot[] newRoots= project.getPackageFragmentRoots(); - assertTrue("Should be the same number of roots", originalRoots.length == newRoots.length); - for (int i= 0; i < newRoots.length; i++) { - assertTrue("roots should be the same", originalRoots[i].equals(newRoots[i])); - } - } finally { - this.deleteProject("P"); - } -} - -/** - * Ensure that cycle are properly reported. - */ -public void testCycleReport() throws CoreException { - - try { - IJavaScriptProject p1 = this.createJavaProject("P1", new String[] {""}); - IJavaScriptProject p2 = this.createJavaProject("P2", new String[] {""}); - IJavaScriptProject p3 = this.createJavaProject("P3", new String[] {""}, new String[] {}, new String[] {"/P2"}); - - // Ensure no cycle reported - IJavaScriptProject[] projects = { p1, p2, p3 }; - int cycleMarkerCount = 0; - for (int i = 0; i < projects.length; i++){ - cycleMarkerCount += this.numberOfCycleMarkers(projects[i]); - } - assertTrue("Should have no cycle markers", cycleMarkerCount == 0); - - // Add cycle - IIncludePathEntry[] originalP1CP= p1.getRawIncludepath(); - IIncludePathEntry[] originalP2CP= p2.getRawIncludepath(); - - // Add P1 as a prerequesite of P2 - int length = originalP2CP.length; - IIncludePathEntry[] newCP= new IIncludePathEntry[length + 1]; - System.arraycopy(originalP2CP, 0 , newCP, 0, length); - newCP[length]= JavaScriptCore.newProjectEntry(p1.getProject().getFullPath(), false); - p2.setRawIncludepath(newCP, null); - - // Add P3 as a prerequesite of P1 - length = originalP1CP.length; - newCP= new IIncludePathEntry[length + 1]; - System.arraycopy(originalP1CP, 0 , newCP, 0, length); - newCP[length]= JavaScriptCore.newProjectEntry(p3.getProject().getFullPath(), false); - p1.setRawIncludepath(newCP, null); - - waitForAutoBuild(); // wait for cycle markers to be created - cycleMarkerCount = 0; - for (int i = 0; i < projects.length; i++){ - cycleMarkerCount += numberOfCycleMarkers(projects[i]); - } - assertEquals("Unexpected number of projects involved in a classpath cycle", 3, cycleMarkerCount); - - } finally { - // cleanup - deleteProjects(new String[] {"P1", "P2", "P3"}); - } -} -/** - * Ensures that the default classpath locations are correct. - * The default classpath should be the root of the project. - */ -public void testDefaultClasspathLocation() throws CoreException { - try { - IJavaScriptProject project = this.createJavaProject("P", new String[] {""}); - IIncludePathEntry[] classpath = project.getRawIncludepath(); - assertTrue("Incorrect default classpath; to many entries", classpath.length == 2); - assertTrue("Incorrect default classpath: " + classpath[0], classpath[0].getPath().equals(project.getUnderlyingResource().getFullPath())); - } finally { - this.deleteProject("P"); - } -} - -/** - * Setting the classpath to empty should result in no entries, - * and a delta with removed roots. - */ -public void testEmptyClasspath() throws CoreException { - IJavaScriptProject project = this.createJavaProject("P", new String[] {""}); - try { - startDeltas(); - setClasspath(project, new IIncludePathEntry[] {}); - IIncludePathEntry[] cp= project.getRawIncludepath(); - assertTrue("classpath should have no entries", cp.length == 0); - - // ensure the deltas are correct - assertDeltas( - "Unexpected delta", - "P[*]: {CHILDREN | CONTENT | CLASSPATH CHANGED}\n" + - " [*]: {REMOVED FROM CLASSPATH}\n" + - " D:\\WTPDevelopment\\junit-workspace\\.metadata\\.plugins\\org.eclipse.wst.jsdt.core\\libraries\\system.js[*]: {REORDERED}\n" + - " ResourceDelta(/P/.settings)[*]" - ); - } finally { - stopDeltas(); - this.deleteProject("P"); - } -} -/* - * Ensures that a source folder that contains character that must be encoded can be written. - * (regression test for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=70193) - */ -public void testEncoding() throws CoreException { - try { - createJavaProject("P", new String[] {"src\u3400"}); - IFile file = getFile("/P/.settings/.jsdtscope"); - String encodedContents = new String (org.eclipse.wst.jsdt.internal.core.util.Util.getResourceContentsAsCharArray(file, "UTF-8")); - encodedContents = Util.convertToIndependantLineDelimiter(encodedContents); - assertEquals( - "\n" + - "\n" + - " \n" + - " \n" + - " \n" + - "\n", - encodedContents); - } finally { - deleteProject("P"); - } -} -/* - * Ensures that a source classpath entry can be encoded and decoded. - */ -public void testEncodeDecodeEntry01() { - assertEncodeDecodeEntry( - "P", - "\n", - JavaScriptCore.newSourceEntry(new Path("/P/src")) - ); -} -/* - * Ensures that a source classpath entry with all possible attributes can be encoded and decoded. - */ -public void testEncodeDecodeEntry02() { - assertEncodeDecodeEntry( - "P", - "\n" + - " \n" + - " \n" + - " \n" + - "\n", - JavaScriptCore.newSourceEntry( - new Path("/P/src"), - new IPath[] {new Path("**/Y.js")}, - new IPath[] {new Path("**/X.js")}, - new Path("/P/bin"), - new IIncludePathAttribute[] {JavaScriptCore.newIncludepathAttribute("attrName", "some value")}) - ); -} -/* - * Ensures that a project classpath entry can be encoded and decoded. - */ -public void testEncodeDecodeEntry03() { - assertEncodeDecodeEntry( - "P1", - "\n", - JavaScriptCore.newProjectEntry(new Path("/P2")) - ); -} -/* - * Ensures that a library classpath entry can be encoded and decoded. - */ -public void testEncodeDecodeEntry04() { - assertEncodeDecodeEntry( - "P", - "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - "\n", - JavaScriptCore.newLibraryEntry( - new Path("/P/lib.jar"), - new Path("/P/src.zip"), - new Path("root"), - new IAccessRule[] {JavaScriptCore.newAccessRule(new Path("**/A*.js"), IAccessRule.K_ACCESSIBLE)}, - new IIncludePathAttribute[] {JavaScriptCore.newIncludepathAttribute("attr1", "val1")}, - true) - ); -} -/* - * Ensures that a library classpath entry can be encoded and decoded. - */ -public void testEncodeDecodeEntry05() { - assertEncodeDecodeEntry( - "P", - "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - "\n", - JavaScriptCore.newLibraryEntry( - new Path("/P/lib.jar"), - new Path("/P/src.zip"), - new Path("root"), - new IAccessRule[] {JavaScriptCore.newAccessRule(new Path("**/A*.js"), IAccessRule.K_ACCESSIBLE | IAccessRule.IGNORE_IF_BETTER)}, - new IIncludePathAttribute[] {JavaScriptCore.newIncludepathAttribute("attr1", "val1")}, - true) - ); -} -/** - * Ensures that adding an empty classpath container - * generates the correct deltas. - */ -public void testEmptyContainer() throws CoreException { - try { - IJavaScriptProject proj = createJavaProject("P", new String[] {}); - - startDeltas(); - - // create container - JavaScriptCore.setJsGlobalScopeContainer( - new Path("container/default"), - new IJavaScriptProject[]{ proj }, - new IJsGlobalScopeContainer[] { - new TestContainer( - new Path("container/default"), - new IIncludePathEntry[] {}) - }, - null); - - // set P's classpath with this container - IIncludePathEntry container = JavaScriptCore.newContainerEntry(new Path("container/default"), true); - proj.setRawIncludepath(new IIncludePathEntry[] {container}, null); - - assertDeltas( - "Unexpected delta", - "P[*]: {CONTENT | CLASSPATH CHANGED}\n" + - " D:\\WTPDevelopment\\junit-workspace\\.metadata\\.plugins\\org.eclipse.wst.jsdt.core\\libraries\\system.js[*]: {REORDERED}\n" + - " ResourceDelta(/P/.classpath)[*]" - ); - } finally { - stopDeltas(); - this.deleteProject("P"); - } -} -/* - * Ensure that a .classpath with an empty inclusion pattern is correctly handled - * (regression test for bug 105581 Creating a Java project from existing source fails because of "Unhandled event loop exception":) - */ -public void testEmptyInclusionPattern() throws CoreException { - try { - IJavaScriptProject project = createJavaProject("P", new String[] {""}); - project.open(null); - editFile( - "/P/.settings/.jsdtscope", - "\n" + - "\n" + - " \n" + - " \n" + - "" - ); - project.getProject().close(null); - project.getProject().open(null); - project.getPackageFragmentRoot(project.getProject()).open(null); - IIncludePathEntry[] classpath = project.getRawIncludepath(); - assertClasspathEquals( - classpath, - "/P[CPE_SOURCE][K_SOURCE][isExported:false][including:X.java]" - ); - } finally { - deleteProject("P"); - } -} -/** - * Exporting a container should make it visible to its dependent project. - * (regression test for bug 21749 Exported libraries and source folders) - */ -public void testExportContainer() throws CoreException { - try { - IJavaScriptProject p1 = this.createJavaProject("P1", new String[] {""}); - - // create container - JavaScriptCore.setJsGlobalScopeContainer( - new Path("container/default"), - new IJavaScriptProject[]{ p1 }, - new IJsGlobalScopeContainer[] { - new TestContainer( - new Path("container/default"), - new IIncludePathEntry[] { - JavaScriptCore.newLibraryEntry(getExternalJCLPath(""), null, null) - }) - }, - null); - - // set P1's classpath with this container - IIncludePathEntry container = JavaScriptCore.newContainerEntry(new Path("container/default"), true); - p1.setRawIncludepath(new IIncludePathEntry[] {container}, null); - - // create dependent project P2 - IJavaScriptProject p2 = this.createJavaProject("P2", new String[] {}, new String[] {}, new String[] {"/P1"}); - IIncludePathEntry[] classpath = ((JavaProject)p2).getExpandedClasspath(); - - // ensure container is exported to P2 - assertEquals("Unexpected number of classpath entries", 2, classpath.length); - assertEquals("Unexpected first entry", "/P1", classpath[0].getPath().toString()); - assertEquals("Unexpected second entry", getSystemJsPathString(), classpath[1].getPath().toOSString()); - } finally { - this.deleteProjects(new String[] {"P1", "P2"}); - } -} -/* - * Ensures that setting 0 extra classpath attributes generates the correct .classpath file. - */ -public void testExtraAttributes1() throws CoreException { - try { - IJavaScriptProject project = createJavaProject("P"); - IIncludePathEntry entry = JavaScriptCore.newSourceEntry(new Path("/P"), new IPath[0], new IPath[0], null, new IIncludePathAttribute[] {}); - project.setRawIncludepath(new IIncludePathEntry[] {entry}, null); - String contents = new String (org.eclipse.wst.jsdt.internal.core.util.Util.getResourceContentsAsCharArray(getFile("/P/.settings/.jsdtscope"))); - assertSourceEquals( - "Unexpected content", - "\n" + - "\n" + - " \n" + - " \n" + - "\n", - contents); - } finally { - deleteProject("P"); - } -} -/* - * Ensures that setting 1 extra classpath attributes generates the correct .classpath file. - */ -public void testExtraAttributes2() throws CoreException { - try { - IJavaScriptProject project = createJavaProject("P"); - IIncludePathAttribute attribute = JavaScriptCore.newIncludepathAttribute("foo", "some value"); - IIncludePathEntry entry = JavaScriptCore.newSourceEntry(new Path("/P"), new IPath[0], new IPath[0], null, new IIncludePathAttribute[] {attribute}); - project.setRawIncludepath(new IIncludePathEntry[] {entry}, null); - String contents = new String (org.eclipse.wst.jsdt.internal.core.util.Util.getResourceContentsAsCharArray(getFile("/P/.settings/.jsdtscope"))); - assertSourceEquals( - "Unexpected content", - "\n" + - "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - "\n", - contents); - } finally { - deleteProject("P"); - } -} -/* - * Ensures that setting 2 extra classpath attributes generates the correct .classpath file. - */ -public void testExtraAttributes3() throws CoreException { - try { - IJavaScriptProject project = createJavaProject("P"); - IIncludePathAttribute attribute1 = JavaScriptCore.newIncludepathAttribute("foo", "some value"); - IIncludePathAttribute attribute2 = JavaScriptCore.newIncludepathAttribute("bar", "other value"); - IIncludePathEntry entry = JavaScriptCore.newSourceEntry(new Path("/P"), new IPath[0], new IPath[0], null, new IIncludePathAttribute[] {attribute1, attribute2}); - project.setRawIncludepath(new IIncludePathEntry[] {entry}, null); - String contents = new String (org.eclipse.wst.jsdt.internal.core.util.Util.getResourceContentsAsCharArray(getFile("/P/.settings/.jsdtscope"))); - assertSourceEquals( - "Unexpected content", - "\n" + - "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - "\n", - contents); - } finally { - deleteProject("P"); - } -} -/* - * Ensures that extra classpath attributes in a .classpath file are correctly read. - */ -public void testExtraAttributes4() throws CoreException { - try { - IJavaScriptProject project = createJavaProject("P"); - editFile( - "/P/.settings/.jsdtscope", - "\n" + - "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - "\n" - ); - assertClasspathEquals( - project.getRawIncludepath(), - "/P[CPE_SOURCE][K_SOURCE][isExported:false][attributes:foo=some value]" - ); - } finally { - deleteProject("P"); - } -} -/** - * Test IJavaScriptProject.hasClasspathCycle(IIncludePathEntry[]). - */ -public void testHasClasspathCycle() throws CoreException { - try { - IJavaScriptProject p1 = this.createJavaProject("P1", new String[] {""}); - IJavaScriptProject p2 = this.createJavaProject("P2", new String[] {""}); - this.createJavaProject("P3", new String[] {""}, new String[] {}, new String[] {"/P1"}); - - IIncludePathEntry[] originalP1CP= p1.getRawIncludepath(); - IIncludePathEntry[] originalP2CP= p2.getRawIncludepath(); - - // Ensure no cycle reported - assertTrue("P1 should not have a cycle", !p1.hasIncludepathCycle(originalP1CP)); - - // Ensure that adding NervousTest as a prerequesite of P2 doesn't report a cycle - int length = originalP2CP.length; - IIncludePathEntry[] newCP= new IIncludePathEntry[length + 1]; - System.arraycopy(originalP2CP, 0 , newCP, 0, length); - newCP[length]= JavaScriptCore.newProjectEntry(p1.getProject().getFullPath(), false); - assertTrue("P2 should not have a cycle", !p2.hasIncludepathCycle(newCP)); - p2.setRawIncludepath(newCP, null); - - // Ensure that adding P3 as a prerequesite of P1 reports a cycle - length = originalP1CP.length; - newCP= new IIncludePathEntry[length + 1]; - System.arraycopy(originalP1CP, 0 , newCP, 0, length); - newCP[length]= JavaScriptCore.newProjectEntry(p2.getProject().getFullPath(), false); - assertTrue("P3 should have a cycle", p2.hasIncludepathCycle(newCP)); - - // Ensure a cycle is not reported through markers - IWorkspace workspace = getJavaModel().getWorkspace(); - IMarker[] markers = workspace.getRoot().findMarkers(IJavaScriptModelMarker.TRANSIENT_PROBLEM, true, 1); - boolean hasCycleMarker = false; - for (int i = 0; i < markers.length; i++){ - if (markers[i].getAttribute(IJavaScriptModelMarker.CYCLE_DETECTED) != null) { - hasCycleMarker = true; - break; - } - } - assertTrue("Should have no cycle markers", !hasCycleMarker); - - } finally { - // cleanup - this.deleteProjects(new String[] {"P1", "P2", "P3"}); - } -} -/** - * Ensures that a marker is created if editing the .classpath results in an invalid classpath. - */ -public void testInvalidClasspath1() throws CoreException { - try { - IJavaScriptProject project = this.createJavaProject("P", new String[] {"src"}); - this.editFile( - "/P/.settings/.jsdtscope", - "\n" + - "\n" + - " - " \n" + - "" - ); - assertMarkers( - "Unexpected markers", - "XML format error in \'.classpath\' file of project P: Bad format", - project); - } finally { - this.deleteProject("P"); - } -} -/** - * Ensures that a marker is created if editing the .classpath results in an invalid classpath. - */ -public void testInvalidClasspath2() throws CoreException { - try { - IJavaScriptProject javaProject = this.createJavaProject("P", new String[] {"src"}); - this.editFile( - "/P/.settings/.jsdtscope", - "\n" + - "\n" + - " \n" + // invalid kind: src1 - " \n" + - "" - ); - assertMarkers( - "Unexpected markers", - "Illegal entry in \'.classpath\' of project P file: Unknown kind: \'src1\'", - javaProject); - - // Verify that error marker is not removed after build - // (regression test for bug 42366: Classpath validation error message removed while rebuilding a project.) - IProject project = javaProject.getProject(); - project.build(IncrementalProjectBuilder.FULL_BUILD, null); - waitForAutoBuild(); - assertMarkers( - "Unexpected markers", - "Illegal entry in \'.classpath\' of project P file: Unknown kind: \'src1\'", - javaProject); - } finally { - this.deleteProject("P"); - } -} - -/* - * Ensures that a non existing source folder cannot be put on the classpath. - * (regression test for bug 66512 Invalid classpath entry not rejected) - */ -public void testInvalidSourceFolder() throws CoreException { - try { - createJavaProject("P1"); - IJavaScriptProject proj = createJavaProject("P2", new String[] {}, new String[] {}, new String[] {"/P1/src1/src2"}); - assertMarkers( - "Unexpected markers", - "Project P2 is missing required source folder: \'/P1/src1/src2\'", - proj); - } finally { - deleteProject("P1"); - deleteProject("P2"); - } -} -/** - * Ensures that only one marker is created if building a project that is - * missing its .classpath file multiple times. - * (regression test for bug 39877 Rebuild All generates extra "Unable to read classpath" entry.) - */ -public void testMissingClasspath() throws CoreException { - try { - IJavaScriptProject javaProject = createJavaProject("P"); - IProject project = javaProject.getProject(); - project.close(null); - deleteFile(new File(project.getLocation().toOSString(), ".settings/.jsdtscope")); - waitForAutoBuild(); - project.open(null); - waitForAutoBuild(); - project.build(IncrementalProjectBuilder.FULL_BUILD, null); - waitForAutoBuild(); - project.build(IncrementalProjectBuilder.FULL_BUILD, null); - waitForAutoBuild(); - assertMarkers( - "Unexpected markers", - "Unable to read \'.jsdtscope\' file of project P", - javaProject); - } finally { - this.deleteProject("P"); - } -} -/** - * Test that a marker is added when a project as a missing project in its classpath. - */ -public void testMissingPrereq1() throws CoreException { - try { - IJavaScriptProject javaProject = this.createJavaProject("A", new String[] {}); - IIncludePathEntry[] classpath = - new IIncludePathEntry[] { - JavaScriptCore.newProjectEntry(new Path("/B")) - }; - javaProject.setRawIncludepath(classpath, null); - this.assertMarkers( - "Unexpected markers", - "Project A is missing required Java project: \'B\'", - javaProject); - } finally { - this.deleteProject("A"); - } -} -/** - * Test that a marker is added when a project as a missing project in its classpath. - */ -public void testMissingPrereq2() throws CoreException { - try { - IJavaScriptProject javaProject = - this.createJavaProject( - "A", - new String[] {}, // source folders - new String[] {}, // lib folders - new String[] {"/B"}); - this.assertMarkers( - "Unexpected markers", - "Project A is missing required Java project: \'B\'", - javaProject); - } finally { - this.deleteProject("A"); - } -} -/** - * Test that a marker indicating a missing project is removed when the project is added. - */ -public void testMissingPrereq3() throws CoreException { - try { - IJavaScriptProject javaProject = - this.createJavaProject( - "A", - new String[] {}, // source folders - new String[] {}, // lib folders - new String[] {"/B"}); - this.createJavaProject("B", new String[] {}); - this.assertMarkers("Unexpected markers", "", javaProject); - } finally { - this.deleteProjects(new String[] {"A", "B"}); - } -} -/** - * Test that a marker indicating a cycle is removed when a project in the cycle is deleted - * and replaced with a missing prereq marker. - * (regression test for bug 15168 circular errors not reported) - */ -public void testMissingPrereq4() throws CoreException { - try { - IJavaScriptProject projectA = - this.createJavaProject( - "A", - new String[] {}, // source folders - new String[] {}, // lib folders - new String[] {"/B"}); - IJavaScriptProject projectB = - this.createJavaProject( - "B", - new String[] {}, // source folders - new String[] {}, // lib folders - new String[] {"/A"}); - this.assertMarkers( - "Unexpected markers for project A", - "A cycle was detected in the include path of project: A", - projectA); - this.assertMarkers( - "Unexpected markers for project B", - "A cycle was detected in the include path of project: B", - projectB); - - // delete project B - this.deleteProject("B"); - this.assertMarkers( - "Unexpected markers for project A after deleting of project B", - "Project A is missing required Java project: \'B\'", - projectA); - - // add project B back - projectB = - this.createJavaProject( - "B", - new String[] {}, // source folders - new String[] {}, // lib folders - new String[] {"/A"}); - this.assertMarkers( - "Unexpected markers for project A after adding project B back", - "A cycle was detected in the build path of project: A", - projectA); - this.assertMarkers( - "Unexpected markers for project B after adding project B back", - "A cycle was detected in the build path of project: B", - projectB); - - } finally { - this.deleteProjects(new String[] {"A", "B"}); - } -} -/** - * Setting the classpath to null should be the same as using the - * default classpath. - */ -public void testNullClasspath() throws CoreException { - try { - IJavaScriptProject project = this.createJavaProject("P", new String[] {""}); - setClasspath(project, null); - IIncludePathEntry[] cp= project.getRawIncludepath(); - assertTrue("classpath should have one root entry", cp.length == 1 && cp[0].getPath().equals(project.getUnderlyingResource().getFullPath())); - } finally { - this.deleteProject("P"); - } -} - -/* - * Ensures that setting the 'combineAccessRules' flag to false on a project entry generates the correct .classpath file. - */ -public void testCombineAccessRules1() throws CoreException { - try { - createJavaProject("P1"); - IJavaScriptProject project = createJavaProject("P2"); - IIncludePathEntry entry = JavaScriptCore.newProjectEntry(new Path("/P1"), (IAccessRule[]) null, false/*don't combine*/, new IIncludePathAttribute[] {}, false); - project.setRawIncludepath(new IIncludePathEntry[] {entry}, null); - String contents = new String (org.eclipse.wst.jsdt.internal.core.util.Util.getResourceContentsAsCharArray(getFile("/P2/.settings/.jsdtscope"))); - assertSourceEquals( - "Unexpected content", - "\n" + - "\n" + - " \n" + - " \n" + - "\n", - contents); - } finally { - deleteProject("P1"); - deleteProject("P2"); - } -} - -/* - * Ensures that setting the 'combineAccessRules' flag to true on a project entry generates the correct .classpath file. - */ -public void testCombineAccessRules2() throws CoreException { - try { - createJavaProject("P1"); - IJavaScriptProject project = createJavaProject("P2"); - IIncludePathEntry entry = JavaScriptCore.newProjectEntry(new Path("/P1"), (IAccessRule[]) null, true/*combine*/, new IIncludePathAttribute[] {}, false); - project.setRawIncludepath(new IIncludePathEntry[] {entry}, null); - String contents = new String (org.eclipse.wst.jsdt.internal.core.util.Util.getResourceContentsAsCharArray(getFile("/P2/.settings/.jsdtscope"))); - assertSourceEquals( - "Unexpected content", - "\n" + - "\n" + - " \n" + - " \n" + - "\n", - contents); - } finally { - deleteProject("P1"); - deleteProject("P2"); - } -} - -/* - * Ensures that 'combineAccessRules' flag in a .classpath file is correctly read. - */ -public void testCombineAccessRules3() throws CoreException { - try { - IJavaScriptProject project = createJavaProject("P2"); - editFile( - "/P2/.settings/.jsdtscope", - "\n" + - "\n" + - " \n" + - " \n" + - "\n" - ); - assertClasspathEquals( - project.getRawIncludepath(), - "/P1[CPE_PROJECT][K_SOURCE][isExported:false][combine access rules:false]" - ); - } finally { - deleteProject("P2"); - } -} - -/* - * Ensures that the absence of 'combineAccessRules' flag in a .classpath file is correctly handled. - */ -public void testCombineAccessRules4() throws CoreException { - try { - IJavaScriptProject project = createJavaProject("P2"); - editFile( - "/P2/.settings/.jsdtscope", - "\n" + - "\n" + - " \n" + - " \n" + - "\n" - ); - assertClasspathEquals( - project.getRawIncludepath(), - "/P1[CPE_PROJECT][K_SOURCE][isExported:false][combine access rules:true]" - ); - } finally { - deleteProject("P2"); - } -} - -/* - * Ensures that the absence of 'combineAccessRules' flag in a .classpath file is correctly handled. - */ -public void testCombineAccessRules5() throws CoreException { - try { - IJavaScriptProject project = createJavaProject("P2"); - editFile( - "/P2/.settings/.jsdtscope", - "\n" + - "\n" + - " \n" + - " \n" + - "\n" - ); - assertClasspathEquals( - project.getRawIncludepath(), - "/P2/src[CPE_SOURCE][K_SOURCE][isExported:false]" - ); - } finally { - deleteProject("P2"); - } -} - -public void testCycleDetection() throws CoreException { - - int max = 5; - IJavaScriptProject[] p = new IJavaScriptProject[max]; - String[] projectNames = new String[max]; - try { - for (int i = 0; i < max; i++) { - projectNames[i] = "P"+i; - p[i] = this.createJavaProject(projectNames[i], new String[] {""}); - } - - IIncludePathEntry[][] extraEntries = new IIncludePathEntry[][]{ - { JavaScriptCore.newProjectEntry(p[1].getPath()), JavaScriptCore.newProjectEntry(p[3].getPath()) }, - { JavaScriptCore.newProjectEntry(p[2].getPath()), JavaScriptCore.newProjectEntry(p[3].getPath()) }, - { JavaScriptCore.newProjectEntry(p[1].getPath()) }, - { JavaScriptCore.newProjectEntry(p[4].getPath())}, - { JavaScriptCore.newProjectEntry(p[3].getPath()), JavaScriptCore.newProjectEntry(p[0].getPath()) } - }; - - int[][] expectedCycleParticipants = new int[][] { - { 0, 0, 0, 0, 0 }, // after setting CP p[0] - { 0, 0, 0, 0, 0 }, // after setting CP p[1] - { 0, 1, 1, 0, 0 }, // after setting CP p[2] - { 0, 1, 1, 0, 0 }, // after setting CP p[3] - { 1, 1, 1, 1, 1 }, // after setting CP p[4] - }; - - for (int i = 0; i < p.length; i++){ - - // append project references - IIncludePathEntry[] oldClasspath = p[i].getRawIncludepath(); - IIncludePathEntry[] newClasspath = new IIncludePathEntry[oldClasspath.length+extraEntries[i].length]; - System.arraycopy(oldClasspath, 0 , newClasspath, 0, oldClasspath.length); - for (int j = 0; j < extraEntries[i].length; j++){ - newClasspath[oldClasspath.length+j] = extraEntries[i][j]; - } - // set classpath - p[i].setRawIncludepath(newClasspath, null); - - // check cycle markers - this.assertCycleMarkers(p[i], p, expectedCycleParticipants[i]); - } - //this.startDeltas(); - - } finally { - this.deleteProjects(projectNames); - } -} - -public void testCycleDetectionThroughContainers() throws CoreException { - - int max = 5; - IJavaScriptProject[] p = new IJavaScriptProject[max]; - String[] projectNames = new String[max]; - try { - for (int i = 0; i < max; i++) { - projectNames[i] = "P"+i; - p[i] = this.createJavaProject(projectNames[i], new String[] {""}); - } - - IJsGlobalScopeContainer[] containers = new IJsGlobalScopeContainer[]{ - new TestContainer( - new Path("container0/default"), - new IIncludePathEntry[]{ JavaScriptCore.newProjectEntry(p[3].getPath()) }), - new TestContainer( - new Path("container1/default"), - new IIncludePathEntry[]{ JavaScriptCore.newProjectEntry(p[1].getPath()) }), - new TestContainer( - new Path("container2/default"), - new IIncludePathEntry[]{ JavaScriptCore.newProjectEntry(p[4].getPath()) }), - }; - - IIncludePathEntry[][] extraEntries = new IIncludePathEntry[][]{ - { JavaScriptCore.newProjectEntry(p[1].getPath()), JavaScriptCore.newContainerEntry(containers[0].getPath()) }, - { JavaScriptCore.newProjectEntry(p[2].getPath()), JavaScriptCore.newProjectEntry(p[3].getPath()) }, - { JavaScriptCore.newContainerEntry(containers[1].getPath()) }, - { JavaScriptCore.newContainerEntry(containers[2].getPath())}, - { JavaScriptCore.newProjectEntry(p[3].getPath()), JavaScriptCore.newProjectEntry(p[0].getPath()) } - }; - - int[][] expectedCycleParticipants = new int[][] { - { 0, 0, 0, 0, 0 }, // after setting CP p[0] - { 0, 0, 0, 0, 0 }, // after setting CP p[1] - { 0, 0, 0, 0, 0 }, // after setting CP p[2] - { 0, 0, 0, 0, 0 }, // after setting CP p[3] - { 1, 1, 1, 1, 1 }, // after setting CP p[4] - }; - - for (int i = 0; i < p.length; i++){ - - // append project references - IIncludePathEntry[] oldClasspath = p[i].getRawIncludepath(); - IIncludePathEntry[] newClasspath = new IIncludePathEntry[oldClasspath.length+extraEntries[i].length]; - System.arraycopy(oldClasspath, 0 , newClasspath, 0, oldClasspath.length); - for (int j = 0; j < extraEntries[i].length; j++){ - newClasspath[oldClasspath.length+j] = extraEntries[i][j]; - } - // set classpath - p[i].setRawIncludepath(newClasspath, null); - - // update container paths - if (i == p.length - 1){ - JavaScriptCore.setJsGlobalScopeContainer( - containers[0].getPath(), - new IJavaScriptProject[]{ p[0] }, - new IJsGlobalScopeContainer[] { containers[0] }, - null); - - JavaScriptCore.setJsGlobalScopeContainer( - containers[1].getPath(), - new IJavaScriptProject[]{ p[2] }, - new IJsGlobalScopeContainer[] { containers[1] }, - null); - - JavaScriptCore.setJsGlobalScopeContainer( - containers[2].getPath(), - new IJavaScriptProject[]{ p[3] }, - new IJsGlobalScopeContainer[] { containers[2] }, - null); - } - - // check cycle markers - this.assertCycleMarkers(p[i], p, expectedCycleParticipants[i]); - } - //this.startDeltas(); - - } finally { - //this.stopDeltas(); - this.deleteProjects(projectNames); - } -} -public void testCycleDetectionThroughContainerVariants() throws CoreException { - - int max = 5; - IJavaScriptProject[] p = new IJavaScriptProject[max]; - String[] projectNames = new String[max]; - try { - for (int i = 0; i < max; i++) { - projectNames[i] = "P"+i; - p[i] = this.createJavaProject(projectNames[i], new String[] {""}); - } - - class LocalTestContainer implements IJsGlobalScopeContainer { - IPath path; - IIncludePathEntry[] entries; - LocalTestContainer(IPath path, IIncludePathEntry[] entries){ - this.path = path; - this.entries = entries; - } - public IPath getPath() { return this.path; } - /** - * @deprecated Use {@link #getIncludepathEntries()} instead - */ - public IIncludePathEntry[] getClasspathEntries() { - return getIncludepathEntries(); - } - public IIncludePathEntry[] getIncludepathEntries() { return this.entries; } - public String getDescription() { return null; } - public int getKind() { return 0; } - /* (non-Javadoc) - * @see org.eclipse.wst.jsdt.core.IJsGlobalScopeContainer#resolvedLibraryImport(java.lang.String) - */ - public String[] resolvedLibraryImport(String a) { - return new String[] {a}; - } - } - - IJsGlobalScopeContainer[] containers = new IJsGlobalScopeContainer[]{ - new LocalTestContainer( - new Path("container0/default"), - new IIncludePathEntry[]{ JavaScriptCore.newProjectEntry(p[3].getPath()) }), - new LocalTestContainer( - new Path("container0/default"), - new IIncludePathEntry[]{ JavaScriptCore.newProjectEntry(p[1].getPath()) }), - new LocalTestContainer( - new Path("container0/default"), - new IIncludePathEntry[]{ JavaScriptCore.newProjectEntry(p[4].getPath()) }), - }; - - IIncludePathEntry[][] extraEntries = new IIncludePathEntry[][]{ - { JavaScriptCore.newProjectEntry(p[1].getPath()), JavaScriptCore.newContainerEntry(containers[0].getPath()) }, - { JavaScriptCore.newProjectEntry(p[2].getPath()), JavaScriptCore.newProjectEntry(p[3].getPath()) }, - { JavaScriptCore.newContainerEntry(containers[1].getPath()) }, - { JavaScriptCore.newContainerEntry(containers[2].getPath())}, - { JavaScriptCore.newProjectEntry(p[3].getPath()), JavaScriptCore.newProjectEntry(p[0].getPath()) } - }; - - int[][] expectedCycleParticipants = new int[][] { - { 0, 0, 0, 0, 0 }, // after setting CP p[0] - { 0, 0, 0, 0, 0 }, // after setting CP p[1] - { 0, 0, 0, 0, 0 }, // after setting CP p[2] - { 0, 0, 0, 0, 0 }, // after setting CP p[3] - { 1, 1, 1, 1, 1 }, // after setting CP p[4] - }; - - for (int i = 0; i < p.length; i++){ - - // append project references - IIncludePathEntry[] oldClasspath = p[i].getRawIncludepath(); - IIncludePathEntry[] newClasspath = new IIncludePathEntry[oldClasspath.length+extraEntries[i].length]; - System.arraycopy(oldClasspath, 0 , newClasspath, 0, oldClasspath.length); - for (int j = 0; j < extraEntries[i].length; j++){ - newClasspath[oldClasspath.length+j] = extraEntries[i][j]; - } - // set classpath - p[i].setRawIncludepath(newClasspath, null); - - // update same container path for multiple projects - if (i == p.length - 1){ - JavaScriptCore.setJsGlobalScopeContainer( - containers[0].getPath(), - new IJavaScriptProject[]{ p[0], p[2], p[3] }, - new IJsGlobalScopeContainer[] { containers[0], containers[1], containers[2] }, - null); - } - - // check cycle markers - this.assertCycleMarkers(p[i], p, expectedCycleParticipants[i]); - } - //this.startDeltas(); - - } finally { - //this.stopDeltas(); - this.deleteProjects(projectNames); - } -} -public void testCycleDetection2() throws CoreException { - - int max = 5; - IJavaScriptProject[] p = new IJavaScriptProject[max]; - String[] projectNames = new String[max]; - try { - for (int i = 0; i < max; i++) { - projectNames[i] = "P"+i; - p[i] = this.createJavaProject(projectNames[i], new String[] {""}); - } - - IIncludePathEntry[][] extraEntries = new IIncludePathEntry[][]{ - { JavaScriptCore.newProjectEntry(p[1].getPath()), JavaScriptCore.newProjectEntry(p[3].getPath()) }, - { JavaScriptCore.newProjectEntry(p[2].getPath()) }, - { JavaScriptCore.newProjectEntry(p[0].getPath()) }, - { JavaScriptCore.newProjectEntry(p[4].getPath())}, - { JavaScriptCore.newProjectEntry(p[0].getPath()) } - }; - - int[][] expectedCycleParticipants = new int[][] { - { 0, 0, 0, 0, 0 }, // after setting CP p[0] - { 0, 0, 0, 0, 0 }, // after setting CP p[1] - { 1, 1, 1, 0, 0 }, // after setting CP p[2] - { 1, 1, 1, 0, 0 }, // after setting CP p[3] - { 1, 1, 1, 1, 1 }, // after setting CP p[4] - }; - - for (int i = 0; i < p.length; i++){ - - // append project references - IIncludePathEntry[] oldClasspath = p[i].getRawIncludepath(); - IIncludePathEntry[] newClasspath = new IIncludePathEntry[oldClasspath.length+extraEntries[i].length]; - System.arraycopy(oldClasspath, 0 , newClasspath, 0, oldClasspath.length); - for (int j = 0; j < extraEntries[i].length; j++){ - newClasspath[oldClasspath.length+j] = extraEntries[i][j]; - } - // set classpath - p[i].setRawIncludepath(newClasspath, null); - - // check cycle markers - this.assertCycleMarkers(p[i], p, expectedCycleParticipants[i]); - } - //this.startDeltas(); - - } finally { - //this.stopDeltas(); - this.deleteProjects(projectNames); - } -} - -public void testCycleDetection3() throws CoreException { - - int max = 6; - IJavaScriptProject[] p = new IJavaScriptProject[max]; - String[] projectNames = new String[max]; - try { - for (int i = 0; i < max; i++) { - projectNames[i] = "P"+i; - p[i] = this.createJavaProject(projectNames[i], new String[] {""}); - } - - IIncludePathEntry[][] extraEntries = new IIncludePathEntry[][]{ - { JavaScriptCore.newProjectEntry(p[2].getPath()), JavaScriptCore.newProjectEntry(p[4].getPath()) }, - { JavaScriptCore.newProjectEntry(p[0].getPath()) }, - { JavaScriptCore.newProjectEntry(p[3].getPath()) }, - { JavaScriptCore.newProjectEntry(p[1].getPath())}, - { JavaScriptCore.newProjectEntry(p[5].getPath()) }, - { JavaScriptCore.newProjectEntry(p[1].getPath()) } - }; - - int[][] expectedCycleParticipants = new int[][] { - { 0, 0, 0, 0, 0, 0 }, // after setting CP p[0] - { 0, 0, 0, 0, 0, 0 }, // after setting CP p[1] - { 0, 0, 0, 0, 0, 0 }, // after setting CP p[2] - { 1, 1, 1, 1, 0, 0 }, // after setting CP p[3] - { 1, 1, 1, 1, 0, 0 }, // after setting CP p[4] - { 1, 1, 1, 1, 1 , 1}, // after setting CP p[5] - }; - - for (int i = 0; i < p.length; i++){ - - // append project references - IIncludePathEntry[] oldClasspath = p[i].getRawIncludepath(); - IIncludePathEntry[] newClasspath = new IIncludePathEntry[oldClasspath.length+extraEntries[i].length]; - System.arraycopy(oldClasspath, 0 , newClasspath, 0, oldClasspath.length); - for (int j = 0; j < extraEntries[i].length; j++){ - newClasspath[oldClasspath.length+j] = extraEntries[i][j]; - } - // set classpath - p[i].setRawIncludepath(newClasspath, null); - - // check cycle markers - this.assertCycleMarkers(p[i], p, expectedCycleParticipants[i]); - } - //this.startDeltas(); - - } finally { - //this.stopDeltas(); - this.deleteProjects(projectNames); - } -} -/* - * Ensures that a cycle is detected if introduced during a post-change event. - * (regression test for bug 113051 No classpath marker produced when cycle through PDE container) - */ -public void testCycleDetection4() throws CoreException { - IResourceChangeListener listener = new IResourceChangeListener() { - boolean containerNeedUpdate = true; - public void resourceChanged(IResourceChangeEvent event) { - if (containerNeedUpdate) { - TestContainer container = new TestContainer( - new Path("org.eclipse.wst.jsdt.core.tests.model.container/default"), - new IIncludePathEntry[] { JavaScriptCore.newProjectEntry(new Path("/P1")) }); - try { - JavaScriptCore.setJsGlobalScopeContainer(container.getPath(), new IJavaScriptProject[] {getJavaProject("P2")}, new IJsGlobalScopeContainer[] {container}, null); - } catch (JavaScriptModelException e) { - e.printStackTrace(); - } - containerNeedUpdate = false; - } - } - }; - try { - IJavaScriptProject p1 = createJavaProject("P1", new String[] {}, new String[] {}, new String[] {"/P2"}); - TestContainer container = new TestContainer( - new Path("org.eclipse.wst.jsdt.core.tests.model.container/default"), - new IIncludePathEntry[] {}); - IJavaScriptProject p2 = createJavaProject("P2", new String[] {}, new String[] {container.getPath().toString()}); - JavaScriptCore.setJsGlobalScopeContainer(container.getPath(), new IJavaScriptProject[] {p2}, new IJsGlobalScopeContainer[] {container}, null); - waitForAutoBuild(); - getWorkspace().addResourceChangeListener(listener, IResourceChangeEvent.POST_CHANGE); - createFile("/P1/test.txt", ""); - assertCycleMarkers(p1, new IJavaScriptProject[] {p1, p2}, new int[] {1, 1}); - } finally { - getWorkspace().removeResourceChangeListener(listener); - deleteProjects(new String[] {"P1", "P2"}); - } -} -public void testPerfDenseCycleDetection1() throws CoreException { - // each project prereqs all other projects - denseCycleDetection(5); -} -public void testPerfDenseCycleDetection2() throws CoreException { - // each project prereqs all other projects - denseCycleDetection(10); -} -public void testPerfDenseCycleDetection3() throws CoreException { - // each project prereqs all other projects - denseCycleDetection(20); -} -/* - * Create projects and set classpaths in one batch - */ -public void testNoCycleDetection1() throws CoreException { - - // each project prereqs all the previous ones - noCycleDetection(5, false, false); - noCycleDetection(10, false, false); - noCycleDetection(20, false, false); - - // each project prereqs all the next ones - noCycleDetection(5, true, false); - noCycleDetection(10, true, false); - noCycleDetection(20, true, false); -} -/* - * Create projects first, then set classpaths - */ -public void testNoCycleDetection2() throws CoreException { - - // each project prereqs all the previous ones - noCycleDetection(5, false, true); - noCycleDetection(10, false, true); - noCycleDetection(20, false, true); - - // each project prereqs all the next ones - noCycleDetection(5, true, true); - noCycleDetection(10, true, true); - noCycleDetection(20, true, true); -} -/* - * Ensures that the .classpath file is not written to disk when setting the raw classpath with no resource change. - */ -public void testNoResourceChange01() throws CoreException { - try { - IJavaScriptProject project = createJavaProject("P", new String[] {"src1"}); - IIncludePathEntry[] newClasspath = createClasspath("P", new String[] {"/P/src2", ""}); - project.setRawIncludepath(newClasspath, false/*cannot modify resources*/, null/*no progress*/); - String contents = new String (org.eclipse.wst.jsdt.internal.core.util.Util.getResourceContentsAsCharArray(getFile("/P/.settings/.jsdtscope"))); - assertSourceEquals( - "Unexpected content", - "\n" + - "\n" + - " \n" + - " \n" + - " \n" + - "\n", - contents); - } finally { - deleteProject("P"); - } -} -/* - * Ensures that the in-memory classpath is correct when setting the raw classpath with no resource change. - */ -public void testNoResourceChange02() throws CoreException { - try { - IJavaScriptProject project = createJavaProject("P", new String[] {"src1"}); - IIncludePathEntry[] newClasspath = createClasspath("P", new String[] {"/P/src2", ""}); - project.setRawIncludepath(newClasspath, false/*cannot modify resources*/, null/*no progress*/); - assertClasspathEquals( - project.getRawIncludepath(), - "/P/src2[CPE_SOURCE][K_SOURCE][isExported:false]" - ); - } finally { - deleteProject("P"); - } -} -/* - * Ensures that a compilation unit on the old classpath doesn't exist after setting a new raw classpath with no resource change. - */ -public void testNoResourceChange03() throws CoreException { - try { - IJavaScriptProject project = createJavaProject("P", new String[] {"src1"}); - createFile( - "/P/src1/X.js", - "public class X {\n" + - "}" - ); - IJavaScriptUnit cu = getCompilationUnit("/P/src1/X.js"); - cu.open(null); - IIncludePathEntry[] newClasspath = createClasspath("P", new String[] {"/P/src2", ""}); - project.setRawIncludepath(newClasspath, false/*cannot modify resources*/, null/*no progress*/); - assertFalse("Compilation unit should not exist", cu.exists()); - } finally { - deleteProject("P"); - } -} -/* - * Ensures that the delta is correct when setting a new raw classpath with no resource change. - */ -public void testNoResourceChange04() throws CoreException { - try { - IJavaScriptProject project = createJavaProject("P", new String[] {"src1"}); - createFolder("/P/src2"); - IIncludePathEntry[] newClasspath = createClasspath("P", new String[] {"/P/src2", ""}); - startDeltas(); - project.setRawIncludepath(newClasspath, false/*cannot modify resources*/, null/*no progress*/); - assertDeltas( - "Unexpected delta", - "P[*]: {CHILDREN | CLASSPATH CHANGED}\n" + - " src1[*]: {REMOVED FROM CLASSPATH}\n" + - " src2[*]: {ADDED TO CLASSPATH}" - ); - } finally { - stopDeltas(); - deleteProject("P"); - } -} -/* - * Ensures that the in-memory output is correct when setting the output with no resource change. - */ -public void testNoResourceChange05() throws CoreException { - try { - IJavaScriptProject project = createJavaProject("P", new String[] {"src1"}); - project.setRawIncludepath(project.getRawIncludepath(), false/*cannot modify resources*/, null/*no progress*/); - IIncludePathEntry[] entries = project.readRawIncludepath(); // force to read classpath - assertEquals( - "/P/src2", - entries[0].getPath().toString()); - } finally { - deleteProject("P"); - } -} -/** - * Ensures that a duplicate entry created by editing the .classpath is detected. - * (regression test for bug 24498 Duplicate entries on classpath cause CP marker to no longer refresh) - */ -public void testDuplicateEntries() throws CoreException { - try { - IJavaScriptProject project = this.createJavaProject("P", new String[] {"src"}); - this.editFile( - "/P/.settings/.jsdtscope", - "\n" + - "\n" + - " \n" + - " \n" + - " \n" + - "" - ); - assertMarkers( - "Unexpected markers", - "Build path contains duplicate entry: \'src\' for project P", - project); - } finally { - this.deleteProject("P"); - } -} -private void denseCycleDetection(final int numberOfParticipants) throws CoreException { - - final IJavaScriptProject[] projects = new IJavaScriptProject[numberOfParticipants]; - final String[] projectNames = new String[numberOfParticipants]; - final int[] allProjectsInCycle = new int[numberOfParticipants]; - - try { - JavaScriptCore.run(new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { - for (int i = 0; i < numberOfParticipants; i++){ - projectNames[i] = "P"+i; - projects[i] = createJavaProject(projectNames[i], new String[]{""}); - allProjectsInCycle[i] = 1; - } - for (int i = 0; i < numberOfParticipants; i++){ - IIncludePathEntry[] extraEntries = new IIncludePathEntry[numberOfParticipants-1]; - int index = 0; - for (int j = 0; j < numberOfParticipants; j++){ - if (i == j) continue; - extraEntries[index++] = JavaScriptCore.newProjectEntry(projects[j].getPath()); - } - // append project references - IIncludePathEntry[] oldClasspath = projects[i].getRawIncludepath(); - IIncludePathEntry[] newClasspath = new IIncludePathEntry[oldClasspath.length+extraEntries.length]; - System.arraycopy(oldClasspath, 0 , newClasspath, 0, oldClasspath.length); - for (int j = 0; j < extraEntries.length; j++){ - newClasspath[oldClasspath.length+j] = extraEntries[j]; - } - // set classpath - projects[i].setRawIncludepath(newClasspath, null); - } - } - }, - null); - - for (int i = 0; i < numberOfParticipants; i++){ - // check cycle markers - this.assertCycleMarkers(projects[i], projects, allProjectsInCycle); - } - - } finally { - this.deleteProjects(projectNames); - } -} -/* - * When using forward references, all projects prereq all of the ones which have a greater index, - * e.g. P0, P1, P2: P0 prereqs {P1, P2}, P1 prereqs {P2}, P2 prereqs {} - * When no using forward references (i.e. backward refs), all projects prereq projects with smaller index - * e.g. P0, P1, P2: P0 prereqs {}, P1 prereqs {P0}, P2 prereqs {P0, P1} - */ -private void noCycleDetection(final int numberOfParticipants, final boolean useForwardReferences, final boolean createProjectsFirst) throws CoreException { - - final IJavaScriptProject[] projects = new IJavaScriptProject[numberOfParticipants]; - final String[] projectNames = new String[numberOfParticipants]; - final int[] allProjectsInCycle = new int[numberOfParticipants]; - - final long[] start = new long[1]; - final long[] time = new long[1]; - - try { - if (createProjectsFirst) { - JavaScriptCore.run(new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { - for (int i = 0; i < numberOfParticipants; i++){ - projectNames[i] = "P"+i; - projects[i] = createJavaProject(projectNames[i], new String[]{""}); - allProjectsInCycle[i] = 0; - } - } - }, - null); - } - JavaScriptCore.run(new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { - if (!createProjectsFirst) { - for (int i = 0; i < numberOfParticipants; i++){ - projectNames[i] = "P"+i; - projects[i] = createJavaProject(projectNames[i], new String[]{""}); - allProjectsInCycle[i] = 0; - } - } - for (int i = 0; i < numberOfParticipants; i++){ - IIncludePathEntry[] extraEntries = new IIncludePathEntry[useForwardReferences ? numberOfParticipants - i -1 : i]; - int index = 0; - for (int j = useForwardReferences ? i+1 : 0; - useForwardReferences ? (j < numberOfParticipants) : (j < i); - j++){ - extraEntries[index++] = JavaScriptCore.newProjectEntry(projects[j].getPath()); - } - // append project references - IIncludePathEntry[] oldClasspath = projects[i].getRawIncludepath(); - IIncludePathEntry[] newClasspath = new IIncludePathEntry[oldClasspath.length+extraEntries.length]; - System.arraycopy(oldClasspath, 0 , newClasspath, 0, oldClasspath.length); - for (int j = 0; j < extraEntries.length; j++){ - newClasspath[oldClasspath.length+j] = extraEntries[j]; - } - // set classpath - long innerStart = System.currentTimeMillis(); // time spent in individual CP setting - projects[i].setRawIncludepath(newClasspath, null); - time[0] += System.currentTimeMillis() - innerStart; - } - start[0] = System.currentTimeMillis(); // time spent in delta refresh - } - }, - null); - time[0] += System.currentTimeMillis()-start[0]; - //System.out.println("No cycle check ("+numberOfParticipants+" participants) : "+ time[0]+" ms, "+ (useForwardReferences ? "forward references" : "backward references") + ", " + (createProjectsFirst ? "two steps (projects created first, then classpaths are set)" : "one step (projects created and classpaths set in one batch)")); - - for (int i = 0; i < numberOfParticipants; i++){ - // check cycle markers - this.assertCycleMarkers(projects[i], projects, allProjectsInCycle); - } - - } finally { - this.deleteProjects(projectNames); - } -} - -/* - * test for bug 32690 - * simulate checkout of project with invalid classpath - */ -public void testNestedSourceFolders() throws CoreException, IOException { - try { - // create project using Platform/Resources API - final IProject project = getProject("P"); - IWorkspaceRunnable create = new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { - project.create(null, null); - project.open(null); - } - }; - getWorkspace().run(create, null); - - // create folders src and src/src2 using java.io API - File pro = project.getLocation().toFile(); - File src = createFolder(pro, "src"); - createFolder(src, "src2"); - - // create .project using java.io API - createFile(pro, ".project", - "\n" + - "\n" + - " org.eclipse.wst.jsdt.core\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " org.eclipse.wst.jsdt.core.javabuilder\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " org.eclipse.wst.jsdt.core.javanature\n" + - " \n" + - ""); - - // create .classpath using java.io API - createFile(pro, ".classpath", - "\n" + - "\n" + - " \n" + - " \n" + - " \n" + - "" - ); - - // refresh - project.refreshLocal(IResource.DEPTH_INFINITE, null); - - assertMarkers( - "Unexpected markers", - "Cannot nest \'P/src/src2\' inside \'P/src\'. To enable the nesting exclude \'src2/\' from \'P/src\'", - JavaScriptCore.create(project)); - } finally { - deleteProject("P"); - } -} -/* - * Ensures that no problems are reported for an optional source entry with no corresponding folder. - */ -public void testOptionalEntry1() throws CoreException { - try { - IJavaScriptProject javaProject = this.createJavaProject("A", new String[] {}); - IIncludePathAttribute attribute = JavaScriptCore.newIncludepathAttribute(IIncludePathAttribute.OPTIONAL, "true"); - IIncludePathEntry[] classpath = - new IIncludePathEntry[] { - JavaScriptCore.newSourceEntry(new Path("/A/src"), new IPath[0], new IPath[0], new Path("/A/bin"), new IIncludePathAttribute[] {attribute}) - }; - javaProject.setRawIncludepath(classpath, null); - assertMarkers( - "Unexpected markers", - "", - javaProject); - } finally { - this.deleteProject("A"); - } -} -/* - * Ensures that no problems are reported for an optional libary entry with no corresponding folder. - */ -public void testOptionalEntry2() throws CoreException { - try { - IJavaScriptProject javaProject = this.createJavaProject("A", new String[] {}); - IIncludePathAttribute attribute = JavaScriptCore.newIncludepathAttribute(IIncludePathAttribute.OPTIONAL, "true"); - IIncludePathEntry[] classpath = - new IIncludePathEntry[] { - JavaScriptCore.newLibraryEntry(new Path("/A/lib"), null, null, null, new IIncludePathAttribute[] {attribute}, false) - }; - javaProject.setRawIncludepath(classpath, null); - assertMarkers( - "Unexpected markers", - "", - javaProject); - } finally { - this.deleteProject("A"); - } -} -/* - * Ensures that no problems are reported for an optional project entry with no corresponding project. - */ -public void testOptionalEntry3() throws CoreException { - try { - IJavaScriptProject javaProject = this.createJavaProject("A", new String[] {}); - IIncludePathAttribute attribute = JavaScriptCore.newIncludepathAttribute(IIncludePathAttribute.OPTIONAL, "true"); - IIncludePathEntry[] classpath = - new IIncludePathEntry[] { - JavaScriptCore.newProjectEntry(new Path("/B"), null/*no access rules*/, false/*don't combine access rule*/, new IIncludePathAttribute[] {attribute}, false/*not exported*/) - }; - javaProject.setRawIncludepath(classpath, null); - assertMarkers( - "Unexpected markers", - "", - javaProject); - } finally { - this.deleteProject("A"); - } -} - -/** - * Ensure classpath is refreshed when project is replaced (43670) - */ -public void testReplaceProject() throws CoreException { - try { - final IJavaScriptProject javaProject = createJavaProject("P", new String[] {"src"}); - - ResourcesPlugin.getWorkspace().run( - new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { - IProjectDescription descr = javaProject.getProject().getDescription(); - descr.setComment("dummy"); // ensure it is changed - javaProject.getProject().setDescription(descr, monitor); - editFile( - "/P/.settings/.jsdtscope", - "\n" + - "\n" + - " \n" + - "" - ); - } - }, - null); - IIncludePathEntry[] classpath = javaProject.getRawIncludepath(); - assertEquals("classpath should have been refreshed", new Path("/P/src2"), classpath[0].getPath()); - } finally { - deleteProject("P"); - } -} - -/* - * Ensures that unknown classpath attributes in a .classpath file are not lost when read and rewritten. - * (regression test for bug 101425 Classpath persistence should be resilient with unknown attributes) - */ -public void testUnknownAttributes() throws CoreException { - try { - IJavaScriptProject project = createJavaProject("P"); - editFile( - "/P/.settings/.jsdtscope", - "\n" + - "\n" + - " \n" + - " \n" + - " \n" + - "\n" - ); - IIncludePathEntry[] classpath = project.getRawIncludepath(); - - // swap 2 entries - IIncludePathEntry src1 = classpath[0]; - classpath[0] = classpath[1]; - classpath[1] = src1; - project.setRawIncludepath(classpath, null); - - // check that .classpath has correct content - String contents = new String (org.eclipse.wst.jsdt.internal.core.util.Util.getResourceContentsAsCharArray(getFile("/P/.settings/.jsdtscope"))); - assertSourceEquals( - "Unexpected content", - "\n" + - "\n" + - " \n" + - " \n" + - " \n" + - "\n", - contents); - } finally { - deleteProject("P"); - } -} - -/* - * Ensures that unknown classpath elements in a .classpath file are not lost when read and rewritten. - * (regression test for bug 101425 Classpath persistence should be resilient with unknown attributes) - */ -public void testUnknownElements1() throws CoreException { - try { - IJavaScriptProject project = createJavaProject("P"); - editFile( - "/P/.settings/.jsdtscope", - "\n" + - "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - "\n" - ); - IIncludePathEntry[] classpath = project.getRawIncludepath(); - - // swap 2 entries - IIncludePathEntry src1 = classpath[0]; - classpath[0] = classpath[1]; - classpath[1] = src1; - project.setRawIncludepath(classpath, null); - - // check that .classpath has correct content - String contents = new String (org.eclipse.wst.jsdt.internal.core.util.Util.getResourceContentsAsCharArray(getFile("/P/.settings/.jsdtscope"))); - assertSourceEquals( - "Unexpected content", - "\n" + - "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - "\n", - contents); - } finally { - deleteProject("P"); - } -} - -/* - * Ensures that unknown classpath elements in a .classpath file are not lost when read and rewritten. - * (regression test for bug 101425 Classpath persistence should be resilient with unknown attributes) - */ -public void testUnknownElements2() throws CoreException { - try { - IJavaScriptProject project = createJavaProject("P"); - editFile( - "/P/.settings/.jsdtscope", - "\n" + - "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - "\n" - ); - IIncludePathEntry[] classpath = project.getRawIncludepath(); - - // swap 2 entries - IIncludePathEntry src1 = classpath[0]; - classpath[0] = classpath[1]; - classpath[1] = src1; - project.setRawIncludepath(classpath, null); - - // check that .classpath has correct content - String contents = new String (org.eclipse.wst.jsdt.internal.core.util.Util.getResourceContentsAsCharArray(getFile("/P/.settings/.jsdtscope"))); - assertSourceEquals( - "Unexpected content", - "\n" + - "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - "\n", - contents); - } finally { - deleteProject("P"); - } -} - -/** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=55992 - * Check that Assert.AssertionFailedException exception is well catched - * a) when verifying a classpath entry - * b) when verifying whole classpath - */ -public void testBug55992a() throws CoreException { - try { - IJavaScriptProject proj = this.createJavaProject("P", new String[] {}); - - IPath path = getExternalJCLPath(""); - IPath sourceAttachmentPath = new Path("jclMin.zip"); - JavaScriptCore.setIncludepathVariables( - new String[] {"TEST_LIB", "TEST_SRC"}, - new IPath[] {path, sourceAttachmentPath}, - null); - - ClasspathEntry cp = new ClasspathEntry( - IPackageFragmentRoot.K_SOURCE, - IIncludePathEntry.CPE_VARIABLE, - new Path("TEST_LIB"), - ClasspathEntry.INCLUDE_ALL, - ClasspathEntry.EXCLUDE_NONE, - new Path("TEST_SRC"), - null, - null, // specific output folder - false, - (IAccessRule[]) null, - false, - ClasspathEntry.NO_EXTRA_ATTRIBUTES); - IJavaScriptModelStatus status = JavaScriptConventions.validateClasspathEntry(proj, cp, false); - assertEquals( - "assertion failed: Source attachment path \'jclMin.zip\' for IIncludePathEntry must be absolute", - status.getMessage()); - } finally { - this.deleteProject("P"); - } -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=61214 - */ -public void testRemoveDuplicates() throws CoreException { - try { - IJavaScriptProject p1 = this.createJavaProject("P1", new String[] {""}); - IIncludePathEntry[] p1ClasspathEntries = new IIncludePathEntry[]{JavaScriptCore.newLibraryEntry(getExternalJCLPath(""), null, null, true)}; - setClasspath(p1, p1ClasspathEntries); - IJavaScriptProject p2 = this.createJavaProject("P2", new String[] {""}); - IIncludePathEntry[] p2ClasspathEntries = new IIncludePathEntry[]{ - JavaScriptCore.newProjectEntry(new Path("/P1")), - JavaScriptCore.newLibraryEntry(getExternalJCLPath(""), null, null, false) - }; - setClasspath(p2, p2ClasspathEntries); - - IIncludePathEntry[] classpath = ((JavaProject)p2).getExpandedClasspath(); - assertEquals("Unexpected number of classpath entries", 2, classpath.length); - assertEquals("Unexpected first entry", "/P1", classpath[0].getPath().toString()); - assertEquals("Unexpected second entry", getSystemJsPathString(), classpath[1].getPath().toOSString()); - } finally { - this.deleteProjects(new String[] {"P1", "P2"}); - } -} -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CodeCorrectionTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CodeCorrectionTests.java deleted file mode 100644 index 23577a3..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CodeCorrectionTests.java +++ /dev/null @@ -1,731 +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 junit.framework.Test; - -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IncrementalProjectBuilder; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.wst.jsdt.core.CorrectionEngine; -import org.eclipse.wst.jsdt.core.IJavaScriptElement; -import org.eclipse.wst.jsdt.core.IJavaScriptModelMarker; -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.search.IJavaScriptSearchConstants; -import org.eclipse.wst.jsdt.core.search.IJavaScriptSearchScope; -import org.eclipse.wst.jsdt.core.search.SearchEngine; -import org.eclipse.wst.jsdt.core.search.SearchPattern; -import org.eclipse.wst.jsdt.core.search.TypeNameRequestor; - -public class CodeCorrectionTests extends AbstractJavaModelTests { - public static boolean fgDebug = false; - public static boolean fgSpecific = false; - - public CodeCorrectionTests(String name) { - super(name); - } - - private IMarker[] getMarkers(IJavaScriptUnit unit) { - try { - IResource resource = unit.getCorrespondingResource(); - return resource.findMarkers( - IJavaScriptModelMarker.JAVASCRIPT_MODEL_PROBLEM_MARKER, - true, IResource.DEPTH_INFINITE); - } catch (CoreException e) { - } - return new IMarker[0]; - } - - private IMarker getMarker(IJavaScriptUnit unit, String message) - throws CoreException { - IMarker[] markers = getMarkers(unit); - for (int i = 0; i < markers.length; i++) { - IMarker marker = markers[i]; - if (message.equals(marker.getAttribute(IMarker.MESSAGE))) { - return marker; - } - } - return null; - } - - /** - * Return the project names to load in the solution when an independent test - * suite is being run. - */ - public static String[] getProjectNames() { - return new String[] { "Compiler", "CodeCorrection" }; - } - - public void setUpSuite() throws Exception { - super.setUpSuite(); - - IJavaScriptProject project = setUpJavaProject("CodeCorrection"); - - // dummy query for waiting until the indexes are ready - SearchEngine engine = new SearchEngine(); - IJavaScriptSearchScope scope = SearchEngine - .createJavaSearchScope(new IJavaScriptElement[] { project }); - 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) { - } - // do a full build to create markers - JavaScriptCore.setOptions(JavaScriptCore.getDefaultOptions()); - try { - getWorkspace().getRoot().getProject("CodeCorrection").build( - IncrementalProjectBuilder.FULL_BUILD, null); - waitForAutoBuild(); - } catch (CoreException e) { - assertTrue("building failed", false); - } - } - - public void tearDownSuite() throws Exception { - deleteProject("CodeCorrection"); - - super.tearDownSuite(); - } - - public static Test suite() { - return buildModelTestSuite(CodeCorrectionTests.class); - /* - * Suite suite = new Suite(CodeCorrectionTests.class.getName()); if - * (fgSpecific) { suite.addTest(new - * CodeCorrectionTests("testCorrectMethod1")); - * - * return suite; } suite.addTest(new - * CodeCorrectionTests("testCorrectFieldType1")); suite.addTest(new - * CodeCorrectionTests("testCorrectFieldType2")); suite.addTest(new - * CodeCorrectionTests("testCorrectFieldType3")); suite.addTest(new - * CodeCorrectionTests("testCorrectLocalVariableType1")); - * suite.addTest(new - * CodeCorrectionTests("testCorrectLocalVariableType2")); - * suite.addTest(new CodeCorrectionTests("testCorrectImport1")); - * suite.addTest(new CodeCorrectionTests("testCorrectImport2")); - * suite.addTest(new CodeCorrectionTests("testCorrectImport3")); - * suite.addTest(new CodeCorrectionTests("testCorrectSuperClass1")); - * suite.addTest(new CodeCorrectionTests("testCorrectSuperClass2")); - * suite.addTest(new CodeCorrectionTests("testCorrectSuperInterface1")); - * suite.addTest(new CodeCorrectionTests("testCorrectSuperInterface2")); - * suite.addTest(new CodeCorrectionTests("testCorrectException1")); - * suite.addTest(new CodeCorrectionTests("testCorrectException2")); - * suite.addTest(new CodeCorrectionTests("testCorrectMethod1")); - * suite.addTest(new CodeCorrectionTests("testCorrectMethod2")); - * suite.addTest(new CodeCorrectionTests("testCorrectField1")); - * suite.addTest(new CodeCorrectionTests("testCorrectField2")); - * suite.addTest(new CodeCorrectionTests("testCorrectLocalVariable1")); - * suite.addTest(new CodeCorrectionTests("testCorrectArgument1")); - * suite.addTest(new CodeCorrectionTests("testCorrectReturnType1")); - * suite.addTest(new CodeCorrectionTests("testCorrectReturnType2")); - * suite.addTest(new CodeCorrectionTests("testWarningTokens")); - * - * return suite; - */ - } - - public void testCorrectFieldType1() throws JavaScriptModelException { - CorrectionEngine engine = new CorrectionEngine(JavaScriptCore - .getOptions()); - CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor(); - IJavaScriptUnit cu = getCompilationUnit("CodeCorrection", "src", "", - "CorrectFieldType1.js"); - IMarker[] markers = getMarkers(cu); - assertTrue("should have one problem", markers.length == 1); - engine.computeCorrections(markers[0], null, 0, requestor); - - String src = cu.getSource(); - String error = "dddz"; - int start = src.indexOf(error); - int end = start + error.length(); - - assertEquals("should have two suggestions", "ddd\n" + "ddd.eee", - requestor.getSuggestions()); - assertEquals("a start of a suggestion is not correct", start + "\n" - + start, requestor.getStarts()); - assertEquals("a end of a suggestion is not correct", end + "\n" + end, - requestor.getEnds()); - } - - public void testCorrectFieldType2() throws JavaScriptModelException { - CorrectionEngine engine = new CorrectionEngine(JavaScriptCore - .getOptions()); - CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor(); - IJavaScriptUnit cu = getCompilationUnit("CodeCorrection", "src", "", - "CorrectFieldType2.js"); - IMarker[] markers = getMarkers(cu); - assertTrue("should have one problem", markers.length == 1); - engine.computeCorrections(markers[0], null, 0, requestor); - - String src = cu.getSource(); - String error = "AClassz"; - int start = src.indexOf(error); - int end = start + error.length(); - - assertEquals("should have two suggestions", "AClass\n" + "AClass2", - requestor.getSuggestions()); - assertEquals("a start of a suggestion is not correct", start + "\n" - + start, requestor.getStarts()); - assertEquals("a end of a suggestion is not correct", end + "\n" + end, - requestor.getEnds()); - } - - public void testCorrectFieldType3() throws CoreException { - CorrectionEngine engine = new CorrectionEngine(JavaScriptCore - .getOptions()); - CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor(); - IJavaScriptUnit cu = getCompilationUnit("CodeCorrection", "src", "", - "CorrectFieldType3.js"); - IMarker marker = getMarker(cu, "AClassz cannot be resolved to a type"); - assertTrue("Marker not found", marker != null); - try { - engine.computeCorrections(marker, null, 0, requestor); - } catch (CoreException e) { - } - - String src = cu.getSource(); - String error = "AClassz"; - int start = src.indexOf(error); - int end = start + error.length(); - - assertEquals("should have two suggestions", "AClass\n" + "AClass2", - requestor.getSuggestions()); - assertEquals("a start of a suggestion is not correct", start + "\n" - + start, requestor.getStarts()); - assertEquals("a end of a suggestion is not correct", end + "\n" + end, - requestor.getEnds()); - } - - public void testCorrectLocalVariableType1() throws JavaScriptModelException { - CorrectionEngine engine = new CorrectionEngine(JavaScriptCore - .getOptions()); - CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor(); - IJavaScriptUnit cu = getCompilationUnit("CodeCorrection", "src", "", - "CorrectLocalVariableType1.js"); - IMarker[] markers = getMarkers(cu); - assertTrue("should have one problem", markers.length == 1); - engine.computeCorrections(markers[0], null, 0, requestor); - - String src = cu.getSource(); - String error = "dddz"; - int start = src.indexOf(error); - int end = start + error.length(); - - assertEquals("should have two suggestions", "ddd\n" + "ddd.eee", - requestor.getSuggestions()); - assertEquals("a start of a suggestion is not correct", start + "\n" - + start, requestor.getStarts()); - assertEquals("a end of a suggestion is not correct", end + "\n" + end, - requestor.getEnds()); - } - - public void testCorrectLocalVariableType2() throws JavaScriptModelException { - CorrectionEngine engine = new CorrectionEngine(JavaScriptCore - .getOptions()); - CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor(); - IJavaScriptUnit cu = getCompilationUnit("CodeCorrection", "src", "", - "CorrectLocalVariableType2.js"); - IMarker[] markers = getMarkers(cu); - assertTrue("should have one problem", markers.length == 1); - engine.computeCorrections(markers[0], null, 0, requestor); - - String src = cu.getSource(); - String error = "AClassz"; - int start = src.indexOf(error); - int end = start + error.length(); - - assertEquals("should have two suggestions", "AClass\n" + "AClass2", - requestor.getSuggestions()); - assertEquals("a start of a suggestion is not correct", start + "\n" - + start, requestor.getStarts()); - assertEquals("a end of a suggestion is not correct", end + "\n" + end, - requestor.getEnds()); - } - - public void testCorrectImport1() throws JavaScriptModelException { - CorrectionEngine engine = new CorrectionEngine(JavaScriptCore - .getOptions()); - CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor(); - IJavaScriptUnit cu = getCompilationUnit("CodeCorrection", "src", "", - "CorrectImport1.js"); - IMarker[] markers = getMarkers(cu); - assertTrue("should have one problem", markers.length == 1); - engine.computeCorrections(markers[0], null, 0, requestor); - - String src = cu.getSource(); - String error = "dddz"; - int start = src.indexOf(error); - int end = start + error.length(); - - assertEquals("should have two suggestions", "ddd\n" + "ddd.eee", - requestor.getSuggestions()); - assertEquals("a start of a suggestion is not correct", start + "\n" - + start, requestor.getStarts()); - assertEquals("a end of a suggestion is not correct", end + "\n" + end, - requestor.getEnds()); - } - - public void testCorrectImport2() throws JavaScriptModelException { - CorrectionEngine engine = new CorrectionEngine(JavaScriptCore - .getOptions()); - CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor(); - IJavaScriptUnit cu = getCompilationUnit("CodeCorrection", "src", "", - "CorrectImport2.js"); - IMarker[] markers = getMarkers(cu); - assertTrue("should have one problem", markers.length == 1); - engine.computeCorrections(markers[0], null, 0, requestor); - - String src = cu.getSource(); - String error = "dddz"; - int start = src.indexOf(error); - int end = start + error.length(); - - assertEquals("should have two suggestions", "ddd\n" + "ddd.eee", - requestor.getSuggestions()); - assertEquals("a start of a suggestion is not correct", start + "\n" - + start, requestor.getStarts()); - assertEquals("a end of a suggestion is not correct", end + "\n" + end, - requestor.getEnds()); - } - - public void testCorrectImport3() throws JavaScriptModelException { - CorrectionEngine engine = new CorrectionEngine(JavaScriptCore - .getOptions()); - CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor(); - IJavaScriptUnit cu = getCompilationUnit("CodeCorrection", "src", "", - "CorrectImport3.js"); - IMarker[] markers = getMarkers(cu); - assertTrue("should have one problem", markers.length == 1); - engine.computeCorrections(markers[0], null, 0, requestor); - - String src = cu.getSource(); - String error = "AClassz"; - int start = src.indexOf(error); - int end = start + error.length(); - - assertEquals("should have two suggestions", "AClass\n" + "AClass2", - requestor.getSuggestions()); - assertEquals("a start of a suggestion is not correct", start + "\n" - + start, requestor.getStarts()); - assertEquals("a end of a suggestion is not correct", end + "\n" + end, - requestor.getEnds()); - } - - public void testCorrectSuperClass1() throws JavaScriptModelException { - CorrectionEngine engine = new CorrectionEngine(JavaScriptCore - .getOptions()); - CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor(); - IJavaScriptUnit cu = getCompilationUnit("CodeCorrection", "src", "", - "CorrectSuperClass1.js"); - IMarker[] markers = getMarkers(cu); - assertTrue("should have one problem", markers.length == 1); - engine.computeCorrections(markers[0], null, 0, requestor); - - String src = cu.getSource(); - String error = "dddz"; - int start = src.indexOf(error); - int end = start + error.length(); - - assertEquals("should have two suggestions", "ddd\n" + "ddd.eee", - requestor.getSuggestions()); - assertEquals("a start of a suggestion is not correct", start + "\n" - + start, requestor.getStarts()); - assertEquals("a end of a suggestion is not correct", end + "\n" + end, - requestor.getEnds()); - } - - public void testCorrectSuperClass2() throws JavaScriptModelException { - CorrectionEngine engine = new CorrectionEngine(JavaScriptCore - .getOptions()); - CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor(); - IJavaScriptUnit cu = getCompilationUnit("CodeCorrection", "src", "", - "CorrectSuperClass2.js"); - IMarker[] markers = getMarkers(cu); - assertTrue("should have one problem", markers.length == 1); - engine.computeCorrections(markers[0], null, 0, requestor); - - String src = cu.getSource(); - String error = "AClassz"; - int start = src.indexOf(error); - int end = start + error.length(); - - assertEquals("should have two suggestions", "AClass\n" + "AClass2", - requestor.getSuggestions()); - assertEquals("a start of a suggestion is not correct", start + "\n" - + start, requestor.getStarts()); - assertEquals("a end of a suggestion is not correct", end + "\n" + end, - requestor.getEnds()); - } - - public void testCorrectSuperInterface1() throws JavaScriptModelException { - CorrectionEngine engine = new CorrectionEngine(JavaScriptCore - .getOptions()); - CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor(); - IJavaScriptUnit cu = getCompilationUnit("CodeCorrection", "src", "", - "CorrectSuperInterface1.js"); - IMarker[] markers = getMarkers(cu); - assertTrue("should have one problem", markers.length == 1); - engine.computeCorrections(markers[0], null, 0, requestor); - - String src = cu.getSource(); - String error = "cccz"; - int start = src.indexOf(error); - int end = start + error.length(); - - assertEquals("should have two suggestions", "ccc\n" + "cccInterface", - requestor.getSuggestions()); - assertEquals("a start of a suggestion is not correct", start + "\n" - + start, requestor.getStarts()); - assertEquals("a end of a suggestion is not correct", end + "\n" + end, - requestor.getEnds()); - } - - public void testCorrectSuperInterface2() throws JavaScriptModelException { - CorrectionEngine engine = new CorrectionEngine(JavaScriptCore - .getOptions()); - CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor(); - IJavaScriptUnit cu = getCompilationUnit("CodeCorrection", "src", "", - "CorrectSuperInterface2.js"); - IMarker[] markers = getMarkers(cu); - assertTrue("should have one problem", markers.length == 1); - engine.computeCorrections(markers[0], null, 0, requestor); - - String src = cu.getSource(); - String error = "AListenerz"; - int start = src.indexOf(error); - int end = start + error.length(); - - assertEquals("should have two suggestions", "AListener", requestor - .getSuggestions()); - assertEquals("a start of a suggestion is not correct", "" + start, - requestor.getStarts()); - assertEquals("a end of a suggestion is not correct", "" + end, - requestor.getEnds()); - } - - public void testCorrectException1() throws JavaScriptModelException { - CorrectionEngine engine = new CorrectionEngine(JavaScriptCore - .getOptions()); - CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor(); - IJavaScriptUnit cu = getCompilationUnit("CodeCorrection", "src", "", - "CorrectException1.js"); - IMarker[] markers = getMarkers(cu); - assertTrue("should have one problem", markers.length == 1); - engine.computeCorrections(markers[0], null, 0, requestor); - - String src = cu.getSource(); - String error = "bbbz"; - int start = src.indexOf(error); - int end = start + error.length(); - - assertEquals("should have two suggestions", "bbb\n" + "bbb.ccc", - requestor.getSuggestions()); - assertEquals("a start of a suggestion is not correct", start + "\n" - + start, requestor.getStarts()); - assertEquals("a end of a suggestion is not correct", end + "\n" + end, - requestor.getEnds()); - } - - public void testCorrectException2() throws JavaScriptModelException { - CorrectionEngine engine = new CorrectionEngine(JavaScriptCore - .getOptions()); - CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor(); - IJavaScriptUnit cu = getCompilationUnit("CodeCorrection", "src", "", - "CorrectException2.js"); - IMarker[] markers = getMarkers(cu); - assertTrue("should have one problem", markers.length == 1); - engine.computeCorrections(markers[0], null, 0, requestor); - - String src = cu.getSource(); - String error = "AnExceptionz"; - int start = src.indexOf(error); - int end = start + error.length(); - - assertEquals("should have two suggestions", "AnException", requestor - .getSuggestions()); - assertEquals("a start of a suggestion is not correct", "" + start, - requestor.getStarts()); - assertEquals("a end of a suggestion is not correct", "" + end, - requestor.getEnds()); - } - - public void testCorrectMethod1() throws JavaScriptModelException { - CorrectionEngine engine = new CorrectionEngine(JavaScriptCore - .getOptions()); - CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor(); - IJavaScriptUnit cu = getCompilationUnit("CodeCorrection", "src", "", - "CorrectMethod1.js"); - IMarker[] markers = getMarkers(cu); - assertTrue("should have one problem", markers.length == 1); - engine.computeCorrections(markers[0], null, 0, requestor); - - String src = cu.getSource(); - String error = "bar"; - int start = src.lastIndexOf(error); - int end = start + error.length(); - - assertEquals("should have one suggestion", "bar0", requestor - .getSuggestions()); - assertEquals("a start of a suggestion is not correct", "" + start, - requestor.getStarts()); - assertEquals("a end of a suggestion is not correct", "" + end, - requestor.getEnds()); - } - - public void testCorrectMethod2() throws JavaScriptModelException { - CorrectionEngine engine = new CorrectionEngine(JavaScriptCore - .getOptions()); - CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor(); - IJavaScriptUnit cu = getCompilationUnit("CodeCorrection", "src", "", - "CorrectMethod2.js"); - IMarker[] markers = getMarkers(cu); - assertTrue("should have one problem", markers.length == 1); - engine.computeCorrections(markers[0], null, 0, requestor); - - String src = cu.getSource(); - String error = "bar"; - int start = src.lastIndexOf(error); - int end = start + error.length(); - - assertEquals("should have one suggestion", "bar0", requestor - .getSuggestions()); - assertEquals("a start of a suggestion is not correct", "" + start, - requestor.getStarts()); - assertEquals("a end of a suggestion is not correct", "" + end, - requestor.getEnds()); - } - - public void testCorrectField1() throws JavaScriptModelException { - CorrectionEngine engine = new CorrectionEngine(JavaScriptCore - .getOptions()); - CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor(); - IJavaScriptUnit cu = getCompilationUnit("CodeCorrection", "src", "", - "CorrectField1.js"); - IMarker[] markers = getMarkers(cu); - assertTrue("should have one problem", markers.length == 1); - engine.computeCorrections(markers[0], null, 0, requestor); - - String src = cu.getSource(); - String error = "bar"; - int start = src.lastIndexOf(error); - int end = start + error.length(); - - assertEquals("should have one suggestion", "bar0", requestor - .getSuggestions()); - assertEquals("a start of a suggestion is not correct", "" + start, - requestor.getStarts()); - assertEquals("a end of a suggestion is not correct", "" + end, - requestor.getEnds()); - } - - public void testCorrectField2() throws JavaScriptModelException { - CorrectionEngine engine = new CorrectionEngine(JavaScriptCore - .getOptions()); - CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor(); - IJavaScriptUnit cu = getCompilationUnit("CodeCorrection", "src", "", - "CorrectField2.js"); - IMarker[] markers = getMarkers(cu); - assertTrue("should have one problem", markers.length == 1); - engine.computeCorrections(markers[0], null, 0, requestor); - - String src = cu.getSource(); - String error = "bar"; - int start = src.lastIndexOf(error); - int end = start + error.length(); - - assertEquals("should have one suggestion", "bar0", requestor - .getSuggestions()); - assertEquals("a start of a suggestion is not correct", "" + start, - requestor.getStarts()); - assertEquals("a end of a suggestion is not correct", "" + end, - requestor.getEnds()); - } - - public void testCorrectLocalVariable1() throws JavaScriptModelException { - CorrectionEngine engine = new CorrectionEngine(JavaScriptCore - .getOptions()); - CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor(); - IJavaScriptUnit cu = getCompilationUnit("CodeCorrection", "src", "", - "CorrectLocalVariable1.js"); - IMarker[] markers = getMarkers(cu); - assertTrue("should have one problem", markers.length == 1); - engine.computeCorrections(markers[0], null, 0, requestor); - - String src = cu.getSource(); - String error = "bar"; - int start = src.lastIndexOf(error); - int end = start + error.length(); - - assertEquals("should have one suggestion", "bar0", requestor - .getSuggestions()); - assertEquals("a start of a suggestion is not correct", "" + start, - requestor.getStarts()); - assertEquals("a end of a suggestion is not correct", "" + end, - requestor.getEnds()); - } - - public void testCorrectArgument1() throws JavaScriptModelException { - CorrectionEngine engine = new CorrectionEngine(JavaScriptCore - .getOptions()); - CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor(); - IJavaScriptUnit cu = getCompilationUnit("CodeCorrection", "src", "", - "CorrectArgument1.js"); - IMarker[] markers = getMarkers(cu); - assertTrue("should have one problem", markers.length == 1); - engine.computeCorrections(markers[0], null, 0, requestor); - - String src = cu.getSource(); - String error = "bar"; - int start = src.lastIndexOf(error); - int end = start + error.length(); - - assertEquals("should have one suggestion", "bar0", requestor - .getSuggestions()); - assertEquals("a start of a suggestion is not correct", "" + start, - requestor.getStarts()); - assertEquals("a end of a suggestion is not correct", "" + end, - requestor.getEnds()); - } - - public void testCorrectReturnType1() throws JavaScriptModelException { - CorrectionEngine engine = new CorrectionEngine(JavaScriptCore - .getOptions()); - CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor(); - IJavaScriptUnit cu = getCompilationUnit("CodeCorrection", "src", "", - "CorrectReturnType1.js"); - IMarker[] markers = getMarkers(cu); - assertTrue("should have one problem", markers.length == 1); - engine.computeCorrections(markers[0], null, 0, requestor); - - String src = cu.getSource(); - String error = "dddz"; - int start = src.indexOf(error); - int end = start + error.length(); - - assertEquals("should have two suggestions", "ddd\n" + "ddd.eee", - requestor.getSuggestions()); - assertEquals("a start of a suggestion is not correct", start + "\n" - + start, requestor.getStarts()); - assertEquals("a end of a suggestion is not correct", end + "\n" + end, - requestor.getEnds()); - } - - public void testCorrectReturnType2() throws JavaScriptModelException { - CorrectionEngine engine = new CorrectionEngine(JavaScriptCore - .getOptions()); - CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor(); - IJavaScriptUnit cu = getCompilationUnit("CodeCorrection", "src", "", - "CorrectReturnType2.js"); - IMarker[] markers = getMarkers(cu); - assertTrue("should have one problem", markers.length == 1); - engine.computeCorrections(markers[0], null, 0, requestor); - - String src = cu.getSource(); - String error = "AClassz"; - int start = src.indexOf(error); - int end = start + error.length(); - - assertEquals("should have two suggestions", "AClass\n" + "AClass2", - requestor.getSuggestions()); - assertEquals("a start of a suggestion is not correct", start + "\n" - + start, requestor.getStarts()); - assertEquals("a end of a suggestion is not correct", end + "\n" + end, - requestor.getEnds()); - } - - public void testWarningTokens() { - assertNull("assertIdentifier is a valid token for @SuppressWarnings", - CorrectionEngine - .getWarningToken(IProblem.UseAssertAsAnIdentifier)); - assertEquals("wrong token", "deprecation", CorrectionEngine - .getWarningToken(IProblem.UsingDeprecatedConstructor)); - assertEquals("wrong token", "deprecation", CorrectionEngine - .getWarningToken(IProblem.OverridingDeprecatedMethod)); - assertEquals("wrong token", "deprecation", CorrectionEngine - .getWarningToken(IProblem.UsingDeprecatedType)); - assertEquals("wrong token", "deprecation", CorrectionEngine - .getWarningToken(IProblem.UsingDeprecatedMethod)); - assertEquals("wrong token", "deprecation", CorrectionEngine - .getWarningToken(IProblem.UsingDeprecatedField)); - assertEquals("wrong token", "finally", CorrectionEngine - .getWarningToken(IProblem.FinallyMustCompleteNormally)); - assertEquals("wrong token", "hiding", CorrectionEngine - .getWarningToken(IProblem.FieldHidingLocalVariable)); - assertEquals("wrong token", "hiding", CorrectionEngine - .getWarningToken(IProblem.FieldHidingField)); - assertEquals("wrong token", "hiding", CorrectionEngine - .getWarningToken(IProblem.LocalVariableHidingLocalVariable)); - assertEquals("wrong token", "hiding", CorrectionEngine - .getWarningToken(IProblem.LocalVariableHidingField)); - assertEquals("wrong token", "hiding", CorrectionEngine - .getWarningToken(IProblem.ArgumentHidingLocalVariable)); - assertEquals("wrong token", "hiding", CorrectionEngine - .getWarningToken(IProblem.ArgumentHidingField)); - assertEquals("wrong token", "hiding", CorrectionEngine - .getWarningToken(IProblem.MaskedCatch)); - assertEquals("wrong token", "nls", CorrectionEngine - .getWarningToken(IProblem.NonExternalizedStringLiteral)); - assertEquals("wrong token", "unused", CorrectionEngine - .getWarningToken(IProblem.LocalVariableIsNeverUsed)); - assertEquals("wrong token", "unused", CorrectionEngine - .getWarningToken(IProblem.ArgumentIsNeverUsed)); - assertEquals("wrong token", "unused", CorrectionEngine - .getWarningToken(IProblem.UnusedPrivateConstructor)); - assertEquals("wrong token", "unused", CorrectionEngine - .getWarningToken(IProblem.UnusedPrivateMethod)); - assertEquals("wrong token", "unused", CorrectionEngine - .getWarningToken(IProblem.UnusedPrivateField)); - assertEquals("wrong token", "unused", CorrectionEngine - .getWarningToken(IProblem.UnusedPrivateType)); - assertEquals("wrong token", "unused", CorrectionEngine - .getWarningToken(IProblem.UnusedMethodDeclaredThrownException)); - assertEquals( - "wrong token", - "unused", - CorrectionEngine - .getWarningToken(IProblem.UnusedConstructorDeclaredThrownException)); - assertEquals("wrong token", "static-access", CorrectionEngine - .getWarningToken(IProblem.IndirectAccessToStaticMethod)); - assertEquals("wrong token", "static-access", CorrectionEngine - .getWarningToken(IProblem.IndirectAccessToStaticField)); - assertEquals("wrong token", "static-access", CorrectionEngine - .getWarningToken(IProblem.IndirectAccessToStaticType)); - assertEquals("wrong token", "static-access", CorrectionEngine - .getWarningToken(IProblem.NonStaticAccessToStaticMethod)); - assertEquals("wrong token", "static-access", CorrectionEngine - .getWarningToken(IProblem.NonStaticAccessToStaticField)); - assertEquals("wrong token", "synthetic-access", CorrectionEngine - .getWarningToken(IProblem.NeedToEmulateFieldReadAccess)); - assertEquals("wrong token", "synthetic-access", CorrectionEngine - .getWarningToken(IProblem.NeedToEmulateFieldWriteAccess)); - assertEquals("wrong token", "synthetic-access", CorrectionEngine - .getWarningToken(IProblem.NeedToEmulateMethodAccess)); - assertEquals("wrong token", "synthetic-access", CorrectionEngine - .getWarningToken(IProblem.NeedToEmulateConstructorAccess)); - assertEquals("wrong token", "unqualified-field-access", - CorrectionEngine - .getWarningToken(IProblem.UnqualifiedFieldAccess)); - } -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CodeCorrectionTestsRequestor.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CodeCorrectionTestsRequestor.java deleted file mode 100644 index 3174482..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CodeCorrectionTestsRequestor.java +++ /dev/null @@ -1,118 +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.model; - -import java.util.*; - -import org.eclipse.wst.jsdt.core.ICorrectionRequestor; - -public class CodeCorrectionTestsRequestor implements ICorrectionRequestor { - private class Suggestion { - public String text; - public int start; - public int end; - public Suggestion(char[] text, int start, int end){ - this.text = new String(text); - this.start = start; - this.end = end; - } - } - - class SuggestionComparator implements Comparator { - public int compare(Object o1,Object o2) { - Suggestion s1 = (Suggestion)o1; - Suggestion s2 = (Suggestion)o2; - - int result = s1.text.compareTo(s2.text); - if(result == 0) { - result = s1.start - s2.start; - if(result == 0) { - result = s1.end - s2.end; - } - } - return result; - } - } - - - private Vector fSuggestions = new Vector(5); - - public void acceptClass(char[] packageName,char[] className,char[] correctionName,int modifiers,int correctionStart,int correctionEnd){ - fSuggestions.addElement(new Suggestion(correctionName, correctionStart, correctionEnd)); - } - - public void acceptField(char[] declaringTypePackageName,char[] declaringTypeName,char[] name,char[] typePackageName,char[] typeName,char[] correctionName,int modifiers,int correctionStart,int correctionEnd){ - fSuggestions.addElement(new Suggestion(correctionName, correctionStart, correctionEnd)); - } - - public void acceptInterface(char[] packageName,char[] interfaceName,char[] correctionName,int modifiers,int correctionStart,int correctionEnd){ - fSuggestions.addElement(new Suggestion(correctionName, correctionStart, correctionEnd)); - } - - public void acceptLocalVariable(char[] name,char[] typePackageName,char[] typeName,int modifiers,int correctionStart,int correctionEnd){ - fSuggestions.addElement(new Suggestion(name, correctionStart, correctionEnd)); - } - - public void acceptMethod(char[] declaringTypePackageName,char[] declaringTypeName,char[] selector,char[][] parameterPackageNames,char[][] parameterTypeNames,char[][] parameterNames,char[] returnTypePackageName,char[] returnTypeName,char[] correctionName,int modifiers,int correctionStart,int correctionEnd){ - fSuggestions.addElement(new Suggestion(correctionName, correctionStart, correctionEnd)); - } - - public void acceptPackage(char[] packageName,char[] correctionName,int correctionStart,int correctionEnd){ - fSuggestions.addElement(new Suggestion(correctionName, correctionStart, correctionEnd)); - } - - public String getSuggestions(){ - Suggestion[] suggestions = getSortedSuggestions(); - - StringBuffer result = new StringBuffer(); - for (int i = 0; i < suggestions.length; i++) { - if(i != 0) - result.append('\n'); - - result.append(suggestions[i].text); - } - return result.toString(); - } - - public String getStarts(){ - Suggestion[] suggestions = getSortedSuggestions(); - - StringBuffer result = new StringBuffer(); - for (int i = 0; i < suggestions.length; i++) { - if(i != 0) - result.append('\n'); - - result.append(suggestions[i].start); - } - return result.toString(); - } - - public String getEnds(){ - Suggestion[] suggestions = getSortedSuggestions(); - - StringBuffer result = new StringBuffer(); - for (int i = 0; i < suggestions.length; i++) { - if(i != 0) - result.append('\n'); - - result.append(suggestions[i].end); - } - return result.toString(); - } - - private Suggestion[] getSortedSuggestions(){ - Object[] unsorted = fSuggestions.toArray(); - Suggestion[] sorted = new Suggestion[unsorted.length]; - System.arraycopy(unsorted, 0, sorted, 0, unsorted.length); - Arrays.sort(sorted, new SuggestionComparator()); - return sorted; - } -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CodeSnippetParsingUtilTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CodeSnippetParsingUtilTests.java deleted file mode 100644 index cdfc232..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CodeSnippetParsingUtilTests.java +++ /dev/null @@ -1,125 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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 java.util.List; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -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.IProblemRequestor; -import org.eclipse.wst.jsdt.core.JavaScriptCore; -import org.eclipse.wst.jsdt.core.JavaScriptModelException; -import org.eclipse.wst.jsdt.core.LibrarySuperType; -import org.eclipse.wst.jsdt.core.WorkingCopyOwner; -import org.eclipse.wst.jsdt.core.compiler.IProblem; -import org.eclipse.wst.jsdt.core.dom.AST; -import org.eclipse.wst.jsdt.internal.core.JavaProject; -import org.eclipse.wst.jsdt.launching.JavaRuntime; - -public class CodeSnippetParsingUtilTests extends TestCase { - public static Test suite() { - return new TestSuite(CodeSnippetParsingUtilTests.class); - } - - /** - * - */ - public CodeSnippetParsingUtilTests() { - } - - /** - * @param name - */ - public CodeSnippetParsingUtilTests(String name) { - super(name); - } - - public void testErrorDetection() throws JavaScriptModelException, CoreException { - String projectName = ".jsValidation"; - String fileName = "snippet.js"; - String contents = "var params = \"someBadString\".substring(1,2,3,4);\nparahnas.shift();"; - - // Create the JavaScript project - IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(projectName); - description.setNatureIds(new String[]{JavaScriptCore.NATURE_ID}); - IProject iProject = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - iProject.create(description, new NullProgressMonitor()); - iProject.open(null); - - // Setup the JavaScript project - IJavaScriptProject project = JavaScriptCore.create(iProject); - project.setRawIncludepath(null, new NullProgressMonitor()); - LibrarySuperType superType = new LibrarySuperType(new Path(JavaRuntime.DEFAULT_SUPER_TYPE_LIBRARY), project, JavaRuntime.DEFAULT_SUPER_TYPE); - ((JavaProject) project).setCommonSuperType(superType); - - // Now create the IJavascriptUnit, and fill in its contents - IPackageFragmentRoot root = project.getPackageFragmentRoot(iProject); - IPackageFragment packageFragment = root.getPackageFragment(IPackageFragment.DEFAULT_PACKAGE_NAME); - IJavaScriptUnit javaScriptUnit = packageFragment.getJavaScriptUnit(fileName); - - final List problems = new ArrayList(); - final IProblemRequestor requestor = new IProblemRequestor() { - public void acceptProblem(IProblem problem) { -// System.err.println(problem.getMessage()); - problems.add(problem); - } - - public boolean isActive() { - return true; - } - - public void beginReporting() { - problems.clear(); - } - - public void endReporting() { - } - }; - WorkingCopyOwner owner = new WorkingCopyOwner() { - public IProblemRequestor getProblemRequestor(IJavaScriptUnit workingCopy) { - return requestor; - } - }; - - /* - * Using a "working copy" allows us to not have to create the file on - * disk - */ - IJavaScriptUnit workingCopy = javaScriptUnit.getWorkingCopy(owner, null); - workingCopy.getBuffer().setContents(contents); - - /* - * Reconcile the working copy. Any problems found will be reported to - * the IProblemRequestor from the given WorkingCopyOwner. - */ - workingCopy.reconcile(AST.JLS3, true, true, owner, new NullProgressMonitor()); - - // Clean up - workingCopy.discardWorkingCopy(); - - //FIXME need to enable semantic validation - //assertFalse("no problems found", problems.isEmpty()); - } -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompilationUnitTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompilationUnitTests.java deleted file mode 100644 index 880e784..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompilationUnitTests.java +++ /dev/null @@ -1,1422 +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 org.eclipse.core.runtime.CoreException; -import org.eclipse.wst.jsdt.internal.core.*; -import org.eclipse.wst.jsdt.internal.core.util.Util; -import org.eclipse.wst.jsdt.core.*; - -import junit.framework.Test; - -public class CompilationUnitTests extends ModifyingResourceTests { - IJavaScriptUnit cu; - IJavaScriptUnit workingCopy; - IJavaScriptProject testProject; - -public CompilationUnitTests(String name) { - super(name); -} -public void setUpSuite() throws Exception { - super.setUpSuite(); - - this.testProject = createJavaProject("P", new String[] {"src"}, new String[] {getSystemJsPathString()}, "bin", "1.5"); - createFolder("/P/src/p"); - createFile( - "/P/src/p/X.js", - "\n\n" + // package now includes comment (see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=93880) - // => need some empty line at beginning to be able to have cu without any other element (see testGetElementAt()) - "/* some comment */" + - " var f1=1;\n" + - " /** @deprecated\n */" + - " var f2;\n" + - " var f3;\n" + - " var f4;\n" + - " var f5, f6, f7;\n" + - " // @Deprecated\n" + - " var f8;\n" + - " function foo( y) {\n" + - " }\n" + - " function bar() {\n" + - " }\n" + - " /** @deprecated\n */" + - " function fred() {\n" + - " }\n" + - " // @Deprecated\n" + - " function fred2() {\n" + - " }\n" + - "" - ); - this.cu = getCompilationUnit("/P/src/p/X.js"); -} - -// Use this static initializer to specify subset for tests -// All specified tests which do not belong to the class are skipped... -static { -// TESTS_PREFIX = "testGetChildren"; -// TESTS_NAMES = new String[] { "testDefaultFlag1" }; -// TESTS_NUMBERS = new int[] { 13 }; -// TESTS_RANGE = new int[] { 16, -1 }; -} -public static Test suite() { - return buildModelTestSuite(CompilationUnitTests.class); -} -protected void tearDown() throws Exception { - if (this.workingCopy != null) - this.workingCopy.discardWorkingCopy(); - super.tearDown(); -} -public void tearDownSuite() throws Exception { - this.deleteProject("P"); - super.tearDownSuite(); -} -/** - * Create working copy and compute problems. - * - * Note that in this case, a complete parse of javadoc comment is performed - * (ie. done with checkDocComment = true) instead of a "light" parse when - * problems are not computed. - * - * See JavaScriptUnit#buildStructure() line with comment: // disable javadoc parsing if not computing problems, not resolving and not creating ast - * and org.eclipse.wst.jsdt.internal.compiler.parser.JavadocParser#checkDeprecation(int) - */ -private IJavaScriptUnit createWorkingCopyComputingProblems(String source) throws JavaScriptModelException { - this.workingCopy = getWorkingCopy("/P/src/p/Y.js", source, true); - return this.workingCopy; -} - - -public void test00Class() throws CoreException { - try { - - String source = - "MyClass.prototype.someMethod = MyClass_someMethod;\n" + - "function MyClass()\n" + - "{\n" + - "this.field1=0;\n" + - "}\n" + - "function MyClass_someMethod()\n" + - "{\n" + - "}"; - createFile("/P/src/X.js", source); - final IJavaScriptUnit compilationUnit = getCompilationUnit("/P/src/X.js"); - IType type = compilationUnit.getType("MyClass"); - assertTrue("Type not defined", type.exists()); - - IField[] fields= type.getFields(); - assertEquals("Wrong number of fields returned", 1, fields.length); - assertEquals("Incorrect name for the field", "field1", fields[0].getElementName()); - assertTrue("Field should exist " , fields[0].exists()); - - IFunction[] methods= type.getFunctions(); - assertEquals("Wrong number of methods returned", 2, methods.length); - assertEquals("Incorrect name for the method", "someMethod", methods[0].getElementName()); - assertTrue("Field should exist " ,methods[0].exists()); - - - } finally { - deleteFile("/P/src/X.js"); - } -} - - - - - -/** - * Calls methods that do nothing to ensure code coverage - */ -public void testCodeCoverage() throws JavaScriptModelException { - this.cu.discardWorkingCopy(); - this.cu.restore(); -} -/** - * Ensures commitWorkingCopy(boolean, IProgressMonitor) throws the correct - * JavaScriptModelException for a JavaScriptUnit. - */ -public void testCommitWorkingCopy() { - try { - this.cu.commitWorkingCopy(false, null); - } catch (JavaScriptModelException jme) { - assertTrue("Incorrect status for committing a JavaScriptUnit", jme.getStatus().getCode() == IJavaScriptModelStatusConstants.INVALID_ELEMENT_TYPES); - return; - } - assertTrue("A compilation unit should throw an exception is a commit is attempted", false); -} - -/* - * Ensure that the deprecated flag is correctly reported - * (regression test fo bug 23207 Flags.isDeprecated(IFunction.getFlags()) doesn't work) - */ -//public void testDeprecatedFlag01() throws JavaScriptModelException { -// IType type = this.cu.getType("X"); -// assertTrue("Type X should not be deprecated", !Flags.isDeprecated(type.getFlags())); -//} -// -/* - * Ensure that the deprecated flag is correctly reported - * (regression test fo bug 23207 Flags.isDeprecated(IFunction.getFlags()) doesn't work) - */ -//public void testDeprecatedFlag02() throws JavaScriptModelException { -// IType type = this.cu.getType("I"); -// assertTrue("Type I should be deprecated", Flags.isDeprecated(type.getFlags())); -//} - -/* - * Ensure that the deprecated flag is correctly reported - * (regression test fo bug 23207 Flags.isDeprecated(IFunction.getFlags()) doesn't work) - */ -public void testDeprecatedFlag03() throws JavaScriptModelException { - IField field = this.cu.getField("f1"); - assertTrue("Field f1 should not be deprecated", !Flags.isDeprecated(field.getFlags())); -} - -/* - * Ensure that the deprecated flag is correctly reported - * (regression test fo bug 23207 Flags.isDeprecated(IFunction.getFlags()) doesn't work) - */ -public void testDeprecatedFlag04() throws JavaScriptModelException { - IField field = this.cu.getField("f2"); - assertTrue("Field f2 should be deprecated", Flags.isDeprecated(field.getFlags())); -} - -/* - * Ensure that the deprecated flag is correctly reported - * (regression test fo bug 23207 Flags.isDeprecated(IFunction.getFlags()) doesn't work) - */ -public void testDeprecatedFlag05() throws JavaScriptModelException { - IFunction method = this.cu.getFunction("bar", new String[]{}); - assertTrue("Method bar should not be deprecated", !Flags.isDeprecated(method.getFlags())); -} - -/* - * Ensure that the deprecated flag is correctly reported - * (regression test fo bug 23207 Flags.isDeprecated(IFunction.getFlags()) doesn't work) - */ -public void testDeprecatedFlag06() throws JavaScriptModelException { - IFunction method = this.cu.getFunction("fred", new String[]{}); - assertTrue("Method fred should be deprecated", Flags.isDeprecated(method.getFlags())); -} - -/* - * Ensure that the deprecated flag is correctly reported - * (regression test fo bug 89807 Outliner should recognize @Deprecated annotation) - */ -public void testDeprecatedFlag07() throws JavaScriptModelException { - IType type = this.cu.getType("I3"); - assertTrue("Type I3 should be deprecated", Flags.isDeprecated(type.getFlags())); -} - -/* - * Ensure that the deprecated flag is correctly reported - * (regression test fo bug 89807 Outliner should recognize @Deprecated annotation) - */ -public void testDeprecatedFlag08() throws JavaScriptModelException { - IField field = this.cu.getType("X").getField("f8"); - assertTrue("Field f8 should be deprecated", Flags.isDeprecated(field.getFlags())); -} - -/* - * Ensure that the deprecated flag is correctly reported - * (regression test fo bug 89807 Outliner should recognize @Deprecated annotation) - */ -public void testDeprecatedFlag09() throws JavaScriptModelException { - IFunction method = this.cu.getType("X").getFunction("fred2", new String[0]); - assertTrue("Method fred2 should be deprecated", Flags.isDeprecated(method.getFlags())); -} - -/* - * Ensures that the categories for a class are correct. - */ -public void testGetCategories01() throws CoreException { - createWorkingCopyComputingProblems( - "package p;\n" + - "/**\n" + - " * @category test\n" + - " */\n" + - "public class Y {\n" + - "}" - ); - String[] categories = this.workingCopy.getType("Y").getCategories(); - assertStringsEqual( - "Unexpected categories", - "test\n", - categories); -} - -/* - * Ensures that the categories for an interface are correct. - */ -public void testGetCategories02() throws CoreException { - createWorkingCopyComputingProblems( - "package p;\n" + - "/**\n" + - " * @category test\n" + - " */\n" + - "public interface Y {\n" + - "}" - ); - String[] categories = workingCopy.getType("Y").getCategories(); - assertStringsEqual( - "Unexpected categories", - "test\n", - categories); -} - -/* - * Ensures that the categories for an enumeration type are correct. - */ -public void testGetCategories03() throws CoreException { - createWorkingCopyComputingProblems( - "package p;\n" + - "/**\n" + - " * @category test\n" + - " */\n" + - "public enum Y {\n" + - "}" - ); - String[] categories = workingCopy.getType("Y").getCategories(); - assertStringsEqual( - "Unexpected categories", - "test\n", - categories); -} - -/* - * Ensures that the categories for an annotation type type are correct. - */ -public void testGetCategories04() throws CoreException { - createWorkingCopyComputingProblems( - "package p;\n" + - "/**\n" + - " * @category test\n" + - " */\n" + - "public @interface Y {\n" + - "}" - ); - String[] categories = workingCopy.getType("Y").getCategories(); - assertStringsEqual( - "Unexpected categories", - "test\n", - categories); -} - -/* - * Ensures that the categories for a method are correct. - */ -public void testGetCategories05() throws CoreException { - createWorkingCopyComputingProblems( - "package p;\n" + - "public class Y {\n" + - " /**\n" + - " * @category test\n" + - " */\n" + - " void foo() {}\n" + - "}" - ); - String[] categories = workingCopy.getType("Y").getFunction("foo", new String[0]).getCategories(); - assertStringsEqual( - "Unexpected categories", - "test\n", - categories); -} - -/* - * Ensures that the categories for a constructor are correct. - */ -public void testGetCategories06() throws CoreException { - createWorkingCopyComputingProblems( - "package p;\n" + - "public class Y {\n" + - " /**\n" + - " * @category test\n" + - " */\n" + - " public Y() {}\n" + - "}" - ); - String[] categories = workingCopy.getType("Y").getFunction("Y", new String[0]).getCategories(); - assertStringsEqual( - "Unexpected categories", - "test\n", - categories); -} - -/* - * Ensures that the categories for a field are correct. - */ -public void testGetCategories07() throws CoreException { - createWorkingCopyComputingProblems( - "package p;\n" + - "public class Y {\n" + - " /**\n" + - " * @category test\n" + - " */\n" + - " int field;\n" + - "}" - ); - String[] categories = workingCopy.getType("Y").getField("field").getCategories(); - assertStringsEqual( - "Unexpected categories", - "test\n", - categories); -} - -/* - * Ensures that the categories for a member type are correct. - */ -public void testGetCategories08() throws CoreException { - createWorkingCopyComputingProblems( - "package p;\n" + - "public class Y {\n" + - " /**\n" + - " * @category test\n" + - " */\n" + - " class Member {}\n" + - "}" - ); - String[] categories = workingCopy.getType("Y").getType("Member").getCategories(); - assertStringsEqual( - "Unexpected categories", - "test\n", - categories); -} - -/* - * Ensures that the categories for an element that has no categories is empty. - */ -public void testGetCategories09() throws CoreException { - createWorkingCopyComputingProblems( - "package p;\n" + - "public class Y {\n" + - " /**\n" + - " */\n" + - " void foo() {}\n" + - "}" - ); - String[] categories = workingCopy.getType("Y").getFunction("foo", new String[0]).getCategories(); - assertStringsEqual( - "Unexpected categories", - "", - categories); -} - -/* - * Ensures that the categories for an element that has multiple category tags is correct. - */ -public void testGetCategories10() throws CoreException { - createWorkingCopyComputingProblems( - "package p;\n" + - "public class Y {\n" + - " /**\n" + - " * @category test1\n" + - " * @category test2\n" + - " */\n" + - " void foo() {}\n" + - "}" - ); - String[] categories = workingCopy.getType("Y").getFunction("foo", new String[0]).getCategories(); - assertStringsEqual( - "Unexpected categories", - "test1\n" + - "test2\n", - categories); -} - -/* - * Ensures that the categories for an element that has multiple categories for one category tag is correct. - */ -public void testGetCategories11() throws CoreException { - createWorkingCopyComputingProblems( - "package p;\n" + - "public class Y {\n" + - " /**\n" + - " * @category test1 test2\n" + - " */\n" + - " void foo() {}\n" + - "}" - ); - String[] categories = workingCopy.getType("Y").getFunction("foo", new String[0]).getCategories(); - assertStringsEqual( - "Unexpected categories", - "test1\n" + - "test2\n", - categories); -} -public void testGetCategories12() throws CoreException { - createWorkingCopyComputingProblems( - "package p;\n" + - "public class Y {\n" + - " /**\n" + - " * @category test1 test2\n" + - " */\n" + - " void foo() {}\n" + - "}" - ); - String[] categories = this.workingCopy.getType("Y").getFunction("foo", new String[0]).getCategories(); - assertStringsEqual( - "Unexpected categories", - "test1\n" + - "test2\n", - categories); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=125676 -public void testGetCategories13() throws CoreException { - createWorkingCopyComputingProblems( - "package p;\n" + - "public class Y {\n" + - " /**\n" + - " * @category " + - " * test\n" + - " */\n" + - " void foo() {}\n" + - "}" - ); - String[] categories = this.workingCopy.getType("Y").getFunction("foo", new String[0]).getCategories(); - assertStringsEqual( - "Unexpected categories", - "", - categories); -} -public void testGetCategories14() throws CoreException { - createWorkingCopyComputingProblems( - "package p;\n" + - "public class Y {\n" + - " /**\n" + - " * @category" + - " * test\n" + - " */\n" + - " void foo() {}\n" + - "}" - ); - String[] categories = this.workingCopy.getType("Y").getFunction("foo", new String[0]).getCategories(); - assertStringsEqual( - "Unexpected categories", - "", - categories); -} -public void testGetCategories15() throws CoreException { - createWorkingCopyComputingProblems( - "package p;\n" + - "public class Y {\n" + - " /**\n" + - " * @category test1" + - " * test2\n" + - " */\n" + - " void foo() {}\n" + - "}" - ); - String[] categories = this.workingCopy.getType("Y").getFunction("foo", new String[0]).getCategories(); - assertStringsEqual( - "Unexpected categories", - "test1\n", - categories); -} - -/* - * Ensures that the children of a type for a given category are correct. - */ -public void testGetChildrenForCategory01() throws CoreException { - createWorkingCopyComputingProblems( - "package p;\n" + - "public class Y {\n" + - " /**\n" + - " * @category test\n" + - " */\n" + - " int field;\n" + - " /**\n" + - " * @category test\n" + - " */\n" + - " void foo1() {}\n" + - " /**\n" + - " * @category test\n" + - " */\n" + - " void foo2() {}\n" + - " /**\n" + - " * @category other\n" + - " */\n" + - " void foo3() {}\n" + - "}" - ); - IJavaScriptElement[] children = workingCopy.getType("Y").getChildrenForCategory("test"); - assertElementsEqual( - "Unexpected children", - "field [in Y [in [Working copy] Y.js [in p [in src [in P]]]]]\n" + - "foo1() [in Y [in [Working copy] Y.js [in p [in src [in P]]]]]\n" + - "foo2() [in Y [in [Working copy] Y.js [in p [in src [in P]]]]]", - children); -} - -/* - * Ensures that the children of a type for a given category are correct. - */ -public void testGetChildrenForCategory02() throws CoreException { - createWorkingCopyComputingProblems( - "package p;\n" + - "public class Y {\n" + - " /**\n" + - " * @category test1 test2\n" + - " */\n" + - " class Member {}\n" + - " /**\n" + - " * @category test1\n" + - " */\n" + - " void foo1() {}\n" + - " /**\n" + - " * @category test2\n" + - " */\n" + - " void foo2() {}\n" + - "}" - ); - IJavaScriptElement[] children = workingCopy.getType("Y").getChildrenForCategory("test1"); - assertElementsEqual( - "Unexpected children", - "Member [in Y [in [Working copy] Y.js [in p [in src [in P]]]]]\n" + - "foo1() [in Y [in [Working copy] Y.js [in p [in src [in P]]]]]", - children); -} -public void testGetChildrenForCategory03() throws CoreException, IOException { - createWorkingCopyComputingProblems( - "package p;\n" + - "public class Y {\n" + - " /**\n" + - " * @category fields test all\n" + - " */\n" + - " int field;\n" + - " /**\n" + - " * @category methods test all\n" + - " */\n" + - " void foo1() {}\n" + - " /**\n" + - " * @category methods test all\n" + - " */\n" + - " void foo2() {}\n" + - " /**\n" + - " * @category methods other all\n" + - " */\n" + - " void foo3() {}\n" + - "}" - ); - IJavaScriptElement[] tests = this.workingCopy.getType("Y").getChildrenForCategory("test"); - assertElementsEqual( - "Unexpected children", - "field [in Y [in [Working copy] Y.js [in p [in src [in P]]]]]\n" + - "foo1() [in Y [in [Working copy] Y.js [in p [in src [in P]]]]]\n" + - "foo2() [in Y [in [Working copy] Y.js [in p [in src [in P]]]]]", - tests); - IJavaScriptElement[] methods = this.workingCopy.getType("Y").getChildrenForCategory("methods"); - assertElementsEqual( - "Unexpected children", - "foo1() [in Y [in [Working copy] Y.js [in p [in src [in P]]]]]\n" + - "foo2() [in Y [in [Working copy] Y.js [in p [in src [in P]]]]]\n" + - "foo3() [in Y [in [Working copy] Y.js [in p [in src [in P]]]]]", - methods); - IJavaScriptElement[] others = this.workingCopy.getType("Y").getChildrenForCategory("other"); - assertElementsEqual( - "Unexpected children", - "foo3() [in Y [in [Working copy] Y.js [in p [in src [in P]]]]]", - others); - IJavaScriptElement[] all = this.workingCopy.getType("Y").getChildrenForCategory("all"); - assertElementsEqual( - "Unexpected children", - "field [in Y [in [Working copy] Y.js [in p [in src [in P]]]]]\n" + - "foo1() [in Y [in [Working copy] Y.js [in p [in src [in P]]]]]\n" + - "foo2() [in Y [in [Working copy] Y.js [in p [in src [in P]]]]]\n" + - "foo3() [in Y [in [Working copy] Y.js [in p [in src [in P]]]]]", - all); -} - -/** - * Ensures getContents() returns the correct value - * for a JavaScriptUnit that is not present - */ -public void testGetContentsForNotPresent() { - CompilationUnit compilationUnit = (CompilationUnit)getCompilationUnit("/P/src/p/Absent.js"); - - assertSourceEquals("Unexpected contents for non present cu", "", new String(compilationUnit.getContents())); -} -/** - * Tests Java element retrieval via source position - */ -public void testGetElementAt() throws JavaScriptModelException { - IField field = this.cu.getField( "f2"); - ISourceRange sourceRange= field.getSourceRange(); - //ensure that we are into the body of the type - IJavaScriptElement element= - this.cu.getElementAt(sourceRange.getOffset() + field.getElementName().length() + 1); - assertTrue("Should have found a type", element instanceof IField); - assertEquals( - "Should have found f2", - "f2", - element.getElementName()); - //ensure that null is returned if there is no element other than the compilation - //unit itself at the given position - element= this.cu.getElementAt(this.cu.getSourceRange().getOffset() + 1); - assertEquals("Should have not found any element", null, element); -} -///** -// * Tests import declararion retrieval via source position. -// * (regression test for bug 14331 IJavaScriptUnit.getElementAt dos not find import decl) -// */ -//public void testGetElementAt2() throws JavaScriptModelException { -// IImportContainer container = this.cu.getImportContainer(); -// ISourceRange sourceRange= container.getSourceRange(); -// //ensure that we are inside the import container -// IJavaScriptElement element= this.cu.getElementAt(sourceRange.getOffset() + 1); -// assertTrue("Should have found an import", element instanceof IImportDeclaration); -// assertEquals( -// "Import not found", -// "p2.*", -// element.getElementName()); -//} -/* - * Ensures that the right field is returnd in a muti-declaration field. - */ -public void testGetElementAt3() throws JavaScriptModelException { - int fieldPos = this.cu.getSource().indexOf("f5"); - IJavaScriptElement element= this.cu.getElementAt(fieldPos); - assertEquals( - "Unexpected field found", - this.cu.getField("f5"), - element); -} -/* - * Ensures that the right field is returnd in a muti-declaration field. - */ -public void testGetElementAt4() throws JavaScriptModelException { - int fieldPos = this.cu.getSource().indexOf("f6"); - IJavaScriptElement element= this.cu.getElementAt(fieldPos); - assertEquals( - "Unexpected field found", - this.cu.getField("f6"), - element); -} -/* - * Ensures that the right field is returnd in a muti-declaration field. - */ -public void testGetElementAt5() throws JavaScriptModelException { - int fieldPos = this.cu.getSource().indexOf("f7"); - IJavaScriptElement element= this.cu.getElementAt(fieldPos); - assertEquals( - "Unexpected field found", - this.cu.getField("f7"), - element); -} -/* - * Ensures that the right field is returned in a muti-declaration field. - */ -public void testGetElementAt6() throws JavaScriptModelException { - int fieldPos = this.cu.getSource().indexOf("var f5"); - IJavaScriptElement element= this.cu.getElementAt(fieldPos); - assertEquals( - "Unexpected field found", - this.cu.getField("f5"), - element); -} -///* -// * Ensures that the right type is returnd if an annotation type as a comment in its header. -// */ -//public void testGetElementAt7() throws JavaScriptModelException { -// int fieldPos = this.cu.getSource().indexOf("Annot"); -// IJavaScriptElement element= this.cu.getElementAt(fieldPos); -// assertEquals( -// "Unexpected type found", -// this.cu.getType("Annot"), -// element); -//} -/** - * Ensures that correct number of fields with the correct names, modifiers, signatures - * and declaring types exist in a type. - */ -public void testGetFields() throws JavaScriptModelException { -// IType type = this.cu.getType("X"); - IField[] fields= this.cu.getFields(); - String[] fieldNames = new String[] {"f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8"}; - String[] flags = new String[] {"public", "protected", "private", "", "", "", "", ""}; - String[] signatures = new String[] {"I", "QObject;", "QX;", "Qjava.lang.String;", "I", "I", "I", "I"}; - assertEquals("Wrong number of fields returned", fieldNames.length, fields.length); - for (int i = 0; i < fields.length; i++) { - assertEquals("Incorrect name for the " + i + " field", fieldNames[i], fields[i].getElementName()); -// String mod= Flags.toString(fields[i].getFlags()); -// assertEquals("Unexpected modifier for " + fields[i].getElementName(), flags[i], mod); -// assertEquals("Unexpected type signature for " + fields[i].getElementName(), signatures[i], fields[i].getTypeSignature()); -// assertEquals("Unexpected declaring type for " + fields[i].getElementName(), type, fields[i].getDeclaringType()); - assertTrue("Field should exist " + fields[i], fields[i].exists()); - } -} -///** -// * Ensure that import declaration handles are returned from the -// * compilation unit. -// * Checks non-existant handle, on demand and not. -// */ -//public void testGetImport() { -// IImportDeclaration imprt = this.cu.getImport("java.lang"); -// assertTrue("Import should not exist " + imprt, !imprt.exists()); -// -// imprt = this.cu.getImport("p2.*"); -// assertTrue("Import should exist " + imprt, imprt.exists()); -// -// imprt = this.cu.getImport("p3.Z"); -// assertTrue("Import should exist " + imprt, imprt.exists()); -//} -///** -// * Ensures that correct number of imports with the correct names -// * exist in "GraphicsTest" compilation unit. -// */ -//public void testGetImports() throws JavaScriptModelException { -// IImportDeclaration[] imprts = this.cu.getImports(); -// IImportContainer container= this.cu.getImportContainer(); -// String[] importNames = new String[] {"p2.*", "p3.Z"}; -// -// assertEquals("Wrong number of imports returned", importNames.length, imprts.length); -// for (int i = 0; i < imprts.length; i++) { -// assertTrue("Incorrect name for the type in this position: " + imprts[i].getElementName(), imprts[i].getElementName().equals(importNames[i])); -// assertTrue("Import does not exist " + imprts[i], imprts[i].exists()); -// if (i == 0) { -// assertTrue("Import is not on demand " + imprts[i], imprts[i].isOnDemand()); -// assertTrue("Import should be non-static " + imprts[i], imprts[i].getFlags() == Flags.AccDefault); -// } else { -// assertTrue("Import is on demand " + imprts[i], !imprts[i].isOnDemand()); -// assertTrue("Import should be non-static " + imprts[i], imprts[i].getFlags() == Flags.AccDefault); -// } -// assertTrue("Container import does not equal import", container.getImport(imprts[i].getElementName()).equals(imprts[i])); -// } -// -// assertTrue("Import container must exist and have children", container.exists() && container.hasChildren()); -// ISourceRange containerRange= container.getSourceRange(); -// assertEquals( -// "Offset container range not correct", -// imprts[0].getSourceRange().getOffset(), -// containerRange.getOffset()); -// assertEquals( -// "Length container range not correct", -// imprts[imprts.length-1].getSourceRange().getOffset() + imprts[imprts.length-1].getSourceRange().getLength(), -// containerRange.getOffset() + containerRange.getLength()); -// assertSourceEquals("Source not correct", -// "import p2.*;\n" + -// "import p3.Z;", -// container.getSource()); -// -//} -/** - * Ensure that type handles are returned from the - * compilation unit for an inner type. - */ -//public void testGetInnerTypes() throws JavaScriptModelException { -// IType type1 = cu.getType("X"); -// assertTrue("X type should have children", type1.hasChildren()); -// assertTrue("X type superclass name should be null", type1.getSuperclassName() == null); -// String[] superinterfaceNames= type1.getSuperInterfaceNames(); -// assertEquals("X type should have one superinterface", 1, superinterfaceNames.length); -// assertEquals("Unexpected super interface name", "Runnable", superinterfaceNames[0]); -// assertEquals("Fully qualified name of the type is incorrect", "p.X", type1.getFullyQualifiedName()); -// IType type2 = type1.getType("Inner"); -// superinterfaceNames = type2.getSuperInterfaceNames(); -// assertEquals("X$Inner type should not have a superinterface", 0, superinterfaceNames.length); -// assertEquals("Fully qualified name of the inner type is incorrect", "p.X$Inner", type2.getFullyQualifiedName()); -// assertEquals("Declaring type of the inner type is incorrect", type1, type2.getDeclaringType()); -// IType type3 = type2.getType("InnerInner"); -// assertTrue("InnerInner type should not have children", !type3.hasChildren()); -//} -/* - * Ensures that the key for a top level type is correct - */ -public void testGetKey1() { -// IType type = this.cu.getType("X"); -// assertEquals("Lp/X;", type.getKey()); - IField type = this.cu.getField("f2"); - assertEquals("Up/X.js;.f2", type.getKey()); -} -/* - * Ensures that the key for a member type is correct - */ -public void testGetKey2() { - IType type = this.cu.getType("X").getType("Inner"); - assertEquals("Lp/X$Inner;", type.getKey()); -} -/* - * Ensures that the key for a secondary type is correct - */ -public void testGetKey3() { - IType type = this.cu.getType("I"); - assertEquals("Lp/X~I;", type.getKey()); -} -/* - * Ensures that the key for an anonymous type is correct - */ -public void testGetKey4() { - IType type = this.cu.getType("X").getFunction("foo", new String[0]).getType("", 1); - assertEquals("Lp/X$1;", type.getKey()); -} -/** - * Ensures that a method has the correct return type, parameters and exceptions. - */ -public void testGetMethod1() throws JavaScriptModelException { -// IType type = this.cu.getType("X"); - IFunction foo = this.cu.getFunction("foo", new String[]{null}); -// String[] exceptionTypes= foo.getExceptionTypes(); -// assertEquals("Wrong number of exception types", 1, exceptionTypes.length); -// assertEquals("Unxepected exception type", "QIOException;", exceptionTypes[0]); -// assertEquals("Wrong return type", "V", foo.getReturnType()); - String[] parameterNames = foo.getParameterNames(); - assertEquals("Wrong number of parameter names", 1, parameterNames.length); - assertEquals("Unexpected parameter name", "y", parameterNames[0]); -} -///** -// * Ensures that a method has the correct AccVarargs flag set. -// */ -//public void testGetMethod2() throws JavaScriptModelException { -// IType type = this.cu.getType("X"); -// IFunction method = type.getMethod("testIsVarArgs", new String[]{"QString;", "[QObject;"}); -// assertTrue("Should have the AccVarargs flag set", Flags.isVarargs(method.getFlags())); -//} -///** -// * Ensures that a constructor has the correct AccVarargs flag set. -// * (regression test for bug 77422 [1.5] ArrayIndexOutOfBoundsException with vararg constructor of generic superclass) -// */ -//public void testGetMethod3() throws JavaScriptModelException { -// IType type = this.cu.getType("X"); -// IFunction method = type.getMethod("X", new String[]{"[QString;"}); -// assertTrue("Should have the AccVarargs flag set", Flags.isVarargs(method.getFlags())); -//} -/** - * Ensures that correct number of methods with the correct names and modifiers - * exist in a type. - */ -public void testGetMethods() throws JavaScriptModelException { -// IType type = this.cu.getType("X"); - IFunction[] methods= this.cu.getFunctions(); - String[] methodNames = new String[] {"foo", "bar", "fred", "fred2"}; - String[] flags = new String[] {"public", "protected static", "private", "private"}; - assertEquals("Wrong number of methods returned", methodNames.length, methods.length); - for (int i = 0; i < methods.length; i++) { - assertEquals("Incorrect name for the " + i + " method", methodNames[i], methods[i].getElementName()); - int modifiers = methods[i].getFlags() & ~Flags.AccVarargs; -// String mod= Flags.toString(modifiers); -// assertEquals("Unexpected modifier for " + methods[i].getElementName(), flags[i], mod); - assertTrue("Method does not exist " + methods[i], methods[i].exists()); - } -} -///** -// * Ensures that correct modifiers are reported for a method in an interface. -// */ -//public void testCheckInterfaceMethodModifiers() throws JavaScriptModelException { -// IType type = this.cu.getType("I"); -// IFunction method = type.getMethod("run", new String[0]); -// String expectedModifiers = ""; -// String modifiers = Flags.toString(method.getFlags() & ~Flags.AccVarargs); -// assertEquals("Expected modifier for " + method.getElementName(), expectedModifiers, modifiers); -//} -///* -// * Ensures that IType#getSuperInterfaceTypeSignatures() is correct for a source type. -// */ -//public void testGetSuperInterfaceTypeSignatures() throws JavaScriptModelException { -// IType type = this.cu.getType("Y"); -// assertStringsEqual( -// "Unexpected signatures", -// "QI2;\n", -// type.getSuperInterfaceTypeSignatures()); -//} -/** - * Ensure that the same element is returned for the primary element of a - * compilation unit. - */ -public void testGetPrimary() { - IJavaScriptElement primary = this.cu.getPrimaryElement(); - assertEquals("Primary element for a compilation unit should be the same", this.cu, primary); - primary = this.cu.getPrimary(); - assertEquals("Primary for a compilation unit should be the same", this.cu, primary); - -} -///////* -////// * Ensures that the occurrence count for an initializer is correct -////// */ -//////public void testGetOccurrenceCount01() { -////// IInitializer initializer = this.cu.getType("X").getInitializer(2); -////// assertEquals("Unexpected occurrence count", 2, initializer.getOccurrenceCount()); -//////} -/////* -//// * Ensures that the occurrence count for an anonymous type is correct -//// */ -////public void testGetOccurrenceCount02() { -//// IType type = this.cu.getType("X").getMethod("foo", new String[]{"QY;"}).getType("", 3); -//// assertEquals("Unexpected occurrence count", 3, type.getOccurrenceCount()); -////} -///** -// * Ensures that correct number of package declarations with the correct names -// * exist a compilation unit. -// */ -//public void testGetPackages() throws JavaScriptModelException { -// IPackageDeclaration[] packages = this.cu.getPackageDeclarations(); -// String packageName = "p"; -// assertEquals("Wrong number of packages returned", 1, packages.length); -// assertEquals("Wrong package declaration returned: ", packageName, packages[0].getElementName()); -//} -/** - * Ensure that type handles are returned from the - * compilation unit. - * Checks non-existant handle and existing handles. - */ -public void testGetType() { - IField type = this.cu.getField("someType"); - assertTrue("Type should not exist " + type, !type.exists()); - - type = this.cu.getField("f2"); - assertTrue("Type should exist " + type, type.exists()); - -// type = this.cu.getType("I"); // secondary type -// assertTrue("Type should exist " + type, type.exists()); -} -///** -// * Ensures that correct number of types with the correct names and modifiers -// * exist in a compilation unit. -// */ -//public void testGetTypes() throws JavaScriptModelException { -// IType[] types = this.cu.getTypes(); -// String[] typeNames = new String[] {"X", "I", "I2", "I3", "Y", "Colors", "Annot"}; -// String[] flags = new String[] {"public", "", "", "", "", "", ""}; -// boolean[] isClass = new boolean[] {true, false, false, false, true, false, false}; -// boolean[] isInterface = new boolean[] {false, true, true, true, false, false, true}; -// boolean[] isAnnotation = new boolean[] {false, false, false, false, false, false, true}; -// boolean[] isEnum = new boolean[] {false, false, false, false, false, true, false}; -// String[] superclassName = new String[] {null, null, null, null, null, null, null}; -// String[] superclassType = new String[] {null, null, null, null, null, null, null}; -// String[][] superInterfaceNames = new String[][] { -// new String[] {"Runnable"}, new String[0], new String[0], new String[0], new String[] {"I2"}, new String[0], new String[0] -// }; -// String[][] superInterfaceTypes = new String[][] { -// new String[] {"QRunnable;"}, new String[0], new String[0], new String[0], new String[] {"QI2;"}, new String[0], new String[0] -// }; -// String[][] formalTypeParameters = new String[][] { -// new String[0], new String[0], new String[] {"E"}, new String[0], new String[] {"E"}, new String[0], new String[0] -// }; -// -// assertEquals("Wrong number of types returned", typeNames.length, types.length); -// for (int i = 0; i < types.length; i++) { -// assertEquals("Incorrect name for the " + i + " type", typeNames[i], types[i].getElementName()); -// String mod= Flags.toString(types[i].getFlags()); -// assertEquals("Unexpected modifier for " + types[i].getElementName(), flags[i], mod); -// assertTrue("Type does not exist " + types[i], types[i].exists()); -// assertEquals("Incorrect isClass for the " + i + " type", isClass[i], types[i].isClass()); -// assertEquals("Incorrect isInterface for the " + i + " type", isInterface[i], types[i].isInterface()); -// assertEquals("Incorrect isAnnotation for the " + i + " type", isAnnotation[i], types[i].isAnnotation()); -// assertEquals("Incorrect isEnum for the " + i + " type", isEnum[i], types[i].isEnum()); -// assertEquals("Incorrect superclassName for the " + i + " type", superclassName[i], types[i].getSuperclassName()); -// assertEquals("Incorrect superclassType for the " + i + " type", superclassType[i], types[i].getSuperclassTypeSignature()); -// assertEquals("Incorrect superInterfaceNames for the " + i + " type", superInterfaceNames[i].length, types[i].getSuperInterfaceNames().length); -// assertEquals("Incorrect superInterfaceTypes for the " + i + " type", superInterfaceTypes[i].length, types[i].getSuperInterfaceTypeSignatures().length); -// assertEquals("Incorrect formalTypeParameters for the " + i + " type", formalTypeParameters[i].length, types[i].getTypeParameters().length); -// } -//} -/** - * Ensures that a compilation unit has children. - */ -public void testHasChildren() throws JavaScriptModelException { - this.cu.close(); - assertTrue("A closed compilation unit should have children", this.cu.hasChildren()); - this.cu.getChildren(); - assertTrue("The compilation unit should have children", this.cu.hasChildren()); -} -/** - * Ensures that a compilation unit's resource has not changed. - */ -public void testHasResourceChanged() { - assertTrue( - "A compilation unit's resource should not have changed", - !this.cu.hasResourceChanged()); -} -///* -// * Ensures that hasChildren doesn't return true for an import container that doesn't exist -// * (regression test for bug 76761 [model] ImportContainer.hasChildren() should not return true -// */ -//public void testImportContainerHasChildren() throws JavaScriptModelException { -// IImportContainer importContainer = getCompilationUnit("/Test/DoesNotExist.js").getImportContainer(); -// boolean gotException = false; -// try { -// importContainer.hasChildren(); -// } catch (JavaScriptModelException e) { -// gotException = e.isDoesNotExist(); -// } -// assertTrue("Should get a not present exception", gotException); -//} -///* -// * Ensures that isEnumConstant returns true for a field representing an enum constant. -// */ -//public void testIsEnumConstant1() throws JavaScriptModelException { -// IField field = this.cu.getType("Colors").getField("BLUE"); -// assertTrue("Colors#BLUE should be an enum constant", field.isEnumConstant()); -//} -///* -// * Ensures that isEnumConstant returns false for a field that is not representing an enum constant. -// */ -//public void testIsEnumConstant2() throws JavaScriptModelException { -// IField field = this.cu.getType("X").getField("f1"); -// assertTrue("X#f1 should not be an enum constant", !field.isEnumConstant()); -//} -/* - * Ensure that the utility method Util.#getNameWithoutJavaLikeExtension(String) works as expected - * (regression test for bug 107735 StringIndexOutOfBoundsException in Util.getNameWithoutJavaLikeExtension()) - */ -public void testNameWithoutJavaLikeExtension() { - String name = Util.getNameWithoutJavaLikeExtension("Test.aj"); - assertEquals("Unepected name without extension", "Test.aj", name); -} -/** - * Ensures that a compilation unit that does not exist responds - * false to #exists() and #isOpen() - */ -public void testNotPresent1() { - IJavaScriptUnit compilationUnit = ((IPackageFragment)this.cu.getParent()).getJavaScriptUnit("DoesNotExist.js"); - assertTrue("CU should not be open", !compilationUnit.isOpen()); - assertTrue("CU should not exist", !compilationUnit.exists()); - assertTrue("CU should still not be open", !compilationUnit.isOpen()); -} -///** -// * Ensures that a compilation unit that does not exist -// * (because it is a child of a jar package fragment) -// * responds false to #exists() and #isOpen() -// * (regression test for PR #1G2RKD2) -// */ -//public void testNotPresent2() throws CoreException { -// IJavaScriptUnit compilationUnit = getPackageFragment("P", getExternalJCLPathString(), "java.lang").getCompilationUnit("DoesNotExist.js"); -// assertTrue("CU should not be open", !compilationUnit.isOpen()); -// assertTrue("CU should not exist", !compilationUnit.exists()); -// assertTrue("CU should still not be open", !compilationUnit.isOpen()); -//} - -/* - * Ensure that the absence of visibility flags is correctly reported as package default - * (regression test fo bug 127213 Flags class missing methods) - */ -public void testPackageDefaultFlag1() throws JavaScriptModelException { - IField field = this.cu.getField("f4"); - assertTrue("X#f4 should be package default", Flags.isPackageDefault(field.getFlags())); -} - -///* -// * Ensure that the presence of a visibility flags is correctly reported as non package default -// * (regression test fo bug 127213 Flags class missing methods) -// */ -//public void testPackageDefaultFlag2() throws JavaScriptModelException { -// IType type = this.cu.getType("X"); -// assertTrue("X should not be package default", !Flags.isPackageDefault(type.getFlags())); -//} - -/* - * Ensure that the presence of a visibility flags as well as the deprecated flag is correctly reported as non package default - * (regression test fo bug 127213 Flags class missing methods) - */ -public void testPackageDefaultFlag3() throws JavaScriptModelException { - IField field = this.cu.getType("X").getField("f2"); - assertTrue("X#f2 should not be package default", !Flags.isPackageDefault(field.getFlags())); -} - -/* - * Ensure that the absence of a visibility flags and the presence of the deprecated flag is correctly reported as package default - * (regression test fo bug 127213 Flags class missing methods) - */ -public void testPackageDefaultFlag4() throws JavaScriptModelException { - IType type = this.cu.getType("I"); - assertTrue("X should be package default", Flags.isPackageDefault(type.getFlags())); -} - -/** - * Ensures that the "structure is known" flag is set for a valid compilation unit. - */ -public void testStructureKnownForCU() throws JavaScriptModelException { - assertTrue("Structure is unknown for valid CU", this.cu.isStructureKnown()); -} -/** - * Ensures that the "structure is unknown" flag is set for a non valid compilation unit. - */ -public void testStructureUnknownForCU() throws CoreException { - try { - this.createFile( - "/P/src/p/Invalid.js", - "@#D(03"); - IJavaScriptUnit badCU = getCompilationUnit("/P/src/p/Invalid.js"); - assertTrue("Structure is known for an invalid CU", !badCU.isStructureKnown()); - } finally { - this.deleteFile("/P/src/p/Invalid.js"); - } -} - -///* -// * Ensure that the super flags is correctly reported -// * (regression test fo bug 127213 Flags class missing methods) -// */ -//public void testSuperFlag1() throws JavaScriptModelException { -// assertTrue("Should contain super flag", Flags.isSuper(Flags.AccSuper)); -//} -// -///* -// * Ensure that the super flags is correctly reported -// * (regression test fo bug 127213 Flags class missing methods) -// */ -//public void testSuperFlag2() throws JavaScriptModelException { -// assertTrue("Should not contain super flag", !Flags.isSuper(Flags.AccDefault)); -//} - -///* -// * Verify fix for bug 73884: [1.5] Unexpected error for class implementing generic interface -// * (see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=73884) -// */ -//public void testBug73884() throws CoreException { -// try { -// String cuSource = -// "package p;\n" + -// "public interface I {\n" + -// "}"; -// createFile("/P/src/p/I.js", cuSource); -// ITypeParameter[] typeParameters = getCompilationUnit("/P/src/p/I.js").getType("I").getTypeParameters(); -// assertTypeParametersEqual( -// "T\n", -// typeParameters); -// } finally { -// deleteFile("/P/src/p/I.js"); -// } -//} - -///* -// * Ensure that the type parameters for a type are correct. -// */ -//public void testTypeParameter1() throws CoreException { -// createWorkingCopy( -// "package p;\n" + -// "public class Y {\n" + -// "}" -// ); -// ITypeParameter[] typeParameters = workingCopy.getType("Y").getTypeParameters(); -// assertTypeParametersEqual( -// "T\n", -// typeParameters); -//} -// -///* -// * Ensure that the type parameters for a type are correct. -// */ -//public void testTypeParameter2() throws CoreException { -// createWorkingCopy( -// "package p;\n" + -// "public class Y {\n" + -// "}" -// ); -// ITypeParameter[] typeParameters = workingCopy.getType("Y").getTypeParameters(); -// assertTypeParametersEqual( -// "T\n" + -// "U\n", -// typeParameters); -//} -// -///* -// * Ensure that the type parameters for a type are correct. -// */ -//public void testTypeParameter3() throws CoreException { -// createWorkingCopy( -// "package p;\n" + -// "public class Y {\n" + -// "}" -// ); -// ITypeParameter[] typeParameters = workingCopy.getType("Y").getTypeParameters(); -// assertTypeParametersEqual( -// "T extends List\n", -// typeParameters); -//} -// -///* -// * Ensure that the type parameters for a type are correct. -// */ -//public void testTypeParameter4() throws CoreException { -// createWorkingCopy( -// "package p;\n" + -// "public class Y {\n" + -// "}" -// ); -// ITypeParameter[] typeParameters = workingCopy.getType("Y").getTypeParameters(); -// assertTypeParametersEqual( -// "T extends List & Runnable & Comparable\n", -// typeParameters); -//} -// -///* -// * Ensure that the type parameters for a method are correct. -// * (regression test for bug 75658 [1.5] SourceElementParser do not compute correctly bounds of type parameter) -// */ -//public void testTypeParameter5() throws CoreException { -// createWorkingCopy( -// "package p;\n" + -// "public class Y {\n" + -// " void foo() {\n" + -// " }\n" + -// "}" -// ); -// ITypeParameter[] typeParameters = workingCopy.getType("Y").getMethod("foo", new String[]{}).getTypeParameters(); -// assertTypeParametersEqual( -// "T extends List\n" + -// "U extends X & Runnable\n", -// typeParameters); -//} -// -///* -// * Verify fix for bug 78275: [recovery] NPE in GoToNextPreviousMemberAction with syntax error -// * (see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=78275) -// */ -//public void testBug78275() throws CoreException { -// try { -// String cuSource = -// " function a() {\n" + -// " }\n" + -// " }\n" + -// " function m() {}\n" + -// ""; -// createFile("/P/src/X.js", cuSource); -// IType type = getCompilationUnit("/P/src/X.js").getType("X"); -// IInitializer[] initializers = type.getInitializers(); -// assertEquals("Invalid number of initializers", 1, initializers.length); -// assertTrue("Invalid length for initializer", initializers[0].getSourceRange().getLength() > 0); -// } finally { -// deleteFile("/P/src/X.js"); -// } -//} -public void test110172() throws CoreException { - try { - String source = - " /**\n" + - " * Javadoc for field f \n" + - " */\n" + - " var f;\n" + - " \n" + - " /**\n" + - " * Javadoc for method foo\n" + - " */\n" + - " function foo( i, l, s) {\n" + - " }\n" + - " \n" + - " /**\n" + - " * Javadoc for member type A\n" + - " */\n" + - " \n" + - " /**\n" + - " * Javadoc for f3\n" + - " */\n" + - " /*\n" + - " * Not a javadoc comment\n" + - " */\n" + - " /**\n" + - " * Real javadoc for f3\n" + - " */\n" + - " var f3;\n" + - " \n" + - " var f2;\n" + - " \n" + - " function foo2() {\n" + - " }\n" + - " \n" + - "\n" + - ""; - createFile("/P/src/X.js", source); -// IType type = getCompilationUnit("/P/src/X.js").getType("X"); - IJavaScriptElement[] members = getCompilationUnit("/P/src/X.js").getChildren(); - final int length = members.length; - assertEquals("Wrong number", 5, length); - for (int i = 0; i < length; i++) { - final IJavaScriptElement 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); - } else if (element instanceof IInitializer) { - IInitializer initializer = (IInitializer) element; - if (Flags.isStatic(initializer.getFlags())) { - 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("initializer") != -1); - } else { - assertNull("Has a javadoc source range", javadocRange); - } - } - } - } finally { - deleteFile("/P/src/X.js"); - } -} -public void test120902() throws CoreException { - try { - String source = - "/**\r\n" + - " * Toy\r\n" + - " */\r\n" + - "function foo() {\r\n" + - "}"; - createFile("/P/src/X.js", source); - final IJavaScriptUnit compilationUnit = getCompilationUnit("/P/src/X.js"); - IFunction type = compilationUnit.getFunction("foo",null); - ISourceRange javadocRange = type.getJSdocRange(); - assertNotNull("No source range", javadocRange); - compilationUnit.getBuffer().setContents(""); - try { - javadocRange = type.getJSdocRange(); - assertNull("Got a source range", javadocRange); - } catch (ArrayIndexOutOfBoundsException e) { - assertFalse("Should not happen", true); - } - } finally { - deleteFile("/P/src/X.js"); - } -} -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionContextTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionContextTests.java deleted file mode 100644 index e76d77b..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionContextTests.java +++ /dev/null @@ -1,3385 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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 org.eclipse.wst.jsdt.internal.codeassist.RelevanceConstants; -import org.eclipse.wst.jsdt.core.*; - -import junit.framework.*; - -public class CompletionContextTests extends AbstractJavaModelCompletionTests implements RelevanceConstants { - -public CompletionContextTests(String name) { - super(name); -} -public void setUpSuite() throws Exception { - if (COMPLETION_PROJECT == null) { - COMPLETION_PROJECT = setUpJavaProject("Completion", "1.4"); - } else { - setUpProjectCompliance(COMPLETION_PROJECT, "1.4"); - } - super.setUpSuite(); -} - -public static Test suite() { - return buildModelTestSuite(CompletionContextTests.class); -} -public void test0001() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0001/X.js", - "function X(){\n" + - " ZZZZ\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0002() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0002/X.js", - "function X() {\n" + - " ZZZZ\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ"); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0003() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0003/X.js", - "function X() {\n" + - " ZZZZ\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0004() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0004/X.js", - "function X() {\n" + - " /**/\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("/**/") + "/**/".length(); - int tokenEnd = tokenStart + "".length() - 1; - int cursorLocation = str.lastIndexOf("/**/") + "/**/".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -//public void test0005() throws JavaScriptModelException { -// this.workingCopies = new IJavaScriptUnit[1]; -// this.workingCopies[0] = getWorkingCopy( -// "/Completion/src3/test0005/X.js", -// "package test0005;\n" + -// "public class X {\n" + -// " ZZZZ foo()\n" + -// "}"); -// -// String str = this.workingCopies[0].getSource(); -// int tokenStart = str.lastIndexOf("ZZZZ"); -// int tokenEnd = tokenStart + "ZZZZ".length() - 1; -// int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); -// -// CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); -// -// assertResults( -// "completion offset="+(cursorLocation)+"\n" + -// "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + -// "completion token=\"ZZZZ\"\n" + -// "completion token kind=TOKEN_KIND_NAME\n" + -// "expectedTypesSignatures=null\n" + -// "expectedTypesKeys=null", -// result.context); -//} -//public void test0006() throws JavaScriptModelException { -// this.workingCopies = new IJavaScriptUnit[1]; -// this.workingCopies[0] = getWorkingCopy( -// "/Completion/src3/test0006/X.js", -// "package test0006;\n" + -// "public class X {\n" + -// " ZZZZ foo()\n" + -// "}"); -// -// String str = this.workingCopies[0].getSource(); -// int tokenStart = str.lastIndexOf("ZZZZ"); -// int tokenEnd = tokenStart + "ZZZZ".length() - 1; -// int cursorLocation = str.lastIndexOf("ZZZZ"); -// -// CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); -// -// assertResults( -// "completion offset="+(cursorLocation)+"\n" + -// "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + -// "completion token=\"\"\n" + -// "completion token kind=TOKEN_KIND_NAME\n" + -// "expectedTypesSignatures=null\n" + -// "expectedTypesKeys=null", -// result.context); -//} -//public void test0007() throws JavaScriptModelException { -// this.workingCopies = new IJavaScriptUnit[1]; -// this.workingCopies[0] = getWorkingCopy( -// "/Completion/src3/test0007/X.js", -// "package test0007;\n" + -// "public class X {\n" + -// " ZZZZ foo()\n" + -// "}"); -// -// String str = this.workingCopies[0].getSource(); -// int tokenStart = str.lastIndexOf("ZZZZ"); -// int tokenEnd = tokenStart + "ZZZZ".length() - 1; -// int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); -// -// CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); -// -// assertResults( -// "completion offset="+(cursorLocation)+"\n" + -// "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + -// "completion token=\"ZZ\"\n" + -// "completion token kind=TOKEN_KIND_NAME\n" + -// "expectedTypesSignatures=null\n" + -// "expectedTypesKeys=null", -// result.context); -//} -public void test0008() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0008/X.js", - " /**/ function foo()\n" + - ""); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("/**/") + "/**/".length(); - int tokenEnd = tokenStart + "".length() - 1; - int cursorLocation = str.lastIndexOf("/**/") + "/**/".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -//public void test0009() throws JavaScriptModelException { -// this.workingCopies = new IJavaScriptUnit[1]; -// this.workingCopies[0] = getWorkingCopy( -// "/Completion/src3/test0009/X.js", -// "package test0009;\n" + -// "public class X {\n" + -// " void foo() {\n" + -// " ZZZZ\n" + -// " }\n" + -// "}"); -// -// String str = this.workingCopies[0].getSource(); -// int tokenStart = str.lastIndexOf("ZZZZ"); -// int tokenEnd = tokenStart + "ZZZZ".length() - 1; -// int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); -// -// CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); -// -// assertResults( -// "completion offset="+(cursorLocation)+"\n" + -// "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + -// "completion token=\"ZZZZ\"\n" + -// "completion token kind=TOKEN_KIND_NAME\n" + -// "expectedTypesSignatures=null\n" + -// "expectedTypesKeys=null", -// result.context); -//} -public void test0010() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0010/X.js", - "package test0010;\n" + - "public class X {\n" + - " void foo() {\n" + - " ZZZZ\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ"); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0011() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0011/X.js", - "package test0011;\n" + - "public class X {\n" + - " void foo() {\n" + - " ZZZZ\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0012() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0012/X.js", - "package test0012;\n" + - "public class X {\n" + - " void foo() {\n" + - " /**/\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("/**/") + "/**/".length(); - int tokenEnd = tokenStart + "".length() - 1; - int cursorLocation = str.lastIndexOf("/**/") + "/**/".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0013() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0013/X.js", - "package test0013;\n" + - "public class X extends ZZZZ {\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0014() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0014/X.js", - "package test0014;\n" + - "public class X extends ZZZZ {\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ"); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0015() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0015/X.js", - "package test0015;\n" + - "public class X extends ZZZZ {\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0016() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0016/X.js", - "package test0016;\n" + - "public class X extends /**/ {\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("/**/") + "/**/".length(); - int tokenEnd = tokenStart + "".length() - 1; - int cursorLocation = str.lastIndexOf("/**/") + "/**/".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0017() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/test0017/YYYY.js", - "package test0017;\n" + - "public class YYYY {\n" + - " public class ZZZZ {\n" + - " }\n" + - "}"); - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0017/X.js", - "package test0017;\n" + - "public class X {\n" + - " void foo() {\n" + - " YYYY.ZZZZ\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0018() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/test0018/YYYY.js", - "package test0018;\n" + - "public class YYYY {\n" + - " public class ZZZZ {\n" + - " }\n" + - "}"); - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0018/X.js", - "package test0018;\n" + - "public class X {\n" + - " void foo() {\n" + - " YYYY.ZZZZ\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ"); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0019() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/test0019/YYYY.js", - "package test0019;\n" + - "public class YYYY {\n" + - " public class ZZZZ {\n" + - " }\n" + - "}"); - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0019/X.js", - "package test0019;\n" + - "public class X {\n" + - " void foo() {\n" + - " YYYY.ZZZZ\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0020() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/test0020/YYYY.js", - "package test0020;\n" + - "public class YYYY {\n" + - " public class ZZZZ {\n" + - " }\n" + - "}"); - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0020/X.js", - "package test0020;\n" + - "public class X {\n" + - " void foo() {\n" + - " YYYY.\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("YYYY.") + "YYYY.".length(); - int tokenEnd = tokenStart + "".length() - 1; - int cursorLocation = str.lastIndexOf("YYYY.") + "YYYY.".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0021() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0021/X.js", - "package test0021;\n" + - "public class X {\n" + - " void foo() {\n" + - " test0021.ZZZZ\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0022() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0022/X.js", - "package test0022;\n" + - "public class X {\n" + - " void foo() {\n" + - " test0022.ZZZZ\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ"); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0023() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0023/X.js", - "package test0023;\n" + - "public class X {\n" + - " void foo() {\n" + - " test0023.ZZZZ\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0024() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0024/X.js", - "package test0024;\n" + - "public class X {\n" + - " void foo() {\n" + - " test0024.\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("test0024.") + "test0024.".length(); - int tokenEnd = tokenStart + "".length() - 1; - int cursorLocation = str.lastIndexOf("test0024.") + "test0024.".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0025() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0025/X.js", - "package test0025;\n" + - "public class X {\n" + - " Object var;\n" + - " void foo() {\n" + - " var.ZZZZ\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0026() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0026/X.js", - "package test0026;\n" + - "public class X {\n" + - " Object var;\n" + - " void foo() {\n" + - " var.ZZZZ\n" + - " }\n" + - "}"); - - - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ"); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0027() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0027/X.js", - "package test0027;\n" + - "public class X {\n" + - " Object var;\n" + - " void foo() {\n" + - " var.ZZZZ\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0028() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0028/X.js", - "package test0028;\n" + - "public class X {\n" + - " Object var;\n" + - " void foo() {\n" + - " var.\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("var.") + "var.".length(); - int tokenEnd = tokenStart + "".length() - 1; - int cursorLocation = str.lastIndexOf("var.") + "var.".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0029() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/test0029/YYYY.js", - "package test0029;\n" + - "public class YYYY {\n" + - " public class ZZZZ {\n" + - " }\n" + - "}"); - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0029/X.js", - "package test0029;\n" + - "public class X extends YYYY.ZZZZ {\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0030() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/test0030/YYYY.js", - "package test0030;\n" + - "public class YYYY {\n" + - " public class ZZZZ {\n" + - " }\n" + - "}"); - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0030/X.js", - "package test0030;\n" + - "public class X extends YYYY.ZZZZ {\n" + - "}"); - - - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ"); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0031() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/test0031/YYYY.js", - "package test0031;\n" + - "public class YYYY {\n" + - " public class ZZZZ {\n" + - " }\n" + - "}"); - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0031/X.js", - "package test0031;\n" + - "public class X extends YYYY.ZZZZ {\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0032() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/test0032/YYYY.js", - "package test0032;\n" + - "public class YYYY {\n" + - " public class ZZZZ {\n" + - " }\n" + - "}"); - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0032/X.js", - "package test0032;\n" + - "public class X extends YYYY. {\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("YYYY.") + "YYYY.".length(); - int tokenEnd = tokenStart + "".length() - 1; - int cursorLocation = str.lastIndexOf("YYYY.") + "YYYY.".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0033() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0033/X.js", - "package test0033;\n" + - "public class X extends test0033.ZZZZ {\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0034() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0034/X.js", - "package test0034;\n" + - "public class X extends test0034.ZZZZ {\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ"); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0035() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0035/X.js", - "package test0035;\n" + - "public class X extends test0035.ZZZZ {\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0036() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0036/X.js", - "package test0036;\n" + - "public class X extends test0036. {\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("test0036.") + "test0036.".length(); - int tokenEnd = tokenStart + "".length() - 1; - int cursorLocation = str.lastIndexOf("test0036.") + "test0036.".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0037() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0037/X.js", - "package test0037;\n" + - "public class X {\n" + - " X ZZZZ;\n" + - " X foo(){\n" + - " foo().ZZZZ\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0038() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0038/X.js", - "package test0038;\n" + - "public class X {\n" + - " X ZZZZ;\n" + - " X foo(){\n" + - " foo().ZZZZ\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ"); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0039() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0039/X.js", - "package test0039;\n" + - "public class X {\n" + - " X ZZZZ;\n" + - " X foo(){\n" + - " foo().ZZZZ\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0040() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0040/X.js", - "package test0040;\n" + - "public class X {\n" + - " X ZZZZ;\n" + - " X foo(){\n" + - " foo().\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("foo().") + "foo().".length(); - int tokenEnd = tokenStart + "".length() - 1; - int cursorLocation = str.lastIndexOf("foo().") + "foo().".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0041() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0041/X.js", - "package test0041;\n" + - "public class X {\n" + - " X ZZZZ;\n" + - " X foo(){\n" + - " int.ZZZZ\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0042() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0042/X.js", - "package test0042;\n" + - "public class X {\n" + - " X ZZZZ;\n" + - " X foo(){\n" + - " int.ZZZZ\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ"); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0043() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0043/X.js", - "package test0043;\n" + - "public class X {\n" + - " X ZZZZ;\n" + - " X foo(){\n" + - " int.ZZZZ\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0044() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0044/X.js", - "package test0044;\n" + - "public class X {\n" + - " X ZZZZ;\n" + - " X foo(){\n" + - " int.\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("int.") + "int.".length(); - int tokenEnd = tokenStart + "".length() - 1; - int cursorLocation = str.lastIndexOf("int.") + "int.".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0045() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0045/X.js", - "package test0045;\n" + - "public class X {\n" + - " void ZZZZ(){\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0046() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0046/X.js", - "package test0046;\n" + - "public class X {\n" + - " void ZZZZ(){\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ"); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0047() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0047/X.js", - "package test0047;\n" + - "public class X {\n" + - " void ZZZZ(){\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0048() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0048/X.js", - "package test0048;\n" + - "public class X {\n" + - " void (){\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("void ") + "void ".length(); - int tokenEnd = tokenStart + "".length() - 1; - int cursorLocation = str.lastIndexOf("void ") + "void ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0049() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0049/X.js", - "package test0049;\n" + - "public class X {\n" + - " int ZZZZ;\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0050() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0050/X.js", - "package test0050;\n" + - "public class X {\n" + - " int ZZZZ;\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ"); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0051() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0051/X.js", - "package test0051;\n" + - "public class X {\n" + - " int ZZZZ;\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0052() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0052/X.js", - "package test0052;\n" + - "public class X {\n" + - " int ;\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("int ") + "int ".length(); - int tokenEnd = tokenStart + "".length() - 1; - int cursorLocation = str.lastIndexOf("int ") + "int ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0053() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0053/X.js", - "package test0053;\n" + - "public class X {\n" + - " {int ZZZZ;}\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0054() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0054/X.js", - "package test0054;\n" + - "public class X {\n" + - " {int ZZZZ;}\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ"); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0055() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0055/X.js", - "package test0055;\n" + - "public class X {\n" + - " {int ZZZZ;}\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0056() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0056/X.js", - "package test0056;\n" + - "public class X {\n" + - " {int ;}\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("int ") + "int ".length(); - int tokenEnd = tokenStart + "".length() - 1; - int cursorLocation = str.lastIndexOf("int ") + "int ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0057() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0057/X.js", - "package test0057;\n" + - "public class X {\n" + - " void foo(int ZZZZ){}\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0058() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0058/X.js", - "package test0058;\n" + - "public class X {\n" + - " void foo(int ZZZZ){}\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ"); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0059() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0059/X.js", - "package test0059;\n" + - "public class X {\n" + - " void foo(int ZZZZ){}\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0060() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0060/X.js", - "package test0060;\n" + - "public class X {\n" + - " void foo(int ){}\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("int ") + "int ".length(); - int tokenEnd = tokenStart + "".length() - 1; - int cursorLocation = str.lastIndexOf("int ") + "int ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0061() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0061/X.js", - "package test0061;\n" + - "public class X ZZZZ {\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0062() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0062/X.js", - "package test0062;\n" + - "public class X ZZZZ {\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ"); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0063() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0063/X.js", - "package test0063;\n" + - "public class X ZZZZ {\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0064() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0064/X.js", - "package test0064;\n" + - "public class X {\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("X ") + "X ".length(); - int tokenEnd = tokenStart + "".length() - 1; - int cursorLocation = str.lastIndexOf("X ") + "X ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0065() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0065/X.js", - "package test0065;\n" + - "ZZZZ\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0066() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0066/X.js", - "package test0066;\n" + - "ZZZZ\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ"); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0067() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0067/X.js", - "package test0067;\n" + - "ZZZZ\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0068() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0068/X.js", - "package test0068;\n" + - "/**/\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("/**/") + "/**/".length(); - int tokenEnd = tokenStart + "".length() - 1; - int cursorLocation = str.lastIndexOf("/**/") + "/**/".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0069() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0069/X.js", - "package test0069;\n" + - "public class X {\n" + - " {\n" + - " do{\n" + - " } ZZZZ\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0070() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0070/X.js", - "package test0070;\n" + - "public class X {\n" + - " {\n" + - " do{\n" + - " } ZZZZ\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ"); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0071() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0071/X.js", - "package test0071;\n" + - "public class X {\n" + - " {\n" + - " do{\n" + - " } ZZZZ\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0072() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0072/X.js", - "package test0072;\n" + - "public class X {\n" + - " {\n" + - " do{\n" + - " }/**/ \n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("/**/ ") + "/**/ ".length(); - int tokenEnd = tokenStart + "".length() - 1; - int cursorLocation = str.lastIndexOf("/**/ ") + "/**/ ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0073() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0073/X.js", - "package ZZZZ;\n" + - "public class X {\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0074() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0074/X.js", - "package ZZZZ;\n" + - "public class X {\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ"); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0075() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0075/X.js", - "package ZZZZ;\n" + - "public class X {\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0076() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0076/X.js", - "package \n" + - "public class X {\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("package ") + "package ".length(); - int tokenEnd = tokenStart + "".length() - 1; - int cursorLocation = str.lastIndexOf("package ") + "package ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0077() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0077/test/X.js", - "package test0077.ZZZZ;\n" + - "public class X {\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0078() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0078/test/X.js", - "package test0078.ZZZZ;\n" + - "public class X {\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ"); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0079() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0079/test/X.js", - "package test0079.ZZZZ;\n" + - "public class X {\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0080() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0080/test/X.js", - "package test0080.\n" + - "public class X {\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("test0080.") + "test0080.".length(); - int tokenEnd = tokenStart + "".length() - 1; - int cursorLocation = str.lastIndexOf("test0080.") + "test0080.".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0081() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0081/X.js", - "package test0081;\n" + - "import ZZZZ;\n" + - "public class X {\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0082() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0082/X.js", - "package test0082;\n" + - "import ZZZZ;\n" + - "public class X {\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ"); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0083() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0083/X.js", - "package test0083;\n" + - "import ZZZZ;\n" + - "public class X {\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0084() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0084/X.js", - "package test0084;\n" + - "import \n" + - "public class X {\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("import ") + "import ".length(); - int tokenEnd = tokenStart + "".length() - 1; - int cursorLocation = str.lastIndexOf("import ") + "import ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0085() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0085/test/X.js", - "package test0085;\n" + - "import test0085.ZZZZ;\n" + - "public class X {\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0086() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0086/test/X.js", - "package test0086;\n" + - "import test0086.ZZZZ;\n" + - "public class X {\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ"); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0087() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0087/test/X.js", - "package test0087;\n" + - "import test0087.ZZZZ;\n" + - "public class X {\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0088() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0084/test/X.js", - "package test0088;\n" + - "import test0085.\n" + - "public class X {\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("test0085.") + "test0085.".length(); - int tokenEnd = tokenStart + "".length() - 1; - int cursorLocation = str.lastIndexOf("test0085.") + "test0085.".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0089() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0089/X.js", - "package test0089;\n" + - "public class X {\n" + - " void foo(int a, int b) {\n" + - " this.foo(ZZZZ\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures={I}\n" + - "expectedTypesKeys={I}", - result.context); -} -public void test0090() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0090/X.js", - "package test0090;\n" + - "public class X {\n" + - " void foo(int a, int b) {\n" + - " this.foo(ZZZZ\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ"); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0091() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0091/X.js", - "package test0091;\n" + - "public class X {\n" + - " void foo(int a, int b) {\n" + - " this.foo(ZZZZ\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures={I}\n" + - "expectedTypesKeys={I}", - result.context); -} -public void test0092() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0092/X.js", - "package test0092;\n" + - "public class X {\n" + - " void foo(int a, int b) {\n" + - " this.foo(\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("this.foo(") + "this.foo(".length(); - int tokenEnd = tokenStart + "".length() - 1; - int cursorLocation = str.lastIndexOf("this.foo(") + "this.foo(".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0093() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0093/X.js", - "package test0093;\n" + - "public class X {\n" + - " void foo(int a, int b) {\n" + - " this.foo(0,ZZZZ\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures={I}\n" + - "expectedTypesKeys={I}", - result.context); -} -public void test0094() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0094/X.js", - "package test0094;\n" + - "public class X {\n" + - " void foo(int a, int b) {\n" + - " this.foo(0,ZZZZ\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ"); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0095() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0095/X.js", - "package test0095;\n" + - "public class X {\n" + - " void foo(int a, int b) {\n" + - " this.foo(0,ZZZZ\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures={I}\n" + - "expectedTypesKeys={I}", - result.context); -} -public void test0096() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0096/X.js", - "package test0096;\n" + - "public class X {\n" + - " void foo(int a, int b) {\n" + - " this.foo(0,\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("this.foo(0,") + "this.foo(0,".length(); - int tokenEnd = tokenStart + "".length() - 1; - int cursorLocation = str.lastIndexOf("this.foo(0,") + "this.foo(0,".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0097() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0097/X.js", - "package test0097;\n" + - "public class X {\n" + - " X(int a, int b) {}\n" + - " void foo(int a, int b) {\n" + - " new X(ZZZZ\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures={I}\n" + - "expectedTypesKeys={I}", - result.context); -} -public void test0098() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0098/X.js", - "package test0098;\n" + - "public class X {\n" + - " X(int a, int b) {}\n" + - " void foo(int a, int b) {\n" + - " new X(ZZZZ\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ"); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0099() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0099/X.js", - "package test0099;\n" + - "public class X {\n" + - " X(int a, int b) {}\n" + - " void foo(int a, int b) {\n" + - " new X(ZZZZ\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures={I}\n" + - "expectedTypesKeys={I}", - result.context); -} -public void test0100() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0100/X.js", - "package test0100;\n" + - "public class X {\n" + - " X(int a, int b) {}\n" + - " void foo(int a, int b) {\n" + - " new X(\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("new X(") + "new X(".length(); - int tokenEnd = tokenStart + "".length() - 1; - int cursorLocation = str.lastIndexOf("new X(") + "new X(".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0101() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0101/X.js", - "package test0101;\n" + - "public class X {\n" + - " X(int a, int b) {}\n" + - " void foo(int a, int b) {\n" + - " new X(0,ZZZZ\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures={I}\n" + - "expectedTypesKeys={I}", - result.context); -} -public void test0102() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0102/X.js", - "package test0102;\n" + - "public class X {\n" + - " X(int a, int b) {}\n" + - " void foo(int a, int b) {\n" + - " new X(0,ZZZZ\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ"); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0103() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0103/X.js", - "package test0103;\n" + - "public class X {\n" + - " X(int a, int b) {}\n" + - " void foo(int a, int b) {\n" + - " new X(0,ZZZZ\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures={I}\n" + - "expectedTypesKeys={I}", - result.context); -} -public void test0104() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0104/X.js", - "package test0104;\n" + - "public class X {\n" + - " X(int a, int b) {}\n" + - " void foo(int a, int b) {\n" + - " new X(0,\n" + - " }\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("new X(0,") + "new X(0,".length(); - int tokenEnd = tokenStart + "".length() - 1; - int cursorLocation = str.lastIndexOf("new X(0,") + "new X(0,".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0105() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0105/X.js", - "package test0105;\n" + - "public class X {\n" + - " Object o = ZZZZ\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures={Ljava.lang.Object;}\n" + - "expectedTypesKeys={Ljava/lang/Object;}", - result.context); -} -public void test0106() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0106/X.js", - "package test0106;\n" + - "public class X {\n" + - " Object o = ZZZZ\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ"); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures={Ljava.lang.Object;}\n" + - "expectedTypesKeys={Ljava/lang/Object;}", - result.context); -} -public void test0107() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0107/X.js", - "package test0107;\n" + - "public class X {\n" + - " Object o = ZZZZ\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures={Ljava.lang.Object;}\n" + - "expectedTypesKeys={Ljava/lang/Object;}", - result.context); -} -public void test0108() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0108/X.js", - "package test0108;\n" + - "public class X {\n" + - " Object o = \n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("Object o = ") + "Object o = ".length(); - int tokenEnd = tokenStart + "".length() - 1; - int cursorLocation = str.lastIndexOf("Object o = ") + "Object o = ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures={Ljava.lang.Object;}\n" + - "expectedTypesKeys={Ljava/lang/Object;}", - result.context); -} -public void test0109() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0109/X.js", - "package test0109;\n" + - "public class X {\n" + - " Object o = new ZZZZ\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures={Ljava.lang.Object;}\n" + - "expectedTypesKeys={Ljava/lang/Object;}", - result.context); -} -public void test0110() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0110/X.js", - "package test0110;\n" + - "public class X {\n" + - " Object o = new ZZZZ\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ"); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures={Ljava.lang.Object;}\n" + - "expectedTypesKeys={Ljava/lang/Object;}", - result.context); -} -public void test0111() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0111/X.js", - "package test0111;\n" + - "public class X {\n" + - " Object o = new ZZZZ\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures={Ljava.lang.Object;}\n" + - "expectedTypesKeys={Ljava/lang/Object;}", - result.context); -} -public void test0112() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0112/X.js", - "package test0112;\n" + - "public class X {\n" + - " Object o = new \n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("Object o = new ") + "Object o = new ".length(); - int tokenEnd = tokenStart + "".length() - 1; - int cursorLocation = str.lastIndexOf("Object o = new ") + "Object o = new ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures={Ljava.lang.Object;}\n" + - "expectedTypesKeys={Ljava/lang/Object;}", - result.context); -} -public void test0113() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0113/X.js", - "package test0113;\n" + - "public class X {\n" + - " Object o = new Object() {\n" + - " ZZZZ\n" + - " };\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0114() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0114/X.js", - "package test0114;\n" + - "public class X {\n" + - " Object o = new Object() {\n" + - " ZZZZ\n" + - " };\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ"); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0115() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0115/X.js", - "package test0115;\n" + - "public class X {\n" + - " Object o = new Object() {\n" + - " ZZZZ\n" + - " };\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("ZZZZ"); - int tokenEnd = tokenStart + "ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZ\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0116() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0116/X.js", - "package test0116;\n" + - "public class X {\n" + - " Object o = new Object() {\n" + - " /**/\n" + - " };\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("/**/") + "/**/".length(); - int tokenEnd = tokenStart + "".length() - 1; - int cursorLocation = str.lastIndexOf("/**/") + "/**/".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0117() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0117/X.js", - "package test0117;\n" + - "public class X {\n" + - " String s = \"ZZZZ\";\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("\"ZZZZ\""); - int tokenEnd = tokenStart + "\"ZZZZ\"".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZZZ\"\n" + - "completion token kind=TOKEN_KIND_STRING_LITERAL\n" + - "expectedTypesSignatures={Ljava.lang.String;}\n" + - "expectedTypesKeys={Ljava/lang/String;}", - result.context); -} -public void test0118() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0118/X.js", - "package test0118;\n" + - "public class X {\n" + - " String s = \"ZZZZ\";\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("\"ZZZZ\""); - int tokenEnd = tokenStart + "\"ZZZZ\"".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZ\"\n" + - "completion token kind=TOKEN_KIND_STRING_LITERAL\n" + - "expectedTypesSignatures={Ljava.lang.String;}\n" + - "expectedTypesKeys={Ljava/lang/String;}", - result.context); -} -public void test0119() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0119/X.js", - "package test0119;\n" + - "public class X {\n" + - " String s = \"ZZZZ\";\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("\"ZZZZ\""); - int tokenEnd = tokenStart + "\"ZZZZ\"".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_STRING_LITERAL\n" + - "expectedTypesSignatures={Ljava.lang.String;}\n" + - "expectedTypesKeys={Ljava/lang/String;}", - result.context); -} -public void test0120() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0120/X.js", - "package test0120;\n" + - "public class X {\n" + - " String s = \"ZZZZ\";\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("\"ZZZZ\""); - int tokenEnd = tokenStart + "".length() - 1; - int cursorLocation = str.lastIndexOf("\"ZZZZ") + "".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures={Ljava.lang.String;}\n" + - "expectedTypesKeys={Ljava/lang/String;}", - result.context); -} -public void test0121() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0121/X.js", - "package test0121;\n" + - "public class X {\n" + - " String s = \"ZZZZ\";\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int cursorLocation = str.lastIndexOf("\"ZZZZ\"") + "\"ZZZZ\"".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=[-1, -1]\n" + - "completion token=null\n" + - "completion token kind=TOKEN_KIND_UNKNOWN\n" + - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); -} -public void test0122() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0122/X.js", - "package test0122;\n" + - "public class X {\n" + - " String s = \"\";\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("\"\""); - int tokenEnd = tokenStart + "\"\"".length() - 1; - int cursorLocation = str.lastIndexOf("\"\"") + "\"".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_STRING_LITERAL\n" + - "expectedTypesSignatures={Ljava.lang.String;}\n" + - "expectedTypesKeys={Ljava/lang/String;}", - result.context); -} -public void test0123() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0123/X.js", - "package test0123;\n" + - "public class X {\n" + - " String s = \"ZZZZ\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("\"ZZZZ"); - int tokenEnd = tokenStart + "\"ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZZZ\"\n" + - "completion token kind=TOKEN_KIND_STRING_LITERAL\n" + - "expectedTypesSignatures={Ljava.lang.String;}\n" + - "expectedTypesKeys={Ljava/lang/String;}", - result.context); -} -public void test0124() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0124/X.js", - "package test0124;\n" + - "public class X {\n" + - " String s = \"ZZZZ\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("\"ZZZZ"); - int tokenEnd = tokenStart + "\"ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZ\"\n" + - "completion token kind=TOKEN_KIND_STRING_LITERAL\n" + - "expectedTypesSignatures={Ljava.lang.String;}\n" + - "expectedTypesKeys={Ljava/lang/String;}", - result.context); -} -public void test0125() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0125/X.js", - "package test0125;\n" + - "public class X {\n" + - " String s = \"ZZZZ\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("\"ZZZZ"); - int tokenEnd = tokenStart + "\"ZZZZ".length() - 1; - int cursorLocation = str.lastIndexOf("ZZZZ") + "".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_STRING_LITERAL\n" + - "expectedTypesSignatures={Ljava.lang.String;}\n" + - "expectedTypesKeys={Ljava/lang/String;}", - result.context); -} -public void test0126() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0126/X.js", - "package test0126;\n" + - "public class X {\n" + - " String s = \"ZZZZ\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("\"ZZZZ"); - int tokenEnd = tokenStart + "".length() - 1; - int cursorLocation = str.lastIndexOf("\"ZZZZ") + "".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_NAME\n" + - "expectedTypesSignatures={Ljava.lang.String;}\n" + - "expectedTypesKeys={Ljava/lang/String;}", - result.context); -} -public void test0127() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0127/X.js", - "package test0127;\n" + - "public class X {\n" + - " String s = \"\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("\""); - int tokenEnd = tokenStart + "\"".length() - 1; - int cursorLocation = str.lastIndexOf("\"") + "\"".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"\"\n" + - "completion token kind=TOKEN_KIND_STRING_LITERAL\n" + - "expectedTypesSignatures={Ljava.lang.String;}\n" + - "expectedTypesKeys={Ljava/lang/String;}", - result.context); -} -public void test0128() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test0127/X.js", - "package test0127;\n" + - "public class X {\n" + - " String s0 = \"\n" + - " String s = \"ZZZZ\"\n" + - "}"); - - String str = this.workingCopies[0].getSource(); - int tokenStart = str.lastIndexOf("\"ZZZZ\""); - int tokenEnd = tokenStart + "\"ZZZZ\"".length() - 1; - int cursorLocation = str.lastIndexOf("\"ZZZZ\"") + "\"ZZZZ".length(); - - CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); - - assertResults( - "completion offset="+(cursorLocation)+"\n" + - "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + - "completion token=\"ZZZZ\"\n" + - "completion token kind=TOKEN_KIND_STRING_LITERAL\n" + - "expectedTypesSignatures={Ljava.lang.String;}\n" + - "expectedTypesKeys={Ljava/lang/String;}", - result.context); -} -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionTests.java deleted file mode 100644 index 0f4da53..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionTests.java +++ /dev/null @@ -1,13665 +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 java.util.Hashtable; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.wst.jsdt.core.*; -import org.eclipse.wst.jsdt.internal.codeassist.CompletionEngine; -import org.eclipse.wst.jsdt.core.IJavaScriptUnit; -import org.eclipse.wst.jsdt.core.eval.IEvaluationContext; -import org.eclipse.wst.jsdt.internal.codeassist.RelevanceConstants; - -import junit.framework.*; - -public class CompletionTests extends AbstractJavaModelCompletionTests implements RelevanceConstants { - -static { -// TESTS_NAMES = new String[] { "testDeprecationCheck17"}; -} -public static Test suite() { - return buildModelTestSuite(CompletionTests.class); -} -public CompletionTests(String name) { - super(name); -} -public void setUpSuite() throws Exception { - if (COMPLETION_PROJECT == null) { - COMPLETION_PROJECT = setUpJavaProject("Completion"); - } else { - setUpProjectCompliance(COMPLETION_PROJECT, "1.4"); - } - super.setUpSuite(); -} -public void tearDownSuite() throws Exception { - super.tearDownSuite(); -} - -public void test00() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/test/Test.js", - "MyClass.prototype.someMethod = MyClass_someMethod;"+ - "function MyClass(){}"+ - "function MyClass_someMethod(){}"+ - "var myClassObj = new MyClass();\n"+ - "myClassObj.someMethod();\n"+ - ""); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "someMethod"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "someMethod[FUNCTION_REF]{, Ltest.MyClass;, ()V, someMethod, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} - - - -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=164311 -public void testBug164311() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " public int zzzzzz;\n" + - " public void method1() {\n" + - " label : if (0> (10));\n" + - " zzz\n" + - " }\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "zzz"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "zzzzzz[FIELD_REF]{zzzzzz, Ltest.Test;, I, zzzzzz, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=164311 -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=167750 -public void testBug164311_2() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n"+ - "public class X {\n"+ - " public void zork() { \n"+ - " } \n"+ - " public void foo() { \n"+ - " this.foo(new Object(){\n"+ - " public void bar() {\n"+ - " if (zzz>(Integer)vvv.foo(i)) {\n"+ - " return;\n"+ - " }\n"+ - " if (true) {\n"+ - " return;\n"+ - " }\n"+ - " zor\n"+ - " } \n"+ - " });\n"+ - " }\n"+ - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "zor"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "zork[FUNCTION_REF]{zork(), Ltest.X;, ()V, zork, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=96213 -public void testBug96213() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/test/Test.js", - " function toto( o) {\n"+ - " return null;\n"+ - " }\n"+ - " function titi( removed) {\n"+ - " }\n"+ - " function foo() {\n"+ - " var removed = 0;\n"+ - " toto(Test.vv).titi(removed);\n"+ - " }\n"+ - ""); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "removed"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "removed[LOCAL_VARIABLE_REF]{removed, null, Lsystem.js.Number;, removed, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=99811 -public void testBug99811() throws JavaScriptModelException { - IJavaScriptUnit aType = null; - try { - this.wc = getWorkingCopy( - "/Completion/src/test/A.js", - "public abstract class A implements I {}"); - - aType = getWorkingCopy( - "/Completion/src/test/I.js", - "public interface I {\n"+ - " public class M extends A {}\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "A"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults("", requestor.getResults()); - } finally { - if(aType != null) { - aType.discardWorkingCopy(); - } - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102572 -public void testCamelCaseField1() throws JavaScriptModelException { - this.oldOptions = JavaScriptCore.getOptions(); - try { - Hashtable options = new Hashtable(oldOptions); - options.put(JavaScriptCore.CODEASSIST_CAMEL_CASE_MATCH, JavaScriptCore.ENABLED); - JavaScriptCore.setOptions(options); - - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/camelcase/Test.js", - "package camelcase;"+ - "public class Test {\n"+ - " int oneTwoThree;\n"+ - " int oTTField;\n"+ - " void foo() {\n"+ - " oTT\n"+ - " }\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "oTT"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "oneTwoThree[FIELD_REF]{oneTwoThree, Lcamelcase.Test;, I, oneTwoThree, null, " + (R_DEFAULT + R_INTERESTING + R_CAMEL_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "oTTField[FIELD_REF]{oTTField, Lcamelcase.Test;, I, oTTField, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - JavaScriptCore.setOptions(oldOptions); - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102572 -public void testCamelCaseLocalVariable1() throws JavaScriptModelException { - this.oldOptions = JavaScriptCore.getOptions(); - try { - Hashtable options = new Hashtable(oldOptions); - options.put(JavaScriptCore.CODEASSIST_CAMEL_CASE_MATCH, JavaScriptCore.ENABLED); - JavaScriptCore.setOptions(options); - - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/camelcase/Test.js", - "package camelcase;"+ - "public class Test {\n"+ - " void foo() {\n"+ - " int oneTwoThree;\n"+ - " int oTTLocal;\n"+ - " oTT\n"+ - " }\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "oTT"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "oneTwoThree[LOCAL_VARIABLE_REF]{oneTwoThree, null, I, oneTwoThree, null, " + (R_DEFAULT + R_INTERESTING + R_CAMEL_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "oTTLocal[LOCAL_VARIABLE_REF]{oTTLocal, null, I, oTTLocal, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - JavaScriptCore.setOptions(oldOptions); - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102572 -public void testCamelCaseMethod1() throws JavaScriptModelException { - this.oldOptions = JavaScriptCore.getOptions(); - try { - Hashtable options = new Hashtable(oldOptions); - options.put(JavaScriptCore.CODEASSIST_CAMEL_CASE_MATCH, JavaScriptCore.ENABLED); - JavaScriptCore.setOptions(options); - - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/camelcase/Test.js", - "package camelcase;"+ - "public class Test {\n"+ - " void oneTwoThree(){}\n"+ - " void oTTMethod(){}\n"+ - " void foo() {\n"+ - " oTT\n"+ - " }\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "oTT"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "oneTwoThree[FUNCTION_REF]{oneTwoThree(), Lcamelcase.Test;, ()V, oneTwoThree, null, " + (R_DEFAULT + R_INTERESTING + R_CAMEL_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "oTTMethod[FUNCTION_REF]{oTTMethod(), Lcamelcase.Test;, ()V, oTTMethod, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - JavaScriptCore.setOptions(oldOptions); - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102572 -public void testCamelCaseMethodDeclaration1() throws JavaScriptModelException { - this.oldOptions = JavaScriptCore.getOptions(); - try { - Hashtable options = new Hashtable(oldOptions); - options.put(JavaScriptCore.CODEASSIST_CAMEL_CASE_MATCH, JavaScriptCore.ENABLED); - JavaScriptCore.setOptions(options); - - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/camelcase/Test.js", - "package camelcase;"+ - "public class Test extends SuperClass {\n"+ - " oTT\n"+ - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/camelcase/SuperClass.js", - "package camelcase;"+ - "public class SuperClass {\n"+ - " public void oneTwoThree(){}\n"+ - " public void oTTMethod(){}\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "oTT"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "oTT[POTENTIAL_METHOD_DECLARATION]{oTT, Lcamelcase.Test;, ()V, oTT, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" + - "oneTwoThree[FUNCTION_DECLARATION]{public void oneTwoThree(), Lcamelcase.SuperClass;, ()V, oneTwoThree, null, " + (R_DEFAULT + R_INTERESTING + R_CAMEL_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "oTTMethod[FUNCTION_DECLARATION]{public void oTTMethod(), Lcamelcase.SuperClass;, ()V, oTTMethod, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - JavaScriptCore.setOptions(oldOptions); - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102572 -public void testCamelCaseType1() throws JavaScriptModelException { - this.oldOptions = JavaScriptCore.getOptions(); - try { - Hashtable options = new Hashtable(oldOptions); - options.put(JavaScriptCore.CODEASSIST_CAMEL_CASE_MATCH, JavaScriptCore.ENABLED); - JavaScriptCore.setOptions(options); - - this.workingCopies = new IJavaScriptUnit[3]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/camelcase/Test.js", - "package camelcase;"+ - "public class Test {\n"+ - " FF\n"+ - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/camelcase/FoFoFo.js", - "package camelcase;"+ - "public class FoFoFo {\n"+ - "}"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/camelcase/FFFTest.js", - "package camelcase;"+ - "public class FFFTest {\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "FF"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "FF[POTENTIAL_METHOD_DECLARATION]{FF, Lcamelcase.Test;, ()V, FF, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" + - "FoFoFo[TYPE_REF]{FoFoFo, camelcase, Lcamelcase.FoFoFo;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CAMEL_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "FFFTest[TYPE_REF]{FFFTest, camelcase, Lcamelcase.FFFTest;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - JavaScriptCore.setOptions(oldOptions); - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102572 -public void testCamelCaseType2() throws JavaScriptModelException { - this.oldOptions = JavaScriptCore.getOptions(); - try { - Hashtable options = new Hashtable(oldOptions); - options.put(JavaScriptCore.CODEASSIST_CAMEL_CASE_MATCH, JavaScriptCore.ENABLED); - JavaScriptCore.setOptions(options); - - this.workingCopies = new IJavaScriptUnit[3]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/camelcase/Test.js", - "package camelcase;"+ - "public class Test {\n"+ - " camelcase.FF\n"+ - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/camelcase/FoFoFo.js", - "package camelcase;"+ - "public class FoFoFo {\n"+ - "}"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/camelcase/FFFTest.js", - "package camelcase;"+ - "public class FFFTest {\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "FF"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "FoFoFo[TYPE_REF]{FoFoFo, camelcase, Lcamelcase.FoFoFo;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CAMEL_CASE + R_NON_RESTRICTED) + "}\n" + - "FFFTest[TYPE_REF]{FFFTest, camelcase, Lcamelcase.FFFTest;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - JavaScriptCore.setOptions(oldOptions); - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102572 -public void testCamelCaseType3() throws JavaScriptModelException { - this.oldOptions = JavaScriptCore.getOptions(); - try { - Hashtable options = new Hashtable(oldOptions); - options.put(JavaScriptCore.CODEASSIST_CAMEL_CASE_MATCH, JavaScriptCore.ENABLED); - JavaScriptCore.setOptions(options); - - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/camelcase/Test.js", - "package camelcase;"+ - "public class Test {\n"+ - " /**/FF\n"+ - "}\n"+ - "class FoFoFo {\n"+ - "}\n"+ - "class FFFTest {\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "/**/FF"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "FF[POTENTIAL_METHOD_DECLARATION]{FF, Lcamelcase.Test;, ()V, FF, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" + - "FoFoFo[TYPE_REF]{FoFoFo, camelcase, Lcamelcase.FoFoFo;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CAMEL_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "FFFTest[TYPE_REF]{FFFTest, camelcase, Lcamelcase.FFFTest;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - JavaScriptCore.setOptions(oldOptions); - } -} - -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102572 -public void testCamelCaseType4() throws JavaScriptModelException { - this.oldOptions = JavaScriptCore.getOptions(); - try { - Hashtable options = new Hashtable(oldOptions); - options.put(JavaScriptCore.CODEASSIST_CAMEL_CASE_MATCH, JavaScriptCore.ENABLED); - JavaScriptCore.setOptions(options); - - this.workingCopies = new IJavaScriptUnit[3]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/camelcase/Test.js", - "package camelcase;"+ - "public class Test {\n"+ - " FF\n"+ - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/camelcase/Member1.js", - "package camelcase;"+ - "public class Member1 {\n"+ - " public class FoFoFo {\n"+ - " }\n"+ - "}"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/camelcase/Member2.js", - "package camelcase;"+ - "public class Member2 {\n"+ - " public class FFFTest {\n"+ - " }\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "FF"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "FF[POTENTIAL_METHOD_DECLARATION]{FF, Lcamelcase.Test;, ()V, FF, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" + - "Member1.FoFoFo[TYPE_REF]{camelcase.Member1.FoFoFo, camelcase, Lcamelcase.Member1$FoFoFo;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CAMEL_CASE + R_NON_RESTRICTED) + "}\n" + - "Member2.FFFTest[TYPE_REF]{camelcase.Member2.FFFTest, camelcase, Lcamelcase.Member2$FFFTest;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - JavaScriptCore.setOptions(oldOptions); - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102572 -public void testCamelCaseType5() throws JavaScriptModelException { - this.oldOptions = JavaScriptCore.getOptions(); - try { - Hashtable options = new Hashtable(oldOptions); - options.put(JavaScriptCore.CODEASSIST_CAMEL_CASE_MATCH, JavaScriptCore.ENABLED); - JavaScriptCore.setOptions(options); - - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/camelcase/Test.js", - "package camelcase;"+ - "public class Test {\n"+ - " public class FoFoFo {\n"+ - " public class FFFTest {\n"+ - " FF\n"+ - " }\n"+ - " }\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "FF"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "FF[POTENTIAL_METHOD_DECLARATION]{FF, Lcamelcase.Test$FoFoFo$FFFTest;, ()V, FF, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" + - "Test.FoFoFo[TYPE_REF]{FoFoFo, camelcase, Lcamelcase.Test$FoFoFo;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CAMEL_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "Test.FoFoFo.FFFTest[TYPE_REF]{FFFTest, camelcase, Lcamelcase.Test$FoFoFo$FFFTest;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - JavaScriptCore.setOptions(oldOptions); - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=157584 -public void testCatchClauseExceptionRef01() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[4]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " public void throwing() throws IZZAException, IZZException {}\n" + - " public void foo() {\n" + - " try {\n" + - " throwing();\n" + - " }\n" + - " catch (IZZAException e) {\n" + - " bar();\n" + - " }\n" + - " catch (IZZ) {\n" + - " }\n" + - " }" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/test/IZZAException.js", - "package test;"+ - "public class IZZAException extends Exception {\n" + - "}\n"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/test/IZZBException.js", - "package test;"+ - "public class IZZBException extends Exception {\n" + - "}\n"); - - this.workingCopies[3] = getWorkingCopy( - "/Completion/src/test/IZZException.js", - "package test;"+ - "public class IZZException extends Exception {\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "IZZ"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "IZZBException[TYPE_REF]{IZZBException, test, Ltest.IZZBException;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION + R_NON_RESTRICTED) + "}\n" + - "IZZException[TYPE_REF]{IZZException, test, Ltest.IZZException;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=157584 -public void testCatchClauseExceptionRef02() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[4]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " public void throwing() throws IZZAException, IZZException {}\n" + - " public void foo() {\n" + - " try {\n" + - " throwing()\n" + - " }\n" + - " catch (IZZAException e) {\n" + - " bar();\n" + - " }\n" + - " catch (IZZ) {\n" + - " }\n" + - " }" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/test/IZZAException.js", - "package test;"+ - "public class IZZAException extends Exception {\n" + - "}\n"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/test/IZZBException.js", - "package test;"+ - "public class IZZBException extends Exception {\n" + - "}\n"); - - this.workingCopies[3] = getWorkingCopy( - "/Completion/src/test/IZZException.js", - "package test;"+ - "public class IZZException extends Exception {\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "IZZ"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "IZZAException[TYPE_REF]{IZZAException, test, Ltest.IZZAException;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION + R_NON_RESTRICTED) + "}\n" + - "IZZBException[TYPE_REF]{IZZBException, test, Ltest.IZZBException;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION + R_NON_RESTRICTED) + "}\n" + - "IZZException[TYPE_REF]{IZZException, test, Ltest.IZZException;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=157584 -public void testCatchClauseExceptionRef03() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[4]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " public void throwing() throws IZZAException, IZZException {}\n" + - " public void foo() {\n" + - " #\n" + - " try {\n" + - " throwing();\n" + - " }\n" + - " catch (IZZAException e) {\n" + - " bar();\n" + - " }\n" + - " catch (IZZ) {\n" + - " }\n" + - " }" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/test/IZZAException.js", - "package test;"+ - "public class IZZAException extends Exception {\n" + - "}\n"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/test/IZZBException.js", - "package test;"+ - "public class IZZBException extends Exception {\n" + - "}\n"); - - this.workingCopies[3] = getWorkingCopy( - "/Completion/src/test/IZZException.js", - "package test;"+ - "public class IZZException extends Exception {\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "IZZ"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "IZZAException[TYPE_REF]{IZZAException, test, Ltest.IZZAException;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION + R_NON_RESTRICTED) + "}\n" + - "IZZBException[TYPE_REF]{IZZBException, test, Ltest.IZZBException;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION + R_NON_RESTRICTED) + "}\n" + - "IZZException[TYPE_REF]{IZZException, test, Ltest.IZZException;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=157584 -public void testCatchClauseExceptionRef04() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[4]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " public void throwing() throws test.p.IZZAException, test.p.IZZException {}\n" + - " public void foo() {\n" + - " try {\n" + - " throwing();\n" + - " }\n" + - " catch (test.p.IZZAException e) {\n" + - " bar();\n" + - " }\n" + - " catch (IZZ) {\n" + - " }\n" + - " }" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/test/p/IZZAException.js", - "package test.p;"+ - "public class IZZAException extends Exception {\n" + - "}\n"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/test/p/IZZBException.js", - "package test.p;"+ - "public class IZZBException extends Exception {\n" + - "}\n"); - - this.workingCopies[3] = getWorkingCopy( - "/Completion/src/test/p/IZZException.js", - "package test.p;"+ - "public class IZZException extends Exception {\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "IZZ"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "IZZBException[TYPE_REF]{test.p.IZZBException, test.p, Ltest.p.IZZBException;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXCEPTION + R_NON_RESTRICTED) + "}\n" + - "IZZException[TYPE_REF]{test.p.IZZException, test.p, Ltest.p.IZZException;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXCEPTION + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=157584 -public void testCatchClauseExceptionRef05() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " public class IZZAException extends Exception {}\n" + - " public class IZZBException extends Exception {}\n" + - " public class IZZException extends Exception {}\n" + - " public void throwing() throws IZZAException, IZZException {}\n" + - " public void foo() {\n" + - " try {\n" + - " throwing();\n" + - " }\n" + - " catch (IZZAException e) {\n" + - " bar();\n" + - " }\n" + - " catch (IZZ) {\n" + - " }\n" + - " }" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "IZZ"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "Test.IZZBException[TYPE_REF]{IZZBException, test, Ltest.Test$IZZBException;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION + R_NON_RESTRICTED) + "}\n" + - "Test.IZZException[TYPE_REF]{IZZException, test, Ltest.Test$IZZException;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=157584 -public void testCatchClauseExceptionRef06() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " public class Inner {\n" + - " public class IZZAException extends Exception {}\n" + - " public class IZZBException extends Exception {}\n" + - " public class IZZException extends Exception {}\n" + - " public void throwing() throws IZZAException, IZZException {}\n" + - " public void foo() {\n" + - " try {\n" + - " throwing();\n" + - " }\n" + - " catch (IZZAException e) {\n" + - " bar();\n" + - " }\n" + - " catch (IZZ) {\n" + - " }\n" + - " }" + - " }" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "IZZ"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "Test.Inner.IZZBException[TYPE_REF]{IZZBException, test, Ltest.Test$Inner$IZZBException;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION + R_NON_RESTRICTED) + "}\n" + - "Test.Inner.IZZException[TYPE_REF]{IZZException, test, Ltest.Test$Inner$IZZException;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=157584 -public void testCatchClauseExceptionRef07() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " void zork() {\n" + - " class IZZAException extends Exception {}\n" + - " class IZZBException extends Exception {}\n" + - " class IZZException extends Exception {}\n" + - " class Local {\n" + - " public void throwing() throws IZZAException, IZZException {}\n" + - " public void foo() {\n" + - " try {\n" + - " throwing();\n" + - " }\n" + - " catch (IZZAException e) {\n" + - " bar();\n" + - " }\n" + - " catch (IZZ) {\n" + - " }\n" + - " }" + - " }" + - " }" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "IZZ"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "IZZBException[TYPE_REF]{IZZBException, test, LIZZBException;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION + R_NON_RESTRICTED) + "}\n" + - "IZZException[TYPE_REF]{IZZException, test, LIZZException;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=157584 -public void testCatchClauseExceptionRef08() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[4]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " public void throwing() throws IZZAException, IZZException {}\n" + - " public void foo() {\n" + - " try {\n" + - " throwing();\n" + - " }\n" + - " catch (IZZAException e) {\n" + - " bar();\n" + - " }\n" + - " catch (/**/) {\n" + - " }\n" + - " }" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/test/IZZAException.js", - "package test;"+ - "public class IZZAException extends Exception {\n" + - "}\n"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/test/IZZBException.js", - "package test;"+ - "public class IZZBException extends Exception {\n" + - "}\n"); - - this.workingCopies[3] = getWorkingCopy( - "/Completion/src/test/IZZException.js", - "package test;"+ - "public class IZZException extends Exception {\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "/**/"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "Test[TYPE_REF]{Test, test, Ltest.Test;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "Exception[TYPE_REF]{Exception, java.lang, Ljava.lang.Exception;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION + R_EXPECTED_TYPE + R_NON_RESTRICTED) + "}\n" + - "IZZException[TYPE_REF]{IZZException, test, Ltest.IZZException;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=157584 -public void testCatchClauseExceptionRef09() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[5]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " public void throwing() throws IZZAException, IZZCException, IZZException {}\n" + - " public void foo() {\n" + - " try {\n" + - " try {\n" + - " throwing();\n" + - " }\n" + - " catch (IZZCException e) {\n" + - " bar();\n" + - " }\n" + - " }\n" + - " catch (IZZAException e) {\n" + - " bar();\n" + - " }\n" + - " catch (IZZ) {\n" + - " }\n" + - " }" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/test/IZZAException.js", - "package test;"+ - "public class IZZAException extends Exception {\n" + - "}\n"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/test/IZZBException.js", - "package test;"+ - "public class IZZBException extends Exception {\n" + - "}\n"); - - this.workingCopies[3] = getWorkingCopy( - "/Completion/src/test/IZZCException.js", - "package test;"+ - "public class IZZCException extends Exception {\n" + - "}\n"); - - this.workingCopies[4] = getWorkingCopy( - "/Completion/src/test/IZZException.js", - "package test;"+ - "public class IZZException extends Exception {\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "IZZ"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "IZZBException[TYPE_REF]{IZZBException, test, Ltest.IZZBException;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION + R_NON_RESTRICTED) + "}\n" + - "IZZCException[TYPE_REF]{IZZCException, test, Ltest.IZZCException;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION + R_NON_RESTRICTED) + "}\n" + - "IZZException[TYPE_REF]{IZZException, test, Ltest.IZZException;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=157584 -public void testCatchClauseExceptionRef10() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[4]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " public void throwing() throws IZZAException, IZZException {}\n" + - " public void foo() {\n" + - " try {\n" + - " throwing();\n" + - " }\n" + - " catch (IZZAException e) {\n" + - " bar();\n" + - " }\n" + - " catch (IZZ) {\n" + - " }\n" + - " }" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/test/IZZAException.js", - "package test;"+ - "public class IZZAException extends Exception {\n" + - "}\n"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/test/IZZBException.js", - "package test;"+ - "public class IZZBException extends Exception {\n" + - "}\n"); - - this.workingCopies[3] = getWorkingCopy( - "/Completion/src/test/IZZException.js", - "package test;"+ - "public class IZZException extends IZZBException {\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "IZZ"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "IZZBException[TYPE_REF]{IZZBException, test, Ltest.IZZBException;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION + R_EXPECTED_TYPE + R_NON_RESTRICTED) + "}\n" + - "IZZException[TYPE_REF]{IZZException, test, Ltest.IZZException;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=157584 -//IZZBException should not be proposed but to filter this proposal -//we would need to know subclasses of IZZAException and it's currenlty too costly to compute -public void testCatchClauseExceptionRef11() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[4]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " public void throwing() throws IZZAException, IZZException {}\n" + - " public void foo() {\n" + - " try {\n" + - " throwing();\n" + - " }\n" + - " catch (IZZAException e) {\n" + - " bar();\n" + - " }\n" + - " catch (IZZ) {\n" + - " }\n" + - " }" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/test/IZZAException.js", - "package test;"+ - "public class IZZAException extends Exception {\n" + - "}\n"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/test/IZZBException.js", - "package test;"+ - "public class IZZBException extends IZZAException {\n" + - "}\n"); - - this.workingCopies[3] = getWorkingCopy( - "/Completion/src/test/IZZException.js", - "package test;"+ - "public class IZZException extends Exception {\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "IZZ"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "IZZBException[TYPE_REF]{IZZBException, test, Ltest.IZZBException;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION + R_NON_RESTRICTED) + "}\n" + - "IZZException[TYPE_REF]{IZZException, test, Ltest.IZZException;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=157584 -public void testCatchClauseExceptionRef12() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[4]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " public void throwing() throws IZZAException, IZZException {}\n" + - " public void foo() {\n" + - " try {\n" + - " throwing();\n" + - " }\n" + - " catch (IZZ) {\n" + - " }\n" + - " }" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/test/IZZAException.js", - "package test;"+ - "public class IZZAException extends Exception {\n" + - "}\n"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/test/IZZBException.js", - "package test;"+ - "public class IZZBException extends Exception {\n" + - "}\n"); - - this.workingCopies[3] = getWorkingCopy( - "/Completion/src/test/IZZException.js", - "package test;"+ - "public class IZZException extends Exception {\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "IZZ"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "IZZBException[TYPE_REF]{IZZBException, test, Ltest.IZZBException;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION + R_NON_RESTRICTED) + "}\n" + - "IZZAException[TYPE_REF]{IZZAException, test, Ltest.IZZAException;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED) + "}\n" + - "IZZException[TYPE_REF]{IZZException, test, Ltest.IZZException;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=157584 -public void testCatchClauseExceptionRef13() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[4]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " public void throwing() throws IZZException {}\n" + - " public void foo() {\n" + - " try {\n" + - " throwing();\n" + - " }\n" + - " catch (IZZAException e) {\n" + - " }\n" + - " catch (IZZ) {\n" + - " }\n" + - " }" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/test/IZZAException.js", - "package test;"+ - "public class IZZAException extends Exception {\n" + - "}\n"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/test/IZZBException.js", - "package test;"+ - "public class IZZBException extends Exception {\n" + - "}\n"); - - this.workingCopies[3] = getWorkingCopy( - "/Completion/src/test/IZZException.js", - "package test;"+ - "public class IZZException extends IZZAException {\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "IZZ"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "IZZBException[TYPE_REF]{IZZBException, test, Ltest.IZZBException;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -public void testCatchClauseExceptionRef14() throws JavaScriptModelException { - - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " public void throwing() throws IZZException {}\n" + - " public void foo() {\n" + - " try {\n" + - " throwing();\n" + - " }\n" + - " catch (IZZAException e) {\n" + - " }\n" + - " catch (IZZ) {\n" + - " }\n" + - " }" + - "}" + - "class IZZAException extends Exception {\n" + - "}" + - "class IZZException extends Exception {\n" + - "}\n"); - - IJavaScriptProject project = this.workingCopies[0].getJavaScriptProject(); - String visibilityCheck = project.getOption(JavaScriptCore.CODEASSIST_VISIBILITY_CHECK, true); - - try { - project.setOption(JavaScriptCore.CODEASSIST_VISIBILITY_CHECK, JavaScriptCore.ENABLED); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "(IZZ"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "IZZException[TYPE_REF]{IZZException, test, Ltest.IZZException;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_EXCEPTION + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - project.setOption(JavaScriptCore.CODEASSIST_VISIBILITY_CHECK, visibilityCheck); - } -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=173907 -public void testCatchClauseExceptionRef15() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[3]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " public void throwing() throws IZZException, IZZAException {}\n" + - " public void foo() {\n" + - " try {\n" + - " try {\n" + - " throwing();\n" + - " } finally {}\n" + - " }\n" + - " catch (IZZAException e) {\n" + - " }\n" + - " catch (IZZ) {\n" + - " }\n" + - " }" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/test/IZZAException.js", - "package test;"+ - "public class IZZAException extends Exception {\n" + - "}\n"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/test/IZZException.js", - "package test;"+ - "public class IZZException extends Exception {\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "IZZ"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "IZZException[TYPE_REF]{IZZException, test, Ltest.IZZException;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65737 - */ -public void testCompletion2InterfacesWithSameMethod() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "Completion2InterfacesWithSameMethod.js"); - - String str = cu.getSource(); - String completeBehind = "var.meth"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:method completion:method() relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionAbstractMethod1() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/CompletionAbstractMethod1.js", - "public class CompletionAbstractMethod1 {\n" + - " abstract class A {\n" + - " abstract void foo();\n" + - " }\n" + - " class B extends A {\n" + - " void foo{} {}\n" + - " void bar() {\n" + - " super.fo\n" + - " }\n" + - " }\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "fo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "", - requestor.getResults()); -} -public void testCompletionAbstractMethod2() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/CompletionAbstractMethod2.js", - "public class CompletionAbstractMethod2 {\n" + - " abstract class A {\n" + - " abstract void foo();\n" + - " }\n" + - " class B extends A {\n" + - " void foo{} {}\n" + - " void bar() {\n" + - " this.fo\n" + - " }\n" + - " }\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "fo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "foo[FUNCTION_REF]{foo(), LCompletionAbstractMethod2$A;, ()V, foo, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -public void testCompletionAbstractMethod3() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/CompletionAbstractMethod3.js", - "public class CompletionAbstractMethod3 {\n" + - " abstract class A {\n" + - " abstract void foo();\n" + - " }\n" + - " class B extends A {\n" + - " void bar() {\n" + - " this.fo\n" + - " }\n" + - " }\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "fo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "foo[FUNCTION_REF]{foo(), LCompletionAbstractMethod3$A;, ()V, foo, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -public void testCompletionAbstractMethod4() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/CompletionAbstractMethod4.js", - "public class CompletionAbstractMethod1 {\n" + - " class A {\n" + - " void foo(){}\n" + - " }\n" + - " abstract class B extends A {\n" + - " abstract void foo();\n" + - " }\n" + - " class C extends B {\n" + - " void foo{} {}\n" + - " void bar() {\n" + - " super.fo\n" + - " }\n" + - " }\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "fo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "", - requestor.getResults()); -} - -/* -* http://dev.eclipse.org/bugs/show_bug.cgi?id=25578 -*/ -public void testCompletionAbstractMethodRelevance1() throws JavaScriptModelException { - IJavaScriptUnit superClass = null; - try { - superClass = getWorkingCopy( - "/Completion/src/CompletionAbstractSuperClass.js", - "public abstract class CompletionAbstractSuperClass {\n"+ - " public void foo1(){}\n"+ - " public abstract void foo2();\n"+ - " public void foo3(){}\n"+ - "}"); - - this.wc = getWorkingCopy( - "/Completion/src/CompletionAbstractMethodRelevance1.js", - "public class CompletionAbstractMethodRelevance1 extends CompletionAbstractSuperClass {\n"+ - " foo\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "foo[POTENTIAL_METHOD_DECLARATION]{foo, LCompletionAbstractMethodRelevance1;, ()V, foo, null, "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}\n" + - "foo1[FUNCTION_DECLARATION]{public void foo1(), LCompletionAbstractSuperClass;, ()V, foo1, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n" + - "foo3[FUNCTION_DECLARATION]{public void foo3(), LCompletionAbstractSuperClass;, ()V, foo3, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n" + - "foo2[FUNCTION_DECLARATION]{public void foo2(), LCompletionAbstractSuperClass;, ()V, foo2, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_ABSTRACT_METHOD + R_METHOD_OVERIDE+ R_NON_RESTRICTED)+"}", - requestor.getResults()); - } finally { - if(superClass != null) { - superClass.discardWorkingCopy(); - } - } -} -/* -* http://dev.eclipse.org/bugs/show_bug.cgi?id=25578 -*/ -public void testCompletionAbstractMethodRelevance2() throws JavaScriptModelException { - IJavaScriptUnit superClass = null; - try { - superClass = getWorkingCopy( - "/Completion/src/CompletionSuperInterface.js", - "public interface CompletionSuperInterface{\n"+ - " public int eqFoo(int a,Object b);\n"+ - "}"); - - this.wc = getWorkingCopy( - "/Completion/src/CompletionAbstractMethodRelevance2.js", - "public class CompletionAbstractMethodRelevance2 implements CompletionSuperInterface {\n"+ - " eq\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "eq"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "eq[POTENTIAL_METHOD_DECLARATION]{eq, LCompletionAbstractMethodRelevance2;, ()V, eq, null, "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}\n" + - "equals[FUNCTION_DECLARATION]{public boolean equals(Object obj), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n" + - "eqFoo[FUNCTION_DECLARATION]{public int eqFoo(int a, Object b), LCompletionSuperInterface;, (ILjava.lang.Object;)I, eqFoo, (a, b), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_ABSTRACT_METHOD + R_METHOD_OVERIDE+ R_NON_RESTRICTED)+"}", - requestor.getResults()); - } finally { - if(superClass != null) { - superClass.discardWorkingCopy(); - } - } -} -public void testCompletionAfterCase1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAfterCase1.js"); - - String str = cu.getSource(); - String completeBehind = "zz"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:zzz completion:zzz relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionAfterCase2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAfterCase2.js"); - - String str = cu.getSource(); - String completeBehind = "zz"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:zzz completion:zzz relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionAfterSupercall1() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/CompletionAfterSupercall1.js", - "public class CompletionAfterSupercall1 extends CompletionAfterSupercall1_1 {\n" + - " public void foo(){\n" + - " super.foo\n" + - " }\n" + - "}\n" + - "abstract class CompletionAfterSupercall1_1 extends CompletionAfterSupercall1_2 implements CompletionAfterSupercall1_3 {\n" + - " \n" + - "}\n" + - "class CompletionAfterSupercall1_2 implements CompletionAfterSupercall1_3 {\n" + - " public void foo(){}\n" + - "}\n" + - "interface CompletionAfterSupercall1_3 {\n" + - " public void foo();\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "super.foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "foo[FUNCTION_REF]{foo(), LCompletionAfterSupercall1_2;, ()V, foo, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_STATIC+ R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -public void testCompletionAfterSwitch() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAfterSwitch.js"); - - String str = cu.getSource(); - String completeBehind = "bar"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:bar completion:bar() relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_NAME+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionAllMemberTypes() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/test/CompletionAllMemberTypes.js", - "package test;\n" + - "public class CompletionAllMemberTypes {\n" + - " class Member1 {\n" + - " class Member2 {\n" + - " class Member3 {\n" + - " }\n" + - " }\n" + - " void foo(){\n" + - " Member\n" + - " }\n" + - " \n}" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "Member"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "CompletionAllMemberTypes.Member1.Member2.Member3[TYPE_REF]{test.CompletionAllMemberTypes.Member1.Member2.Member3, test, Ltest.CompletionAllMemberTypes$Member1$Member2$Member3;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "CompletionAllMemberTypes.Member1[TYPE_REF]{Member1, test, Ltest.CompletionAllMemberTypes$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "CompletionAllMemberTypes.Member1.Member2[TYPE_REF]{Member2, test, Ltest.CompletionAllMemberTypes$Member1$Member2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -public void testCompletionAllMemberTypes2() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/test/CompletionAllMemberTypes2.js", - "package test;\n" + - "public class CompletionAllMemberTypes2 {\n" + - " class Member1 {\n" + - " class Member5 {\n" + - " class Member6 {\n" + - " }\n" + - " }\n" + - " class Member2 {\n" + - " class Member3 {\n" + - " class Member4 {\n" + - " }\n" + - " }\n" + - " void foo(){\n" + - " Member\n" + - " }\n" + - " }\n" + - " \n}" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "Member"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "CompletionAllMemberTypes2.Member1.Member2.Member3.Member4[TYPE_REF]{test.CompletionAllMemberTypes2.Member1.Member2.Member3.Member4, test, Ltest.CompletionAllMemberTypes2$Member1$Member2$Member3$Member4;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "CompletionAllMemberTypes2.Member1.Member5.Member6[TYPE_REF]{test.CompletionAllMemberTypes2.Member1.Member5.Member6, test, Ltest.CompletionAllMemberTypes2$Member1$Member5$Member6;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "CompletionAllMemberTypes2.Member1[TYPE_REF]{Member1, test, Ltest.CompletionAllMemberTypes2$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "CompletionAllMemberTypes2.Member1.Member2[TYPE_REF]{Member2, test, Ltest.CompletionAllMemberTypes2$Member1$Member2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "CompletionAllMemberTypes2.Member1.Member2.Member3[TYPE_REF]{Member3, test, Ltest.CompletionAllMemberTypes2$Member1$Member2$Member3;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "CompletionAllMemberTypes2.Member1.Member5[TYPE_REF]{Member5, test, Ltest.CompletionAllMemberTypes2$Member1$Member5;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -public void testCompletionAllMemberTypes3() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/test/CompletionAllMemberTypes2.js", - "package test;\n" + - "public interface CompletionAllMemberTypes2 {\n" + - " interface Member1 {\n" + - " interface Member5 {\n" + - " interface Member6 {\n" + - " }\n" + - " }\n" + - " interface Member2 {\n" + - " interface Member3 {\n" + - " interface Member4 {\n" + - " }\n" + - " }\n" + - " Member\n" + - " }\n" + - " \n}" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "Member"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "Member[POTENTIAL_METHOD_DECLARATION]{Member, Ltest.CompletionAllMemberTypes2$Member1$Member2;, ()V, Member, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" + - "CompletionAllMemberTypes2.Member1.Member2.Member3.Member4[TYPE_REF]{test.CompletionAllMemberTypes2.Member1.Member2.Member3.Member4, test, Ltest.CompletionAllMemberTypes2$Member1$Member2$Member3$Member4;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "CompletionAllMemberTypes2.Member1.Member5.Member6[TYPE_REF]{test.CompletionAllMemberTypes2.Member1.Member5.Member6, test, Ltest.CompletionAllMemberTypes2$Member1$Member5$Member6;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "CompletionAllMemberTypes2.Member1[TYPE_REF]{Member1, test, Ltest.CompletionAllMemberTypes2$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "CompletionAllMemberTypes2.Member1.Member2[TYPE_REF]{Member2, test, Ltest.CompletionAllMemberTypes2$Member1$Member2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "CompletionAllMemberTypes2.Member1.Member2.Member3[TYPE_REF]{Member3, test, Ltest.CompletionAllMemberTypes2$Member1$Member2$Member3;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "CompletionAllMemberTypes2.Member1.Member5[TYPE_REF]{Member5, test, Ltest.CompletionAllMemberTypes2$Member1$Member5;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -public void testCompletionAllMemberTypes4() throws JavaScriptModelException { - IJavaScriptUnit anInterface = null; - try { - anInterface = getWorkingCopy( - "/Completion/src/test/AnInterface.js", - "package test;\n" + - "public interface AnInterface {\n" + - " public interface Member1 {\n" + - " public interface Member5 {\n" + - " public interface Member6 {\n" + - " }\n" + - " }\n" + - " public interface Member2 {\n" + - " public interface Member3 {\n" + - " interface Member4 {\n" + - " }\n" + - " }\n" + - " Member\n" + - " }\n" + - " \n}" + - "}"); - - this.wc = getWorkingCopy( - "/Completion/src/test/CompletionAllMemberTypes2.js", - "package test;\n" + - "public class CompletionAllMemberTypes2 {\n" + - " class Member1 {\n" + - " class Member5 {\n" + - " class Member6 {\n" + - " }\n" + - " }\n" + - " class Member2 implements AnInterface {\n" + - " class Member3 {\n" + - " class Member4 {\n" + - " }\n" + - " }\n" + - " void foo(){\n" + - " Member\n" + - " }\n" + - " }\n" + - " \n}" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "Member"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "AnInterface.Member1.Member2[TYPE_REF]{test.AnInterface.Member1.Member2, test, Ltest.AnInterface$Member1$Member2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "AnInterface.Member1.Member2.Member3[TYPE_REF]{test.AnInterface.Member1.Member2.Member3, test, Ltest.AnInterface$Member1$Member2$Member3;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "AnInterface.Member1.Member2.Member3.Member4[TYPE_REF]{test.AnInterface.Member1.Member2.Member3.Member4, test, Ltest.AnInterface$Member1$Member2$Member3$Member4;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "AnInterface.Member1.Member5[TYPE_REF]{test.AnInterface.Member1.Member5, test, Ltest.AnInterface$Member1$Member5;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "AnInterface.Member1.Member5.Member6[TYPE_REF]{test.AnInterface.Member1.Member5.Member6, test, Ltest.AnInterface$Member1$Member5$Member6;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "CompletionAllMemberTypes2.Member1.Member2.Member3.Member4[TYPE_REF]{test.CompletionAllMemberTypes2.Member1.Member2.Member3.Member4, test, Ltest.CompletionAllMemberTypes2$Member1$Member2$Member3$Member4;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "CompletionAllMemberTypes2.Member1.Member5.Member6[TYPE_REF]{test.CompletionAllMemberTypes2.Member1.Member5.Member6, test, Ltest.CompletionAllMemberTypes2$Member1$Member5$Member6;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "AnInterface.Member1[TYPE_REF]{Member1, test, Ltest.AnInterface$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "CompletionAllMemberTypes2.Member1[TYPE_REF]{Member1, test, Ltest.CompletionAllMemberTypes2$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "CompletionAllMemberTypes2.Member1.Member2[TYPE_REF]{Member2, test, Ltest.CompletionAllMemberTypes2$Member1$Member2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "CompletionAllMemberTypes2.Member1.Member2.Member3[TYPE_REF]{Member3, test, Ltest.CompletionAllMemberTypes2$Member1$Member2$Member3;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "CompletionAllMemberTypes2.Member1.Member5[TYPE_REF]{Member5, test, Ltest.CompletionAllMemberTypes2$Member1$Member5;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - if(anInterface != null) { - anInterface.discardWorkingCopy(); - } - } -} - -public void testCompletionAllMemberTypes5() throws JavaScriptModelException { - IJavaScriptUnit aType = null; - Hashtable oldCurrentOptions = JavaScriptCore.getOptions(); - try { - Hashtable options = new Hashtable(oldCurrentOptions); - options.put(JavaScriptCore.CODEASSIST_VISIBILITY_CHECK, JavaScriptCore.ENABLED); - JavaScriptCore.setOptions(options); - - aType = getWorkingCopy( - "/Completion/src/test/AType.js", - "package test;\n" + - "public class AType {\n" + - " public class Member1 {\n" + - " private class Member2 {\n" + - " public class Member3 {\n" + - " public class Member4 {\n" + - " }\n" + - " }\n" + - " }\n" + - " \n}" + - "}"); - - this.wc = getWorkingCopy( - "/Completion/src/test/CompletionAllMemberTypes5.js", - "package test;\n" + - "public class CompletionAllMemberTypes5 {\n" + - " void foo(){\n" + - " Member\n" + - " }\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "Member"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - // AType.Member1.Member2.Member3 and AType.Member1.Member2.Member3.Member4 should not be proposed because they are not visible. - // But visibility need modifiers of enclosing types to be computed. - assertResults( - "AType.Member1[TYPE_REF]{test.AType.Member1, test, Ltest.AType$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "AType.Member1.Member2.Member3[TYPE_REF]{test.AType.Member1.Member2.Member3, test, Ltest.AType$Member1$Member2$Member3;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "AType.Member1.Member2.Member3.Member4[TYPE_REF]{test.AType.Member1.Member2.Member3.Member4, test, Ltest.AType$Member1$Member2$Member3$Member4;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - if(aType != null) { - aType.discardWorkingCopy(); - } - JavaScriptCore.setOptions(oldCurrentOptions); - } -} - -public void testCompletionAllMemberTypes6() throws JavaScriptModelException { - Hashtable oldCurrentOptions = JavaScriptCore.getOptions(); - try { - Hashtable options = new Hashtable(oldCurrentOptions); - options.put(JavaScriptCore.CODEASSIST_VISIBILITY_CHECK, JavaScriptCore.ENABLED); - JavaScriptCore.setOptions(options); - - this.wc = getWorkingCopy( - "/Completion/src/test/CompletionAllMemberTypes6.js", - "package test;\n" + - "class AType {\n" + - " public class Member1 {\n" + - " private class Member2 {\n" + - " public class Member3 {\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n" + - "public class CompletionAllMemberTypes6 {\n" + - " void foo(){\n" + - " Member\n" + - " }\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "Member"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "AType.Member1[TYPE_REF]{test.AType.Member1, test, Ltest.AType$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - JavaScriptCore.setOptions(oldCurrentOptions); - } -} - -public void testCompletionAllMemberTypes7() throws JavaScriptModelException { - Hashtable oldCurrentOptions = JavaScriptCore.getOptions(); - try { - Hashtable options = new Hashtable(oldCurrentOptions); - options.put(JavaScriptCore.CODEASSIST_VISIBILITY_CHECK, JavaScriptCore.ENABLED); - JavaScriptCore.setOptions(options); - - this.wc = getWorkingCopy( - "/Completion/src/test/AType.js", - "package test;\n" + - "class AType {\n" + - " public class Member1 {\n" + - " private class Member2 {\n" + - " public class Member3 {\n" + - " }\n" + - " }\n" + - " }\n" + - " void foo(){\n" + - " Member\n" + - " }\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "Member"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "AType.Member1.Member2[TYPE_REF]{test.AType.Member1.Member2, test, Ltest.AType$Member1$Member2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "AType.Member1.Member2.Member3[TYPE_REF]{test.AType.Member1.Member2.Member3, test, Ltest.AType$Member1$Member2$Member3;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "AType.Member1[TYPE_REF]{Member1, test, Ltest.AType$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - JavaScriptCore.setOptions(oldCurrentOptions); - } -} - -public void testCompletionAllocationExpressionIsParent1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAllocationExpressionIsParent1.js"); - - String str = cu.getSource(); - String completeBehind = "zz"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionAllocationExpressionIsParent2() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/CompletionAllocationExpressionIsParent2.js", - "public class CompletionAllocationExpressionIsParent2 {\n" + - " public class Inner {\n" + - " public Inner(long i, long j){super();}\n" + - " public Inner(Object i, Object j){super();}\n" + - " \n" + - " }\n" + - " \n" + - " long zzlong;\n" + - " int zzint;\n" + - " double zzdouble;\n" + - " boolean zzboolean;\n" + - " Object zzObject;\n" + - " \n" + - " void foo() {\n" + - " this.new Inner(1, zz\n" + - " }\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "zz"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "zzObject[FIELD_REF]{zzObject, LCompletionAllocationExpressionIsParent2;, Ljava.lang.Object;, zzObject, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" + - "zzboolean[FIELD_REF]{zzboolean, LCompletionAllocationExpressionIsParent2;, Z, zzboolean, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" + - "zzdouble[FIELD_REF]{zzdouble, LCompletionAllocationExpressionIsParent2;, D, zzdouble, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" + - "zzint[FIELD_REF]{zzint, LCompletionAllocationExpressionIsParent2;, I, zzint, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" + - "zzlong[FIELD_REF]{zzlong, LCompletionAllocationExpressionIsParent2;, J, zzlong, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED)+"}", - requestor.getResults()); -} - -public void testCompletionAllocationExpressionIsParent3() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/CompletionAllocationExpressionIsParent3.js", - "public class CompletionAllocationExpressionIsParent3 {\n" + - " public class Inner {\n" + - " public Inner(long i, long j){super();}\n" + - " public Inner(Object i, Object j){super();}\n" + - " \n" + - " }\n" + - " \n" + - " long zzlong;\n" + - " int zzint;\n" + - " double zzdouble;\n" + - " boolean zzboolean;\n" + - " Object zzObject;\n" + - " \n" + - " void foo() {\n" + - " new CompletionAllocationExpressionIsParent3().new Inner(1, zz\n" + - " }\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "zz"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "zzObject[FIELD_REF]{zzObject, LCompletionAllocationExpressionIsParent3;, Ljava.lang.Object;, zzObject, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" + - "zzboolean[FIELD_REF]{zzboolean, LCompletionAllocationExpressionIsParent3;, Z, zzboolean, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" + - "zzdouble[FIELD_REF]{zzdouble, LCompletionAllocationExpressionIsParent3;, D, zzdouble, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" + - "zzint[FIELD_REF]{zzint, LCompletionAllocationExpressionIsParent3;, I, zzint, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" + - "zzlong[FIELD_REF]{zzlong, LCompletionAllocationExpressionIsParent3;, J, zzlong, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED)+"}", - requestor.getResults()); -} - -public void testCompletionAllocationExpressionIsParent4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAllocationExpressionIsParent4.js"); - - String str = cu.getSource(); - String completeBehind = "zz"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} - -public void testCompletionAllocationExpressionIsParent5() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAllocationExpressionIsParent5.js"); - - String str = cu.getSource(); - String completeBehind = "zz"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} - - -public void testCompletionAllocationExpressionIsParent6() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/CompletionAllocationExpressionIsParent6.js", - "public class CompletionAllocationExpressionIsParent6 {\n" + - " \n" + - " long zzlong;\n" + - " int zzint;\n" + - " double zzdouble;\n" + - " boolean zzboolean;\n" + - " Object zzObject;\n" + - " \n" + - " void foo() {\n" + - " new CompletionAllocation_ERROR_ExpressionIsParent6Plus().new Inner(1, zz\n" + - " }\n" + - "}\n" + - "class CompletionAllocationExpressionIsParent6Plus {\n" + - " public class Inner {\n" + - " public Inner(long i, long j){\n" + - " \n" + - " } \n" + - " } \n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "zz"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "zzObject[FIELD_REF]{zzObject, LCompletionAllocationExpressionIsParent6;, Ljava.lang.Object;, zzObject, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" + - "zzboolean[FIELD_REF]{zzboolean, LCompletionAllocationExpressionIsParent6;, Z, zzboolean, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" + - "zzdouble[FIELD_REF]{zzdouble, LCompletionAllocationExpressionIsParent6;, D, zzdouble, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" + - "zzint[FIELD_REF]{zzint, LCompletionAllocationExpressionIsParent6;, I, zzint, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" + - "zzlong[FIELD_REF]{zzlong, LCompletionAllocationExpressionIsParent6;, J, zzlong, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED)+"}", - requestor.getResults()); -} - -public void testCompletionAmbiguousFieldName() throws JavaScriptModelException { - - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAmbiguousFieldName.js"); - - String str = cu.getSource(); - String completeBehind = "xBa"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "should have two completions", - "element:xBar completion:this.xBar relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" + - "element:xBar completion:xBar relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} - -public void testCompletionAmbiguousFieldName2() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/CompletionAmbiguousFieldName2.js", - "public class CompletionAmbiguousFieldName2 {\n"+ - " int xBar;\n"+ - " class classFoo {\n"+ - " public void foo(int xBar){\n"+ - " xBa\n"+ - " }\n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "xBa"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "xBar[FIELD_REF]{CompletionAmbiguousFieldName2.this.xBar, LCompletionAmbiguousFieldName2;, I, xBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "xBar[LOCAL_VARIABLE_REF]{xBar, null, I, xBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED)+"}", - requestor.getResults()); -} - -public void testCompletionAmbiguousFieldName3() throws JavaScriptModelException { - - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAmbiguousFieldName3.js"); - - String str = cu.getSource(); - String completeBehind = "xBa"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "should have two completions", - "element:xBar completion:ClassFoo.this.xBar relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" + - "element:xBar completion:xBar relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionAmbiguousFieldName4() throws JavaScriptModelException { - - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAmbiguousFieldName4.js"); - - String str = cu.getSource(); - String completeBehind = "xBa"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "should have one completion", - "element:xBar completion:xBar relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionAmbiguousType() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAmbiguousType.js"); - - String str = cu.getSource(); - String completeBehind = "ABC"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "should have two completions", - "element:ABC completion:p1.ABC relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"\n" + - "element:ABC completion:p2.ABC relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionAmbiguousType2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAmbiguousType2.js"); - - String str = cu.getSource(); - String completeBehind = "ABC"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "should have two completions", - "element:ABC completion:ABC relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:ABC completion:p2.ABC relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME+ R_NON_RESTRICTED), - requestor.getResults()); -} - -public void testCompletionArgumentName() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionArgumentName.js"); - - String str = cu.getSource(); - String completeBehind = "ClassWithComplexName "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "should have two completions", - "element:classWithComplexName completion:classWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" + - "element:complexName2 completion:complexName2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" + - "element:name completion:name relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" + - "element:withComplexName completion:withComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} - -public void testCompletionArrayAccess1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionArrayAccess1.js"); - - String str = cu.getSource(); - String completeBehind = "zzz"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:zzz1 completion:zzz1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:zzz2 completion:zzz2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE +R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} - -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=84690 -public void testCompletionArrayClone() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/test/CompletionArrayClone.js", - "package test;\n" + - "public class CompletionArrayClone {\n" + - " public void foo() {\n" + - " long[] var;\n" + - " var.clon\n" + - " }\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "clon"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "clone[FUNCTION_REF]{clone(), [J, ()Ljava.lang.Object;, clone, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} - -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=84690 -public void testCompletionArrayLength() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/test/CompletionArrayLength.js", - "package test;\n" + - "public class CompletionArrayLength {\n" + - " public void foo() {\n" + - " long[] var;\n" + - " var.leng\n" + - " }" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "leng"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "length[FIELD_REF]{length, [J, I, length, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} - -public void testCompletionArraysCloneMethod() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionArraysCloneMethod.js"); - - String str = cu.getSource(); - String completeBehind = ".cl"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:clone completion:clone() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED), - requestor.getResults()); -} - -public void testCompletionAssignmentInMethod1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAssignmentInMethod1.js"); - - String str = cu.getSource(); - String completeBehind = "zz"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} - -public void testCompletionAssignmentInMethod2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAssignmentInMethod2.js"); - - String str = cu.getSource(); - String completeBehind = "zz"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} - -public void testCompletionAssignmentInMethod3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAssignmentInMethod3.js"); - - String str = cu.getSource(); - String completeBehind = "Objec"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Object completion:Object relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} - - -public void testCompletionAssignmentInMethod4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAssignmentInMethod4.js"); - - String str = cu.getSource(); - String completeBehind = "Objec"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Object completion:Object relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} - - -public void testCompletionBasicAnonymousDeclaration1() throws JavaScriptModelException { - CompletionResult result = complete( - "/Completion/src3/test0000/CompletionBasicCompletionContext.js", - "public class CompletionBasicAnonymousDeclaration1 {\n"+ - " void foo() {\n"+ - " new Object(\n"+ - " }\n"+ - "}", - "new Object("); - - assertResults( - "expectedTypesSignatures=null\n" + - "expectedTypesKeys=null", - result.context); - - assertResults( - "Object[ANONYMOUS_CLASS_DECLARATION]{, Ljava.lang.Object;, ()V, null, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" + - "Object[FUNCTION_REF]{, Ljava.lang.Object;, ()V, Object, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}", - result.proposals); -} - -public void testCompletionBasicCompletionContext() throws JavaScriptModelException { - CompletionResult result = complete( - "/Completion/src3/test0000/CompletionBasicCompletionContext.js", - "package test0000;\n" + - "public class CompletionBasicCompletionContext {\n" + - " void bar(String o) {\n" + - " String zzz = null; \n" + - " o = zzz\n" + - " }\n" + - "}", - "zzz"); - - assertResults( - "expectedTypesSignatures={Ljava.lang.String;}\n" + - "expectedTypesKeys={Ljava/lang/String;}", - result.context); - - assertResults( - "zzz[LOCAL_VARIABLE_REF]{zzz, null, Ljava.lang.String;, zzz, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + + R_EXACT_NAME + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - result.proposals); -} - -public void testCompletionBasicField1() throws JavaScriptModelException { - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBasicField1.js"); - - String str = cu.getSource(); - String completeBehind = "zzvar"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertResults( - "zzvarzz[FIELD_REF]{zzvarzz, LCompletionBasicField1;, I, zzvarzz, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} - -public void testCompletionBasicKeyword1() throws JavaScriptModelException { - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBasicKeyword1.js"); - - String str = cu.getSource(); - String completeBehind = "whil"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertResults( - "while[KEYWORD]{while, null, null, while, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} - -public void testCompletionBasicLocalVariable1() throws JavaScriptModelException { - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBasicLocalVariable1.js"); - - String str = cu.getSource(); - String completeBehind = "zzvar"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertResults( - "zzvarzz[LOCAL_VARIABLE_REF]{zzvarzz, null, I, zzvarzz, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} - -public void testCompletionBasicMethod1() throws JavaScriptModelException { - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBasicMethod1.js"); - - String str = cu.getSource(); - String completeBehind = "zzfo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertResults( - "zzfoo[FUNCTION_REF]{zzfoo(), LCompletionBasicMethod1;, ()V, zzfoo, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} - -public void testCompletionBasicMethodDeclaration1() throws JavaScriptModelException { - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBasicMethodDeclaration1.js"); - - String str = cu.getSource(); - String completeBehind = "equals"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertResults( - "equals[POTENTIAL_METHOD_DECLARATION]{equals, LCompletionBasicMethodDeclaration1;, ()V, equals, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" + - "equals[FUNCTION_DECLARATION]{public boolean equals(Object obj), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_EXACT_NAME + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} - -public void testCompletionBasicPackage1() throws JavaScriptModelException { - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBasicPackage1.js"); - - String str = cu.getSource(); - String completeBehind = "java.lan"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertResults( - "java.lang[PACKAGE_REF]{java.lang, java.lang, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_QUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} - - -public void testCompletionBasicPotentialMethodDeclaration1() throws JavaScriptModelException { - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBasicPotentialMethodDeclaration1.js"); - - String str = cu.getSource(); - String completeBehind = "zzpot"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertResults( - "zzpot[POTENTIAL_METHOD_DECLARATION]{zzpot, LCompletionBasicPotentialMethodDeclaration1;, ()V, zzpot, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} - - -public void testCompletionBasicType1() throws JavaScriptModelException { - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBasicType1.js"); - - String str = cu.getSource(); - String completeBehind = "Objec"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertResults( - "Object[TYPE_REF]{Object, java.lang, Ljava.lang.Object;, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} - -public void testCompletionBasicVariableDeclaration1() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/CompletionBasicVariableDeclaration1.js", - "public class CompletionBasicVariableDeclaration1 {\n"+ - " public Object obj;\n"+ - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "obj"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "object[VARIABLE_DECLARATION]{object, null, Ljava.lang.Object;, object, null, " + (R_DEFAULT + R_INTERESTING + R_CASE+ R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} - -public void testCompletionBinaryOperator1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBinaryOperator1.js"); - - String str = cu.getSource(); - String completeBehind = "var"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:var1 completion:var1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" + - "element:var2 completion:var2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:var3 completion:var3 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:var4 completion:var4 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE+ R_NON_RESTRICTED), - requestor.getResults()); -} - -public void testCompletionBinaryOperator2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBinaryOperator2.js"); - - String str = cu.getSource(); - String completeBehind = "var"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:var1 completion:var1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:var2 completion:var2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" + - "element:var3 completion:var3 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} - - -public void testCompletionBinaryOperator3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBinaryOperator3.js"); - - String str = cu.getSource(); - String completeBehind = "var"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:var1 completion:var1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" + - "element:var2 completion:var2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:var3 completion:var3 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} - - -/** - * Ensures that completion is not case sensitive - */ -public void testCompletionCaseInsensitive() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu = getCompilationUnit("Completion", "src", "", "CompletionCaseInsensitive.js"); - - String str = cu.getSource(); - String completeBehind = "Fiel"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals("should have one class", - "element:field completion:field relevance:"+(R_DEFAULT + R_INTERESTING + R_NON_STATIC + R_NON_RESTRICTED), - requestor.getResults()); -} - - -/** - * Complete a package in a case insensitive way - */ -public void testCompletionCaseInsensitivePackage() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionCaseInsensitivePackage.js"); - - String str = cu.getSource(); - String completeBehind = "Ja"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length(); - - cu.codeComplete(cursorLocation, requestor); - assertEquals( - "should have package completions", - "element:jarpack1 completion:jarpack1 relevance:"+(R_DEFAULT + R_INTERESTING+ R_NON_RESTRICTED)+"\n" + - "element:jarpack2 completion:jarpack2 relevance:"+(R_DEFAULT + R_INTERESTING+ R_NON_RESTRICTED)+"\n" + - "element:java completion:java relevance:"+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"\n" + - "element:java.io completion:java.io relevance:"+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"\n" + - "element:java.lang completion:java.lang relevance:"+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED), - requestor.getResults()); -} - - -public void testCompletionCastIsParent1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionCastIsParent1.js"); - - String str = cu.getSource(); - String completeBehind = "zz"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:zz00 completion:zz00 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz00M completion:zz00M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz01 completion:zz01 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz01M completion:zz01M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz02 completion:zz02 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz02M completion:zz02M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz10 completion:zz10 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz10M completion:zz10M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz11 completion:zz11 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz11M completion:zz11M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz12 completion:zz12 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz12M completion:zz12M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz20 completion:zz20 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz20M completion:zz20M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz21 completion:zz21 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz21M completion:zz21M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz22 completion:zz22 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz22M completion:zz22M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzOb completion:zzOb relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzObM completion:zzObM() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} - - -public void testCompletionCastIsParent2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionCastIsParent2.js"); - - String str = cu.getSource(); - String completeBehind = "xx"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:XX00 completion:XX00 relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:XX01 completion:XX01 relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:XX02 completion:XX02 relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:XX10 completion:XX10 relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:XX11 completion:XX11 relevance:"+(R_DEFAULT + R_INTERESTING + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:XX12 completion:XX12 relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:XX20 completion:XX20 relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:XX21 completion:XX21 relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:XX22 completion:XX22 relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} - -public void testCompletionCatchArgumentName() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/CompletionCatchArgumentName.js", - "public class CompletionCatchArgumentName {\n"+ - " public void foo(){\n"+ - " try{\n"+ - " \n"+ - " } catch (Exception ex)\n"+ - " }\n"+ - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "ex"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "exception[VARIABLE_DECLARATION]{exception, null, Ljava.lang.Exception;, exception, null, " + (R_DEFAULT + R_INTERESTING + R_CASE+ R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} - -public void testCompletionCatchArgumentName2() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - - Object argumentPrefixPreviousValue = options.get(JavaScriptCore.CODEASSIST_ARGUMENT_PREFIXES); - options.put(JavaScriptCore.CODEASSIST_ARGUMENT_PREFIXES,"arg"); //$NON-NLS-1$ - Object localPrefixPreviousValue = options.get(JavaScriptCore.CODEASSIST_LOCAL_PREFIXES); - options.put(JavaScriptCore.CODEASSIST_LOCAL_PREFIXES,"loc"); //$NON-NLS-1$ - - JavaScriptCore.setOptions(options); - - try { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionCatchArgumentName2.js"); - - String str = cu.getSource(); - String completeBehind = "Exception "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:exception completion:exception relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+ - "element:locException completion:locException relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX+ R_NON_RESTRICTED), - requestor.getResults()); - } finally { - options.put(JavaScriptCore.CODEASSIST_ARGUMENT_PREFIXES,argumentPrefixPreviousValue); - options.put(JavaScriptCore.CODEASSIST_LOCAL_PREFIXES,localPrefixPreviousValue); - JavaScriptCore.setOptions(options); - } -} - -public void testCompletionClassLiteralAfterAnonymousType1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionClassLiteralAfterAnonymousType1.js"); - - String str = cu.getSource(); - String completeBehind = "double."; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED), - requestor.getResults()); -} - -public void testCompletionConditionalExpression1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionConditionalExpression1.js"); - - String str = cu.getSource(); - String completeBehind = "var"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:var1 completion:var1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" + - "element:var2 completion:var2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:var3 completion:var3 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:var4 completion:var4 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} - -public void testCompletionConditionalExpression2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionConditionalExpression2.js"); - - String str = cu.getSource(); - String completeBehind = "var"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:var1 completion:var1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" + - "element:var2 completion:var2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:var3 completion:var3 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:var4 completion:var4 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} - -public void testCompletionConditionalExpression3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionConditionalExpression3.js"); - - String str = cu.getSource(); - String completeBehind = "var"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:var1 completion:var1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" + - "element:var2 completion:var2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:var3 completion:var3 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:var4 completion:var4 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} - - -/* -* http://dev.eclipse.org/bugs/show_bug.cgi?id=24939 -*/ -public void testCompletionConstructorForAnonymousType() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionConstructorForAnonymousType.js"); - - String str = cu.getSource(); - String completeBehind = "TypeWithConstructor("; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:TypeWithConstructor completion: relevance:"+(R_DEFAULT + R_INTERESTING+ R_NON_RESTRICTED), - requestor.getResults()); -} - -public void testCompletionEmptyToken1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionEmptyToken1.js"); - - String str = cu.getSource(); - String completeBehind = "zz"; - // completion is just at start of 'zz' - int cursorLocation = str.lastIndexOf(completeBehind); - int start = cursorLocation; - int end = start + 4; - cu.codeComplete(cursorLocation, requestor); - - if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) { - assertEquals( - "element:clone completion:clone() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:equals completion:equals() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:finalize completion:finalize() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:foo completion:foo() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:getClass completion:getClass() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:hashCode completion:hashCode() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:notify completion:notify() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:notifyAll completion:notifyAll() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:toString completion:toString() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:wait completion:wait() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:wait completion:wait() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:wait completion:wait() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:zzyy completion:zzyy position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResultsWithPosition()); - } else { - assertEquals( - "element:CompletionEmptyToken1 completion:CompletionEmptyToken1 position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:clone completion:clone() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:equals completion:equals() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:finalize completion:finalize() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:foo completion:foo() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:getClass completion:getClass() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:hashCode completion:hashCode() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:notify completion:notify() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:notifyAll completion:notifyAll() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:toString completion:toString() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:wait completion:wait() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:wait completion:wait() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:wait completion:wait() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:zzyy completion:zzyy position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResultsWithPosition()); - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=100808 -public void testCompletionEmptyToken2() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/testCompletionEmptyToken2/Test.js", - "package testCompletionEmptyToken2."); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true); - - String str = this.wc.getSource(); - String completeBehind = "testCompletionEmptyToken2."; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - int start = str.lastIndexOf(completeBehind); - int end = start + completeBehind.length(); - - assertResults( - "expectedTypesSignatures=null\n"+ - "expectedTypesKeys=null", - requestor.getContext()); - - assertResults( - "testCompletionEmptyToken2[PACKAGE_REF]{testCompletionEmptyToken2, testCompletionEmptyToken2, null, null, null, ["+start+", "+end+"], " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} - -/* -* http://dev.eclipse.org/bugs/show_bug.cgi?id=25221 -*/ -public void testCompletionEmptyTypeName1() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/CompletionEmptyTypeName1.js", - "public class CompletionEmptyTypeName1 {\n"+ - " void foo() {\n"+ - " A a = new \n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "new "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) { - assertResults( - "A[TYPE_REF]{A, , LA;, null, null, " +(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}", - requestor.getResults()); - } else { - assertResults( - "CompletionEmptyTypeName1[TYPE_REF]{CompletionEmptyTypeName1, , LCompletionEmptyTypeName1;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED)+"}\n"+ - "A[TYPE_REF]{A, , LA;, null, null, " +(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}", - requestor.getResults()); - } -} - -/* -* http://dev.eclipse.org/bugs/show_bug.cgi?id=25221 -*/ -public void testCompletionEmptyTypeName2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionEmptyTypeName2.js"); - - String str = cu.getSource(); - String completeBehind = " = "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) { - assertEquals( - "element:a completion:a relevance:"+(R_DEFAULT + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:clone completion:clone() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:equals completion:equals() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:finalize completion:finalize() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:foo completion:foo() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:getClass completion:getClass() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:hashCode completion:hashCode() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:notify completion:notify() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:notifyAll completion:notifyAll() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:toString completion:toString() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:wait completion:wait() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:wait completion:wait() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:wait completion:wait() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); - } else { - assertEquals( - "element:A completion:A relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:CompletionEmptyTypeName2 completion:CompletionEmptyTypeName2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:a completion:a relevance:"+(R_DEFAULT + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:clone completion:clone() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:equals completion:equals() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:finalize completion:finalize() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:foo completion:foo() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:getClass completion:getClass() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:hashCode completion:hashCode() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:notify completion:notify() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:notifyAll completion:notifyAll() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:toString completion:toString() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:wait completion:wait() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:wait completion:wait() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:wait completion:wait() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); - } -} - -/* -* http://dev.eclipse.org/bugs/show_bug.cgi?id=41643 -*/ -public void testCompletionEmptyTypeName3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionEmptyTypeName3.js"); - - String str = cu.getSource(); - String completeBehind = " = "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) { - assertEquals( - "element:clone completion:clone() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:equals completion:equals() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:finalize completion:finalize() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:foo completion:foo() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:getClass completion:getClass() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:hashCode completion:hashCode() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:notify completion:notify() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:notifyAll completion:notifyAll() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:toString completion:toString() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:wait completion:wait() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:wait completion:wait() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:wait completion:wait() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:x completion:x relevance:"+(R_DEFAULT + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE+ R_NON_RESTRICTED), - requestor.getResults()); - } else { - assertEquals( - "element:CompletionEmptyTypeName2 completion:CompletionEmptyTypeName2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" + - "element:CompletionEmptyTypeName3 completion:CompletionEmptyTypeName3 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:CompletionEmptyTypeName3.CompletionEmptyTypeName3_1 completion:CompletionEmptyTypeName3_1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:CompletionEmptyTypeName3_2 completion:CompletionEmptyTypeName3_2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:clone completion:clone() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:equals completion:equals() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:finalize completion:finalize() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:foo completion:foo() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:getClass completion:getClass() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:hashCode completion:hashCode() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:notify completion:notify() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:notifyAll completion:notifyAll() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:toString completion:toString() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:wait completion:wait() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:wait completion:wait() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:wait completion:wait() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:x completion:x relevance:"+(R_DEFAULT + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE+ R_NON_RESTRICTED), - requestor.getResults()); - } -} - -/** - * Complete at end of file. - */ -public void testCompletionEndOfCompilationUnit() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu = getCompilationUnit("Completion", "src", "", "CompletionEndOfCompilationUnit.js"); - cu.codeComplete(cu.getSourceRange().getOffset() + cu.getSourceRange().getLength(), requestor); - assertEquals( - "should have two methods of 'foo'", - "element:foo completion:foo() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:foo completion:foo() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED), - requestor.getResults()); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=66570 - */ -public void testCompletionExactNameCaseInsensitive() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionExactNameCaseInsensitive.js"); - - String str = cu.getSource(); - String completeBehind = "(compleTionexactnamecaseInsensitive"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:CompletionExactNameCaseInsensitive completion:CompletionExactNameCaseInsensitive relevance:"+(R_DEFAULT + R_INTERESTING + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+ "\n" + - "element:CompletionExactNameCaseInsensitivePlus completion:CompletionExactNameCaseInsensitivePlus relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -/* -* http://dev.eclipse.org/bugs/show_bug.cgi?id=25820 -*/ -public void testCompletionExpectedTypeIsNotValid() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionExpectedTypeIsNotValid.js"); - - String str = cu.getSource(); - String completeBehind = "new U"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=95505 -public void testCompletionExpectedTypeOnEmptyToken1() throws JavaScriptModelException { - IJavaScriptUnit aType = null; - try { - - aType = getWorkingCopy( - "/Completion/src/test/AType.js", - "package test;\n" + - "public class AType{\n"+ - "}"); - - this.wc = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n" + - "public class Test{\n"+ - " void foo() {\n"+ - " AType a = new \n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "AType a = new "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "expectedTypesSignatures={Ltest.AType;}\n"+ - "expectedTypesKeys={Ltest/AType;}", - requestor.getContext()); - if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) { - assertResults( - "AType[TYPE_REF]{AType, test, Ltest.AType;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } else { - assertResults( - "Test[TYPE_REF]{Test, test, Ltest.Test;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "AType[TYPE_REF]{AType, test, Ltest.AType;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } - } finally { - if(aType != null) { - aType.discardWorkingCopy(); - } - } -} - - -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=95505 -public void testCompletionExpectedTypeOnEmptyToken3() throws JavaScriptModelException { - IJavaScriptUnit aType = null; - try { - aType = getWorkingCopy( - "/Completion/src/test/AType.js", - "package test;\n" + - "public class AType{\n"+ - "}"); - - this.wc = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n" + - "public class Test{\n"+ - " void foo() {\n"+ - " AType a = \n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - requestor.setIgnored(CompletionProposal.METHOD_REF, true); - requestor.setIgnored(CompletionProposal.FIELD_REF, true); - requestor.setIgnored(CompletionProposal.LOCAL_VARIABLE_REF, true); - - String str = this.wc.getSource(); - String completeBehind = "AType a = "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "expectedTypesSignatures={Ltest.AType;}\n"+ - "expectedTypesKeys={Ltest/AType;}", - requestor.getContext()); - if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) { - assertResults( - "", - requestor.getResults()); - } else { - assertResults( - "Test[TYPE_REF]{Test, test, Ltest.Test;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "AType[TYPE_REF]{AType, test, Ltest.AType;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } - } finally { - if(aType != null) { - aType.discardWorkingCopy(); - } - } -} - - -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=95505 -public void testCompletionExpectedTypeOnEmptyToken4() throws JavaScriptModelException { - IJavaScriptUnit aType = null; - try { - aType = getWorkingCopy( - "/Completion/src/test/AInterface.js", - "package test;\n" + - "public interface AInterface{\n"+ - "}"); - - this.wc = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n" + - "public class Test{\n"+ - " void foo() {\n"+ - " AInterface a = new \n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - - String str = this.wc.getSource(); - String completeBehind = "AInterface a = new "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "expectedTypesSignatures={Ltest.AInterface;}\n"+ - "expectedTypesKeys={Ltest/AInterface;}", - requestor.getContext()); - - if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) { - assertResults( - "AInterface[TYPE_REF]{AInterface, test, Ltest.AInterface;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } else { - assertResults( - "Test[TYPE_REF]{Test, test, Ltest.Test;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "AInterface[TYPE_REF]{AInterface, test, Ltest.AInterface;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } - } finally { - if(aType != null) { - aType.discardWorkingCopy(); - } - } -} - - -public void testCompletionFieldInitializer1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFieldInitializer1.js"); - - String str = cu.getSource(); - String completeBehind = "zz"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} - - -public void testCompletionFieldInitializer2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFieldInitializer2.js"); - - String str = cu.getSource(); - String completeBehind = "zz"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} - - -public void testCompletionFieldInitializer3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFieldInitializer3.js"); - - String str = cu.getSource(); - String completeBehind = "Objec"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Object completion:Object relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} - - -public void testCompletionFieldInitializer4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFieldInitializer4.js"); - - String str = cu.getSource(); - String completeBehind = "Objec"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Object completion:Object relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} - - -public void testCompletionFieldName() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFieldName.js"); - - String str = cu.getSource(); - String completeBehind = "ClassWithComplexName "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "should have two completions", - "element:classWithComplexName completion:classWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" + - "element:complexName2 completion:complexName2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" + - "element:name completion:name relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" + - "element:withComplexName completion:withComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} - - -/** - * Complete the type "A" from "new A". - */ -public void testCompletionFindClass() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/CompletionFindClass.js", - "public class CompletionFindClass {\n" + - " private A[] a;\n" + - " public CompletionFindClass () {\n" + - " this.a = new A\n" + - " }\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "A"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "ABC[TYPE_REF]{p1.ABC, p1, Lp1.ABC;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + - "ABC[TYPE_REF]{p2.ABC, p2, Lp2.ABC;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + - "A3[TYPE_REF]{A3, , LA3;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" + - "A[TYPE_REF]{A, , LA;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} - - -/** - * The same type must be find only once - */ -public void testCompletionFindClass2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindClass2.js"); - - String str = cu.getSource(); - String completeBehind = "PX"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "should have one classe", - "element:PX completion:pack1.PX relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_QUALIFIED + R_NON_RESTRICTED), - requestor.getResults()); -} - - -/** - * Complete the type "Default" in the default package example. - */ -public void testCompletionFindClassDefaultPackage() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionDefaultPackage.js"); - - String str = cu.getSource(); - String completeBehind = "Def"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "should have one class", - "element:Default completion:Default relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED), - requestor.getResults()); -} - - -/** - * Complete the constructor "CompletionFindConstructor" from "new CompletionFindConstructor(". - */ -public void testCompletionFindConstructor() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/CompletionFindConstructor.js", - "public class CompletionFindConstructor {\n"+ - " public CompletionFindConstructor (int i) {\n"+ - " }\n"+ - " publuc void foo(){\n"+ - " int x = 45;\n"+ - " new CompletionFindConstructor(i);\n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - - String str = this.wc.getSource(); - String completeBehind = "CompletionFindConstructor("; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "expectedTypesSignatures=null\n"+ - "expectedTypesKeys=null", - requestor.getContext()); - - assertResults( - "CompletionFindConstructor[ANONYMOUS_CLASS_DECLARATION]{, LCompletionFindConstructor;, (I)V, null, (i), "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}\n" + - "CompletionFindConstructor[FUNCTION_REF]{, LCompletionFindConstructor;, (I)V, CompletionFindConstructor, (i), "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} - - -/** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78801 - */ -public void testCompletionFindConstructor2() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/CompletionFindConstructor2.js", - "import zconstructors.*;\n"+ - "public class CompletionFindConstructor2 {\n"+ - " Constructor2 c = new Constructor2();\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - - String str = this.wc.getSource(); - String completeBehind = "Constructor2("; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "expectedTypesSignatures=null\n"+ - "expectedTypesKeys=null", - requestor.getContext()); - - assertEquals( - "Constructor2[ANONYMOUS_CLASS_DECLARATION]{, Lzconstructors.Constructor2;, ()V, null, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" + - "Constructor2[FUNCTION_REF]{, Lzconstructors.Constructor2;, ()V, Constructor2, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} - -/** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78801 - */ -public void testCompletionFindConstructor3() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/CompletionFindConstructor3.js", - "import zconstructors.*;\n"+ - "public class CompletionFindConstructor3 {\n"+ - " Constructor3 c = new Constructor3();\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - - String str = this.wc.getSource(); - String completeBehind = "Constructor3("; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "expectedTypesSignatures=null\n"+ - "expectedTypesKeys=null", - requestor.getContext()); - - assertEquals( - "Constructor3[ANONYMOUS_CLASS_DECLARATION]{, Lzconstructors.Constructor3;, ()V, null, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" + - "Constructor3[FUNCTION_REF]{, Lzconstructors.Constructor3;, ()V, Constructor3, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} - -/** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78801 - */ -public void testCompletionFindConstructor4() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/CompletionFindConstructor4.js", - "import zconstructors.*;\n"+ - "public class CompletionFindConstructor4 {\n"+ - " Constructor4 c = new Constructor4();\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - - String str = this.wc.getSource(); - String completeBehind = "Constructor4("; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "expectedTypesSignatures=null\n"+ - "expectedTypesKeys=null", - requestor.getContext()); - - assertEquals( - "Constructor4[ANONYMOUS_CLASS_DECLARATION]{, Lzconstructors.Constructor4;, (I)V, null, (i), " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" + - "Constructor4[FUNCTION_REF]{, Lzconstructors.Constructor4;, (I)V, Constructor4, (i), " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} - -/** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78801 - */ -public void testCompletionFindConstructor5() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/CompletionFindConstructor5.js", - "import zconstructors.*;\n"+ - "public class CompletionFindConstructor5 {\n"+ - " Constructor5 c = new Constructor5();\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - - String str = this.wc.getSource(); - String completeBehind = "Constructor5("; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "expectedTypesSignatures=null\n"+ - "expectedTypesKeys=null", - requestor.getContext()); - - assertEquals( - "Constructor5[ANONYMOUS_CLASS_DECLARATION]{, Lzconstructors.Constructor5;, (I)V, null, (arg0), " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" + - "Constructor5[FUNCTION_REF]{, Lzconstructors.Constructor5;, (I)V, Constructor5, (arg0), " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} - -/** - * Complete the exception "Exception" in a catch clause. - */ -public void testCompletionFindExceptions1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindException1.js"); - - String str = cu.getSource(); - String completeBehind = "Ex"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "should have one class", - "element:Exception completion:Exception relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXCEPTION + R_UNQUALIFIED + R_NON_RESTRICTED), - requestor.getResults()); -} - -/** - * Complete the exception "Exception" in a throws clause. - */ -public void testCompletionFindExceptions2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindException2.js"); - - String str = cu.getSource(); - String completeBehind = "Ex"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "should have one class", - "element:Exception completion:Exception relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXCEPTION + R_UNQUALIFIED + R_NON_RESTRICTED), - requestor.getResults()); -} - -/** - * Complete the field "var" from "va"; - */ -public void testCompletionFindField1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindField1.js"); - - String str = cu.getSource(); - String completeBehind = "va"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "should have one field: 'var' and one variable: 'var'", - "element:var completion:this.var relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n"+ - "element:var completion:var relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED), - requestor.getResults()); -} - -/** - * Complete the field "var" from "this.va"; - */ -public void testCompletionFindField2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindField2.js"); - - String str = cu.getSource(); - String completeBehind = "va"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "should have 1 field of starting with 'va'", - "element:var completion:var relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED), - requestor.getResults()); -} - -public void testCompletionFindField3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindField3.js"); - - String str = cu.getSource(); - String completeBehind = "b.ba"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:bar completion:bar relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED), - requestor.getResults()); -} - -/** - * Complete the import, "import pac" - */ -public void testCompletionFindImport1() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/CompletionFindImport1.js", - "import pac\n"+ - "\n"+ - "public class CompletionFindImport1 {\n"+ - "\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "pac"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "pack[PACKAGE_REF]{pack.*;, pack, null, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "pack1[PACKAGE_REF]{pack1.*;, pack1, null, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "pack1.pack3[PACKAGE_REF]{pack1.pack3.*;, pack1.pack3, null, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "pack2[PACKAGE_REF]{pack2.*;, pack2, null, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) +"}", - requestor.getResults()); -} - -public void testCompletionFindImport2() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/CompletionFindImport2.js", - "import pack1.P\n"+ - "\n"+ - "public class CompletionFindImport2 {\n"+ - "\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "pack1.P"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "pack1.pack3[PACKAGE_REF]{pack1.pack3.*;, pack1.pack3, null, null, null, "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}\n"+ - "PX[TYPE_REF]{pack1.PX;, pack1, Lpack1.PX;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} - -/** - * Complete the local variable "var"; - */ -public void testCompletionFindLocalVariable() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindLocalVariable.js"); - - String str = cu.getSource(); - String completeBehind = "va"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - assertEquals( - "should have one local variable of 'var'", - "element:var completion:var relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED), - requestor.getResults()); -} - -public void testCompletionFindMemberType1() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/CompletionFindMemberType1.js", - "interface A1 {\n"+ - " class Inner1 {\n"+ - " }\n"+ - "}\n"+ - "interface B1 extends A1 {\n"+ - " class Inner1 {\n"+ - " }\n"+ - "}\n"+ - "public class CompletionFindMemberType1 {\n"+ - " public void foo() {\n"+ - " B1.Inner\n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "Inner"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "B1.Inner1[TYPE_REF]{Inner1, , LB1$Inner1;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) +"}", - requestor.getResults()); -} - -public void testCompletionFindMemberType2() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/CompletionPrefixMethodName2.js", - "interface A2 {\n"+ - " class ZInner2{\n"+ - " }\n"+ - "}\n"+ - "interface B2 extends A2 {\n"+ - " class ZInner2 {\n"+ - " }\n"+ - "}\n"+ - "public class CompletionFindMemberType2 implements B2{\n"+ - " public void foo() {\n"+ - " ZInner\n"+ - " }\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "ZInner"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "B2.ZInner2[TYPE_REF]{ZInner2, , LB2$ZInner2;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE+ R_UNQUALIFIED + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} - -/** - * Complete the method call "a.foobar" from "a.fooba"; - */ -public void testCompletionFindMethod1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindMethod1.js"); - - String str = cu.getSource(); - String completeBehind = "fooba"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - assertEquals( - "should have two methods of 'foobar'", - "element:foobar completion:foobar() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED)+"\n" + - "element:foobar completion:foobar() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED), - requestor.getResults()); -} -/** - * Too much Completion match on interface - */ -public void testCompletionFindMethod2() throws JavaScriptModelException { - - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindMethod2.js"); - - String str = cu.getSource(); - String completeBehind = "fooba"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "should have two completions", - "element:foobar completion:foobar() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED)+"\n" + - "element:foobar completion:foobar() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED), - requestor.getResults()); -} -/** - * Complete the method call "foobar" from "fooba"; - */ -public void testCompletionFindMethodInThis() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindMethodInThis.js"); - - String str = cu.getSource(); - String completeBehind = "fooba"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - assertEquals( - "should have one method of 'foobar'", - "element:foobar completion:foobar relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED), - requestor.getResults()); -} - -/** - * Complete the method call "foobar" from "fooba". The compilation - * unit simulates typing in process; ie it has incomplete structure/syntax errors. - */ -public void testCompletionFindMethodWhenInProcess() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindMethodInProcess.js"); - - String str = cu.getSource(); - String completeBehind = "fooba"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - assertEquals( - "should have a method of 'foobar'", - "element:foobar completion:foobar() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED), - requestor.getResults()); - cu.close(); -} - -public void testCompletionFindSecondaryType1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindSecondaryType1.js"); - - String str = cu.getSource(); - String completeBehind = "/**/Secondary"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:SecondaryType1 completion:SecondaryType1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:SecondaryType2 completion:SecondaryType2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} - -/** - * Complete the field "bar" from "this.ba" - */ -public void testCompletionFindThisDotField() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindThisDotField.js"); - - String str = cu.getSource(); - String completeBehind = "this.ba"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - assertEquals( - "should have one result of 'bar'", - "element:bar completion:bar relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED), - requestor.getResults()); -} - -public void testCompletionImportedType1() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/imported/ZZZZ.js", - "package test.imported;"+ - "public class ZZZZ {\n"+ - " \n"+ - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/test/CompletionImportedType1.js", - "package test;"+ - "public class CompletionImportedType1 {"+ - " ZZZ\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[1].getSource(); - String completeBehind = "ZZZ"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[1].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "ZZZ[POTENTIAL_METHOD_DECLARATION]{ZZZ, Ltest.CompletionImportedType1;, ()V, ZZZ, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" + - "ZZZZ[TYPE_REF]{test.imported.ZZZZ, test.imported, Ltest.imported.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} - -public void testCompletionImportedType2() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[4]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/imported1/ZZZZ.js", - "package test.imported1;"+ - "public class ZZZZ {\n"+ - " \n"+ - "}"); - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/test/imported2/ZZZZ.js", - "package test.imported2;"+ - "public class ZZZZ {\n"+ - " \n"+ - "}"); - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/test/imported3/ZZZZ.js", - "package test.imported3;"+ - "public class ZZZZ {\n"+ - " \n"+ - "}"); - - this.workingCopies[3] = getWorkingCopy( - "/Completion/src/test/CompletionImportedType2.js", - "package test;"+ - "import test.imported1.*;"+ - "import test.imported2.*;"+ - "import test.imported3.*;"+ - "public class CompletionImportedType2 {"+ - " ZZZ\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[3].getSource(); - String completeBehind = "ZZZ"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[3].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "ZZZ[POTENTIAL_METHOD_DECLARATION]{ZZZ, Ltest.CompletionImportedType2;, ()V, ZZZ, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" + - "ZZZZ[TYPE_REF]{test.imported1.ZZZZ, test.imported1, Ltest.imported1.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "ZZZZ[TYPE_REF]{test.imported2.ZZZZ, test.imported2, Ltest.imported2.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "ZZZZ[TYPE_REF]{test.imported3.ZZZZ, test.imported3, Ltest.imported3.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} - -public void testCompletionImportedType3() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[4]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/imported1/ZZZZ.js", - "package test.imported1;"+ - "public class ZZZZ {\n"+ - " \n"+ - "}"); - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/test/imported2/ZZZZ.js", - "package test.imported2;"+ - "public class ZZZZ {\n"+ - " \n"+ - "}"); - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/test/imported3/ZZZZ.js", - "package test.imported3;"+ - "public class ZZZZ {\n"+ - " \n"+ - "}"); - - this.workingCopies[3] = getWorkingCopy( - "/Completion/src/test/CompletionImportedType3.js", - "package test;"+ - "import test.imported2.*;"+ - "public class CompletionImportedType3 {"+ - " ZZZ\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[3].getSource(); - String completeBehind = "ZZZ"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[3].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "ZZZ[POTENTIAL_METHOD_DECLARATION]{ZZZ, Ltest.CompletionImportedType3;, ()V, ZZZ, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" + - "ZZZZ[TYPE_REF]{test.imported1.ZZZZ, test.imported1, Ltest.imported1.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "ZZZZ[TYPE_REF]{test.imported3.ZZZZ, test.imported3, Ltest.imported3.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "ZZZZ[TYPE_REF]{ZZZZ, test.imported2, Ltest.imported2.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} - -public void testCompletionImportedType4() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[3]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/imported1/ZZZZ.js", - "package test.imported1;"+ - "public class ZZZZ {\n"+ - " \n"+ - "}"); - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/test/imported2/ZZZZ.js", - "package test.imported2;"+ - "public class ZZZZ {\n"+ - " \n"+ - "}"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/test/CompletionImportedType4.js", - "package test;"+ - "import test.imported1.*;"+ - "public class CompletionImportedType4 {"+ - " ZZZ\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[2].getSource(); - String completeBehind = "ZZZ"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[2].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "ZZZ[POTENTIAL_METHOD_DECLARATION]{ZZZ, Ltest.CompletionImportedType4;, ()V, ZZZ, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" + - "ZZZZ[TYPE_REF]{test.imported2.ZZZZ, test.imported2, Ltest.imported2.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "ZZZZ[TYPE_REF]{ZZZZ, test.imported1, Ltest.imported1.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} - -public void testCompletionImportedType5() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[3]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/imported1/ZZZZ.js", - "package test.imported1;"+ - "public class ZZZZ {\n"+ - " \n"+ - "}"); - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/test/imported2/ZZZZ.js", - "package test.imported2;"+ - "public class ZZZZ {\n"+ - " \n"+ - "}"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/test/CompletionImportedType5.js", - "package test;"+ - "import test.imported2.*;"+ - "public class CompletionImportedType5 {"+ - " ZZZ\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[2].getSource(); - String completeBehind = "ZZZ"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[2].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "ZZZ[POTENTIAL_METHOD_DECLARATION]{ZZZ, Ltest.CompletionImportedType5;, ()V, ZZZ, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" + - "ZZZZ[TYPE_REF]{test.imported1.ZZZZ, test.imported1, Ltest.imported1.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "ZZZZ[TYPE_REF]{ZZZZ, test.imported2, Ltest.imported2.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} - -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151 -public void testCompletionInsideExtends1() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/test/CompletionInsideExtends1.js", - "package test;\n" + - "public class CompletionInsideExtends1 extends {\n" + - " public class CompletionInsideExtends1Inner {}\n" + - "}\n" + - "class CompletionInsideExtends1TopLevel {\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "extends "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) { - assertResults( - "", - requestor.getResults()); - } else { - assertResults( - "CompletionInsideExtends1TopLevel[TYPE_REF]{CompletionInsideExtends1TopLevel, test, Ltest.CompletionInsideExtends1TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } - -} - -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151 -public void testCompletionInsideExtends10() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/test/CompletionInsideExtends10.js", - "package test;\n" + - "public interface CompletionInsideExtends10 {\n" + - " public interface CompletionInsideExtends10Inner extends CompletionInsideExtends{\n" + - " public interface CompletionInsideExtends10InnerInner {\n" + - " }\n" + - " }\n" + - "}\n" + - "interface CompletionInsideExtends10TopLevel {\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "extends CompletionInsideExtends"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "CompletionInsideExtends10[TYPE_REF]{CompletionInsideExtends10, test, Ltest.CompletionInsideExtends10;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "CompletionInsideExtends10TopLevel[TYPE_REF]{CompletionInsideExtends10TopLevel, test, Ltest.CompletionInsideExtends10TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} - -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151 -public void testCompletionInsideExtends11() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/test/CompletionInsideExtends11.js", - "package test;\n" + - "public class CompletionInsideExtends11 implements {\n" + - " public class CompletionInsideExtends11Inner {\n" + - " }\n" + - "}\n" + - "class CompletionInsideExtends11TopLevel {\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "implements "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) { - assertResults( - "", - requestor.getResults()); - } else { - assertResults( - "", - requestor.getResults()); - } -} - -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151 -public void testCompletionInsideExtends12() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/test/CompletionInsideExtends12.js", - "package test;\n" + - "public class CompletionInsideExtends12 implements CompletionInsideExtends {\n" + - " public class CompletionInsideExtends12Inner {\n" + - " }\n" + - "}\n" + - "class CompletionInsideExtends12TopLevel {\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "implements CompletionInsideExtends"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "", - requestor.getResults()); -} - -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151 -public void testCompletionInsideExtends2() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/test/CompletionInsideExtends2.js", - "package test;\n" + - "public class CompletionInsideExtends2 extends CompletionInsideExtends {\n" + - " public class CompletionInsideExtends2Inner {}\n" + - "}\n" + - "class CompletionInsideExtends2TopLevel {\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "extends CompletionInsideExtends"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "CompletionInsideExtends2TopLevel[TYPE_REF]{CompletionInsideExtends2TopLevel, test, Ltest.CompletionInsideExtends2TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} - -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151 -public void testCompletionInsideExtends3() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/test/CompletionInsideExtends3.js", - "package test;\n" + - "public class CompletionInsideExtends3 {\n" + - " public class CompletionInsideExtends3Inner extends {\n" + - " public class CompletionInsideExtends3InnerInner {\n" + - " }\n" + - " }\n" + - "}\n" + - "class CompletionInsideExtends3TopLevel {\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "extends "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) { - assertResults( - "", - requestor.getResults()); - } else { - assertResults( - "CompletionInsideExtends3[TYPE_REF]{CompletionInsideExtends3, test, Ltest.CompletionInsideExtends3;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "CompletionInsideExtends3TopLevel[TYPE_REF]{CompletionInsideExtends3TopLevel, test, Ltest.CompletionInsideExtends3TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } -} - -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151 -public void testCompletionInsideExtends4() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/test/CompletionInsideExtends4.js", - "package test;\n" + - "public class CompletionInsideExtends4 {\n" + - " public class CompletionInsideExtends4Inner extends CompletionInsideExtends{\n" + - " public class CompletionInsideExtends4InnerInner {\n" + - " }\n" + - " }\n" + - "\n}" + - "class CompletionInsideExtends4TopLevel {\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "extends CompletionInsideExtends"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "CompletionInsideExtends4[TYPE_REF]{CompletionInsideExtends4, test, Ltest.CompletionInsideExtends4;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "CompletionInsideExtends4TopLevel[TYPE_REF]{CompletionInsideExtends4TopLevel, test, Ltest.CompletionInsideExtends4TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} - -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151 -public void testCompletionInsideExtends5() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/test/CompletionInsideExtends5.js", - "package test;\n" + - "public class CompletionInsideExtends5 {\n" + - " void foo() {\n" + - " public class CompletionInsideExtends5Inner extends {\n" + - " public class CompletionInsideExtends5InnerInner {\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n" + - "class CompletionInsideExtends5TopLevel {\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "extends "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) { - assertResults( - "", - requestor.getResults()); - } else { - assertResults( - "CompletionInsideExtends5[TYPE_REF]{CompletionInsideExtends5, test, Ltest.CompletionInsideExtends5;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "CompletionInsideExtends5TopLevel[TYPE_REF]{CompletionInsideExtends5TopLevel, test, Ltest.CompletionInsideExtends5TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } -} - -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151 -public void testCompletionInsideExtends6() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/test/CompletionInsideExtends6.js", - "package test;\n" + - "public class CompletionInsideExtends6 {\n" + - " void foo() {\n" + - " public class CompletionInsideExtends6Inner extends CompletionInsideExtends {\n" + - " public class CompletionInsideExtends6InnerInner {\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n" + - "class CompletionInsideExtends6TopLevel {\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "extends CompletionInsideExtends"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "CompletionInsideExtends6[TYPE_REF]{CompletionInsideExtends6, test, Ltest.CompletionInsideExtends6;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "CompletionInsideExtends6TopLevel[TYPE_REF]{CompletionInsideExtends6TopLevel, test, Ltest.CompletionInsideExtends6TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} - -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151 -public void testCompletionInsideExtends7() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/test/CompletionInsideExtends7.js", - "package test;\n" + - "public interface CompletionInsideExtends7 extends {\n" + - " public interface CompletionInsideExtends7Inner {}\n" + - "}\n" + - "interface CompletionInsideExtends7TopLevel {\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "extends "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) { - assertResults( - "", - requestor.getResults()); - } else { - assertResults( - "CompletionInsideExtends7TopLevel[TYPE_REF]{CompletionInsideExtends7TopLevel, test, Ltest.CompletionInsideExtends7TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151 -public void testCompletionInsideExtends8() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/test/CompletionInsideExtends8.js", - "package test;\n" + - "public interface CompletionInsideExtends8 extends CompletionInsideExtends {\n" + - " public interface CompletionInsideExtends8Inner {}\n" + - "}\n" + - "interface CompletionInsideExtends8TopLevel {\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "extends CompletionInsideExtends"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "CompletionInsideExtends8TopLevel[TYPE_REF]{CompletionInsideExtends8TopLevel, test, Ltest.CompletionInsideExtends8TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} - -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151 -public void testCompletionInsideExtends9() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/test/CompletionInsideExtends9.js", - "package test;\n" + - "public interface CompletionInsideExtends9 {\n" + - " public interface CompletionInsideExtends9Inner extends {\n" + - " public interface CompletionInsideExtends9InnerInner {\n" + - " }\n" + - " }\n" + - "}\n" + - "interface CompletionInsideExtends9TopLevel {\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "extends "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) { - assertResults( - "", - requestor.getResults()); - } else { - assertResults( - "CompletionInsideExtends9[TYPE_REF]{CompletionInsideExtends9, test, Ltest.CompletionInsideExtends9;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "CompletionInsideExtends9TopLevel[TYPE_REF]{CompletionInsideExtends9TopLevel, test, Ltest.CompletionInsideExtends9TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } -} - -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=82740 -public void testCompletionInsideGenericClass() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/test/CompletionInsideGenericClass.js", - "package test;\n" + - "public class CompletionInsideGenericClass {\n" + - " CompletionInsideGenericClas\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "CompletionInsideGenericClas"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "CompletionInsideGenericClas[POTENTIAL_METHOD_DECLARATION]{CompletionInsideGenericClas, Ltest.CompletionInsideGenericClass;, ()V, CompletionInsideGenericClas, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" + - "CompletionInsideGenericClass[TYPE_REF]{CompletionInsideGenericClass, test, Ltest.CompletionInsideGenericClass;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} - -public void testCompletionInsideStaticMethod() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionInsideStaticMethod.js"); - - String str = cu.getSource(); - String completeBehind = "doT"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:doTheThing completion:doTheThing() relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionInstanceofOperator1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionInstanceofOperator1.js"); - - String str = cu.getSource(); - String completeBehind = "x instanceof WWWCompletionInstanceof"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:WWWCompletionInstanceof1 completion:WWWCompletionInstanceof1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" + - "element:WWWCompletionInstanceof2 completion:WWWCompletionInstanceof2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" + - "element:WWWCompletionInstanceof3 completion:WWWCompletionInstanceof3 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" + - "element:WWWCompletionInstanceof4 completion:WWWCompletionInstanceof4 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordAssert1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAssert1.js"); - - String str = cu.getSource(); - String completeBehind = "as"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:assert completion:assert relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordAssert2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAssert2.js"); - - String str = cu.getSource(); - String completeBehind = "as"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordAssert3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAssert3.js"); - - String str = cu.getSource(); - String completeBehind = "as"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordAssert4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAssert4.js"); - - String str = cu.getSource(); - String completeBehind = "as"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:assert completion:assert relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordAssert5() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAssert5.js"); - - String str = cu.getSource(); - String completeBehind = "as"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordAssert6() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAssert6.js"); - - String str = cu.getSource(); - String completeBehind = "as"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordBreak1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordBreak1.js"); - - String str = cu.getSource(); - String completeBehind = "bre"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:break completion:break relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordBreak2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordBreak2.js"); - - String str = cu.getSource(); - String completeBehind = "bre"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordBreak3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordBreak3.js"); - - String str = cu.getSource(); - String completeBehind = "bre"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:break completion:break relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordBreak4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordBreak4.js"); - - String str = cu.getSource(); - String completeBehind = "bre"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:break completion:break relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordBreak5() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordBreak5.js"); - - String str = cu.getSource(); - String completeBehind = "bre"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordBreak6() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordBreak6.js"); - - String str = cu.getSource(); - String completeBehind = "bre"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:break completion:break relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordCase1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase1.js"); - - String str = cu.getSource(); - String completeBehind = "cas"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:case completion:case relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordCase10() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase10.js"); - - String str = cu.getSource(); - String completeBehind = "cas"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordCase2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase2.js"); - - String str = cu.getSource(); - String completeBehind = "cas"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:case completion:case relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordCase3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase3.js"); - - String str = cu.getSource(); - String completeBehind = "cas"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:case completion:case relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordCase4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase4.js"); - - String str = cu.getSource(); - String completeBehind = "cas"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:case completion:case relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordCase5() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase5.js"); - - String str = cu.getSource(); - String completeBehind = "cas"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordCase6() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase6.js"); - - String str = cu.getSource(); - String completeBehind = "cas"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:case completion:case relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordCase7() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase7.js"); - - String str = cu.getSource(); - String completeBehind = "cas"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:case completion:case relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordCase8() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase8.js"); - - String str = cu.getSource(); - String completeBehind = "cas"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:case completion:case relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordCase9() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase9.js"); - - String str = cu.getSource(); - String completeBehind = "cas"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:case completion:case relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordCatch1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch1.js"); - - String str = cu.getSource(); - String completeBehind = "cat"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:catch completion:catch relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordCatch10() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch10.js"); - - String str = cu.getSource(); - String completeBehind = "cat"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:catch completion:catch relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+ - "element:catchz completion:catchz relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordCatch2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch2.js"); - - String str = cu.getSource(); - String completeBehind = "cat"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordCatch3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch3.js"); - - String str = cu.getSource(); - String completeBehind = "cat"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordCatch4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch4.js"); - - String str = cu.getSource(); - String completeBehind = "cat"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordCatch5() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch5.js"); - - String str = cu.getSource(); - String completeBehind = "cat"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:catch completion:catch relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+ - "element:catchz completion:catchz relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordCatch6() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch6.js"); - - String str = cu.getSource(); - String completeBehind = "cat"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:catch completion:catch relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordCatch7() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch7.js"); - - String str = cu.getSource(); - String completeBehind = "cat"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordCatch8() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch8.js"); - - String str = cu.getSource(); - String completeBehind = "cat"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordCatch9() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch9.js"); - - String str = cu.getSource(); - String completeBehind = "cat"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordClass1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass1.js"); - - String str = cu.getSource(); - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordClass10() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass10.js"); - - String str = cu.getSource(); - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Class completion:Class relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:ClassWithComplexName completion:ClassWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordClass11() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass11.js"); - - String str = cu.getSource(); - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Class completion:Class relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:ClassWithComplexName completion:ClassWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordClass12() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass12.js"); - - String str = cu.getSource(); - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Class completion:Class relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:ClassWithComplexName completion:ClassWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordClass13() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass13.js"); - - String str = cu.getSource(); - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordClass14() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass14.js"); - - String str = cu.getSource(); - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Class completion:Class relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:ClassWithComplexName completion:ClassWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordClass15() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass15.js"); - - String str = cu.getSource(); - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Class completion:Class relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:ClassWithComplexName completion:ClassWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordClass16() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass16.js"); - - String str = cu.getSource(); - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Class completion:Class relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:ClassWithComplexName completion:ClassWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordClass17() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass17.js"); - - String str = cu.getSource(); - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordClass18() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass18.js"); - - String str = cu.getSource(); - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordClass19() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass19.js"); - - String str = cu.getSource(); - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordClass2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass2.js"); - - String str = cu.getSource(); - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordClass20() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass20.js"); - - String str = cu.getSource(); - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordClass21() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass21.js"); - - String str = cu.getSource(); - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Class completion:Class relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:ClassWithComplexName completion:ClassWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordClass22() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass22.js"); - - String str = cu.getSource(); - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Class completion:Class relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:ClassWithComplexName completion:ClassWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordClass23() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass23.js"); - - String str = cu.getSource(); - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Class completion:Class relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:ClassWithComplexName completion:ClassWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordClass24() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass24.js"); - - String str = cu.getSource(); - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Class completion:Class relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:ClassWithComplexName completion:ClassWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordClass3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass3.js"); - - String str = cu.getSource(); - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordClass4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass4.js"); - - String str = cu.getSource(); - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordClass5() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass5.js"); - - String str = cu.getSource(); - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordClass6() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass6.js"); - - String str = cu.getSource(); - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Class completion:Class relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:ClassWithComplexName completion:ClassWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordClass7() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass7.js"); - - String str = cu.getSource(); - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Class completion:Class relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:ClassWithComplexName completion:ClassWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordClass8() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass8.js"); - - String str = cu.getSource(); - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Class completion:Class relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:ClassWithComplexName completion:ClassWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordClass9() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass9.js"); - - String str = cu.getSource(); - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Class completion:Class relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:ClassWithComplexName completion:ClassWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordContinue1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordContinue1.js"); - - String str = cu.getSource(); - String completeBehind = "cont"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:continue completion:continue relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordContinue2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordContinue2.js"); - - String str = cu.getSource(); - String completeBehind = "cont"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordContinue3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordContinue3.js"); - - String str = cu.getSource(); - String completeBehind = "cont"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:continue completion:continue relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordContinue4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordContinue4.js"); - - String str = cu.getSource(); - String completeBehind = "cont"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordDefault1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault1.js"); - - String str = cu.getSource(); - String completeBehind = "def"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:default completion:default relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordDefault10() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault10.js"); - - String str = cu.getSource(); - String completeBehind = "def"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Default completion:Default relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordDefault2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault2.js"); - - String str = cu.getSource(); - String completeBehind = "def"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Default completion:Default relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:default completion:default relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordDefault3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault3.js"); - - String str = cu.getSource(); - String completeBehind = "def"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Default completion:Default relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:default completion:default relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordDefault4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault4.js"); - - String str = cu.getSource(); - String completeBehind = "def"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Default completion:Default relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordDefault5() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault5.js"); - - String str = cu.getSource(); - String completeBehind = "def"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Default completion:Default relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordDefault6() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault6.js"); - - String str = cu.getSource(); - String completeBehind = "def"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:default completion:default relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordDefault7() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault7.js"); - - String str = cu.getSource(); - String completeBehind = "def"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Default completion:Default relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:default completion:default relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordDefault8() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault8.js"); - - String str = cu.getSource(); - String completeBehind = "def"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Default completion:Default relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:default completion:default relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordDefault9() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault9.js"); - - String str = cu.getSource(); - String completeBehind = "def"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Default completion:Default relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordDo1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDo1.js"); - - String str = cu.getSource(); - String completeBehind = "do"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:do completion:do relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"\n"+ - "element:double completion:double relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordDo2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDo2.js"); - - String str = cu.getSource(); - String completeBehind = "do"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:double completion:double relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordDo3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDo3.js"); - - String str = cu.getSource(); - String completeBehind = "do"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:double completion:double relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordDo4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDo4.js"); - - String str = cu.getSource(); - String completeBehind = "do"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:do completion:do relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"\n"+ - "element:double completion:double relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordDo5() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDo5.js"); - - String str = cu.getSource(); - String completeBehind = "do"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:double completion:double relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordDo6() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDo6.js"); - - String str = cu.getSource(); - String completeBehind = "do"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:double completion:double relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordElse1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordElse1.js"); - - String str = cu.getSource(); - String completeBehind = "els"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:else completion:else relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordElse2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordElse2.js"); - - String str = cu.getSource(); - String completeBehind = "els"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordElse3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordElse3.js"); - - String str = cu.getSource(); - String completeBehind = "els"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordElse4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordElse4.js"); - - String str = cu.getSource(); - String completeBehind = "els"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordElse5() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordElse5.js"); - - String str = cu.getSource(); - String completeBehind = "els"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:else completion:else relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordElse6() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordElse6.js"); - - String str = cu.getSource(); - String completeBehind = "els"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordElse7() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordElse7.js"); - - String str = cu.getSource(); - String completeBehind = "els"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordElse8() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordElse8.js"); - - String str = cu.getSource(); - String completeBehind = "els"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordFalse1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFalse1.js"); - - String str = cu.getSource(); - String completeBehind = "fal"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordFalse2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFalse2.js"); - - String str = cu.getSource(); - String completeBehind = "fal"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:false completion:false relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordFalse3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFalse3.js"); - - String str = cu.getSource(); - String completeBehind = "fal"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordFalse4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFalse4.js"); - - String str = cu.getSource(); - String completeBehind = "fal"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:false completion:false relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED), - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=95008 -public void testCompletionKeywordFalse5() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " boolean test = ;\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "boolean test = "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "Test[TYPE_REF]{Test, test, Ltest.Test;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "clone[FUNCTION_REF]{clone(), Ljava.lang.Object;, ()Ljava.lang.Object;, clone, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "finalize[FUNCTION_REF]{finalize(), Ljava.lang.Object;, ()V, finalize, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "getClass[FUNCTION_REF]{getClass(), Ljava.lang.Object;, ()Ljava.lang.Class;, getClass, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "hashCode[FUNCTION_REF]{hashCode(), Ljava.lang.Object;, ()I, hashCode, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "notify[FUNCTION_REF]{notify(), Ljava.lang.Object;, ()V, notify, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "notifyAll[FUNCTION_REF]{notifyAll(), Ljava.lang.Object;, ()V, notifyAll, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "toString[FUNCTION_REF]{toString(), Ljava.lang.Object;, ()Ljava.lang.String;, toString, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "wait[FUNCTION_REF]{wait(), Ljava.lang.Object;, ()V, wait, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "wait[FUNCTION_REF]{wait(), Ljava.lang.Object;, (J)V, wait, (millis), " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "wait[FUNCTION_REF]{wait(), Ljava.lang.Object;, (JI)V, wait, (millis, nanos), " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "test[FIELD_REF]{test, Ltest.Test;, Z, test, null, " + (R_DEFAULT + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED) + "}\n" + - "equals[FUNCTION_REF]{equals(), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED) + "}\n" + - "false[KEYWORD]{false, null, null, false, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_TRUE_OR_FALSE + R_NON_RESTRICTED) + "}\n" + - "true[KEYWORD]{true, null, null, true, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_TRUE_OR_FALSE + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -public void testCompletionKeywordFinal1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal1.js"); - - String str = cu.getSource(); - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:final completion:final relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordFinal10() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal10.js"); - - String str = cu.getSource(); - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:final completion:final relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordFinal11() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal11.js"); - - String str = cu.getSource(); - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordFinal12() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal12.js"); - - String str = cu.getSource(); - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:final completion:final relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordFinal13() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal13.js"); - - String str = cu.getSource(); - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:final completion:final relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordFinal14() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal14.js"); - - String str = cu.getSource(); - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:final completion:final relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+ - "element:finalize completion:protected void finalize() throws Throwable relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordFinal15() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal15.js"); - - String str = cu.getSource(); - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordFinal16() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal16.js"); - - String str = cu.getSource(); - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:final completion:final relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+ - "element:finalize completion:protected void finalize() throws Throwable relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordFinal17() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal17.js"); - - String str = cu.getSource(); - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:final completion:final relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordFinal18() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal18.js"); - - String str = cu.getSource(); - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:final completion:final relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+ - "element:finalize completion:finalize() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordFinal2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal2.js"); - - String str = cu.getSource(); - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordFinal3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal3.js"); - - String str = cu.getSource(); - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:final completion:final relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordFinal4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal4.js"); - - String str = cu.getSource(); - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:final completion:final relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordFinal5() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal5.js"); - - String str = cu.getSource(); - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:final completion:final relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+ - "element:finalize completion:protected void finalize() throws Throwable relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordFinal6() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal6.js"); - - String str = cu.getSource(); - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordFinal7() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal7.js"); - - String str = cu.getSource(); - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:final completion:final relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+ - "element:finalize completion:protected void finalize() throws Throwable relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordFinal8() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal8.js"); - - String str = cu.getSource(); - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:final completion:final relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordFinal9() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal9.js"); - - String str = cu.getSource(); - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:final completion:final relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+ - "element:finalize completion:finalize() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE +R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordFinally1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally1.js"); - - String str = cu.getSource(); - String completeBehind = "finall"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:finally completion:finally relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordFinally10() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally10.js"); - - String str = cu.getSource(); - String completeBehind = "finall"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordFinally11() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally11.js"); - - String str = cu.getSource(); - String completeBehind = "finall"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordFinally12() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally12.js"); - - String str = cu.getSource(); - String completeBehind = "finall"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:finally completion:finally relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordFinally13() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally13.js"); - - String str = cu.getSource(); - String completeBehind = "finall"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:finally completion:finally relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+ - "element:finallyz completion:finallyz relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordFinally14() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally14.js"); - - String str = cu.getSource(); - String completeBehind = "finall"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:finallyz completion:finallyz relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordFinally2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally2.js"); - - String str = cu.getSource(); - String completeBehind = "finall"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordFinally3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally3.js"); - - String str = cu.getSource(); - String completeBehind = "finall"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordFinally4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally4.js"); - - String str = cu.getSource(); - String completeBehind = "finall"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordFinally5() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally5.js"); - - String str = cu.getSource(); - String completeBehind = "finall"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:finally completion:finally relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordFinally6() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally6.js"); - - String str = cu.getSource(); - String completeBehind = "finall"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:finally completion:finally relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+ - "element:finallyz completion:finallyz relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordFinally7() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally7.js"); - - String str = cu.getSource(); - String completeBehind = "finall"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:finallyz completion:finallyz relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordFinally8() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally8.js"); - - String str = cu.getSource(); - String completeBehind = "finall"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:finally completion:finally relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordFinally9() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally9.js"); - - String str = cu.getSource(); - String completeBehind = "finall"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordFor1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFor1.js"); - - String str = cu.getSource(); - String completeBehind = "fo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:foo completion:foo() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:for completion:for relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordFor2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFor2.js"); - - String str = cu.getSource(); - String completeBehind = "fo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:foo completion:foo() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordFor3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFor3.js"); - - String str = cu.getSource(); - String completeBehind = "fo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordFor4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFor4.js"); - - String str = cu.getSource(); - String completeBehind = "fo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:foo completion:foo() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:for completion:for relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordFor5() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFor5.js"); - - String str = cu.getSource(); - String completeBehind = "fo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:foo completion:foo() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordFor6() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFor6.js"); - - String str = cu.getSource(); - String completeBehind = "fo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordIf1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordIf1.js"); - - String str = cu.getSource(); - String completeBehind = "if"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:if completion:if relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordIf2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordIf2.js"); - - String str = cu.getSource(); - String completeBehind = "if"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordIf3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordIf3.js"); - - String str = cu.getSource(); - String completeBehind = "if"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordIf4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordIf4.js"); - - String str = cu.getSource(); - String completeBehind = "if"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:if completion:if relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordIf5() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordIf5.js"); - - String str = cu.getSource(); - String completeBehind = "if"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordIf6() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordIf6.js"); - - String str = cu.getSource(); - String completeBehind = "if"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordImport1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImport1.js"); - - String str = cu.getSource(); - String completeBehind = "imp"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:import completion:import relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordImport2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "p", "CompletionKeywordImport2.js"); - - String str = cu.getSource(); - String completeBehind = "imp"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:import completion:import relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordImport3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImport3.js"); - - String str = cu.getSource(); - String completeBehind = "imp"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:import completion:import relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordImport4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImport4.js"); - - String str = cu.getSource(); - String completeBehind = "imp"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordImport5() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImport5.js"); - - String str = cu.getSource(); - String completeBehind = "imp"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:import completion:import relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordImport6() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImport6.js"); - - String str = cu.getSource(); - String completeBehind = "imp"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordImport7() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImport7.js"); - - String str = cu.getSource(); - String completeBehind = "imp"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:import completion:import relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordImport8() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "p", "CompletionKeywordImport8.js"); - - String str = cu.getSource(); - String completeBehind = "imp"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:import completion:import relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordInstanceof1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInstanceof1.js"); - - String str = cu.getSource(); - String completeBehind = "ins"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:instanceof completion:instanceof relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordInstanceof2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInstanceof2.js"); - - String str = cu.getSource(); - String completeBehind = "ins"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordInstanceof3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInstanceof3.js"); - - String str = cu.getSource(); - String completeBehind = "ins"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordInstanceof4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInstanceof4.js"); - - String str = cu.getSource(); - String completeBehind = "ins"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:instanceof completion:instanceof relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordInstanceof5() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInstanceof5.js"); - - String str = cu.getSource(); - String completeBehind = "ins"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordInstanceof6() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInstanceof6.js"); - - String str = cu.getSource(); - String completeBehind = "ins"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordNew1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew1.js"); - - String str = cu.getSource(); - String completeBehind = "ne"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:new completion:new relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordNew10() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew10.js"); - - String str = cu.getSource(); - String completeBehind = "ne"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:new completion:new relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordNew11() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew11.js"); - - String str = cu.getSource(); - String completeBehind = "ne"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:new completion:new relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordNew12() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew12.js"); - - String str = cu.getSource(); - String completeBehind = "ne"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:new completion:new relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordNew13() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew13.js"); - - String str = cu.getSource(); - String completeBehind = "ne"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:new completion:new relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordNew14() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew14.js"); - - String str = cu.getSource(); - String completeBehind = "ne"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:new completion:new relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordNew15() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew15.js"); - - String str = cu.getSource(); - String completeBehind = "ne"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:new completion:new relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordNew16() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew16.js"); - - String str = cu.getSource(); - String completeBehind = "ne"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:new completion:new relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordNew2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew2.js"); - - String str = cu.getSource(); - String completeBehind = "ne"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:new completion:new relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordNew3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew3.js"); - - String str = cu.getSource(); - String completeBehind = "ne"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:new completion:new relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordNew4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew4.js"); - - String str = cu.getSource(); - String completeBehind = "ne"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:new completion:new relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordNew5() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew5.js"); - - String str = cu.getSource(); - String completeBehind = "ne"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:new completion:new relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordNew6() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew6.js"); - - String str = cu.getSource(); - String completeBehind = "ne"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:new completion:new relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordNew7() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew7.js"); - - String str = cu.getSource(); - String completeBehind = "ne"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:new completion:new relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordNew8() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew8.js"); - - String str = cu.getSource(); - String completeBehind = "ne"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:new completion:new relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordNew9() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew9.js"); - - String str = cu.getSource(); - String completeBehind = "ne"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:new completion:new relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordNull1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNull1.js"); - - String str = cu.getSource(); - String completeBehind = "nul"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordNull2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNull2.js"); - - String str = cu.getSource(); - String completeBehind = "nul"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:null completion:null relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordNull3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNull3.js"); - - String str = cu.getSource(); - String completeBehind = "nul"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordNull4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNull4.js"); - - String str = cu.getSource(); - String completeBehind = "nul"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:null completion:null relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordPackage1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPackage1.js"); - - String str = cu.getSource(); - String completeBehind = "pac"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:package completion:package relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordPackage2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "p", "CompletionKeywordPackage2.js"); - - String str = cu.getSource(); - String completeBehind = "pac"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} - -public void testCompletionKeywordPackage3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPackage3.js"); - - String str = cu.getSource(); - String completeBehind = "pac"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordPackage4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPackage4.js"); - - String str = cu.getSource(); - String completeBehind = "pac"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordPackage5() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPackage5.js"); - - String str = cu.getSource(); - String completeBehind = "pac"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordPackage6() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPackage6.js"); - - String str = cu.getSource(); - String completeBehind = "pac"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordPackage7() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPackage7.js"); - - String str = cu.getSource(); - String completeBehind = "pac"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordPackage8() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "p", "CompletionKeywordPackage8.js"); - - String str = cu.getSource(); - String completeBehind = "pac"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordPrivate1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate1.js"); - - String str = cu.getSource(); - String completeBehind = "pri"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:private completion:private relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordPrivate10() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate10.js"); - - String str = cu.getSource(); - String completeBehind = "pri"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordPrivate2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate2.js"); - - String str = cu.getSource(); - String completeBehind = "pri"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:private completion:private relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordPrivate3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate3.js"); - - String str = cu.getSource(); - String completeBehind = "pri"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:private completion:private relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordPrivate4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate4.js"); - - String str = cu.getSource(); - String completeBehind = "pri"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordPrivate5() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate5.js"); - - String str = cu.getSource(); - String completeBehind = "pri"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordPrivate6() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate6.js"); - - String str = cu.getSource(); - String completeBehind = "pri"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:private completion:private relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordPrivate7() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate7.js"); - - String str = cu.getSource(); - String completeBehind = "pri"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:private completion:private relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordPrivate8() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate8.js"); - - String str = cu.getSource(); - String completeBehind = "pri"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:private completion:private relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordPrivate9() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate9.js"); - - String str = cu.getSource(); - String completeBehind = "pri"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordProtected1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected1.js"); - - String str = cu.getSource(); - String completeBehind = "pro"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:protected completion:protected relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordProtected10() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected10.js"); - - String str = cu.getSource(); - String completeBehind = "pro"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordProtected2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected2.js"); - - String str = cu.getSource(); - String completeBehind = "pro"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:protected completion:protected relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordProtected3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected3.js"); - - String str = cu.getSource(); - String completeBehind = "pro"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:protected completion:protected relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordProtected4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected4.js"); - - String str = cu.getSource(); - String completeBehind = "pro"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordProtected5() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected5.js"); - - String str = cu.getSource(); - String completeBehind = "pro"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordProtected6() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected6.js"); - - String str = cu.getSource(); - String completeBehind = "pro"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:protected completion:protected relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordProtected7() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected7.js"); - - String str = cu.getSource(); - String completeBehind = "pro"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:protected completion:protected relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordProtected8() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected8.js"); - - String str = cu.getSource(); - String completeBehind = "pro"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:protected completion:protected relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordProtected9() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected9.js"); - - String str = cu.getSource(); - String completeBehind = "pro"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordPublic1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic1.js"); - - String str = cu.getSource(); - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:public completion:public relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordPublic10() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic10.js"); - - String str = cu.getSource(); - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordPublic11() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic11.js"); - - String str = cu.getSource(); - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:public completion:public relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordPublic12() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic12.js"); - - String str = cu.getSource(); - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordPublic13() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic13.js"); - - String str = cu.getSource(); - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:public completion:public relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordPublic14() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic14.js"); - - String str = cu.getSource(); - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:public completion:public relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordPublic15() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic15.js"); - - String str = cu.getSource(); - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordPublic16() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic16.js"); - - String str = cu.getSource(); - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordPublic17() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic17.js"); - - String str = cu.getSource(); - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:public completion:public relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordPublic18() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic18.js"); - - String str = cu.getSource(); - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:public completion:public relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordPublic19() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic19.js"); - - String str = cu.getSource(); - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:public completion:public relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordPublic2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic2.js"); - - String str = cu.getSource(); - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:public completion:public relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordPublic20() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic10.js"); - - String str = cu.getSource(); - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordPublic3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic3.js"); - - String str = cu.getSource(); - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:public completion:public relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordPublic4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic4.js"); - - String str = cu.getSource(); - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordPublic5() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic5.js"); - - String str = cu.getSource(); - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordPublic6() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic6.js"); - - String str = cu.getSource(); - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:public completion:public relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordPublic7() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic7.js"); - - String str = cu.getSource(); - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:public completion:public relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordPublic8() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic8.js"); - - String str = cu.getSource(); - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:public completion:public relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordPublic9() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic9.js"); - - String str = cu.getSource(); - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordReturn1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordReturn1.js"); - - String str = cu.getSource(); - String completeBehind = "re"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:return completion:return relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordReturn2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordReturn2.js"); - - String str = cu.getSource(); - String completeBehind = "re"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordReturn3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordReturn3.js"); - - String str = cu.getSource(); - String completeBehind = "re"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordReturn4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordReturn4.js"); - - String str = cu.getSource(); - String completeBehind = "re"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:return completion:return relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordReturn5() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordReturn5.js"); - - String str = cu.getSource(); - String completeBehind = "re"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordReturn6() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordReturn6.js"); - - String str = cu.getSource(); - String completeBehind = "re"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordStatic1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic1.js"); - - String str = cu.getSource(); - String completeBehind = "sta"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:static completion:static relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordStatic10() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic10.js"); - - String str = cu.getSource(); - String completeBehind = "sta"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:static completion:static relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordStatic2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic2.js"); - - String str = cu.getSource(); - String completeBehind = "sta"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:static completion:static relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordStatic3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic3.js"); - - String str = cu.getSource(); - String completeBehind = "sta"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:static completion:static relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordStatic4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic4.js"); - - String str = cu.getSource(); - String completeBehind = "sta"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordStatic5() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic5.js"); - - String str = cu.getSource(); - String completeBehind = "sta"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:static completion:static relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordStatic6() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic6.js"); - - String str = cu.getSource(); - String completeBehind = "sta"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:static completion:static relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordStatic7() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic7.js"); - - String str = cu.getSource(); - String completeBehind = "sta"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:static completion:static relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordStatic8() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic8.js"); - - String str = cu.getSource(); - String completeBehind = "sta"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:static completion:static relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordStatic9() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic9.js"); - - String str = cu.getSource(); - String completeBehind = "sta"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordStrictfp1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStrictfp1.js"); - - String str = cu.getSource(); - String completeBehind = "stric"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:strictfp completion:strictfp relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordStrictfp2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStrictfp2.js"); - - String str = cu.getSource(); - String completeBehind = "stric"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordStrictfp3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStrictfp3.js"); - - String str = cu.getSource(); - String completeBehind = "stric"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:strictfp completion:strictfp relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordStrictfp4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStrictfp4.js"); - - String str = cu.getSource(); - String completeBehind = "stric"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordStrictfp5() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStrictfp5.js"); - - String str = cu.getSource(); - String completeBehind = "stric"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:strictfp completion:strictfp relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordStrictfp6() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStrictfp6.js"); - - String str = cu.getSource(); - String completeBehind = "stric"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordStrictfp7() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStrictfp7.js"); - - String str = cu.getSource(); - String completeBehind = "stric"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:strictfp completion:strictfp relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordStrictfp8() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStrictfp8.js"); - - String str = cu.getSource(); - String completeBehind = "stric"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordSuper1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper1.js"); - - String str = cu.getSource(); - String completeBehind = "sup"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:SuperClass completion:SuperClass relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" + - "element:SuperInterface completion:SuperInterface relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" + - "element:super completion:super relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordSuper10() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper10.js"); - - String str = cu.getSource(); - String completeBehind = "sup"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:SuperClass completion:SuperClass relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" + - "element:SuperInterface completion:SuperInterface relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" + - "element:super completion:super relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordSuper11() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper11.js"); - - String str = cu.getSource(); - String completeBehind = "sup"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:SuperClass completion:SuperClass relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" + - "element:SuperInterface completion:SuperInterface relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordSuper12() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src2/CompletionKeywordSuper12.js", - "public class CompletionKeywordSuper12 {\n"+ - " public CompletionKeywordSuper12() {\n"+ - " #\n"+ - " sup\n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - - String str = this.wc.getSource(); - String completeBehind = "sup"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "expectedTypesSignatures=null\n"+ - "expectedTypesKeys=null", - requestor.getContext()); - - assertResults( - "SuperClass[TYPE_REF]{SuperClass, , LSuperClass;, null, null, " + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "SuperInterface[TYPE_REF]{SuperInterface, , LSuperInterface;, null, null, " + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "super[KEYWORD]{super, null, null, super, null, "+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED)+"}\n" + - "super[FUNCTION_REF]{super(), Ljava.lang.Object;, ()V, super, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -public void testCompletionKeywordSuper2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper2.js"); - - String str = cu.getSource(); - String completeBehind = "sup"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:SuperClass completion:SuperClass relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" + - "element:SuperInterface completion:SuperInterface relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" + - "element:super completion:super relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordSuper3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper3.js"); - - String str = cu.getSource(); - String completeBehind = "sup"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:SuperClass completion:SuperClass relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" + - "element:SuperInterface completion:SuperInterface relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordSuper4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper4.js"); - - String str = cu.getSource(); - String completeBehind = "sup"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:SuperClass completion:SuperClass relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" + - "element:SuperInterface completion:SuperInterface relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" + - "element:super completion:super relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordSuper5() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper5.js"); - - String str = cu.getSource(); - String completeBehind = "sup"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:SuperClass completion:SuperClass relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" + - "element:SuperInterface completion:SuperInterface relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordSuper6() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src2/CompletionKeywordSuper6.js", - "public class CompletionKeywordSuper6 {\n"+ - " public CompletionKeywordSuper6() {\n"+ - " sup\n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - - String str = this.wc.getSource(); - String completeBehind = "sup"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "expectedTypesSignatures=null\n"+ - "expectedTypesKeys=null", - requestor.getContext()); - - assertResults( - "SuperClass[TYPE_REF]{SuperClass, , LSuperClass;, null, null, " + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "SuperInterface[TYPE_REF]{SuperInterface, , LSuperInterface;, null, null, " + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "super[KEYWORD]{super, null, null, super, null, "+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED)+"}\n" + - "super[FUNCTION_REF]{super(), Ljava.lang.Object;, ()V, super, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -public void testCompletionKeywordSuper7() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper7.js"); - - String str = cu.getSource(); - String completeBehind = "sup"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:SuperClass completion:SuperClass relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" + - "element:SuperInterface completion:SuperInterface relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" + - "element:super completion:super relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordSuper8() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper8.js"); - - String str = cu.getSource(); - String completeBehind = "sup"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:SuperClass completion:SuperClass relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" + - "element:SuperInterface completion:SuperInterface relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" + - "element:super completion:super relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordSuper9() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper9.js"); - - String str = cu.getSource(); - String completeBehind = "sup"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:SuperClass completion:SuperClass relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" + - "element:SuperInterface completion:SuperInterface relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordSwitch1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSwitch1.js"); - - String str = cu.getSource(); - String completeBehind = "sw"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:switch completion:switch relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordSwitch2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSwitch2.js"); - - String str = cu.getSource(); - String completeBehind = "sw"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordSwitch3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSwitch3.js"); - - String str = cu.getSource(); - String completeBehind = "sw"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordSwitch4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSwitch4.js"); - - String str = cu.getSource(); - String completeBehind = "sw"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:switch completion:switch relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordSwitch5() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSwitch5.js"); - - String str = cu.getSource(); - String completeBehind = "sw"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordSwitch6() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSwitch6.js"); - - String str = cu.getSource(); - String completeBehind = "sw"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordThis1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis1.js"); - - String str = cu.getSource(); - String completeBehind = "thi"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:this completion:this relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordThis10() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis10.js"); - - String str = cu.getSource(); - String completeBehind = "thi"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordThis11() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis11.js"); - - String str = cu.getSource(); - String completeBehind = "thi"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:this completion:this relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordThis12() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis12.js"); - - String str = cu.getSource(); - String completeBehind = "thi"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordThis13() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis13.js"); - - String str = cu.getSource(); - String completeBehind = "thi"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:this completion:this relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordThis14() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis14.js"); - - String str = cu.getSource(); - String completeBehind = "thi"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -/* - * bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=42402 - */ -public void testCompletionKeywordThis15() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src2/CompletionKeywordThis15.js", - "public class CompletionKeywordThis15 {\n" + - " public class InnerClass {\n" + - " public InnerClass() {\n" + - " CompletionKeywordThis15 a = CompletionKeywordThis15.this;\n" + - " }\n" + - " }\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "CompletionKeywordThis15."; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "CompletionKeywordThis15.InnerClass[TYPE_REF]{InnerClass, , LCompletionKeywordThis15$InnerClass;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}\n" + - "class[FIELD_REF]{class, null, Ljava.lang.Class;, class, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}\n"+ - "this[KEYWORD]{this, null, null, this, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -public void testCompletionKeywordThis2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis2.js"); - - String str = cu.getSource(); - String completeBehind = "thi"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:this completion:this relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordThis3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis3.js"); - - String str = cu.getSource(); - String completeBehind = "thi"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordThis4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis4.js"); - - String str = cu.getSource(); - String completeBehind = "thi"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:this completion:this relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordThis5() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis5.js"); - - String str = cu.getSource(); - String completeBehind = "thi"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordThis6() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis6.js"); - - String str = cu.getSource(); - String completeBehind = "thi"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:this completion:this relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordThis7() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis7.js"); - - String str = cu.getSource(); - String completeBehind = "thi"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordThis8() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis8.js"); - - String str = cu.getSource(); - String completeBehind = "thi"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:this completion:this relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordThis9() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis9.js"); - - String str = cu.getSource(); - String completeBehind = "thi"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:this completion:this relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordThrow1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrow1.js"); - - String str = cu.getSource(); - String completeBehind = "thr"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Throwable completion:Throwable relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:throw completion:throw relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordThrow2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrow2.js"); - - String str = cu.getSource(); - String completeBehind = "thr"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Throwable completion:Throwable relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordThrow3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrow3.js"); - - String str = cu.getSource(); - String completeBehind = "thr"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Throwable completion:Throwable relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordThrow4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrow4.js"); - - String str = cu.getSource(); - String completeBehind = "thr"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Throwable completion:Throwable relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:throw completion:throw relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordThrow5() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrow5.js"); - - String str = cu.getSource(); - String completeBehind = "thr"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Throwable completion:Throwable relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordThrow6() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrow6.js"); - - String str = cu.getSource(); - String completeBehind = "thr"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Throwable completion:Throwable relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordThrows1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrows1.js"); - - String str = cu.getSource(); - String completeBehind = "thro"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:throws completion:throws relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordThrows2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrows2.js"); - - String str = cu.getSource(); - String completeBehind = "thro"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordThrows3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrows3.js"); - - String str = cu.getSource(); - String completeBehind = "thro"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:throws completion:throws relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordThrows4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrows4.js"); - - String str = cu.getSource(); - String completeBehind = "thro"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:throws completion:throws relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordThrows5() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrows5.js"); - - String str = cu.getSource(); - String completeBehind = "thro"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:throws completion:throws relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordThrows6() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrows6.js"); - - String str = cu.getSource(); - String completeBehind = "thro"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordThrows7() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrows7.js"); - - String str = cu.getSource(); - String completeBehind = "thro"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:throws completion:throws relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordThrows8() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrows8.js"); - - String str = cu.getSource(); - String completeBehind = "thro"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:throws completion:throws relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordTrue1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTrue1.js"); - - String str = cu.getSource(); - String completeBehind = "tru"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordTrue2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTrue2.js"); - - String str = cu.getSource(); - String completeBehind = "tru"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:true completion:true relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordTrue3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTrue3.js"); - - String str = cu.getSource(); - String completeBehind = "tru"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordTrue4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTrue4.js"); - - String str = cu.getSource(); - String completeBehind = "tru"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:true completion:true relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED), - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=90615 -public void testCompletionKeywordTrue5() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/test/CompletionKeywordTrue5.js", - "package test;\n" + - "public class CompletionKeywordTrue5 {\n" + - " public void foo() {\n" + - " boolean var;\n" + - " var = tr\n" + - " }\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "tr"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "true[KEYWORD]{true, null, null, true, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=90615 -public void testCompletionKeywordTrue6() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/test/CompletionKeywordTrue6.js", - "package test;\n" + - "public class CompletionKeywordTrue6 {\n" + - " public void foo() {\n" + - " boolean var;\n" + - " var = \n" + - " }\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "var = "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) { - assertResults( - "clone[FUNCTION_REF]{clone(), Ljava.lang.Object;, ()Ljava.lang.Object;, clone, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+ - "finalize[FUNCTION_REF]{finalize(), Ljava.lang.Object;, ()V, finalize, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+ - "foo[FUNCTION_REF]{foo(), Ltest.CompletionKeywordTrue6;, ()V, foo, null, " +(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+ - "getClass[FUNCTION_REF]{getClass(), Ljava.lang.Object;, ()Ljava.lang.Class;, getClass, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+ - "hashCode[FUNCTION_REF]{hashCode(), Ljava.lang.Object;, ()I, hashCode, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+ - "notify[FUNCTION_REF]{notify(), Ljava.lang.Object;, ()V, notify, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+ - "notifyAll[FUNCTION_REF]{notifyAll(), Ljava.lang.Object;, ()V, notifyAll, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+ - "toString[FUNCTION_REF]{toString(), Ljava.lang.Object;, ()Ljava.lang.String;, toString, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+ - "wait[FUNCTION_REF]{wait(), Ljava.lang.Object;, ()V, wait, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+ - "wait[FUNCTION_REF]{wait(), Ljava.lang.Object;, (J)V, wait, (millis), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+ - "wait[FUNCTION_REF]{wait(), Ljava.lang.Object;, (JI)V, wait, (millis, nanos), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+ - "equals[FUNCTION_REF]{equals(), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"}\n"+ - "var[LOCAL_VARIABLE_REF]{var, null, Z, var, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"}\n"+ - "false[KEYWORD]{false, null, null, false, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_TRUE_OR_FALSE + R_NON_RESTRICTED)+"}\n"+ - "true[KEYWORD]{true, null, null, true, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_TRUE_OR_FALSE + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } else { - assertResults( - "CompletionKeywordTrue6[TYPE_REF]{CompletionKeywordTrue6, test, Ltest.CompletionKeywordTrue6;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+ - "clone[FUNCTION_REF]{clone(), Ljava.lang.Object;, ()Ljava.lang.Object;, clone, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+ - "finalize[FUNCTION_REF]{finalize(), Ljava.lang.Object;, ()V, finalize, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+ - "foo[FUNCTION_REF]{foo(), Ltest.CompletionKeywordTrue6;, ()V, foo, null, " +(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+ - "getClass[FUNCTION_REF]{getClass(), Ljava.lang.Object;, ()Ljava.lang.Class;, getClass, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+ - "hashCode[FUNCTION_REF]{hashCode(), Ljava.lang.Object;, ()I, hashCode, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+ - "notify[FUNCTION_REF]{notify(), Ljava.lang.Object;, ()V, notify, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+ - "notifyAll[FUNCTION_REF]{notifyAll(), Ljava.lang.Object;, ()V, notifyAll, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+ - "toString[FUNCTION_REF]{toString(), Ljava.lang.Object;, ()Ljava.lang.String;, toString, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+ - "wait[FUNCTION_REF]{wait(), Ljava.lang.Object;, ()V, wait, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+ - "wait[FUNCTION_REF]{wait(), Ljava.lang.Object;, (J)V, wait, (millis), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+ - "wait[FUNCTION_REF]{wait(), Ljava.lang.Object;, (JI)V, wait, (millis, nanos), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+ - "equals[FUNCTION_REF]{equals(), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"}\n"+ - "var[LOCAL_VARIABLE_REF]{var, null, Z, var, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"}\n"+ - "false[KEYWORD]{false, null, null, false, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_TRUE_OR_FALSE + R_NON_RESTRICTED)+"}\n"+ - "true[KEYWORD]{true, null, null, true, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_TRUE_OR_FALSE + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } -} -public void testCompletionKeywordTry1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTry1.js"); - - String str = cu.getSource(); - String completeBehind = "tr"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:try completion:try relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordTry2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTry2.js"); - - String str = cu.getSource(); - String completeBehind = "tr"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:true completion:true relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordTry3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTry3.js"); - - String str = cu.getSource(); - String completeBehind = "try"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordTry4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTry4.js"); - - String str = cu.getSource(); - String completeBehind = "tr"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:try completion:try relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordTry5() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTry5.js"); - - String str = cu.getSource(); - String completeBehind = "tr"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:true completion:true relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordTry6() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTry6.js"); - - String str = cu.getSource(); - String completeBehind = "try"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordWhile1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile1.js"); - - String str = cu.getSource(); - String completeBehind = "wh"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:while completion:while relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordWhile10() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile10.js"); - - String str = cu.getSource(); - String completeBehind = "wh"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:while completion:while relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordWhile2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile2.js"); - - String str = cu.getSource(); - String completeBehind = "wh"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordWhile3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile3.js"); - - String str = cu.getSource(); - String completeBehind = "wh"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordWhile4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile4.js"); - - String str = cu.getSource(); - String completeBehind = "wh"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:while completion:while relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordWhile5() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile5.js"); - - String str = cu.getSource(); - String completeBehind = "wh"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:while completion:while relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordWhile6() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile6.js"); - - String str = cu.getSource(); - String completeBehind = "wh"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:while completion:while relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionKeywordWhile7() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile7.js"); - - String str = cu.getSource(); - String completeBehind = "wh"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordWhile8() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile8.js"); - - String str = cu.getSource(); - String completeBehind = "wh"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "", - requestor.getResults()); -} -public void testCompletionKeywordWhile9() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile9.js"); - - String str = cu.getSource(); - String completeBehind = "wh"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:while completion:while relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionLocalName() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionLocalName.js"); - - String str = cu.getSource(); - String completeBehind = "ClassWithComplexName "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "should have two completions", - "element:classWithComplexName completion:classWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" + - "element:complexName2 completion:complexName2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" + - "element:name completion:name relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" + - "element:withComplexName completion:withComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionLocalType1() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/CompletionLocalType1.js", - "public class CompletionLocalType1 {\n" + - " void foo() {\n" + - " class ZZZZ {\n" + - " ZZZ\n" + - " }\n" + - " }\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "ZZZ"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "ZZZ[POTENTIAL_METHOD_DECLARATION]{ZZZ, LZZZZ;, ()V, ZZZ, null, "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}\n"+ - "ZZZZ[TYPE_REF]{ZZZZ, , LZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -/* -* http://dev.eclipse.org/bugs/show_bug.cgi?id=25815 -*/ -public void testCompletionMemberType() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/CompletionMemberType.js", - "public class CompletionMemberType {\n"+ - " public class Y {\n"+ - " public void foo(){\n"+ - " Y var = new Y\n"+ - " }\n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "new Y"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "CompletionMemberType.Y[TYPE_REF]{Y, , LCompletionMemberType$Y;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_EXACT_NAME+ R_UNQUALIFIED + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -public void testCompletionMemberType2() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/test/CompletionMemberType2.js", - "public class CompletionMemberType2 {\n"+ - " public class MemberException extends Exception {\n"+ - " }\n"+ - " void foo() {\n"+ - " throw new \n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "new "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) { - assertResults( - "", - requestor.getResults()); - } else { - assertResults( - "CompletionMemberType2[TYPE_REF]{CompletionMemberType2, test, Ltest.CompletionMemberType2;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+ - "CompletionMemberType2.MemberException[TYPE_REF]{MemberException, test, Ltest.CompletionMemberType2$MemberException;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION+ R_NON_RESTRICTED)+"}", - requestor.getResults()); - } -} -public void testCompletionMemberType3() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/test/CompletionArrayClone.js", - "public class CompletionMemberType3 {\n"+ - " public class MemberException extends Exception {\n"+ - " }\n"+ - " void foo() {\n"+ - " throw new MemberE\n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "new MemberE"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "CompletionMemberType3.MemberException[TYPE_REF]{MemberException, test, Ltest.CompletionMemberType3$MemberException;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXCEPTION+ R_UNQUALIFIED + R_NON_RESTRICTED) +"}", - requestor.getResults()); -} -public void testCompletionMessageSendIsParent1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMessageSendIsParent1.js"); - - String str = cu.getSource(); - String completeBehind = "zz"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionMessageSendIsParent2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMessageSendIsParent2.js"); - - String str = cu.getSource(); - String completeBehind = "zz"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionMessageSendIsParent3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMessageSendIsParent3.js"); - - String str = cu.getSource(); - String completeBehind = "zz"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionMessageSendIsParent4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMessageSendIsParent4.js"); - - String str = cu.getSource(); - String completeBehind = "zz"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionMessageSendIsParent5() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMessageSendIsParent5.js"); - - String str = cu.getSource(); - String completeBehind = "zz"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionMessageSendIsParent6() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMessageSendIsParent6.js"); - - String str = cu.getSource(); - String completeBehind = "zz"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionMethodDeclaration() throws JavaScriptModelException { - - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodDeclaration.js"); - - String str = cu.getSource(); - String completeBehind = "eq"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "should have two completions", - "element:eqFoo completion:public int eqFoo(int a, Object b) relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"\n" + - "element:equals completion:public boolean equals(Object obj) relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionMethodDeclaration10() throws JavaScriptModelException { - - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodDeclaration10.js"); - - String str = cu.getSource(); - String completeBehind = "clon"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "should have one completion", - "element:CloneNotSupportedException completion:CloneNotSupportedException relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:clone completion:protected Object clone() throws CloneNotSupportedException relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED), - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=80063 -public void testCompletionMethodDeclaration11() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/test/CompletionMethodDeclaration11.js", - "package test;\n" + - "public class CompletionMethodDeclaration11 {\n" + - " private void foo() {\n" + - " }\n" + - "}\n" + - "class CompletionMethodDeclaration11_2 extends CompletionMethodDeclaration11 {\n" + - " fo\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "fo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "fo[POTENTIAL_METHOD_DECLARATION]{fo, Ltest.CompletionMethodDeclaration11_2;, ()V, fo, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -public void testCompletionMethodDeclaration12() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/test/CompletionMethodDeclaration12.js", - "package test;\n" + - "public class CompletionMethodDeclaration12 {\n" + - " public void foo() {\n" + - " }\n" + - "}\n" + - "class CompletionMethodDeclaration12_2 extends CompletionMethodDeclaration12{\n" + - " public final void foo() {\n" + - " }\n" + - "}\n" + - "class CompletionMethodDeclaration12_3 extends CompletionMethodDeclaration12_2 {\n" + - " fo\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "fo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "fo[POTENTIAL_METHOD_DECLARATION]{fo, Ltest.CompletionMethodDeclaration12_3;, ()V, fo, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -public void testCompletionMethodDeclaration2() throws JavaScriptModelException { - IJavaScriptUnit superClass = null; - try { - superClass = getWorkingCopy( - "/Completion/src/CompletionSuperClass.js", - "public class CompletionSuperClass{\n" + - " public class Inner {}\n" + - " public int eqFoo(int a,Object b){\n" + - " return 1;\n" + - " }\n" + - "}"); - - this.wc = getWorkingCopy( - "/Completion/src/CompletionMethodDeclaration2.js", - "public class CompletionMethodDeclaration2 extends CompletionSuperClass {\n" + - " eq\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "eq"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "eq[POTENTIAL_METHOD_DECLARATION]{eq, LCompletionMethodDeclaration2;, ()V, eq, null, "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}\n" + - "eqFoo[FUNCTION_DECLARATION]{public int eqFoo(int a, Object b), LCompletionSuperClass;, (ILjava.lang.Object;)I, eqFoo, (a, b), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n" + - "equals[FUNCTION_DECLARATION]{public boolean equals(Object obj), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED)+"}", - requestor.getResults()); - } finally { - if(superClass != null) { - superClass.discardWorkingCopy(); - } - } -} -/** - * Completion should not propose declarations of method already locally implemented - */ -public void testCompletionMethodDeclaration3() throws JavaScriptModelException { - IJavaScriptUnit superClass = null; - try { - superClass = getWorkingCopy( - "/Completion/src/CompletionSuperClass.js", - "public class CompletionSuperClass{\n" + - " public class Inner {}\n" + - " public int eqFoo(int a,Object b){\n" + - " return 1;\n" + - " }\n" + - "}"); - - this.wc = getWorkingCopy( - "/Completion/src/CompletionMethodDeclaration3.js", - "public class CompletionMethodDeclaration3 extends CompletionSuperClass {\n" + - " eq\n" + - " \n" + - " public int eqFoo(int a,Object b){\n" + - " return 1;\n" + - " }\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "eq"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "eq[POTENTIAL_METHOD_DECLARATION]{eq, LCompletionMethodDeclaration3;, ()V, eq, null, "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}\n" + - "equals[FUNCTION_DECLARATION]{public boolean equals(Object obj), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED)+"}", - requestor.getResults()); - } finally { - if(superClass != null) { - superClass.discardWorkingCopy(); - } - } -} -public void testCompletionMethodDeclaration4() throws JavaScriptModelException { - IJavaScriptUnit superClass = null; - try { - superClass = getWorkingCopy( - "/Completion/src/CompletionSuperInterface.js", - "public interface CompletionSuperInterface{\n"+ - " public int eqFoo(int a,Object b);\n"+ - "}"); - - this.wc = getWorkingCopy( - "/Completion/src/CompletionMethodDeclaration4.js", - "public abstract class CompletionMethodDeclaration4 implements CompletionSuperInterface {\n"+ - " eq\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "eq"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "eq[POTENTIAL_METHOD_DECLARATION]{eq, LCompletionMethodDeclaration4;, ()V, eq, null, "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}\n" + - "equals[FUNCTION_DECLARATION]{public boolean equals(Object obj), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+ - "eqFoo[FUNCTION_DECLARATION]{public int eqFoo(int a, Object b), LCompletionSuperInterface;, (ILjava.lang.Object;)I, eqFoo, (a, b), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_ABSTRACT_METHOD + R_METHOD_OVERIDE+ R_NON_RESTRICTED)+"}", - requestor.getResults()); - } finally { - if(superClass != null) { - superClass.discardWorkingCopy(); - } - } -} -public void testCompletionMethodDeclaration5() throws JavaScriptModelException { - IJavaScriptUnit superClass = null; - try { - superClass = getWorkingCopy( - "/Completion/src/CompletionSuperClass.js", - "public class CompletionSuperClass{\n" + - " public class Inner {}\n" + - " public int eqFoo(int a,Object b){\n" + - " return 1;\n" + - " }\n" + - "}"); - - this.wc = getWorkingCopy( - "/Completion/src/CompletionMethodDeclaration5.js", - "public class CompletionMethodDeclaration5 {\n" + - " public static void main(String[] args) {\n" + - " new CompletionSuperClass() {\n" + - " }\n" + - "\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "new CompletionSuperClass() {"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) { - assertResults( - "[POTENTIAL_METHOD_DECLARATION]{, LCompletionSuperClass;, ()V, , null, "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}\n" + - "clone[FUNCTION_DECLARATION]{protected Object clone() throws CloneNotSupportedException, Ljava.lang.Object;, ()Ljava.lang.Object;, clone, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+ - "eqFoo[FUNCTION_DECLARATION]{public int eqFoo(int a, Object b), LCompletionSuperClass;, (ILjava.lang.Object;)I, eqFoo, (a, b), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+ - "equals[FUNCTION_DECLARATION]{public boolean equals(Object obj), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+ - "finalize[FUNCTION_DECLARATION]{protected void finalize() throws Throwable, Ljava.lang.Object;, ()V, finalize, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+ - "hashCode[FUNCTION_DECLARATION]{public int hashCode(), Ljava.lang.Object;, ()I, hashCode, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+ - "toString[FUNCTION_DECLARATION]{public String toString(), Ljava.lang.Object;, ()Ljava.lang.String;, toString, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED)+ "}", - requestor.getResults()); - } else { - assertResults( - "[POTENTIAL_METHOD_DECLARATION]{, LCompletionSuperClass;, ()V, , null, "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}\n" + - "CompletionMethodDeclaration5[TYPE_REF]{CompletionMethodDeclaration5, , LCompletionMethodDeclaration5;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+ - "clone[FUNCTION_DECLARATION]{protected Object clone() throws CloneNotSupportedException, Ljava.lang.Object;, ()Ljava.lang.Object;, clone, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+ - "eqFoo[FUNCTION_DECLARATION]{public int eqFoo(int a, Object b), LCompletionSuperClass;, (ILjava.lang.Object;)I, eqFoo, (a, b), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+ - "equals[FUNCTION_DECLARATION]{public boolean equals(Object obj), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+ - "finalize[FUNCTION_DECLARATION]{protected void finalize() throws Throwable, Ljava.lang.Object;, ()V, finalize, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+ - "hashCode[FUNCTION_DECLARATION]{public int hashCode(), Ljava.lang.Object;, ()I, hashCode, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+ - "toString[FUNCTION_DECLARATION]{public String toString(), Ljava.lang.Object;, ()Ljava.lang.String;, toString, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED)+ "}", - requestor.getResults()); - } - } finally { - if(superClass != null) { - superClass.discardWorkingCopy(); - } - } -} -public void testCompletionMethodDeclaration6() throws JavaScriptModelException { - - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodDeclaration6.js"); - - String str = cu.getSource(); - String completeBehind = "clon"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "should have one completion", - "element:CloneNotSupportedException completion:CloneNotSupportedException relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionMethodDeclaration7() throws JavaScriptModelException { - - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodDeclaration7.js"); - - String str = cu.getSource(); - String completeBehind = "clon"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "should have one completion", - "element:CloneNotSupportedException completion:CloneNotSupportedException relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:clone completion:protected Object clone() throws CloneNotSupportedException relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionMethodDeclaration8() throws JavaScriptModelException { - - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodDeclaration8.js"); - - String str = cu.getSource(); - String completeBehind = "clon"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "should have one completion", - "element:CloneNotSupportedException completion:CloneNotSupportedException relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:clone completion:protected Object clone() throws CloneNotSupportedException relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionMethodDeclaration9() throws JavaScriptModelException { - - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodDeclaration9.js"); - - String str = cu.getSource(); - String completeBehind = "clon"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "should have one completion", - "element:CloneNotSupportedException completion:CloneNotSupportedException relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:clone completion:protected Object clone() throws CloneNotSupportedException relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionMethodThrowsClause() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodThrowsClause.js"); - - String str = cu.getSource(); - String completeBehind = "Ex"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Exception completion:Exception relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXCEPTION + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionMethodThrowsClause2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodThrowsClause2.js"); - - String str = cu.getSource(); - String completeBehind = "Ex"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Exception completion:Exception relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXCEPTION+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionNonEmptyToken1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionNonEmptyToken1.js"); - - String str = cu.getSource(); - String completeBehind = "zz"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - int start = cursorLocation - 2; - int end = start + 4; - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:zzyy completion:zzyy position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResultsWithPosition()); -} -public void testCompletionNonStaticFieldRelevance() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionNonStaticFieldRelevance.js"); - - String str = cu.getSource(); - String completeBehind = "var.Ii"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Ii0 completion:Ii0 relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "\n" + - "element:ii1 completion:ii1 relevance:" + (R_DEFAULT + R_INTERESTING + R_NON_STATIC+ R_NON_RESTRICTED), - requestor.getResults()); -} -/** - * Attempt to do completion with a null requestor - */ -public void testCompletionNullRequestor() throws JavaScriptModelException { - try { - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindThisDotField.js"); - cu.codeComplete(5, (CompletionRequestor)null); - } catch (IllegalArgumentException iae) { - return; - } - assertTrue("Should not be able to do completion with a null requestor", false); -} -/* -* http://dev.eclipse.org/bugs/show_bug.cgi?id=24565 -*/ -public void testCompletionObjectsMethodWithInterfaceReceiver() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionObjectsMethodWithInterfaceReceiver.js"); - - String str = cu.getSource(); - String completeBehind = "hash"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:hashCode completion:hashCode() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_EXACT_EXPECTED_TYPE+ R_NON_RESTRICTED), - requestor.getResults()); -} -/** - * Ensures that the code assist features works on class files with associated source. - */ -public void testCompletionOnClassFile() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IClassFile cu = getClassFile("Completion", "zzz.jar", "jarpack1", "X.class"); - - String str = cu.getSource(); - String completeBehind = "Obj"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - assertEquals( - "should have one class", - "element:Object completion:Object relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -/* -* http://dev.eclipse.org/bugs/show_bug.cgi?id=25890 -*/ -public void testCompletionOnStaticMember1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionOnStaticMember1.js"); - - String str = cu.getSource(); - String completeBehind = "var"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:var1 completion:var1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" + - "element:var2 completion:var2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED), - requestor.getResults()); -} -/* -* http://dev.eclipse.org/bugs/show_bug.cgi?id=25890 -*/ -public void testCompletionOnStaticMember2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionOnStaticMember2.js"); - - String str = cu.getSource(); - String completeBehind = "method"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:method1 completion:method1() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" + - "element:method2 completion:method2() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED), - requestor.getResults()); -} -/** - * Test that an out of bounds index causes an exception. - */ -public void testCompletionOutOfBounds() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionOutOfBounds.js"); - try { - cu.codeComplete(cu.getSource().length() + 1, requestor); - } catch (JavaScriptModelException e) { - return; - } - assertTrue("should have failed", false); -} -public void testCompletionPackageAndClass1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "z1.z2.qla0", "Qla3.js"); - - String str = cu.getSource(); - String completeBehind = "z1.z2.ql"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Qla1 completion:z1.z2.Qla1 relevance:" + (R_DEFAULT + R_INTERESTING + R_QUALIFIED + R_NON_RESTRICTED) + "\n" + - "element:qla2 completion:z1.z2.qla2 relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE + R_QUALIFIED + R_NON_RESTRICTED) + "\n" + - "element:z1.z2.qla0 completion:z1.z2.qla0 relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE + R_QUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionPackageAndClass2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "z1.z2.qla0", "Wla.js"); - - String str = cu.getSource(); - String completeBehind = "z1.z2.qla0."; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Qla3 completion:Qla3 relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "\n" + - "element:Qla4 completion:Qla4 relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "\n" + - "element:Wla completion:Wla relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionPrefixFieldName1() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/CompletionPrefixFieldName1.js", - "public class CompletionPrefixFieldName1 {\n"+ - " int xBar;\n"+ - " \n"+ - " class classFoo {\n"+ - " int xBar;\n"+ - " \n"+ - " public void foo(){\n"+ - " xBa\n"+ - " }\n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "xBa"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "xBar[FIELD_REF]{CompletionPrefixFieldName1.this.xBar, LCompletionPrefixFieldName1;, I, xBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + - "xBar[FIELD_REF]{xBar, LCompletionPrefixFieldName1$classFoo;, I, xBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -public void testCompletionPrefixFieldName2() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/CompletionPrefixFieldName2.js", - "public class CompletionPrefixFieldName2 {\n"+ - " int xBar;\n"+ - " \n"+ - " class classFoo {\n"+ - " int xBar;\n"+ - " \n"+ - " public void foo(){\n"+ - " new CompletionPrefixFieldName2().xBa\n"+ - " }\n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "xBa"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "xBar[FIELD_REF]{xBar, LCompletionPrefixFieldName2;, I, xBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -public void testCompletionPrefixMethodName1() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/CompletionPrefixMethodName1.js", - "public class CompletionPrefixMethodName1 {\n"+ - " int xBar(){}\n"+ - " \n"+ - " class classFoo {\n"+ - " int xBar(){}\n"+ - " \n"+ - " public void foo(){\n"+ - " xBa\n"+ - " }\n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "xBa"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "xBar[FUNCTION_REF]{CompletionPrefixMethodName1.this.xBar(), LCompletionPrefixMethodName1;, ()I, xBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + - "xBar[FUNCTION_REF]{xBar(), LCompletionPrefixMethodName1$classFoo;, ()I, xBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -public void testCompletionPrefixMethodName2() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/CompletionPrefixMethodName2.js", - "public class CompletionPrefixMethodName2 {\n"+ - " int xBar(){}\n"+ - " \n"+ - " class classFoo {\n"+ - " int xBar(){}\n"+ - " \n"+ - " public void foo(){\n"+ - " new CompletionPrefixMethodName2().xBa\n"+ - " }\n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "xBa"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "xBar[FUNCTION_REF]{xBar(), LCompletionPrefixMethodName2;, ()I, xBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -public void testCompletionPrefixMethodName3() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/CompletionPrefixMethodName2.js", - "public class CompletionPrefixMethodName3 {\n"+ - " int xBar(int a, int b){}\n"+ - " \n"+ - " class classFoo {\n"+ - " int xBar(int a, int b){}\n"+ - " \n"+ - " public void foo(){\n"+ - " xBar(1,\n"+ - " }\n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "xBar(1,"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "xBar[FUNCTION_REF]{CompletionPrefixMethodName3.this.xBar(1,, LCompletionPrefixMethodName3;, (II)I, xBar, (a, b), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME+ R_NON_RESTRICTED)+"}\n"+ - "xBar[FUNCTION_REF]{, LCompletionPrefixMethodName3$classFoo;, (II)I, xBar, (a, b), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -public void testCompletionQualifiedAllocationType1() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/CompletionQualifiedAllocationType1.js", - "public class CompletionQualifiedAllocationType1 {\n"+ - " public class YYY {\n"+ - " }\n"+ - " void foo(){\n"+ - " this.new YYY\n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "YYY"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "CompletionQualifiedAllocationType1.YYY[TYPE_REF]{YYY, , LCompletionQualifiedAllocationType1$YYY;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME+ R_UNQUALIFIED + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -/* -* http://dev.eclipse.org/bugs/show_bug.cgi?id=26677 -*/ -public void testCompletionQualifiedExpectedType() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/test/CompletionQualifiedExpectedType.js", - "import pack1.PX;\n"+ - "\n"+ - "public class CompletionQualifiedExpectedType {\n"+ - " void foo() {\n"+ - " pack2.PX var = new \n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "new "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) { - assertResults( - "PX[TYPE_REF]{pack2.PX, pack2, Lpack2.PX;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE+ R_NON_RESTRICTED)+ "}", - requestor.getResults()); - } else { - assertResults( - "CompletionQualifiedExpectedType[TYPE_REF]{CompletionQualifiedExpectedType, test, Ltest.CompletionQualifiedExpectedType;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" + - "PX[TYPE_REF]{pack2.PX, pack2, Lpack2.PX;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE+ R_NON_RESTRICTED)+ "}", - requestor.getResults()); - } -} -/** - * Complete the type "Repeated", "RepeatedOtherType from "Repeated". - */ -public void testCompletionRepeatedType() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionRepeatedType.js"); - - String str = cu.getSource(); - String completeBehind = "/**/CompletionRepeated"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - assertEquals( - "should have two types", - "element:CompletionRepeatedOtherType completion:CompletionRepeatedOtherType relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:CompletionRepeatedType completion:CompletionRepeatedType relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -/* -* http://dev.eclipse.org/bugs/show_bug.cgi?id=25591 -*/ -public void testCompletionReturnInInitializer() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionReturnInInitializer.js"); - - String str = cu.getSource(); - String completeBehind = "eq"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:equals completion:equals() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionReturnStatementIsParent1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionReturnStatementIsParent1.js"); - - String str = cu.getSource(); - String completeBehind = "zz"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:zz00 completion:zz00 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz00M completion:zz00M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz01 completion:zz01 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz01M completion:zz01M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz02 completion:zz02 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz02M completion:zz02M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz10 completion:zz10 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz10M completion:zz10M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz11 completion:zz11 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz11M completion:zz11M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz12 completion:zz12 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz12M completion:zz12M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz20 completion:zz20 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz20M completion:zz20M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz21 completion:zz21 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz21M completion:zz21M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz22 completion:zz22 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zz22M completion:zz22M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzOb completion:zzOb relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzObM completion:zzObM() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionReturnStatementIsParent2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionReturnStatementIsParent2.js"); - - String str = cu.getSource(); - String completeBehind = "xx"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:XX00 completion:XX00 relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:XX01 completion:XX01 relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:XX02 completion:XX02 relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:XX10 completion:XX10 relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:XX11 completion:XX11 relevance:"+(R_DEFAULT + R_INTERESTING + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:XX12 completion:XX12 relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:XX20 completion:XX20 relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:XX21 completion:XX21 relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:XX22 completion:XX22 relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=66908 - */ -public void testCompletionSameClass() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionSameClass.js"); - - String str = cu.getSource(); - String completeBehind = "(CompletionSameClas"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:CompletionSameClass completion:CompletionSameClass relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionSameSuperClass() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/CompletionSameSuperClass.js", - "public class CompletionSameSuperClass extends A {\n" + - " class Inner extends A {\n" + - " void foo(int bar){\n" + - " bar\n" + - " }\n" + - " } \n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "bar"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "bar[FIELD_REF]{CompletionSameSuperClass.this.bar, LA;, I, bar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"}\n"+ - "bar[FIELD_REF]{this.bar, LA;, I, bar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"}\n"+ - "bar[FUNCTION_REF]{CompletionSameSuperClass.this.bar(), LA;, ()V, bar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"}\n"+ - "bar[LOCAL_VARIABLE_REF]{bar, null, I, bar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+ - "bar[FUNCTION_REF]{bar(), LA;, ()V, bar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -public void testCompletionStaticMethod1() throws JavaScriptModelException { - IJavaScriptUnit aType = null; - try { - aType = getWorkingCopy( - "/Completion/src/TypeWithAMethodAndAStaticMethod .js", - "public class TypeWithAMethodAndAStaticMethod {\n"+ - " public static void foo(){}\n"+ - " public void foo0(){}\n"+ - "}"); - - this.wc = getWorkingCopy( - "/Completion/src/CompletionStaticMethod1.js", - "public class CompletionStaticMethod1 extends TypeWithAMethodAndAStaticMethod {\n"+ - " void bar(){\n"+ - " new TypeWithAMethodAndAStaticMethod(){\n"+ - " class Inner1 extends TypeWithAMethodAndAStaticMethod {\n"+ - " void bar(){\n"+ - " foo\n"+ - " }\n"+ - " }\n"+ - " };\n"+ - " }\n"+ - " \n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "foo0[FUNCTION_REF]{CompletionStaticMethod1.this.foo0(), LTypeWithAMethodAndAStaticMethod;, ()V, foo0, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "foo0[FUNCTION_REF]{foo0(), LTypeWithAMethodAndAStaticMethod;, ()V, foo0, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED) + "}\n" + - "foo[FUNCTION_REF]{CompletionStaticMethod1.foo(), LTypeWithAMethodAndAStaticMethod;, ()V, foo, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED) + "}\n" + - "foo[FUNCTION_REF]{foo(), LTypeWithAMethodAndAStaticMethod;, ()V, foo, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_NAME + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - if(aType != null) { - aType.discardWorkingCopy(); - } - } -} -public void testCompletionStaticMethodDeclaration1() throws JavaScriptModelException { - IJavaScriptUnit aType = null; - try { - aType = getWorkingCopy( - "/Completion/src/TypeWithAMethodAndAStaticMethod .js", - "public class TypeWithAMethodAndAStaticMethod {\n"+ - " public static void foo(){}\n"+ - " public void foo0(){}\n"+ - "}"); - - this.wc = getWorkingCopy( - "/Completion/src/CompletionStaticMethodDeclaration1.js", - "public class CompletionStaticMethodDeclaration1 extends TypeWithAMethodAndAStaticMethod {\n"+ - " foo\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "foo[POTENTIAL_METHOD_DECLARATION]{foo, LCompletionStaticMethodDeclaration1;, ()V, foo, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" + - "foo0[FUNCTION_DECLARATION]{public void foo0(), LTypeWithAMethodAndAStaticMethod;, ()V, foo0, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - if(aType != null) { - aType.discardWorkingCopy(); - } - } -} -public void testCompletionStaticMethodDeclaration2() throws JavaScriptModelException { - IJavaScriptUnit aType = null; - try { - aType = getWorkingCopy( - "/Completion/src/TypeWithAMethodAndAStaticMethod .js", - "public class TypeWithAMethodAndAStaticMethod {\n"+ - " public static void foo(){}\n"+ - " public void foo0(){}\n"+ - "}"); - - this.wc = getWorkingCopy( - "/Completion/src/CompletionStaticMethodDeclaration2.js", - "public class CompletionStaticMethodDeclaration2 {\n" + - " class Inner1 extends TypeWithAMethodAndAStaticMethod {\n" + - " foo\n" + - " }\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "foo[POTENTIAL_METHOD_DECLARATION]{foo, LCompletionStaticMethodDeclaration2$Inner1;, ()V, foo, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" + - "foo0[FUNCTION_DECLARATION]{public void foo0(), LTypeWithAMethodAndAStaticMethod;, ()V, foo0, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - if(aType != null) { - aType.discardWorkingCopy(); - } - } -} -public void testCompletionStaticMethodDeclaration3() throws JavaScriptModelException { - IJavaScriptUnit aType = null; - try { - aType = getWorkingCopy( - "/Completion/src/TypeWithAMethodAndAStaticMethod .js", - "public class TypeWithAMethodAndAStaticMethod {\n"+ - " public static void foo(){}\n"+ - " public void foo0(){}\n"+ - "}"); - - this.wc = getWorkingCopy( - "/Completion/src/CompletionStaticMethodDeclaration3.js", - "public class CompletionStaticMethodDeclaration3 {\n" + - " static class Inner1 extends TypeWithAMethodAndAStaticMethod {\n" + - " foo\n" + - " }\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "foo[POTENTIAL_METHOD_DECLARATION]{foo, LCompletionStaticMethodDeclaration3$Inner1;, ()V, foo, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" + - "foo0[FUNCTION_DECLARATION]{public void foo0(), LTypeWithAMethodAndAStaticMethod;, ()V, foo0, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - if(aType != null) { - aType.discardWorkingCopy(); - } - } -} -public void testCompletionStaticMethodDeclaration4() throws JavaScriptModelException { - IJavaScriptUnit aType = null; - try { - aType = getWorkingCopy( - "/Completion/src/TypeWithAMethodAndAStaticMethod .js", - "public class TypeWithAMethodAndAStaticMethod {\n"+ - " public static void foo(){}\n"+ - " public void foo0(){}\n"+ - "}"); - - this.wc = getWorkingCopy( - "/Completion/src/CompletionStaticMethodDeclaration4.js", - "public class CompletionStaticMethodDeclaration4 {\n" + - " void bar() {\n" + - " class Local1 extends TypeWithAMethodAndAStaticMethod {\n" + - " foo\n" + - " }\n" + - " }\n" + - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "foo[POTENTIAL_METHOD_DECLARATION]{foo, LLocal1;, ()V, foo, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" + - "foo0[FUNCTION_DECLARATION]{public void foo0(), LTypeWithAMethodAndAStaticMethod;, ()V, foo0, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - if(aType != null) { - aType.discardWorkingCopy(); - } - } -} -public void testCompletionStaticMethodDeclaration5() throws JavaScriptModelException { - IJavaScriptUnit aType = null; - try { - aType = getWorkingCopy( - "/Completion/src/TypeWithAMethodAndAStaticMethod .js", - "public class TypeWithAMethodAndAStaticMethod {\n"+ - " public static void foo(){}\n"+ - " public void foo0(){}\n"+ - "}"); - - this.wc = getWorkingCopy( - "/Completion/src/CompletionStaticMethodDeclaration5.js", - "public class CompletionStaticMethodDeclaration5 {\n"+ - " void bar() {\n"+ - " static class Local1 extends TypeWithAMethodAndAStaticMethod {\n"+ - " foo\n"+ - " }\n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "foo[POTENTIAL_METHOD_DECLARATION]{foo, LLocal1;, ()V, foo, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" + - "foo0[FUNCTION_DECLARATION]{public void foo0(), LTypeWithAMethodAndAStaticMethod;, ()V, foo0, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - if(aType != null) { - aType.discardWorkingCopy(); - } - } -} -public void testCompletionStaticMethodDeclaration6() throws JavaScriptModelException { - IJavaScriptUnit aType = null; - try { - aType = getWorkingCopy( - "/Completion/src/TypeWithAMethodAndAStaticMethod .js", - "public class TypeWithAMethodAndAStaticMethod {\n"+ - " public static void foo(){}\n"+ - " public void foo0(){}\n"+ - "}"); - - this.wc = getWorkingCopy( - "/Completion/src/CompletionStaticMethodDeclaration6.js", - "public class CompletionStaticMethodDeclaration6 {\n"+ - " void bar() {\n"+ - " new TypeWithAMethodAndAStaticMethod() {\n"+ - " foo\n"+ - " };\n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "foo[POTENTIAL_METHOD_DECLARATION]{foo, LTypeWithAMethodAndAStaticMethod;, ()V, foo, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" + - "foo0[FUNCTION_DECLARATION]{public void foo0(), LTypeWithAMethodAndAStaticMethod;, ()V, foo0, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - if(aType != null) { - aType.discardWorkingCopy(); - } - } -} -public void testCompletionSuperType() throws JavaScriptModelException { - IJavaScriptUnit superClass = null; - try { - superClass = getWorkingCopy( - "/Completion/src/CompletionSuperClass.js", - "public class CompletionSuperClass{\n" + - " public class Inner {}\n" + - " public int eqFoo(int a,Object b){\n" + - " return 1;\n" + - " }\n" + - "}"); - - this.wc = getWorkingCopy( - "/Completion/src/CompletionSuperType.js", - "public class CompletionSuperType extends CompletionSuperClass."); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "CompletionSuperClass."; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "CompletionSuperClass.Inner[TYPE_REF]{Inner, , LCompletionSuperClass$Inner;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_CLASS+ R_NON_RESTRICTED)+"}", - requestor.getResults()); - } finally { - if(superClass != null) { - superClass.discardWorkingCopy(); - } - } -} -public void testCompletionSuperType2() throws JavaScriptModelException { - IJavaScriptUnit superClass = null; - IJavaScriptUnit superClass2 = null; - IJavaScriptUnit superInterface = null; - IJavaScriptUnit superInterface2 = null; - try { - superClass = getWorkingCopy( - "/Completion/src/CompletionSuperClass.js", - "public class CompletionSuperClass{\n" + - " public class Inner {}\n" + - " public int eqFoo(int a,Object b){\n" + - " return 1;\n" + - " }\n" + - "}"); - - superClass2 = getWorkingCopy( - "/Completion/src/CompletionSuperClass2.js", - "public class CompletionSuperClass2 {\n" + - " public class InnerClass {}\n" + - " public interface InnerInterface {}\n" + - "}"); - - superInterface = getWorkingCopy( - "/Completion/src/CompletionSuperInterface.js", - "public interface CompletionSuperInterface{\n" + - " public int eqFoo(int a,Object b);\n" + - "}"); - - superInterface2 = getWorkingCopy( - "/Completion/src/CompletionSuperInterface2.js", - "public interface CompletionSuperInterface2 {\n" + - " public class InnerClass {}\n" + - " public interface InnerInterface {}\n" + - "}"); - - this.wc = getWorkingCopy( - "/Completion/src/CompletionSuperType2.js", - "public class CompletionSuperType2 extends CompletionSuper"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "CompletionSuper"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "CompletionSuperClass[TYPE_REF]{CompletionSuperClass, , LCompletionSuperClass;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_CLASS + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" + - "CompletionSuperClass2[TYPE_REF]{CompletionSuperClass2, , LCompletionSuperClass2;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_CLASS + R_UNQUALIFIED + R_NON_RESTRICTED)+"}", - requestor.getResults()); - } finally { - if(superClass != null) { - superClass.discardWorkingCopy(); - } - if(superClass2 != null) { - superClass2.discardWorkingCopy(); - } - if(superInterface != null) { - superInterface.discardWorkingCopy(); - } - if(superInterface2 != null) { - superInterface2.discardWorkingCopy(); - } - } -} -public void testCompletionSuperType4() throws JavaScriptModelException { - IJavaScriptUnit superClass2 = null; - try { - superClass2 = getWorkingCopy( - "/Completion/src/CompletionSuperClass2.js", - "public class CompletionSuperClass2 {\n" + - " public class InnerClass {}\n" + - " public interface InnerInterface {}\n" + - "}"); - - this.wc = getWorkingCopy( - "/Completion/src/CompletionSuperType4.js", - "public class CompletionSuperType4 extends CompletionSuperClass2.Inner"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "CompletionSuperClass2.Inner"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "CompletionSuperClass2.InnerInterface[TYPE_REF]{InnerInterface, , LCompletionSuperClass2$InnerInterface;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED)+ "}\n"+ - "CompletionSuperClass2.InnerClass[TYPE_REF]{InnerClass, , LCompletionSuperClass2$InnerClass;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_CLASS + R_NON_RESTRICTED)+"}", - requestor.getResults()); - } finally { - if(superClass2 != null) { - superClass2.discardWorkingCopy(); - } - } -} -public void testCompletionThrowStatement() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionThrowStatement.js"); - - String str = cu.getSource(); - String completeBehind = "Ex"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Exception completion:Exception relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXCEPTION + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionToplevelType1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "p3", "CompletionToplevelType1.js"); - - String str = cu.getSource(); - String completeBehind = "CompletionToplevelType1"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:CompletionToplevelType1 completion:CompletionToplevelType1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionType1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionType1.js"); - - String str = cu.getSource(); - String completeBehind = "CT1"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:CT1 completion:CT1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+ - "element:CT1 completion:q2.CT1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionUnaryOperator1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionUnaryOperator1.js"); - - String str = cu.getSource(); - String completeBehind = "var"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:var1 completion:var1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" + - "element:var2 completion:var2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:var3 completion:var3 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionUnaryOperator2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionUnaryOperator2.js"); - - String str = cu.getSource(); - String completeBehind = "var"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:var1 completion:var1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:var2 completion:var2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" + - "element:var3 completion:var3 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -/* - * bug : http://dev.eclipse.org/bugs/show_bug.cgi?id=24440 - */ -public void testCompletionUnresolvedEnclosingType() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionUnresolvedEnclosingType.js"); - - String str = cu.getSource(); - String completeBehind = "new ZZZ("; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertTrue( - requestor.getResults().length() == 0); -} -public void testCompletionUnresolvedFieldType() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionUnresolvedFieldType.js"); - - String str = cu.getSource(); - String completeBehind = "bar"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:barPlus completion:barPlus() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionUnresolvedParameterType() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionUnresolvedParameterType.js"); - - String str = cu.getSource(); - String completeBehind = "bar"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:barPlus completion:barPlus() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionUnresolvedReturnType() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionUnresolvedReturnType.js"); - - String str = cu.getSource(); - String completeBehind = "bar"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:barPlus completion:barPlus() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionVariableInitializerInInitializer1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableInitializerInInitializer1.js"); - - String str = cu.getSource(); - String completeBehind = "zz"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionVariableInitializerInInitializer2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableInitializerInInitializer2.js"); - - String str = cu.getSource(); - String completeBehind = "zz"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionVariableInitializerInInitializer3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableInitializerInInitializer3.js"); - - String str = cu.getSource(); - String completeBehind = "Objec"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Object completion:Object relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionVariableInitializerInInitializer4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableInitializerInInitializer4.js"); - - String str = cu.getSource(); - String completeBehind = "Objec"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Object completion:Object relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionVariableInitializerInMethod1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableInitializerInMethod1.js"); - - String str = cu.getSource(); - String completeBehind = "zz"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionVariableInitializerInMethod2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableInitializerInMethod2.js"); - - String str = cu.getSource(); - String completeBehind = "zz"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionVariableInitializerInMethod3() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableInitializerInMethod3.js"); - - String str = cu.getSource(); - String completeBehind = "Objec"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Object completion:Object relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionVariableInitializerInMethod4() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableInitializerInMethod4.js"); - - String str = cu.getSource(); - String completeBehind = "Objec"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:Object completion:Object relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -/* -* http://dev.eclipse.org/bugs/show_bug.cgi?id=25811 -*/ -public void testCompletionVariableName1() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableName1.js"); - - String str = cu.getSource(); - String completeBehind = "TEST_FOO_MyClass "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:class1 completion:class1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" + - "element:myClass completion:myClass relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionVariableName10() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Object argumentPrefixPreviousValue = options.get(JavaScriptCore.CODEASSIST_LOCAL_PREFIXES); - options.put(JavaScriptCore.CODEASSIST_LOCAL_PREFIXES,"pre"); //$NON-NLS-1$ - Object localPrefixPreviousValue = options.get(JavaScriptCore.CODEASSIST_LOCAL_SUFFIXES); - options.put(JavaScriptCore.CODEASSIST_LOCAL_SUFFIXES,"suf"); //$NON-NLS-1$ - - JavaScriptCore.setOptions(options); - - try { - this.wc = getWorkingCopy( - "/Completion/src/CompletionVariableName10.js", - "class FooBar {\n"+ - "}\n"+ - "public class CompletionVariableName10 {\n"+ - " void foo(){\n"+ - " FooBar fo\n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "fo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "foBar[VARIABLE_DECLARATION]{foBar, null, LFooBar;, foBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "foBarsuf[VARIABLE_DECLARATION]{foBarsuf, null, LFooBar;, foBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"}\n"+ - "fooBar[VARIABLE_DECLARATION]{fooBar, null, LFooBar;, fooBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED)+"}\n"+ - "fooBarsuf[VARIABLE_DECLARATION]{fooBarsuf, null, LFooBar;, fooBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_LESS_NEW_CHARACTERS + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"}", - requestor.getResults()); - } finally { - options.put(JavaScriptCore.CODEASSIST_LOCAL_PREFIXES,argumentPrefixPreviousValue); - options.put(JavaScriptCore.CODEASSIST_LOCAL_SUFFIXES,localPrefixPreviousValue); - JavaScriptCore.setOptions(options); - } -} -public void testCompletionVariableName11() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Object argumentPrefixPreviousValue = options.get(JavaScriptCore.CODEASSIST_LOCAL_PREFIXES); - options.put(JavaScriptCore.CODEASSIST_LOCAL_PREFIXES,"pre"); //$NON-NLS-1$ - Object localPrefixPreviousValue = options.get(JavaScriptCore.CODEASSIST_LOCAL_SUFFIXES); - options.put(JavaScriptCore.CODEASSIST_LOCAL_SUFFIXES,"suf"); //$NON-NLS-1$ - - JavaScriptCore.setOptions(options); - - try { - this.wc = getWorkingCopy( - "/Completion/src/CompletionVariableName11.js", - "class FooBar {\n"+ - "}\n"+ - "public class CompletionVariableName11 {\n"+ - " void foo(){\n"+ - " FooBar pr\n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "pr"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "preBar[VARIABLE_DECLARATION]{preBar, null, LFooBar;, preBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NON_RESTRICTED)+"}\n"+ - "preFooBar[VARIABLE_DECLARATION]{preFooBar, null, LFooBar;, preFooBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NON_RESTRICTED)+"}\n"+ - "preBarsuf[VARIABLE_DECLARATION]{preBarsuf, null, LFooBar;, preBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NAME_FIRST_SUFFIX+ R_NON_RESTRICTED)+"}\n"+ - "preFooBarsuf[VARIABLE_DECLARATION]{preFooBarsuf, null, LFooBar;, preFooBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"}", - requestor.getResults()); - } finally { - options.put(JavaScriptCore.CODEASSIST_LOCAL_PREFIXES,argumentPrefixPreviousValue); - options.put(JavaScriptCore.CODEASSIST_LOCAL_SUFFIXES,localPrefixPreviousValue); - JavaScriptCore.setOptions(options); - } -} -public void testCompletionVariableName12() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Object argumentPrefixPreviousValue = options.get(JavaScriptCore.CODEASSIST_LOCAL_PREFIXES); - options.put(JavaScriptCore.CODEASSIST_LOCAL_PREFIXES,"pre"); //$NON-NLS-1$ - Object localPrefixPreviousValue = options.get(JavaScriptCore.CODEASSIST_LOCAL_SUFFIXES); - options.put(JavaScriptCore.CODEASSIST_LOCAL_SUFFIXES,"suf"); //$NON-NLS-1$ - - JavaScriptCore.setOptions(options); - - try { - this.wc = getWorkingCopy( - "/Completion/src/CompletionVariableName12.js", - "class FooBar {\n"+ - "}\n"+ - "public class CompletionVariableName12 {\n"+ - " void foo(){\n"+ - " FooBar prethe\n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "prethe"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "preTheBar[VARIABLE_DECLARATION]{preTheBar, null, LFooBar;, preTheBar, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NON_RESTRICTED)+"}\n"+ - "preTheFooBar[VARIABLE_DECLARATION]{preTheFooBar, null, LFooBar;, preTheFooBar, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NON_RESTRICTED)+"}\n"+ - "preTheBarsuf[VARIABLE_DECLARATION]{preTheBarsuf, null, LFooBar;, preTheBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"}\n"+ - "preTheFooBarsuf[VARIABLE_DECLARATION]{preTheFooBarsuf, null, LFooBar;, preTheFooBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"}", - requestor.getResults()); - } finally { - options.put(JavaScriptCore.CODEASSIST_LOCAL_PREFIXES,argumentPrefixPreviousValue); - options.put(JavaScriptCore.CODEASSIST_LOCAL_SUFFIXES,localPrefixPreviousValue); - JavaScriptCore.setOptions(options); - } -} -public void testCompletionVariableName13() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Object argumentPrefixPreviousValue = options.get(JavaScriptCore.CODEASSIST_LOCAL_PREFIXES); - options.put(JavaScriptCore.CODEASSIST_LOCAL_PREFIXES,"pre"); //$NON-NLS-1$ - Object localPrefixPreviousValue = options.get(JavaScriptCore.CODEASSIST_LOCAL_SUFFIXES); - options.put(JavaScriptCore.CODEASSIST_LOCAL_SUFFIXES,"suf"); //$NON-NLS-1$ - - JavaScriptCore.setOptions(options); - - try { - this.wc = getWorkingCopy( - "/Completion/src/CompletionVariableName13.js", - "class FooBar {\n"+ - "}\n"+ - "public class CompletionVariableName13 {\n"+ - " void foo(){\n"+ - " FooBar prefo\n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "prefo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "preFoBar[VARIABLE_DECLARATION]{preFoBar, null, LFooBar;, preFoBar, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NON_RESTRICTED)+"}\n"+ - "preFoBarsuf[VARIABLE_DECLARATION]{preFoBarsuf, null, LFooBar;, preFoBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"}\n"+ - "preFooBar[VARIABLE_DECLARATION]{preFooBar, null, LFooBar;, preFooBar, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED)+"}\n"+ - "preFooBarsuf[VARIABLE_DECLARATION]{preFooBarsuf, null, LFooBar;, preFooBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NAME_FIRST_SUFFIX + R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED)+"}", - requestor.getResults()); - } finally { - options.put(JavaScriptCore.CODEASSIST_LOCAL_PREFIXES,argumentPrefixPreviousValue); - options.put(JavaScriptCore.CODEASSIST_LOCAL_SUFFIXES,localPrefixPreviousValue); - JavaScriptCore.setOptions(options); - } -} -public void testCompletionVariableName14() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Object argumentPrefixPreviousValue = options.get(JavaScriptCore.CODEASSIST_LOCAL_PREFIXES); - options.put(JavaScriptCore.CODEASSIST_LOCAL_PREFIXES,"pre"); //$NON-NLS-1$ - Object localPrefixPreviousValue = options.get(JavaScriptCore.CODEASSIST_LOCAL_SUFFIXES); - options.put(JavaScriptCore.CODEASSIST_LOCAL_SUFFIXES,"suf"); //$NON-NLS-1$ - - JavaScriptCore.setOptions(options); - - try { - this.wc = getWorkingCopy( - "/Completion/src/CompletionVariableName14.js", - "class FooBar {\n"+ - "}\n"+ - "public class CompletionVariableName14 {\n"+ - " void foo(){\n"+ - " FooBar prethefo\n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "prethefo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "preThefoBar[VARIABLE_DECLARATION]{preThefoBar, null, LFooBar;, preThefoBar, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NON_RESTRICTED)+"}\n"+ - "preThefoBarsuf[VARIABLE_DECLARATION]{preThefoBarsuf, null, LFooBar;, preThefoBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"}\n"+ - "preTheFooBar[VARIABLE_DECLARATION]{preTheFooBar, null, LFooBar;, preTheFooBar, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED)+"}\n"+ - "preTheFooBarsuf[VARIABLE_DECLARATION]{preTheFooBarsuf, null, LFooBar;, preTheFooBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NAME_FIRST_SUFFIX + R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED)+"}", - requestor.getResults()); - } finally { - options.put(JavaScriptCore.CODEASSIST_LOCAL_PREFIXES,argumentPrefixPreviousValue); - options.put(JavaScriptCore.CODEASSIST_LOCAL_SUFFIXES,localPrefixPreviousValue); - JavaScriptCore.setOptions(options); - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=128045 -public void testCompletionVariableName15() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Object argumentPrefixPreviousValue = options.get(JavaScriptCore.CODEASSIST_LOCAL_PREFIXES); - options.put(JavaScriptCore.CODEASSIST_LOCAL_PREFIXES,"pre"); //$NON-NLS-1$ - Object localPrefixPreviousValue = options.get(JavaScriptCore.CODEASSIST_LOCAL_SUFFIXES); - options.put(JavaScriptCore.CODEASSIST_LOCAL_SUFFIXES,"suf"); //$NON-NLS-1$ - - JavaScriptCore.setOptions(options); - - try { - this.wc = getWorkingCopy( - "/Completion/src/CompletionVariableName15.js", - "class FooBar {\n"+ - "}\n"+ - "public class CompletionVariableName15 {\n"+ - " void foo(){\n"+ - " FooBar pro\n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "pro"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "proBar[VARIABLE_DECLARATION]{proBar, null, LFooBar;, proBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "proFooBar[VARIABLE_DECLARATION]{proFooBar, null, LFooBar;, proFooBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "proBarsuf[VARIABLE_DECLARATION]{proBarsuf, null, LFooBar;, proBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "proFooBarsuf[VARIABLE_DECLARATION]{proFooBarsuf, null, LFooBar;, proFooBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_CASE + R_NON_RESTRICTED)+"}", - requestor.getResults()); - } finally { - options.put(JavaScriptCore.CODEASSIST_LOCAL_PREFIXES,argumentPrefixPreviousValue); - options.put(JavaScriptCore.CODEASSIST_LOCAL_SUFFIXES,localPrefixPreviousValue); - JavaScriptCore.setOptions(options); - } -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=150228 -public void testCompletionVariableName16() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n"+ - "public class Test {\n"+ - " void foo(){\n"+ - " Object ;\n"+ - " foo = null;\n"+ - " }\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "Object "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "object[VARIABLE_DECLARATION]{object, null, Ljava.lang.Object;, object, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "foo[VARIABLE_DECLARATION]{foo, null, Ljava.lang.Object;, foo, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_NAME_FIRST_PREFIX + R_NAME_LESS_NEW_CHARACTERS + R_CASE + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=150228 -public void testCompletionVariableName17() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n"+ - "public class Test {\n"+ - " void foo(){\n"+ - " Object foo1;\n"+ - " /*here*/Object ;\n"+ - " Object foo3;\n"+ - " foo1 = null;\n"+ - " foo2 = null;\n"+ - " foo3 = null;\n"+ - " }\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "/*here*/Object "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "object[VARIABLE_DECLARATION]{object, null, Ljava.lang.Object;, object, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "foo2[VARIABLE_DECLARATION]{foo2, null, Ljava.lang.Object;, foo2, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_NAME_FIRST_PREFIX + R_NAME_LESS_NEW_CHARACTERS + R_CASE + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=150228 -public void testCompletionVariableName18() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n"+ - "public class Test {\n"+ - " void foo(){\n"+ - " Object ;\n"+ - " foo = Test.class;\n"+ - " }\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "Object "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "object[VARIABLE_DECLARATION]{object, null, Ljava.lang.Object;, object, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "foo[VARIABLE_DECLARATION]{foo, null, Ljava.lang.Object;, foo, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_NAME_FIRST_PREFIX + R_NAME_LESS_NEW_CHARACTERS + R_CASE + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=150228 -public void testCompletionVariableName19() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n"+ - "public class Test {\n"+ - " void foo(){\n"+ - " Object ;\n"+ - " object = null;\n"+ - " }\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "Object "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "object[VARIABLE_DECLARATION]{object, null, Ljava.lang.Object;, object, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_NAME_FIRST_PREFIX + R_NAME_LESS_NEW_CHARACTERS + R_CASE + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -/* -* http://dev.eclipse.org/bugs/show_bug.cgi?id=25811 -*/ -public void testCompletionVariableName2() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableName2.js"); - - String str = cu.getSource(); - String completeBehind = "Test_Bar_MyClass "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:bar_MyClass completion:bar_MyClass relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" + - "element:class1 completion:class1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" + - "element:myClass completion:myClass relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" + - "element:test_Bar_MyClass completion:test_Bar_MyClass relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=150228 -public void testCompletionVariableName20() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n"+ - "public class Test {\n"+ - " void foo(){\n"+ - " /*here*/Object ;\n"+ - " class X {\n"+ - " Object foo1 = foo2;\n"+ - " void bar() {\n"+ - " foo1 = null;\n"+ - " Object foo3 = foo4;\n"+ - " foo3 = null;\n"+ - " }\n"+ - " }\n"+ - " foo5 = null;\n"+ - " }\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "/*here*/Object "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "object[VARIABLE_DECLARATION]{object, null, Ljava.lang.Object;, object, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "foo2[VARIABLE_DECLARATION]{foo2, null, Ljava.lang.Object;, foo2, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_NAME_FIRST_PREFIX + R_NAME_LESS_NEW_CHARACTERS + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "foo4[VARIABLE_DECLARATION]{foo4, null, Ljava.lang.Object;, foo4, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_NAME_FIRST_PREFIX + R_NAME_LESS_NEW_CHARACTERS + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "foo5[VARIABLE_DECLARATION]{foo5, null, Ljava.lang.Object;, foo5, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_NAME_FIRST_PREFIX + R_NAME_LESS_NEW_CHARACTERS + R_CASE + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=150228 -public void testCompletionVariableName21() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n"+ - "public class Test {\n"+ - " void foo(){\n"+ - " {\n"+ - " /*here*/Object ;\n"+ - " foo1 = null;\n"+ - " }\n"+ - " foo2 = null;\n"+ - " }\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "/*here*/Object "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "object[VARIABLE_DECLARATION]{object, null, Ljava.lang.Object;, object, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "foo1[VARIABLE_DECLARATION]{foo1, null, Ljava.lang.Object;, foo1, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_NAME_FIRST_PREFIX + R_NAME_LESS_NEW_CHARACTERS + R_CASE + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=150228 -public void testCompletionVariableName22() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n"+ - "public class Test {\n"+ - " void foo(){\n"+ - " Object foo1;\n"+ - " /*here*/Object ;\n"+ - " {\n"+ - " Object foo3;\n"+ - " foo1 = null;\n"+ - " foo2 = null;\n"+ - " foo3 = null;\n"+ - " }\n"+ - " }\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "/*here*/Object "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "object[VARIABLE_DECLARATION]{object, null, Ljava.lang.Object;, object, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "foo2[VARIABLE_DECLARATION]{foo2, null, Ljava.lang.Object;, foo2, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_NAME_FIRST_PREFIX + R_NAME_LESS_NEW_CHARACTERS + R_CASE + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=150228 -public void testCompletionVariableName23() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n"+ - "public class Test {\n"+ - " void foo(){\n"+ - " /*here*/Object ;\n"+ - " foo1 = null;\n"+ - " #\n"+ - " }\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "/*here*/Object "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "object[VARIABLE_DECLARATION]{object, null, Ljava.lang.Object;, object, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "foo1[VARIABLE_DECLARATION]{foo1, null, Ljava.lang.Object;, foo1, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_NAME_FIRST_PREFIX + R_NAME_LESS_NEW_CHARACTERS + R_CASE + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=150228 -public void testCompletionVariableName24() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n"+ - "public class Test {\n"+ - " void foo(){\n"+ - " /*here*/Object ;\n"+ - " #\n"+ - " foo1 = null;\n"+ - " }\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "/*here*/Object "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "object[VARIABLE_DECLARATION]{object, null, Ljava.lang.Object;, object, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "foo1[VARIABLE_DECLARATION]{foo1, null, Ljava.lang.Object;, foo1, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_NAME_FIRST_PREFIX + R_NAME_LESS_NEW_CHARACTERS + R_CASE + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=150228 -public void testCompletionVariableName25() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n"+ - "public class Test {\n"+ - " void foo(){\n"+ - " /*here*/Object ;\n"+ - " #\n"+ - " foo1 = null;\n"+ - " #\n"+ - " foo2 = null;\n"+ - " }\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "/*here*/Object "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "object[VARIABLE_DECLARATION]{object, null, Ljava.lang.Object;, object, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "foo1[VARIABLE_DECLARATION]{foo1, null, Ljava.lang.Object;, foo1, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_NAME_FIRST_PREFIX + R_NAME_LESS_NEW_CHARACTERS + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "foo2[VARIABLE_DECLARATION]{foo2, null, Ljava.lang.Object;, foo2, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_NAME_FIRST_PREFIX + R_NAME_LESS_NEW_CHARACTERS + R_CASE + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=150228 -public void testCompletionVariableName26() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n"+ - "public class Test {\n"+ - " void foo(){\n"+ - " /*here*/Object ;\n"+ - " #\n"+ - " foo1 = null;\n"+ - " #\n"+ - " foo2 = null;\n"+ - " #\n"+ - " }\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "/*here*/Object "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "object[VARIABLE_DECLARATION]{object, null, Ljava.lang.Object;, object, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "foo1[VARIABLE_DECLARATION]{foo1, null, Ljava.lang.Object;, foo1, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_NAME_FIRST_PREFIX + R_NAME_LESS_NEW_CHARACTERS + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "foo2[VARIABLE_DECLARATION]{foo2, null, Ljava.lang.Object;, foo2, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_NAME_FIRST_PREFIX + R_NAME_LESS_NEW_CHARACTERS + R_CASE + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=150228 -public void testCompletionVariableName27() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n"+ - "public class Test {\n"+ - " void foo(){\n"+ - " /*here*/Object ;\n"+ - " Object foo0 = null;\n"+ - " foo0 = null;\n"+ - " #\n"+ - " class X {\n"+ - " Object foo1 = foo2;\n"+ - " void bar() {\n"+ - " foo1 = null;\n"+ - " Object foo3 = foo4;\n"+ - " foo3 = null;\n"+ - " }\n"+ - " }\n"+ - " foo5 = null;\n"+ - " }\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "/*here*/Object "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "object[VARIABLE_DECLARATION]{object, null, Ljava.lang.Object;, object, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "foo2[VARIABLE_DECLARATION]{foo2, null, Ljava.lang.Object;, foo2, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_NAME_FIRST_PREFIX + R_NAME_LESS_NEW_CHARACTERS + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "foo4[VARIABLE_DECLARATION]{foo4, null, Ljava.lang.Object;, foo4, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_NAME_FIRST_PREFIX + R_NAME_LESS_NEW_CHARACTERS + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "foo5[VARIABLE_DECLARATION]{foo5, null, Ljava.lang.Object;, foo5, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_NAME_FIRST_PREFIX + R_NAME_LESS_NEW_CHARACTERS + R_CASE + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=150228 -public void testCompletionVariableName28() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n"+ - "public class Test {\n"+ - " void foo(){\n"+ - " /*here*/Object ;\n"+ - " Object foo1 = null;\n"+ - " foo1.foo2 = null;\n"+ - " foo3.foo4 = null;\n"+ - " }\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "/*here*/Object "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "object[VARIABLE_DECLARATION]{object, null, Ljava.lang.Object;, object, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "foo3[VARIABLE_DECLARATION]{foo3, null, Ljava.lang.Object;, foo3, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_NAME_FIRST_PREFIX + R_NAME_LESS_NEW_CHARACTERS + R_CASE + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=150228 -public void testCompletionVariableName29() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n"+ - "public class Test {\n"+ - " void foo(){\n"+ - " /*here*/Object ;\n"+ - " class X {\n"+ - " void bar1() {\n"+ - " var1 = null;\n"+ - " }\n"+ - " void bar2() {\n"+ - " Object var2 = null;\n"+ - " var2 = null;\n"+ - " }\n"+ - " void bar3() {\n"+ - " Object var3 = null;\n"+ - " {\n"+ - " var3 = null;\n"+ - " Object var4 = null;\n"+ - " }\n"+ - " var4 = null;\n"+ - " }\n"+ - " }\n"+ - " }\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "/*here*/Object "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "object[VARIABLE_DECLARATION]{object, null, Ljava.lang.Object;, object, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "var1[VARIABLE_DECLARATION]{var1, null, Ljava.lang.Object;, var1, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_NAME_FIRST_PREFIX + R_NAME_LESS_NEW_CHARACTERS + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "var4[VARIABLE_DECLARATION]{var4, null, Ljava.lang.Object;, var4, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_NAME_FIRST_PREFIX + R_NAME_LESS_NEW_CHARACTERS + R_CASE + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -public void testCompletionVariableName3() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Object argumentPrefixPreviousValue = options.get(JavaScriptCore.CODEASSIST_LOCAL_PREFIXES); - options.put(JavaScriptCore.CODEASSIST_LOCAL_PREFIXES,"p1,p2"); //$NON-NLS-1$ - Object localPrefixPreviousValue = options.get(JavaScriptCore.CODEASSIST_LOCAL_SUFFIXES); - options.put(JavaScriptCore.CODEASSIST_LOCAL_SUFFIXES,"s1,s2"); //$NON-NLS-1$ - - JavaScriptCore.setOptions(options); - - try { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableName3.js"); - - String str = cu.getSource(); - String completeBehind = "OneName "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:name completion:name relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+ - "element:names1 completion:names1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"\n"+ - "element:names2 completion:names2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_SUFFIX + R_NON_RESTRICTED)+"\n"+ - "element:oneName completion:oneName relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+ - "element:oneNames1 completion:oneNames1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"\n"+ - "element:oneNames2 completion:oneNames2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_SUFFIX + R_NON_RESTRICTED)+"\n"+ - "element:p1Name completion:p1Name relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NON_RESTRICTED)+"\n"+ - "element:p1Names1 completion:p1Names1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"\n"+ - "element:p1Names2 completion:p1Names2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NAME_SUFFIX + R_NON_RESTRICTED)+"\n"+ - "element:p1OneName completion:p1OneName relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NON_RESTRICTED)+"\n"+ - "element:p1OneNames1 completion:p1OneNames1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"\n"+ - "element:p1OneNames2 completion:p1OneNames2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NAME_SUFFIX + R_NON_RESTRICTED)+"\n"+ - "element:p2Name completion:p2Name relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_PREFIX + R_NON_RESTRICTED)+"\n"+ - "element:p2Names1 completion:p2Names1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_PREFIX + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"\n"+ - "element:p2Names2 completion:p2Names2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_PREFIX + R_NAME_SUFFIX + R_NON_RESTRICTED)+"\n"+ - "element:p2OneName completion:p2OneName relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_PREFIX + R_NON_RESTRICTED)+"\n"+ - "element:p2OneNames1 completion:p2OneNames1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_PREFIX + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"\n"+ - "element:p2OneNames2 completion:p2OneNames2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_PREFIX + R_NAME_SUFFIX+ R_NON_RESTRICTED), - requestor.getResults()); - } finally { - options.put(JavaScriptCore.CODEASSIST_LOCAL_PREFIXES,argumentPrefixPreviousValue); - options.put(JavaScriptCore.CODEASSIST_LOCAL_SUFFIXES,localPrefixPreviousValue); - JavaScriptCore.setOptions(options); - } -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=150228 -public void testCompletionVariableName30() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n"+ - "public class Test {\n"+ - " public Test(){\n"+ - " Object ;\n"+ - " foo = null;\n"+ - " }\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "Object "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "object[VARIABLE_DECLARATION]{object, null, Ljava.lang.Object;, object, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "foo[VARIABLE_DECLARATION]{foo, null, Ljava.lang.Object;, foo, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_NAME_FIRST_PREFIX + R_NAME_LESS_NEW_CHARACTERS + R_CASE + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=150228 -public void testCompletionVariableName31() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n"+ - "public class Test {\n"+ - " {\n"+ - " Object ;\n"+ - " foo = null;\n"+ - " }\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "Object "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "object[VARIABLE_DECLARATION]{object, null, Ljava.lang.Object;, object, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "foo[VARIABLE_DECLARATION]{foo, null, Ljava.lang.Object;, foo, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_NAME_FIRST_PREFIX + R_NAME_LESS_NEW_CHARACTERS + R_CASE + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=150228 -public void testCompletionVariableName32() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n"+ - "public class Test {\n"+ - " void bar(Object ) {\n"+ - " foo = null;\n"+ - " }\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "Object "; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "object[VARIABLE_DECLARATION]{object, null, Ljava.lang.Object;, object, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "foo[VARIABLE_DECLARATION]{foo, null, Ljava.lang.Object;, foo, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_NAME_FIRST_PREFIX + R_NAME_LESS_NEW_CHARACTERS + R_CASE + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=162743 -public void testCompletionVariableName33() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n"+ - "public class Test {\n"+ - " void bar() {\n"+ - " /**/int v\n"+ - " variable = null;\n"+ - " variable = null;\n"+ - " variable = null;\n"+ - " }\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "/**/int v"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "vI[VARIABLE_DECLARATION]{vI, null, I, vI, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "variable[VARIABLE_DECLARATION]{variable, null, I, variable, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_NAME_FIRST_PREFIX + R_NAME_LESS_NEW_CHARACTERS + R_CASE + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=162968 -public void testCompletionVariableName34() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n"+ - "public class Test {\n"+ - " int vDefined;\n"+ - " void bar() {\n"+ - " /**/int v\n"+ - " System.out.println(vUnknown);\n"+ - " System.out.println(vUnknown);\n"+ - " }\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "/**/int v"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "vI[VARIABLE_DECLARATION]{vI, null, I, vI, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "vUnknown[VARIABLE_DECLARATION]{vUnknown, null, I, vUnknown, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_NAME_FIRST_PREFIX + R_NAME_LESS_NEW_CHARACTERS + R_CASE + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=166570 -public void testCompletionVariableName35() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n"+ - "public class Test {\n"+ - " void bar() {\n"+ - " Test2 zzz\n"+ - " int zzzzz = 0;\n"+ - " }\n"+ - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/test/Test2.js", - "package test;\n"+ - "public class Test2 {\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "Test2 zzz"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "zzzTest2[VARIABLE_DECLARATION]{zzzTest2, null, Ltest.Test2;, zzzTest2, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -public void testCompletionVariableName4() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/CompletionVariableName4.js", - "class FooBar {\n"+ - "}\n"+ - "public class CompletionVariableName4 {\n"+ - " void foo(){\n"+ - " FooBar the\n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "the"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "theBar[VARIABLE_DECLARATION]{theBar, null, LFooBar;, theBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "theFooBar[VARIABLE_DECLARATION]{theFooBar, null, LFooBar;, theFooBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -public void testCompletionVariableName5() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/CompletionVariableName5.js", - "class FooBar {\n"+ - "}\n"+ - "public class CompletionVariableName5 {\n"+ - " void foo(){\n"+ - " FooBar thefo\n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "thefo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "thefoBar[VARIABLE_DECLARATION]{thefoBar, null, LFooBar;, thefoBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "theFooBar[VARIABLE_DECLARATION]{theFooBar, null, LFooBar;, theFooBar, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -public void testCompletionVariableName6() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/CompletionVariableName6.js", - "class FooBar {\n"+ - "}\n"+ - "public class CompletionVariableName6 {\n"+ - " void foo(){\n"+ - " FooBar theba\n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "theba"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "thebaFooBar[VARIABLE_DECLARATION]{thebaFooBar, null, LFooBar;, thebaFooBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "theBar[VARIABLE_DECLARATION]{theBar, null, LFooBar;, theBar, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -public void testCompletionVariableName7() throws JavaScriptModelException { - this.wc = getWorkingCopy( - "/Completion/src/CompletionVariableName7.js", - "class FooBar {\n"+ - "}\n"+ - "public class CompletionVariableName7 {\n"+ - " void foo(){\n"+ - " FooBar fo\n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "fo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "foBar[VARIABLE_DECLARATION]{foBar, null, LFooBar;, foBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "fooBar[VARIABLE_DECLARATION]{fooBar, null, LFooBar;, fooBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} - -public void testCompletionVariableName8() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Object argumentPrefixPreviousValue = options.get(JavaScriptCore.CODEASSIST_LOCAL_PREFIXES); - options.put(JavaScriptCore.CODEASSIST_LOCAL_PREFIXES,"pre"); //$NON-NLS-1$ - Object localPrefixPreviousValue = options.get(JavaScriptCore.CODEASSIST_LOCAL_SUFFIXES); - options.put(JavaScriptCore.CODEASSIST_LOCAL_SUFFIXES,"suf"); //$NON-NLS-1$ - - JavaScriptCore.setOptions(options); - - try { - this.wc = getWorkingCopy( - "/Completion/src/CompletionVariableName8.js", - "class FooBar {\n"+ - "}\n"+ - "public class CompletionVariableName8 {\n"+ - " void foo(){\n"+ - " FooBar the\n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "the"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "theBar[VARIABLE_DECLARATION]{theBar, null, LFooBar;, theBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "theFooBar[VARIABLE_DECLARATION]{theFooBar, null, LFooBar;, theFooBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "theBarsuf[VARIABLE_DECLARATION]{theBarsuf, null, LFooBar;, theBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"}\n"+ - "theFooBarsuf[VARIABLE_DECLARATION]{theFooBarsuf, null, LFooBar;, theFooBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_CASE + R_NON_RESTRICTED)+"}", - requestor.getResults()); - } finally { - options.put(JavaScriptCore.CODEASSIST_LOCAL_PREFIXES,argumentPrefixPreviousValue); - options.put(JavaScriptCore.CODEASSIST_LOCAL_SUFFIXES,localPrefixPreviousValue); - JavaScriptCore.setOptions(options); - } -} -public void testCompletionVariableName9() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Object argumentPrefixPreviousValue = options.get(JavaScriptCore.CODEASSIST_LOCAL_PREFIXES); - options.put(JavaScriptCore.CODEASSIST_LOCAL_PREFIXES,"pre"); //$NON-NLS-1$ - Object localPrefixPreviousValue = options.get(JavaScriptCore.CODEASSIST_LOCAL_SUFFIXES); - options.put(JavaScriptCore.CODEASSIST_LOCAL_SUFFIXES,"suf"); //$NON-NLS-1$ - - JavaScriptCore.setOptions(options); - - try { - this.wc = getWorkingCopy( - "/Completion/src/CompletionVariableName9.js", - "class FooBar {\n"+ - "}\n"+ - "public class CompletionVariableName9 {\n"+ - " void foo(){\n"+ - " FooBar thefo\n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "thefo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "thefoBar[VARIABLE_DECLARATION]{thefoBar, null, LFooBar;, thefoBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+ - "thefoBarsuf[VARIABLE_DECLARATION]{thefoBarsuf, null, LFooBar;, thefoBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"}\n"+ - "theFooBar[VARIABLE_DECLARATION]{theFooBar, null, LFooBar;, theFooBar, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED)+"}\n"+ - "theFooBarsuf[VARIABLE_DECLARATION]{theFooBarsuf, null, LFooBar;, theFooBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_LESS_NEW_CHARACTERS + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"}", - requestor.getResults()); - } finally { - options.put(JavaScriptCore.CODEASSIST_LOCAL_PREFIXES,argumentPrefixPreviousValue); - options.put(JavaScriptCore.CODEASSIST_LOCAL_SUFFIXES,localPrefixPreviousValue); - JavaScriptCore.setOptions(options); - } -} -public void testCompletionVariableNameOfArray1() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/CompletionVariableNameOfArray1.js", - "public class CompletionVariableNameOfArray1 {\n"+ - " Object[] ob\n"+ - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "ob"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "objects[VARIABLE_DECLARATION]{objects, null, [Ljava.lang.Object;, objects, null, " + (R_DEFAULT + R_INTERESTING + R_CASE+ R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -public void testCompletionVariableNameOfArray2() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/CompletionVariableNameOfArray2.js", - "public class CompletionVariableNameOfArray2 {\n"+ - " Class[] cl\n"+ - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "cl"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "classes[VARIABLE_DECLARATION]{classes, null, [Ljava.lang.Class;, classes, null, " + (R_DEFAULT + R_INTERESTING + R_CASE+ R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -public void testCompletionVariableNameOfArray3() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/CompletionVariableNameOfArray3.js", - "public class CompletionVariableNameOfArray3 {\n"+ - " Object[][] ob\n"+ - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "ob"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "objects[VARIABLE_DECLARATION]{objects, null, [[Ljava.lang.Object;, objects, null, " + (R_DEFAULT + R_INTERESTING + R_CASE+ R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -public void testCompletionVariableNameOfArray4() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/CompletionVariableNameOfArray4.js", - "public class CompletionVariableNameOfArray4 {\n"+ - " Objectz[] ob\n"+ - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "ob"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "", - requestor.getResults()); -} -public void testCompletionVariableNameUnresolvedType() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableNameUnresolvedType.js"); - - String str = cu.getSource(); - String completeBehind = "ob"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "should have no completion", - "", - requestor.getResults()); -} -public void testCompletionVisibilityCheckDisabled() throws JavaScriptModelException { - String visibilityCheckID = "org.eclipse.wst.jsdt.core.codeComplete.visibilityCheck"; - Hashtable options = JavaScriptCore.getOptions(); - Object visibilityCheckPreviousValue = options.get(visibilityCheckID); - options.put(visibilityCheckID,"disabled"); - JavaScriptCore.setOptions(options); - - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVisibilityCheck.js"); - - String str = cu.getSource(); - String completeBehind = "x.p"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - options.put(visibilityCheckID,visibilityCheckPreviousValue); - JavaScriptCore.setOptions(options); - assertEquals( - "should have three methods", - "element:privateFoo completion:privateFoo() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED)+"\n" + - "element:protectedFoo completion:protectedFoo() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED)+"\n" + - "element:publicFoo completion:publicFoo() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionVisibilityCheckEnabled() throws JavaScriptModelException { - String visibilityCheckID = "org.eclipse.wst.jsdt.core.codeComplete.visibilityCheck"; - Hashtable options = JavaScriptCore.getOptions(); - Object visibilityCheckPreviousValue = options.get(visibilityCheckID); - options.put(visibilityCheckID,"enabled"); - JavaScriptCore.setOptions(options); - - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVisibilityCheck.js"); - - String str = cu.getSource(); - String completeBehind = "x.p"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - options.put(visibilityCheckID,visibilityCheckPreviousValue); - JavaScriptCore.setOptions(options); - assertEquals( - "should have two methods", - "element:protectedFoo completion:protectedFoo() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED)+"\n" + - "element:publicFoo completion:publicFoo() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED), - requestor.getResults()); -} -/* -* http://dev.eclipse.org/bugs/show_bug.cgi?id=25815 -*/ -public void testCompletionVoidMethod() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVoidMethod.js"); - - String str = cu.getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:foo completion:foo() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:foo1 completion:foo1() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:foo3 completion:foo3() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED), - requestor.getResults()); -} -public void testCompletionWithBinaryFolder() throws JavaScriptModelException { - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("Completion", "src", "", "CompletionWithBinaryFolder.js"); - - String str = cu.getSource(); - String completeBehind = "My"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "should have two completions", - "element:MyClass completion:MyClass relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" + - "element:mypackage completion:mypackage relevance:"+(R_DEFAULT + R_INTERESTING+ R_NON_RESTRICTED), - requestor.getResults()); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=95167 -public void testCompletionWithProblem1() throws JavaScriptModelException { - IJavaScriptUnit aType = null; - try { - aType = getWorkingCopy( - "/Completion/src/test/AType.js", - "package test;\n" + - "public class AType{\n"+ - " void foo(Unknown var) {\n"+ - " }\n"+ - "}"); - - this.wc = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n" + - "public class Test{\n"+ - " void foo() {\n"+ - " AType a = null;\n"+ - " a.zz\n"+ - " }\n"+ - "}"); - - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.wc.getSource(); - String completeBehind = "a.zz"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); - - // no completion must be found - assertResults( - "", - requestor.getResults()); - - // no error must be found - assertResults( - "", - requestor.getProblem()); - } finally { - if(aType != null) { - aType.discardWorkingCopy(); - } - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296 -public void testDeprecationCheck1() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Object optionValue = options.get(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK); - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, JavaScriptCore.DISABLED); //$NON-NLS-1$ - - JavaScriptCore.setOptions(options); - - try { - this.workingCopies = new IJavaScriptUnit[3]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/deprecation/Test.js", - "package deprecation;"+ - "public class Test {\n"+ - " ZZZTy\n"+ - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/deprecation/ZZZType1.js", - "package deprecation;"+ - "public class ZZZType1 {\n"+ - "}"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/deprecation/ZZZType2.js", - "package deprecation;"+ - "/** @deprecated */\n"+ - "public class ZZZType2 {\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "ZZZTy"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "ZZZTy[POTENTIAL_METHOD_DECLARATION]{ZZZTy, Ldeprecation.Test;, ()V, ZZZTy, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" + - "ZZZType1[TYPE_REF]{ZZZType1, deprecation, Ldeprecation.ZZZType1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "ZZZType2[TYPE_REF]{ZZZType2, deprecation, Ldeprecation.ZZZType2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, optionValue); - JavaScriptCore.setOptions(options); - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296 -public void testDeprecationCheck10() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Object optionValue = options.get(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK); - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, JavaScriptCore.ENABLED); //$NON-NLS-1$ - - JavaScriptCore.setOptions(options); - - try { - - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/deprecation/Test.js", - "package deprecation;"+ - "public class Test {\n"+ - " public void bar1(){}\n"+ - " /** @deprecated */\n"+ - " public void bar2(){}\n"+ - " void foo() {"+ - " bar\n"+ - " }"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "bar"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "bar1[FUNCTION_REF]{bar1(), Ldeprecation.Test;, ()V, bar1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "bar2[FUNCTION_REF]{bar2(), Ldeprecation.Test;, ()V, bar2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, optionValue); - JavaScriptCore.setOptions(options); - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296 -public void testDeprecationCheck11() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Object optionValue = options.get(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK); - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, JavaScriptCore.DISABLED); //$NON-NLS-1$ - - JavaScriptCore.setOptions(options); - - try { - - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/deprecation/Test.js", - "package deprecation;"+ - "public class Test {\n"+ - " public int bar1;\n"+ - " /** @deprecated */\n"+ - " public int bar2;\n"+ - " void foo() {"+ - " bar\n"+ - " }"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "bar"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "bar1[FIELD_REF]{bar1, Ldeprecation.Test;, I, bar1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "bar2[FIELD_REF]{bar2, Ldeprecation.Test;, I, bar2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, optionValue); - JavaScriptCore.setOptions(options); - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296 -public void testDeprecationCheck12() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Object optionValue = options.get(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK); - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, JavaScriptCore.ENABLED); //$NON-NLS-1$ - - JavaScriptCore.setOptions(options); - - try { - - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/deprecation/Test.js", - "package deprecation;"+ - "public class Test {\n"+ - " public int bar1;\n"+ - " /** @deprecated */\n"+ - " public int bar2;\n"+ - " void foo() {"+ - " bar\n"+ - " }"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "bar"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "bar1[FIELD_REF]{bar1, Ldeprecation.Test;, I, bar1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "bar2[FIELD_REF]{bar2, Ldeprecation.Test;, I, bar2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, optionValue); - JavaScriptCore.setOptions(options); - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296 -public void testDeprecationCheck13() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Object optionValue = options.get(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK); - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, JavaScriptCore.DISABLED); //$NON-NLS-1$ - - JavaScriptCore.setOptions(options); - - try { - - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/deprecation/Test.js", - "package deprecation;"+ - "public class Test {\n"+ - " class Inner1 {}\n"+ - " /** @deprecated */\n"+ - " class Inner2 {}\n"+ - " void foo() {"+ - " Inn\n"+ - " }"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "Inn"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "Test.Inner1[TYPE_REF]{Inner1, deprecation, Ldeprecation.Test$Inner1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "Test.Inner2[TYPE_REF]{Inner2, deprecation, Ldeprecation.Test$Inner2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, optionValue); - JavaScriptCore.setOptions(options); - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296 -public void testDeprecationCheck14() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Object optionValue = options.get(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK); - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, JavaScriptCore.ENABLED); //$NON-NLS-1$ - - JavaScriptCore.setOptions(options); - - try { - - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/deprecation/Test.js", - "package deprecation;"+ - "public class Test {\n"+ - " class Inner1 {}\n"+ - " /** @deprecated */\n"+ - " class Inner2 {}\n"+ - " void foo() {"+ - " Inn\n"+ - " }"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "Inn"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "Test.Inner1[TYPE_REF]{Inner1, deprecation, Ldeprecation.Test$Inner1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "Test.Inner2[TYPE_REF]{Inner2, deprecation, Ldeprecation.Test$Inner2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, optionValue); - JavaScriptCore.setOptions(options); - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296 -public void testDeprecationCheck15() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Object optionValue = options.get(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK); - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, JavaScriptCore.ENABLED); //$NON-NLS-1$ - - JavaScriptCore.setOptions(options); - - try { - - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/deprecation/Test.js", - "package deprecation;"+ - "public class Test {\n"+ - " void foo() {"+ - " ZZZType1.foo\n"+ - " }"+ - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/deprecation/ZZZType1.js", - "package deprecation;"+ - "/** @deprecated */\n"+ - "public class ZZZType1 {\n"+ - " public static int foo1;\n"+ - " public static int foo2;\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "ZZZType1.foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "", - requestor.getResults()); - } finally { - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, optionValue); - JavaScriptCore.setOptions(options); - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296 -public void testDeprecationCheck16() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Object optionValue = options.get(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK); - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, JavaScriptCore.ENABLED); //$NON-NLS-1$ - - JavaScriptCore.setOptions(options); - - try { - - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/deprecation/Test.js", - "package deprecation;"+ - "/** @deprecated */\n"+ - "public class ZZZType1 {\n"+ - "}"+ - "public class Test {\n"+ - " void foo() {"+ - " ZZZTy\n"+ - " }"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "ZZZTy"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "ZZZType1[TYPE_REF]{ZZZType1, deprecation, Ldeprecation.ZZZType1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, optionValue); - JavaScriptCore.setOptions(options); - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127628 -public void testDeprecationCheck17() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Object optionValue = options.get(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK); - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, JavaScriptCore.ENABLED); //$NON-NLS-1$ - - JavaScriptCore.setOptions(options); - - try { - - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/deprecation/Test.js", - "package deprecation;"+ - "public class Test {\n"+ - " Bug127628Ty\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "Bug127628Ty"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "Bug127628Ty[POTENTIAL_METHOD_DECLARATION]{Bug127628Ty, Ldeprecation.Test;, ()V, Bug127628Ty, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" + - "Bug127628Type1.Bug127628TypeInner1[TYPE_REF]{deprecation.Bug127628Type1.Bug127628TypeInner1, deprecation, Ldeprecation.Bug127628Type1$Bug127628TypeInner1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "Bug127628Type2.Bug127628TypeInner2[TYPE_REF]{deprecation.Bug127628Type2.Bug127628TypeInner2, deprecation, Ldeprecation.Bug127628Type2$Bug127628TypeInner2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "Bug127628Type1[TYPE_REF]{Bug127628Type1, deprecation, Ldeprecation.Bug127628Type1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, optionValue); - JavaScriptCore.setOptions(options); - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296 -public void testDeprecationCheck2() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Object optionValue = options.get(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK); - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, JavaScriptCore.ENABLED); //$NON-NLS-1$ - - JavaScriptCore.setOptions(options); - - try { - this.workingCopies = new IJavaScriptUnit[3]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/deprecation/Test.js", - "package deprecation;"+ - "public class Test {\n"+ - " ZZZTy\n"+ - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/deprecation/ZZZType1.js", - "package deprecation;"+ - "public class ZZZType1 {\n"+ - "}"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/deprecation/ZZZType2.js", - "package deprecation;"+ - "/** @deprecated */\n"+ - "public class ZZZType2 {\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "ZZZTy"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "ZZZTy[POTENTIAL_METHOD_DECLARATION]{ZZZTy, Ldeprecation.Test;, ()V, ZZZTy, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" + - "ZZZType1[TYPE_REF]{ZZZType1, deprecation, Ldeprecation.ZZZType1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, optionValue); - JavaScriptCore.setOptions(options); - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296 -public void testDeprecationCheck3() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Object optionValue = options.get(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK); - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, JavaScriptCore.DISABLED); //$NON-NLS-1$ - - JavaScriptCore.setOptions(options); - - try { - - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/deprecation/Test.js", - "package deprecation;"+ - "public class Test {\n"+ - " void foo() {"+ - " ZZZType1.fo\n"+ - " }"+ - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/deprecation/ZZZType1.js", - "package deprecation;"+ - "public class ZZZType1 {\n"+ - " public static void foo1(){}\n"+ - " /** @deprecated */\n"+ - " public static void foo2(){}\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "ZZZType1.fo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "foo1[FUNCTION_REF]{foo1(), Ldeprecation.ZZZType1;, ()V, foo1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}\n" + - "foo2[FUNCTION_REF]{foo2(), Ldeprecation.ZZZType1;, ()V, foo2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, optionValue); - JavaScriptCore.setOptions(options); - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296 -public void testDeprecationCheck4() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Object optionValue = options.get(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK); - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, JavaScriptCore.ENABLED); //$NON-NLS-1$ - - JavaScriptCore.setOptions(options); - - try { - - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/deprecation/Test.js", - "package deprecation;"+ - "public class Test {\n"+ - " void foo() {"+ - " ZZZType1.fo\n"+ - " }"+ - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/deprecation/ZZZType1.js", - "package deprecation;"+ - "public class ZZZType1 {\n"+ - " public static void foo1(){}\n"+ - " /** @deprecated */\n"+ - " public static void foo2(){}\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "ZZZType1.fo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "foo1[FUNCTION_REF]{foo1(), Ldeprecation.ZZZType1;, ()V, foo1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, optionValue); - JavaScriptCore.setOptions(options); - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296 -public void testDeprecationCheck5() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Object optionValue = options.get(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK); - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, JavaScriptCore.DISABLED); //$NON-NLS-1$ - - JavaScriptCore.setOptions(options); - - try { - - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/deprecation/Test.js", - "package deprecation;"+ - "public class Test {\n"+ - " ZZZType1.Inn\n"+ - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/deprecation/ZZZType1.js", - "package deprecation;"+ - "public class ZZZType1 {\n"+ - " public class Inner1 {}\n"+ - " /** @deprecated */\n"+ - " public class Inner2 {}\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "ZZZType1.Inn"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "ZZZType1.Inner1[TYPE_REF]{Inner1, deprecation, Ldeprecation.ZZZType1$Inner1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "ZZZType1.Inner2[TYPE_REF]{Inner2, deprecation, Ldeprecation.ZZZType1$Inner2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, optionValue); - JavaScriptCore.setOptions(options); - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296 -public void testDeprecationCheck6() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Object optionValue = options.get(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK); - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, JavaScriptCore.ENABLED); //$NON-NLS-1$ - - JavaScriptCore.setOptions(options); - - try { - - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/deprecation/Test.js", - "package deprecation;"+ - "public class Test {\n"+ - " ZZZType1.Inn\n"+ - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/deprecation/ZZZType1.js", - "package deprecation;"+ - "public class ZZZType1 {\n"+ - " public class Inner1 {}\n"+ - " /** @deprecated */\n"+ - " public class Inner2 {}\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "ZZZType1.Inn"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "ZZZType1.Inner1[TYPE_REF]{Inner1, deprecation, Ldeprecation.ZZZType1$Inner1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, optionValue); - JavaScriptCore.setOptions(options); - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296 -public void testDeprecationCheck7() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Object optionValue = options.get(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK); - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, JavaScriptCore.DISABLED); //$NON-NLS-1$ - - JavaScriptCore.setOptions(options); - - try { - - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/deprecation/Test.js", - "package deprecation;"+ - "public class Test {\n"+ - " void foo() {"+ - " ZZZType1.fo\n"+ - " }"+ - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/deprecation/ZZZType1.js", - "package deprecation;"+ - "public class ZZZType1 {\n"+ - " public static int foo1;\n"+ - " /** @deprecated */\n"+ - " public static int foo2;\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "ZZZType1.fo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "foo1[FIELD_REF]{foo1, Ldeprecation.ZZZType1;, I, foo1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}\n" + - "foo2[FIELD_REF]{foo2, Ldeprecation.ZZZType1;, I, foo2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, optionValue); - JavaScriptCore.setOptions(options); - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296 -public void testDeprecationCheck8() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Object optionValue = options.get(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK); - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, JavaScriptCore.ENABLED); //$NON-NLS-1$ - - JavaScriptCore.setOptions(options); - - try { - - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/deprecation/Test.js", - "package deprecation;"+ - "public class Test {\n"+ - " void foo() {"+ - " ZZZType1.fo\n"+ - " }"+ - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/deprecation/ZZZType1.js", - "package deprecation;"+ - "public class ZZZType1 {\n"+ - " public static int foo1;\n"+ - " /** @deprecated */\n"+ - " public static int foo2;\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "ZZZType1.fo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "foo1[FIELD_REF]{foo1, Ldeprecation.ZZZType1;, I, foo1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, optionValue); - JavaScriptCore.setOptions(options); - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296 -public void testDeprecationCheck9() throws JavaScriptModelException { - Hashtable options = JavaScriptCore.getOptions(); - Object optionValue = options.get(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK); - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, JavaScriptCore.DISABLED); //$NON-NLS-1$ - - JavaScriptCore.setOptions(options); - - try { - - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/deprecation/Test.js", - "package deprecation;"+ - "public class Test {\n"+ - " public void bar1(){}\n"+ - " /** @deprecated */\n"+ - " public void bar2(){}\n"+ - " void foo() {"+ - " bar\n"+ - " }"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "bar"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "bar1[FUNCTION_REF]{bar1(), Ldeprecation.Test;, ()V, bar1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + - "bar2[FUNCTION_REF]{bar2(), Ldeprecation.Test;, ()V, bar2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, optionValue); - JavaScriptCore.setOptions(options); - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=144858 -public void testDuplicateLocals1() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " void foo() {\n" + - " int x = 0;\n" + - " TestString x = null;\n" + - " x.bar;\n" + - " }\n" + - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/test/TestString.js", - "package test;"+ - "public class TestString {\n" + - " public void bar() {\n" + - " }\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "bar"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "bar[FUNCTION_REF]{bar(), Ltest.TestString;, ()V, bar, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_STATIC + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=144858 -public void testDuplicateLocals2() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " public static void main(String[] args) {\n" + - " int x = 2;\n" + - " try {\n" + - " \n" + - " } catch(TestException x) {\n" + - " x.bar\n" + - " } catch(Exception e) {\n" + - " }\n" + - " }\n" + - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/test/TestException.js", - "package test;"+ - "public class TestException extends Exception {\n" + - " public void bar() {\n" + - " }\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "bar"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "bar[FUNCTION_REF]{bar(), Ltest.TestException;, ()V, bar, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_STATIC + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=144858 -public void testDuplicateLocals3() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " public static void main(String[] args) {\n" + - " int x = x = 0;\n" + - " if (true) {\n" + - " TestString x = x.bar\n" + - " }\n" + - " }\n" + - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/test/TestString.js", - "package test;"+ - "public class TestString {\n" + - " public void bar() {\n" + - " }\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "bar"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "bar[FUNCTION_REF]{bar(), Ltest.TestString;, ()V, bar, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_STATIC + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=144858 -public void testDuplicateLocals4() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " public static void main(String[] args) {\n" + - " for (int i = 0; i < 10; i++) {\n" + - " for (TestString i = null; i.bar < 5;) {\n" + - " // do something\n" + - " }\n" + - " }\n" + - " }\n" + - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/test/TestString.js", - "package test;"+ - "public class TestString {\n" + - " public void bar() {\n" + - " }\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "bar"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "bar[FUNCTION_REF]{bar(), Ltest.TestString;, ()V, bar, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_STATIC + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=144858 -public void testDuplicateLocals5() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " public static void main(String[] args) {\n" + - " for (int i = 0; i < 10; i++) {\n" + - " for (TestString i = null; ;) {\n" + - " i.bar // do something\n" + - " }\n" + - " }\n" + - " }\n" + - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/test/TestString.js", - "package test;"+ - "public class TestString {\n" + - " public void bar() {\n" + - " }\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "bar"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "bar[FUNCTION_REF]{bar(), Ltest.TestString;, ()V, bar, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_STATIC + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=165662 -public void testDuplicateLocalsType1() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " void foo() {\n" + - " class Local {\n" + - " void foo() {}\n" + - " }\n" + - " {\n" + - " class Local {\n" + - " Local(int i) {\n" + - " this.init(i);\n" + - " }\n" + - " void init(int i) {}\n" + - " public void bar() {}\n" + - " }\n" + - " Local l = new Local(0);\n" + - " l.bar\n" + - " }\n" + - " }\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "bar"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "bar[FUNCTION_REF]{bar(), LLocal;, ()V, bar, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_STATIC + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=165662 -public void testDuplicateLocalsType2() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " void foo() {\n" + - " class Local {\n" + - " void foo() {\n" + - " }\n" + - " }\n" + - " {\n" + - " class Local {\n" + - " Local(int i) {\n" + - " this.init(i);\n" + - " this.bar();\n" + - " }\n" + - " void init(int i) {}\n" + - " void bar() {\n" + - " }\n" + - " }\n" + - " Local l = new Local(0);\n" + - " }\n" + - " Local l = new Local();\n" + - " l.foo\n" + - " }\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "foo[FUNCTION_REF]{foo(), LLocal;, ()V, foo, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_STATIC + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=139937 -public void testEvaluationContextCompletion() throws JavaScriptModelException { - class EvaluationContextCompletionRequestor extends CompletionRequestor { - public boolean acceptContext; - public void accept(CompletionProposal proposal) { - // Do nothing - } - public void acceptContext(CompletionContext context) { - this.acceptContext = context != null; - } - } - String start = ""; - IJavaScriptProject javaProject = getJavaProject("Completion"); - IEvaluationContext context = javaProject.newEvaluationContext(); - EvaluationContextCompletionRequestor rc = new EvaluationContextCompletionRequestor(); - context.codeComplete(start, start.length(), rc); - - assertTrue("acceptContext() method isn't call", rc.acceptContext); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=140123 -public void testEvaluationContextCompletion2() throws JavaScriptModelException { - class EvaluationContextCompletionRequestor extends CompletionRequestor { - public boolean acceptContext; - public boolean beginReporting; - public boolean endReporting; - - public void accept(CompletionProposal proposal) { - // Do nothing - } - public void acceptContext(CompletionContext context) { - this.acceptContext = context != null; - } - - public void beginReporting() { - this.beginReporting = true; - super.beginReporting(); - } - - public void endReporting() { - this.endReporting = true; - super.endReporting(); - } - } - String start = ""; - IJavaScriptProject javaProject = getJavaProject("Completion"); - IEvaluationContext context = javaProject.newEvaluationContext(); - EvaluationContextCompletionRequestor rc = new EvaluationContextCompletionRequestor(); - context.codeComplete(start, start.length(), rc); - - assertTrue("acceptContext() method isn't call", rc.acceptContext); - assertTrue("beginReporting() method isn't call", rc.beginReporting); - assertTrue("endReporting() method isn't call", rc.endReporting); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=140123 -public void testEvaluationContextCompletion3() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/TestEvaluationContextCompletion3.js", - "package test;"+ - "public class TestEvaluationContextCompletion3 {\n"+ - "}"); - - String start = "TestEvaluationContextCompletion3"; - IJavaScriptProject javaProject = getJavaProject("Completion"); - IEvaluationContext context = javaProject.newEvaluationContext(); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, false); - context.codeComplete(start, start.length(), requestor, this.wcOwner); - - int startOffset = 0; - int endOffset = start.length(); - - assertResults( - "completion offset="+endOffset+"\n"+ - "completion range=["+startOffset+", "+(endOffset-1)+"]\n"+ - "completion token=\"TestEvaluationContextCompletion3\"\n"+ - "completion token kind=TOKEN_KIND_NAME\n"+ - "expectedTypesSignatures=null\n"+ - "expectedTypesKeys=null", - requestor.getContext()); - - assertResults( - "TestEvaluationContextCompletion3[TYPE_REF]{test.TestEvaluationContextCompletion3, test, Ltest.TestEvaluationContextCompletion3;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=140123 -public void testEvaluationContextCompletion4() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/TestEvaluationContextCompletion4.js", - "package test;"+ - "public class TestEvaluationContextCompletion4 {\n"+ - "}"); - - String start = "TestEvaluationContextCompletion4"; - IJavaScriptProject javaProject = getJavaProject("Completion"); - IEvaluationContext context = javaProject.newEvaluationContext(); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, false); - requestor.setIgnored(CompletionProposal.TYPE_REF, true); - context.codeComplete(start, start.length(), requestor, this.wcOwner); - - int startOffset = 0; - int endOffset = start.length(); - - assertResults( - "completion offset="+endOffset+"\n"+ - "completion range=["+startOffset+", "+(endOffset-1)+"]\n"+ - "completion token=\"TestEvaluationContextCompletion4\"\n"+ - "completion token kind=TOKEN_KIND_NAME\n"+ - "expectedTypesSignatures=null\n"+ - "expectedTypesKeys=null", - requestor.getContext()); - - assertResults( - "", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=141518 -public void testEvaluationContextCompletion5() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/TestEvaluationContextCompletion5.js", - "package test;"+ - "public class TestEvaluationContextCompletion5 {\n"+ - "}"); - - String start = "someVariable.to"; - IJavaScriptProject javaProject = getJavaProject("Completion"); - IEvaluationContext context = javaProject.newEvaluationContext(); - - context.newVariable( "Object", "someVariable", null ); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, false); - context.codeComplete(start, start.length(), requestor, this.wcOwner); - - int startOffset = start.length() - 2; - int endOffset = startOffset + 2 ; - - assertResults( - "completion offset="+endOffset+"\n"+ - "completion range=["+startOffset+", "+(endOffset-1)+"]\n"+ - "completion token=\"to\"\n"+ - "completion token kind=TOKEN_KIND_NAME\n"+ - "expectedTypesSignatures=null\n"+ - "expectedTypesKeys=null", - requestor.getContext()); - - assertResults( - "toString[FUNCTION_REF]{toString(), Ljava.lang.Object;, ()Ljava.lang.String;, toString, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 -public void testFavoriteImports001() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test/Test.js", - "package test;\n" + - "public class Test {\n" + - " public void method() {\n" + - " foo\n" + - " }\n" + - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/test/p/ZZZ.js", - "package test.p;\n" + - "public class ZZZ {\n" + - " public static int foo;\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); - - String str = this.workingCopies[0].getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; - int start1 = str.lastIndexOf("foo") + "".length(); - int end1 = start1 + "foo".length(); - int start2 = str.lastIndexOf("public class"); - int end2 = start2 + "".length(); - assertResults( - "foo[FIELD_REF]{ZZZ.foo, Ltest.p.ZZZ;, I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + - " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 -public void testFavoriteImports002() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test/Test.js", - "package test;\n" + - "public class Test {\n" + - " public void method() {\n" + - " foo\n" + - " }\n" + - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/test/p/ZZZ.js", - "package test.p;\n" + - "public class ZZZ {\n" + - " public static int foo(){}\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); - - String str = this.workingCopies[0].getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; - int start1 = str.lastIndexOf("foo") + "".length(); - int end1 = start1 + "foo".length(); - int start2 = str.lastIndexOf("public class"); - int end2 = start2 + "".length(); - assertResults( - "foo[FUNCTION_REF]{ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + - " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 -public void testFavoriteImports003() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test/Test.js", - "package test;\n" + - "public class Test {\n" + - " public void method() {\n" + - " foo\n" + - " }\n" + - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/test/p/ZZZ.js", - "package test.p;\n" + - "public class ZZZ {\n" + - " public static int foo;\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - requestor.setFavoriteReferences(new String[]{"test.p.ZZZ"}); - - String str = this.workingCopies[0].getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 -public void testFavoriteImports004() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test/Test.js", - "package test;\n" + - "public class Test {\n" + - " public void method() {\n" + - " foo\n" + - " }\n" + - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/test/p/ZZZ.js", - "package test.p;\n" + - "public class ZZZ {\n" + - " public static int foo(){}\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - requestor.setFavoriteReferences(new String[]{"test.p.ZZZ"}); - - String str = this.workingCopies[0].getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 -public void testFavoriteImports005() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test/Test.js", - "package test;\n" + - "public class Test {\n" + - " public void method() {\n" + - " foo\n" + - " }\n" + - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/test/p/ZZZ.js", - "package test.p;\n" + - "public class ZZZ {\n" + - " public static int foo;\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.foo"}); - - String str = this.workingCopies[0].getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; - int start1 = str.lastIndexOf("foo") + "".length(); - int end1 = start1 + "foo".length(); - int start2 = str.lastIndexOf("public class"); - int end2 = start2 + "".length(); - assertResults( - "foo[FIELD_REF]{ZZZ.foo, Ltest.p.ZZZ;, I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + - " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 -public void testFavoriteImports006() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test/Test.js", - "package test;\n" + - "public class Test {\n" + - " public void method() {\n" + - " foo\n" + - " }\n" + - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/test/p/ZZZ.js", - "package test.p;\n" + - "public class ZZZ {\n" + - " public static int foo(){}\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.foo"}); - - String str = this.workingCopies[0].getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; - int start1 = str.lastIndexOf("foo") + "".length(); - int end1 = start1 + "foo".length(); - int start2 = str.lastIndexOf("public class"); - int end2 = start2 + "".length(); - assertResults( - "foo[FUNCTION_REF]{ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + - " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 -public void testFavoriteImports007() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test/Test.js", - "package test;\n" + - "import test.p.ZZZ.*;\n" + - "public class Test {\n" + - " public void method() {\n" + - " foo\n" + - " }\n" + - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/test/p/ZZZ.js", - "package test.p;\n" + - "public class ZZZ {\n" + - " public static int foo(){}\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); - - String str = this.workingCopies[0].getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; - int start1 = str.lastIndexOf("foo") + "".length(); - int end1 = start1 + "foo".length(); - int start2 = str.lastIndexOf("public class"); - int end2 = start2 + "".length(); - assertResults( - "foo[FUNCTION_REF]{ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + - " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 -public void testFavoriteImports009() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test/Test.js", - "package test;\n" + - "import test.p.ZZZ.*;\n" + - "public class Test {\n" + - " public void method() {\n" + - " foo\n" + - " }\n" + - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/test/p/ZZZ.js", - "package test.p;\n" + - "public class ZZZ {\n" + - " public static int foo(){}\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.foo"}); - - String str = this.workingCopies[0].getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; - int start1 = str.lastIndexOf("foo") + "".length(); - int end1 = start1 + "foo".length(); - int start2 = str.lastIndexOf("public class"); - int end2 = start2 + "".length(); - assertResults( - "foo[FUNCTION_REF]{ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + - " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 -public void testFavoriteImports011() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test/Test.js", - "package test;\n" + - "import test.p.ZZZ.foo;\n" + - "public class Test {\n" + - " public void method() {\n" + - " foo\n" + - " }\n" + - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/test/p/ZZZ.js", - "package test.p;\n" + - "public class ZZZ {\n" + - " public static int foo(){}\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); - - String str = this.workingCopies[0].getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; - int start1 = str.lastIndexOf("foo") + "".length(); - int end1 = start1 + "foo".length(); - int start2 = str.lastIndexOf("public class"); - int end2 = start2 + "".length(); - assertResults( - "foo[FUNCTION_REF]{ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + - " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 -public void testFavoriteImports013() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test/Test.js", - "package test;\n" + - "import test.p.ZZZ.foo;\n" + - "public class Test {\n" + - " public void method() {\n" + - " foo\n" + - " }\n" + - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/test/p/ZZZ.js", - "package test.p;\n" + - "public class ZZZ {\n" + - " public static int foo(){}\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.foo"}); - - String str = this.workingCopies[0].getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; - int start1 = str.lastIndexOf("foo") + "".length(); - int end1 = start1 + "foo".length(); - int start2 = str.lastIndexOf("public class"); - int end2 = start2 + "".length(); - assertResults( - "foo[FUNCTION_REF]{ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + - " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 -public void testFavoriteImports016() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test/Test.js", - "package test;\n" + - "public class Test {\n" + - " public class foo {\n" + - " public void method() {\n" + - " foo\n" + - " }\n" + - " }\n" + - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/test/p/ZZZ.js", - "package test.p;\n" + - "public class ZZZ {\n" + - " public static int foo(){}\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); - - String str = this.workingCopies[0].getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; - int start1 = str.lastIndexOf("foo") + "".length(); - int end1 = start1 + "foo".length(); - int start2 = str.lastIndexOf("public class Test"); - int end2 = start2 + "".length(); - assertResults( - "foo[FUNCTION_REF]{ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + - " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}\n"+ - "Test.foo[TYPE_REF]{foo, test, Ltest.Test$foo;, null, null, ["+start1+", "+end1+"], "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 -public void testFavoriteImports017() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test/Test.js", - "package test;\n" + - "public class Test {\n" + - " public void foo() {\n" + - " foo\n" + - " }\n" + - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/test/p/ZZZ.js", - "package test.p;\n" + - "public class ZZZ {\n" + - " public static int foo(){}\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); - - String str = this.workingCopies[0].getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int start1 = str.lastIndexOf("foo") + "".length(); - int end1 = start1 + "foo".length(); - assertResults( - "foo[FUNCTION_REF]{foo(), Ltest.Test;, ()V, foo, null, ["+start1+", "+end1+"], "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 -public void testFavoriteImports018() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test/Test.js", - "package test;\n" + - "public class Test {\n" + - " public int foo;\n" + - " public void method() {\n" + - " foo\n" + - " }\n" + - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/test/p/ZZZ.js", - "package test.p;\n" + - "public class ZZZ {\n" + - " public static int foo(){}\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); - - String str = this.workingCopies[0].getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; - int start1 = str.lastIndexOf("foo") + "".length(); - int end1 = start1 + "foo".length(); - int start2 = str.lastIndexOf("public class Test"); - int end2 = start2 + "".length(); - assertResults( - "foo[FUNCTION_REF]{ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + - " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}\n"+ - "foo[FIELD_REF]{foo, Ltest.Test;, I, foo, null, ["+start1+", "+end1+"], "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 -public void testFavoriteImports019() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test/Test.js", - "package test;\n" + - "public class Test {\n" + - " public void method() {\n" + - " int foo = 0;\n" + - " foo\n" + - " }\n" + - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/test/p/ZZZ.js", - "package test.p;\n" + - "public class ZZZ {\n" + - " public static int foo(){}\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); - - String str = this.workingCopies[0].getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; - int start1 = str.lastIndexOf("foo") + "".length(); - int end1 = start1 + "foo".length(); - int start2 = str.lastIndexOf("public class Test"); - int end2 = start2 + "".length(); - assertResults( - "foo[FUNCTION_REF]{ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + - " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}\n"+ - "foo[LOCAL_VARIABLE_REF]{foo, null, I, foo, null, ["+start1+", "+end1+"], "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 -public void testFavoriteImports020() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test/Test.js", - "package test;\n" + - "public class Test {\n" + - " public void method() {\n" + - " foo\n" + - " }\n" + - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/test/p/ZZZ.js", - "package test.p;\n" + - "public class ZZZ {\n" + - " public static int foo(){}\n" + - " public static int foo(int i){}\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); - - String str = this.workingCopies[0].getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; - int start1 = str.lastIndexOf("foo") + "".length(); - int end1 = start1 + "foo".length(); - int start2 = str.lastIndexOf("public class Test"); - int end2 = start2 + "".length(); - assertResults( - "foo[FUNCTION_REF]{ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + - " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}\n"+ - "foo[FUNCTION_REF]{ZZZ.foo(), Ltest.p.ZZZ;, (I)I, foo, (i), ["+start1+", "+end1+"], "+(relevance1)+"}\n" + - " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 -public void testFavoriteImports022() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test/Test.js", - "package test;\n" + - "public class Test {\n" + - " public void method() {\n" + - " foo();\n" + - " }\n" + - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/test/p/ZZZ.js", - "package test.p;\n" + - "public class ZZZ {\n" + - " public static int foo(){}\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); - - String str = this.workingCopies[0].getSource(); - String completeBehind = "foo("; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 -public void testFavoriteImports023() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test/Test.js", - "package test;\n" + - "/** */\n" + - "public class Test {\n" + - " public void method() {\n" + - " foo\n" + - " }\n" + - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/test/p/ZZZ.js", - "package test.p;\n" + - "public class ZZZ {\n" + - " public static int foo;\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); - - String str = this.workingCopies[0].getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; - int start1 = str.lastIndexOf("foo") + "".length(); - int end1 = start1 + "foo".length(); - int start2 = str.lastIndexOf("/** */"); - int end2 = start2 + "".length(); - assertResults( - "foo[FIELD_REF]{ZZZ.foo, Ltest.p.ZZZ;, I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + - " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 -public void testFavoriteImports024() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test/Test.js", - "package test;\n" + - "public class Test {\n" + - " public void method() {\n" + - " foo\n" + - " }\n" + - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/test/p/ZZZ.js", - "package test.p;\n" + - "public class ZZZ {\n" + - " public int foo;\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); - - String str = this.workingCopies[0].getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 -public void testFavoriteImports025() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test/Test.js", - "package test;\n" + - "public class Test {\n" + - " public void method() {\n" + - " foo\n" + - " }\n" + - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/test/p/ZZZ.js", - "package test.p;\n" + - "public class ZZZ {\n" + - " public int foo;\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.foo"}); - - String str = this.workingCopies[0].getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 -public void testFavoriteImports026() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test/Test.js", - "package test;\n" + - "public class Test {\n" + - " public void method() {\n" + - " foo\n" + - " }\n" + - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/test/p/ZZZ.js", - "package test.p;\n" + - "public class ZZZ {\n" + - " public int foo(){return 0;};\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); - - String str = this.workingCopies[0].getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 -public void testFavoriteImports027() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test/Test.js", - "package test;\n" + - "public class Test {\n" + - " public void method() {\n" + - " foo\n" + - " }\n" + - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/test/p/ZZZ.js", - "package test.p;\n" + - "public class ZZZ {\n" + - " public int foo(){return 0;};\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.foo"}); - - String str = this.workingCopies[0].getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 -public void testFavoriteImports028() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test/Test.js", - "package test;\n" + - "import test.p.ZZZ;\n" + - "public class Test {\n" + - " public void method() {\n" + - " foo\n" + - " }\n" + - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/test/p/ZZZ.js", - "package test.p;\n" + - "public class ZZZ {\n" + - " public static int foo(){return 0;};\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.foo"}); - - String str = this.workingCopies[0].getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int start1 = str.lastIndexOf("foo") + "".length(); - int end1 = start1 + "foo".length(); - assertResults( - "foo[FUNCTION_REF]{ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 -public void testFavoriteImports030() throws JavaScriptModelException { - this.oldOptions = JavaScriptCore.getOptions(); - - try { - Hashtable options = new Hashtable(this.oldOptions); - options.put(JavaScriptCore.CODEASSIST_SUGGEST_STATIC_IMPORTS, JavaScriptCore.DISABLED); - JavaScriptCore.setOptions(options); - - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test/Test.js", - "package test;\n" + - "public class Test {\n" + - " public void method() {\n" + - " foo\n" + - " }\n" + - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/test/p/ZZZ.js", - "package test.p;\n" + - "public class ZZZ {\n" + - " public static int foo(){}\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); - - String str = this.workingCopies[0].getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; - int start1 = str.lastIndexOf("foo") + "".length(); - int end1 = start1 + "foo".length(); - int start2 = str.lastIndexOf("public class"); - int end2 = start2 + "".length(); - assertResults( - "foo[FUNCTION_REF]{ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + - " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); - } finally { - JavaScriptCore.setOptions(oldOptions); - } -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 -public void testFavoriteImports031() throws JavaScriptModelException { - this.oldOptions = JavaScriptCore.getOptions(); - - try { - Hashtable options = new Hashtable(this.oldOptions); - options.put(JavaScriptCore.CODEASSIST_SUGGEST_STATIC_IMPORTS, JavaScriptCore.ENABLED); - JavaScriptCore.setOptions(options); - - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src3/test/Test.js", - "package test;\n" + - "public class Test {\n" + - " public void method() {\n" + - " foo\n" + - " }\n" + - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src3/test/p/ZZZ.js", - "package test.p;\n" + - "public class ZZZ {\n" + - " public static int foo(){}\n" + - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); - - String str = this.workingCopies[0].getSource(); - String completeBehind = "foo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; - int start1 = str.lastIndexOf("foo") + "".length(); - int end1 = start1 + "foo".length(); - int start2 = str.lastIndexOf("public class"); - int end2 = start2 + "".length(); - assertResults( - "foo[FUNCTION_REF]{ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + - " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); - } finally { - JavaScriptCore.setOptions(oldOptions); - } -} -public void testInconsistentHierarchy1() throws CoreException, IOException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/p/Test.js", - "package p;"+ - "public class Test extends Unknown {\n" + - " void foo() {\n" + - " this.has\n" + - " }\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "this.has"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "hashCode[FUNCTION_REF]{hashCode(), Ljava.lang.Object;, ()I, hashCode, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=22072 -public void testLabel1() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/label/Test.js", - "package label;"+ - "public class Test {\n"+ - " void foo() {\n"+ - " label1 : for(;;) foo();\n"+ - " label2 : for(;;)\n"+ - " label3 : for(;;) {\n"+ - " label4 : for(;;) {\n"+ - " break lab\n"+ - " }\n"+ - " }\n"+ - " }\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "lab"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "label2[LABEL_REF]{label2, null, null, label2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "label3[LABEL_REF]{label3, null, null, label3, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "label4[LABEL_REF]{label4, null, null, label4, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=22072 -public void testLabel2() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/label/Test.js", - "package label;"+ - "public class Test {\n"+ - " void foo() {\n"+ - " #\n"+ - " label1 : for(;;) foo();\n"+ - " label2 : for(;;)\n"+ - " label3 : for(;;) {\n"+ - " label4 : for(;;) {\n"+ - " break lab\n"+ - " }\n"+ - " }\n"+ - " }\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "lab"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "label2[LABEL_REF]{label2, null, null, label2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "label3[LABEL_REF]{label3, null, null, label3, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "label4[LABEL_REF]{label4, null, null, label4, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=22072 -public void testLabel3() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/label/Test.js", - "package label;"+ - "public class Test {\n"+ - " void foo() {\n"+ - " label1 : for(;;) foo();\n"+ - " label2 : for(;;)\n"+ - " label3 : for(;;) {\n"+ - " label4 : for(;;) {\n"+ - " break lab\n"+ - " }\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "lab"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "label2[LABEL_REF]{label2, null, null, label2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "label3[LABEL_REF]{label3, null, null, label3, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "label4[LABEL_REF]{label4, null, null, label4, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=22072 -public void testLabel4() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/label/Test.js", - "package label;"+ - "public class Test {\n"+ - " void foo() {\n"+ - " #\n"+ - " label1 : for(;;) foo();\n"+ - " label2 : for(;;)\n"+ - " label3 : for(;;) {\n"+ - " label4 : for(;;) {\n"+ - " break lab\n"+ - " }\n"+ - "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "lab"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "label2[LABEL_REF]{label2, null, null, label2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "label3[LABEL_REF]{label3, null, null, label3, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "label4[LABEL_REF]{label4, null, null, label4, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=22072 -public void testLabel5() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/label/Test.js", - "package label;"+ - "public class Test {\n" + - " void foo() {\n" + - " #\n" + - " label1 : for(;;) {\n" + - " class X {\n" + - " void foo() {\n" + - " label2 : for(;;) foo();\n" + - " }\n" + - " }\n" + - " continue lab\n" + - " }\n" + - " }\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "lab"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "label1[LABEL_REF]{label1, null, null, label1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=22072 -public void testLabel6() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/label/Test.js", - "package label;"+ - "public class Test {\n" + - " void foo() {\n" + - " #\n" + - " label1 : for(;;) {\n" + - " class X {\n" + - " void foo() {\n" + - " label2 : for(;;) {\n" + - " continue lab\n" + - " }\n" + - " }\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "lab"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "label2[LABEL_REF]{label2, null, null, label2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -public void testParameterNames1() throws CoreException, IOException { - Hashtable options = JavaScriptCore.getOptions(); - Object timeout = options.get(JavaScriptCore.TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC); - options.put(JavaScriptCore.TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC,"2000"); //$NON-NLS-1$ - - JavaScriptCore.setOptions(options); - - try { - this.workingCopies = new IJavaScriptUnit[1]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/p/Test.js", - "package p;"+ - "public class Test {\n" + - " void foo(doctest.X x) {\n" + - " x.fo\n" + - " }\n" + - "}\n"); - - addLibrary( - "Completion", - "tmpDoc.jar", - null, - "tmpDocDoc.zip", - false); - - CompletionTestsRequestor2 requestor; - try { - requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "x.fo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "foo[FUNCTION_REF]{foo(), Ldoctest.X;, (Ljava.lang.Object;)V, foo, (param), " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED) + "}", - requestor.getResults()); - } finally { - removeLibrary("Completion", "tmpDoc.jar"); - } - } finally { - options.put(JavaScriptCore.TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC, timeout); - JavaScriptCore.setOptions(options); - } -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=22072 -public void testStaticMembers1() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[3]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " void foo() {\n" + - " StaticMembers.\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/test/StaticMembers.js", - "package test;"+ - "public class StaticMembers extends SuperStaticMembers {\n" + - " public static int staticField;\n" + - " public static int staticMethod() {}\n" + - " public class Clazz {}\n" + - " public static class StaticClazz {}\n" + - "}\n"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/test/SuperStaticMembers.js", - "package test;"+ - "public class SuperStaticMembers {\n" + - " public static int superStaticField;\n" + - " public static int supeStaticMethod() {}\n" + - " public class SuperClazz {}\n" + - " public static class SuperStaticClazz {}\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); - String str = this.workingCopies[0].getSource(); - String completeBehind = "StaticMembers."; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "supeStaticMethod[FUNCTION_REF]{supeStaticMethod(), Ltest.SuperStaticMembers;, ()I, supeStaticMethod, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "superStaticField[FIELD_REF]{superStaticField, Ltest.SuperStaticMembers;, I, superStaticField, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "StaticMembers.Clazz[TYPE_REF]{Clazz, test, Ltest.StaticMembers$Clazz;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}\n" + - "StaticMembers.StaticClazz[TYPE_REF]{StaticClazz, test, Ltest.StaticMembers$StaticClazz;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}\n" + - "class[FIELD_REF]{class, null, Ljava.lang.Class;, class, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}\n" + - "staticField[FIELD_REF]{staticField, Ltest.StaticMembers;, I, staticField, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}\n" + - "staticMethod[FUNCTION_REF]{staticMethod(), Ltest.StaticMembers;, ()I, staticMethod, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}\n" + - "this[KEYWORD]{this, null, null, this, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}", - requestor.getResults()); -} -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionTests2.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionTests2.java deleted file mode 100644 index 73f8982..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionTests2.java +++ /dev/null @@ -1,2416 +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.FileOutputStream; -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.StringTokenizer; - -import junit.framework.ComparisonFailure; -import junit.framework.Test; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspaceRunnable; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.wst.jsdt.core.IAccessRule; -import org.eclipse.wst.jsdt.core.IIncludePathAttribute; -import org.eclipse.wst.jsdt.core.IIncludePathEntry; -import org.eclipse.wst.jsdt.core.IJavaScriptProject; -import org.eclipse.wst.jsdt.core.IJavaScriptUnit; -import org.eclipse.wst.jsdt.core.IJsGlobalScopeContainer; -import org.eclipse.wst.jsdt.core.JavaScriptCore; -import org.eclipse.wst.jsdt.internal.codeassist.RelevanceConstants; - -public class CompletionTests2 extends ModifyingResourceTests implements RelevanceConstants { - - public static final String DEFUALT_JSDTSCOPE = "\n" + - "\n" + - " \n" + - " \n"+ - " \n"+ - ""; - /* - .project = DEFAULT_PROJECT_LEFT + project name + DEFAULT_PROJECT_RIGHT; - */ - public static final String DEFAULT_PROJECT_LEFT = "\n" + - "\n" + - " "; - - - public static final String DEFAULT_PROJECT_RIGHT ="\n" + - " \n" + - " \n" + - " \n"+ - " \n"+ - " \n"+ - " org.eclipse.wst.jsdt.core.javascriptValidator\n"+ - " \n"+ - " \n"+ - " \n"+ - " \n"+ - " \n"+ - " org.eclipse.wst.jsdt.core.jsNature\n"+ - " \n" + - ""; - - - - - - public static class CompletionContainerInitializer implements ContainerInitializer.ITestInitializer { - - public static class DefaultContainer implements IJsGlobalScopeContainer { - char[][] libPaths; - boolean[] areExported; - String[] forbiddenReferences; - public DefaultContainer(char[][] libPaths, boolean[] areExported, String[] forbiddenReferences) { - this.libPaths = libPaths; - this.areExported = areExported; - this.forbiddenReferences = forbiddenReferences; - } - /** - * @deprecated Use {@link #getIncludepathEntries()} instead - */ - public IIncludePathEntry[] getClasspathEntries() { - return getIncludepathEntries(); - } - public IIncludePathEntry[] getIncludepathEntries() { - int length = this.libPaths.length; - IIncludePathEntry[] entries = new IIncludePathEntry[length]; - for (int j = 0; j < length; j++) { - IPath path = new Path(new String(this.libPaths[j])); - boolean isExported = this.areExported[j]; - - IAccessRule[] accessRules; - if(forbiddenReferences != null && forbiddenReferences[j]!= null && forbiddenReferences[j].length() != 0) { - StringTokenizer tokenizer = new StringTokenizer(forbiddenReferences[j], ";"); - int count = tokenizer.countTokens(); - accessRules = new IAccessRule[count]; - String token = null; - for (int i = 0; i < count; i++) { - token = tokenizer.nextToken(); - accessRules[i] = JavaScriptCore.newAccessRule(new Path(token), IAccessRule.K_NON_ACCESSIBLE); - } - } else { - accessRules = new IAccessRule[0]; - } - if (path.segmentCount() == 1) { - entries[j] = JavaScriptCore.newProjectEntry(path, accessRules, true, new IIncludePathAttribute[0], isExported); - } else { - entries[j] = JavaScriptCore.newLibraryEntry(path, null, null, accessRules, new IIncludePathAttribute[0], isExported); - } - } - return entries; - } - public String getDescription() { - return "Test container"; - } - public int getKind() { - return IJsGlobalScopeContainer.K_APPLICATION; - } - public IPath getPath() { - return new Path("org.eclipse.wst.jsdt.core.tests.model.TEST_CONTAINER"); - } - /* (non-Javadoc) - * @see org.eclipse.wst.jsdt.core.IJsGlobalScopeContainer#resolvedLibraryImport(java.lang.String) - */ - public String[] resolvedLibraryImport(String a) { - return new String[] {a}; - } - } - - Map containerValues; - CoreException exception; - - public CompletionContainerInitializer(String projectName, String[] libPaths, boolean[] areExported) { - this(projectName, libPaths, areExported, null); - } - public CompletionContainerInitializer(String projectName, String[] libPaths, boolean[] areExported, String[] forbiddenRefrences) { - containerValues = new HashMap(); - - int libPathsLength = libPaths.length; - char[][] charLibPaths = new char[libPathsLength][]; - for (int i = 0; i < libPathsLength; i++) { - charLibPaths[i] = libPaths[i].toCharArray(); - } - containerValues.put( - projectName, - newContainer(charLibPaths, areExported, forbiddenRefrences) - ); - } - protected DefaultContainer newContainer(final char[][] libPaths, final boolean[] areExperted, final String[] forbiddenRefrences) { - return new DefaultContainer(libPaths, areExperted, forbiddenRefrences); - } - public boolean allowFailureContainer() { - return true; - } - public void initialize(IPath containerPath, IJavaScriptProject project) throws CoreException { - if (containerValues == null) return; - try { - JavaScriptCore.setJsGlobalScopeContainer( - containerPath, - new IJavaScriptProject[] {project}, - new IJsGlobalScopeContainer[] {(IJsGlobalScopeContainer)containerValues.get(project.getElementName())}, - null); - } catch (CoreException e) { - this.exception = e; - throw e; - } - } - } -public CompletionTests2(String name) { - super(name); -} -public void setUpSuite() throws Exception { - super.setUpSuite(); - - setUpJavaProject("Completion"); -} -public void tearDownSuite() throws Exception { - deleteProject("Completion"); - - super.tearDownSuite(); -} - -protected static void assertResults(String expected, String actual) { - try { - assertEquals(expected, actual); - } catch(ComparisonFailure c) { - System.out.println(actual); - System.out.println(); - throw c; - } -} -static { -// TESTS_NAMES = new String[] { "testBug96950" }; -} -public static Test suite() { - return buildModelTestSuite(CompletionTests2.class); -} - -File createFile(File parent, String name, String content) throws IOException { - File file = new File(parent, name); - FileOutputStream out = new FileOutputStream(file); - out.write(content.getBytes()); - out.close(); - return file; -} -File createDirectory(File parent, String name) { - File dir = new File(parent, name); - dir.mkdirs(); - return dir; -} -/** - * Test for bug 29832 - */ -public void testBug29832() throws Exception { - try { - // create variable -// JavaScriptCore.setClasspathVariables( -// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, -// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, -// null); - - // create P1 - // IFile f = getFile("/Completion/lib.jar"); - IFile f = getFile("/Completion/ZZZ.js"); - - - IJavaScriptProject p = this.createJavaProject( - "P1", - new String[]{"/"}, - new String[]{}); - IFile libFile = this.createFile("/P1/ZZZ.js", f.getContents()); - this.addLibraryEntry(p, libFile.getLocation().toString(), true); - - // create P2 - this.createJavaProject( - "P2", - new String[]{"/"}, - new String[]{}, - new String[]{"/P1"}); - this.createFile( - "/P2/X.js", - "function testZZZClass {\n"+ - " var z = new ZZZ();\n"+ - " z;\n" + - "}"); - - waitUntilIndexesReady(); - - // do completion - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("P2", "", "", "X.js"); - - String str = cu.getSource(); - String completeBehind = "z"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - -// assertEquals( -// "element:ZZZ completion:pz.ZZZ relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED), -// requestor.getResults()); - assertEquals( - "element:ZZZ completion:ZZZ relevance:" +(R_DEFAULT+R_RESOLVED+R_INTERESTING+R_NON_RESTRICTED) + "\n"+ - "element:ZZZ completion:ZZZ() relevance:" + (R_DEFAULT+R_INTERESTING+R_UNQUALIFIED+R_NON_RESTRICTED) + "\n"+ - "element:ZZZ completion:ZZZ() relevance:" + (R_DEFAULT+R_INTERESTING+R_UNQUALIFIED+R_NON_RESTRICTED) + "\n"+ - "element:z completion:z relevance:"+ (R_DEFAULT+R_RESOLVED+R_INTERESTING+R_CASE+R_EXACT_NAME+R_UNQUALIFIED+R_NON_RESTRICTED), - requestor.getResults()); - - // delete P1 - p.getProject().delete(true, false, null); - - // create P1 - File dest = getWorkspaceRoot().getLocation().toFile(); - File pro = this.createDirectory(dest, "P1"); - File proSet = this.createDirectory(pro,".settings"); - - this.createFile(proSet, ".jsdtscope", DEFUALT_JSDTSCOPE); - - -// "\n" + -// "\n" + -// " \n" + -// " \n" + -// " \n" + -// ""); - - this.createFile(pro, ".project", DEFAULT_PROJECT_LEFT + "org.eclipse.wst.jsdt.core" + DEFAULT_PROJECT_RIGHT); -// "\n" + -// "\n" + -// " org.eclipse.wst.jsdt.core\n" + -// " \n" + -// " \n" + -// " \n" + -// " \n" + -// " \n" + -// " org.eclipse.wst.jsdt.core.javabuilder\n" + -// " \n" + -// " \n" + -// " \n" + -// " \n" + -// " \n" + -// " org.eclipse.wst.jsdt.core.javanature\n" + -// " \n" + -// ""); - - //File src = this.createDirectory(pro, "src"); - - //File pz = this.createDirectory(src, "pz"); - - this.createFile(pro,"ZZZ.js","function testZZZClass {\n"+ - " var z = new ZZZ();\n"+ - " z;\n" + - "}"); - - final IProject project = getWorkspaceRoot().getProject("P1"); - IWorkspaceRunnable populate = new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { - project.create(null); - project.open(null); - } - }; - getWorkspace().run(populate, null); - JavaScriptCore.create(project); - - waitUntilIndexesReady(); - - // do completion - requestor = new CompletionTestsRequestor(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:z completion:z relevance:"+ (R_DEFAULT+R_INTERESTING+R_CASE+R_EXACT_NAME+R_UNQUALIFIED+R_NON_RESTRICTED) + "\n" + - "element:z completion:z relevance:"+(R_DEFAULT+R_RESOLVED+R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED), - requestor.getResults()); - } finally { - this.deleteProject("P1"); - this.deleteProject("P2"); - } -} -/** - * Test for bug 33560 - */ -public void testBug33560() throws Exception { - try { - // create variable -// JavaScriptCore.setClasspathVariables( -// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, -// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, -// null); - - // create P1 - //IFile f = getFile("/Completion/lib.jar"); - IFile f = getFile("/Completion/ZZZ.js"); - IJavaScriptProject p = this.createJavaProject( - "P1", - new String[]{"/"}, - new String[]{});; - IFile libFile = this.createFile("/P1/ZZZ.js", f.getContents()); - this.addLibraryEntry(p, libFile.getLocation().toString(), true); - - // create P2 - this.createJavaProject( - "P2", - new String[]{"/"}, - new String[]{}, - new String[]{"/P1"}); - - // create P3 - this.createJavaProject( - "P3", - new String[]{"/"}, - new String[]{}, - new String[]{"/P1"}); - this.createFile( - "/P3/X.js", - "function testZZZClass {\n"+ - " var z = new ZZZ();\n"+ - " z;\n" + - "}"); - - waitUntilIndexesReady(); - - // do completion - CompletionTestsRequestor requestor = new CompletionTestsRequestor(); - IJavaScriptUnit cu= getCompilationUnit("P3", "", "", "X.js"); - - String str = cu.getSource(); - String completeBehind = "z"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - assertEquals( - "element:ZZZ completion:ZZZ relevance:" +(R_DEFAULT+R_RESOLVED+R_INTERESTING+R_NON_RESTRICTED ) + "\n"+ - "element:ZZZ completion:ZZZ() relevance:" + (R_DEFAULT+R_INTERESTING+R_UNQUALIFIED+R_NON_RESTRICTED) + "\n"+ - "element:ZZZ completion:ZZZ() relevance:" + (R_DEFAULT+R_INTERESTING+R_UNQUALIFIED+R_NON_RESTRICTED) + "\n"+ - "element:z completion:z relevance:"+ (R_DEFAULT+R_RESOLVED+R_INTERESTING+R_CASE+R_EXACT_NAME+R_UNQUALIFIED+R_NON_RESTRICTED), - requestor.getResults()); - - - // delete P1 - p.getProject().delete(true, false, null); - - // create P1 - File dest = getWorkspaceRoot().getLocation().toFile(); - File pro = this.createDirectory(dest, "P1"); - File proSet = this.createDirectory(pro,".settings"); - - this.createFile(proSet, ".jsdtscope", DEFUALT_JSDTSCOPE); -// this.createFile(pro, ".classpath", "\n" + -// "\n" + -// " \n" + -// " \n" + -// " \n" + -// ""); - this.createFile(pro, ".project", DEFAULT_PROJECT_LEFT + "org.eclipse.wst.jsdt.core" + DEFAULT_PROJECT_RIGHT); -// this.createFile(pro, ".project", -// "\n" + -// "\n" + -// " org.eclipse.wst.jsdt.core\n" + -// " \n" + -// " \n" + -// " \n" + -// " \n" + -// " \n" + -// " org.eclipse.wst.jsdt.core.javabuilder\n" + -// " \n" + -// " \n" + -// " \n" + -// " \n" + -// " \n" + -// " org.eclipse.wst.jsdt.core.javanature\n" + -// " \n" + -// ""); -// - File src = this.createDirectory(pro, "src"); - - File pz = this.createDirectory(src, "pz"); - - this.createFile(pro,"ZZZ.js","function testZZZClass {\n"+ - " var z = new ZZZ();\n"+ - " z;\n" + - "}"); - - final IProject project = getWorkspaceRoot().getProject("P1"); - IWorkspaceRunnable populate = new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { - project.create(null); - project.open(null); - } - }; - getWorkspace().run(populate, null); - JavaScriptCore.create(project); - - waitUntilIndexesReady(); - - // do completion - requestor = new CompletionTestsRequestor(); - cu.codeComplete(cursorLocation, requestor); - - assertEquals( - "element:z completion:z relevance:"+ (R_DEFAULT+R_INTERESTING+R_CASE+R_EXACT_NAME+R_UNQUALIFIED+R_NON_RESTRICTED) + "\n" + - "element:z completion:z relevance:"+(R_DEFAULT+R_RESOLVED+R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED), - requestor.getResults()); - } finally { - this.deleteProject("P1"); - this.deleteProject("P2"); - this.deleteProject("P3"); - } -} -/* - * - * This tests a project which includes functions and methods marked as "not exported" from another project. This is N/A for JS. - */ - -//public void testBug79288() throws Exception { -// try { -// // create variable -//// JavaScriptCore.setClasspathVariables( -//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, -//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, -//// null); -// -// // create P1 -// this.createJavaProject( -// "P1", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// "bin"); -// -// this.createFolder("/P1/src/a"); -// this.createFile( -// "/P1/src/a/XX1.js", -// "package a;\n"+ -// "public class XX1 {\n"+ -// "}"); -// -// // create P2 -// this.createJavaProject( -// "P2", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// new String[]{"/P1"}, -// "bin"); -// -// this.createFolder("/P2/src/b"); -// this.createFile( -// "/P2/src/b/XX2.js", -// "package b;\n"+ -// "public class XX2 {\n"+ -// "}"); -// -// // create P3 -// this.createJavaProject( -// "P3", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// new String[]{"/P2"}, -// "bin"); -// -// this.createFile( -// "/P3/src/YY.js", -// "public class YY {\n"+ -// " vois foo(){\n"+ -// " XX\n"+ -// " }\n"+ -// "}"); -// -// waitUntilIndexesReady(); -// -// // do completion -// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); -// IJavaScriptUnit cu= getCompilationUnit("P3", "src", "", "YY.js"); -// -// String str = cu.getSource(); -// String completeBehind = "XX"; -// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); -// cu.codeComplete(cursorLocation, requestor); -// -// assertResults( -// "XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", -// requestor.getResults()); -// } finally { -// this.deleteProject("P1"); -// this.deleteProject("P2"); -// this.deleteProject("P3"); -// } -//} - - - - -//public void testBug91772() throws Exception { -// try { -// // create variable -//// JavaScriptCore.setClasspathVariables( -//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, -//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, -//// null); -// -// // create P1 -// this.createJavaProject( -// "P1", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// "bin"); -// -// this.createFolder("/P1/src/a"); -// this.createFile( -// "/P1/src/a/XX1.js", -// "package a;\n"+ -// "public class XX1 {\n"+ -// "}"); -// -// // create P2 -// ContainerInitializer.setInitializer(new CompletionContainerInitializer("P2", new String[] {"/P1"}, new boolean[] {true})); -// String[] classLib = new String[]{"JCL_LIB"}; -// int classLibLength = classLib.length; -// String[] lib = new String[classLibLength + 1]; -// System.arraycopy(classLib, 0, lib, 0, classLibLength); -// lib[classLibLength] = "org.eclipse.wst.jsdt.core.tests.model.TEST_CONTAINER"; -// this.createJavaProject( -// "P2", -// new String[]{"src"}, -// lib, -// "bin"); -// -// this.createFolder("/P2/src/b"); -// this.createFile( -// "/P2/src/b/XX2.js", -// "package b;\n"+ -// "public class XX2 {\n"+ -// "}"); -// -// // create P3 -// this.createJavaProject( -// "P3", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// new String[]{"/P2"}, -// "bin"); -// -// this.createFile( -// "/P3/src/YY.js", -// "public class YY {\n"+ -// " vois foo(){\n"+ -// " XX\n"+ -// " }\n"+ -// "}"); -// -// waitUntilIndexesReady(); -// -// // do completion -// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); -// IJavaScriptUnit cu= getCompilationUnit("P3", "src", "", "YY.js"); -// -// String str = cu.getSource(); -// String completeBehind = "XX"; -// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); -// cu.codeComplete(cursorLocation, requestor); -// -// assertResults( -// "XX1[TYPE_REF]{a.XX1, a, La.XX1;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + -// "XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", -// requestor.getResults()); -// } finally { -// this.deleteProject("P1"); -// this.deleteProject("P2"); -// this.deleteProject("P3"); -// -// -// // TODO the following code is not the correct way to remove the container -// // Cleanup caches -// JavaModelManager manager = JavaModelManager.getJavaModelManager(); -// manager.containers = new HashMap(5); -// manager.variables = new HashMap(5); -// } -//} -//public void testBug93891() throws Exception { -// Hashtable oldOptions = JavaScriptCore.getOptions(); -// try { -// Hashtable options = new Hashtable(oldOptions); -// options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.ERROR); -// options.put(JavaScriptCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaScriptCore.ENABLED); -// options.put(JavaScriptCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaScriptCore.DISABLED); -// JavaScriptCore.setOptions(options); -// -// // create variable -//// JavaScriptCore.setClasspathVariables( -//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, -//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, -//// null); -// -// // create P1 -// this.createJavaProject( -// "P1", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// "bin"); -// -// this.createFolder("/P1/src/a"); -// this.createFile( -// "/P1/src/a/XX1.js", -// "package a;\n"+ -// "public class XX1 {\n"+ -// "}"); -// -// this.createFolder("/P1/src/b"); -// this.createFile( -// "/P1/src/b/XX2.js", -// "package b;\n"+ -// "public class XX2 {\n"+ -// "}"); -// -// // create P2 -// ContainerInitializer.setInitializer(new CompletionContainerInitializer("P2", new String[] {"/P1"}, new boolean[] {true}, new String[]{"a/*"})); -// String[] classLib = new String[]{"JCL_LIB"}; -// int classLibLength = classLib.length; -// String[] lib = new String[classLibLength + 1]; -// System.arraycopy(classLib, 0, lib, 0, classLibLength); -// lib[classLibLength] = "org.eclipse.wst.jsdt.core.tests.model.TEST_CONTAINER"; -// this.createJavaProject( -// "P2", -// new String[]{"src"}, -// lib, -// "bin"); -// -// this.createFolder("/P2/src/b"); -// this.createFile( -// "/P2/src/YY.js", -// "public class YY {\n"+ -// " void foo() {\n"+ -// " XX\n"+ -// " }\n"+ -// "}"); -// -// waitUntilIndexesReady(); -// -// // do completion -// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); -// IJavaScriptUnit cu= getCompilationUnit("P2", "src", "", "YY.js"); -// -// String str = cu.getSource(); -// String completeBehind = "XX"; -// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); -// cu.codeComplete(cursorLocation, requestor); -// -// assertResults( -// "XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", -// requestor.getResults()); -// } finally { -// this.deleteProject("P1"); -// this.deleteProject("P2"); -// -// // TODO the following code is not the correct way to remove the container -// // Cleanup caches -// JavaModelManager manager = JavaModelManager.getJavaModelManager(); -// manager.containers = new HashMap(5); -// manager.variables = new HashMap(5); -// -// JavaScriptCore.setOptions(oldOptions); -// } -//} -//public void testAccessRestriction1() throws Exception { -// Hashtable oldOptions = JavaScriptCore.getOptions(); -// try { -// Hashtable options = new Hashtable(oldOptions); -// options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.IGNORE); -// options.put(JavaScriptCore.COMPILER_PB_DISCOURAGED_REFERENCE, JavaScriptCore.IGNORE); -// options.put(JavaScriptCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaScriptCore.DISABLED); -// options.put(JavaScriptCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaScriptCore.DISABLED); -// JavaScriptCore.setOptions(options); -// -// // create variable -//// JavaScriptCore.setClasspathVariables( -//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, -//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, -//// null); -// -// // create P1 -// this.createJavaProject( -// "P1", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// "bin"); -// -// this.createFolder("/P1/src/a"); -// this.createFile( -// "/P1/src/a/XX1.js", -// "package a;\n"+ -// "public class XX1 {\n"+ -// "}"); -// -// this.createFolder("/P1/src/b"); -// this.createFile( -// "/P1/src/b/XX2.js", -// "package b;\n"+ -// "public class XX2 {\n"+ -// "}"); -// -// // create P2 -// this.createJavaProject( -// "P2", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// new String[]{"/P1"}, -// "bin"); -// this.createFile( -// "/P2/src/YY.js", -// "public class YY {\n"+ -// " void foo() {\n"+ -// " XX\n"+ -// " }\n"+ -// "}"); -// -// waitUntilIndexesReady(); -// -// // do completion -// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); -// IJavaScriptUnit cu= getCompilationUnit("P2", "src", "", "YY.js"); -// -// String str = cu.getSource(); -// String completeBehind = "XX"; -// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); -// cu.codeComplete(cursorLocation, requestor); -// -// assertResults( -// "XX1[TYPE_REF]{a.XX1, a, La.XX1;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + -// "XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", -// requestor.getResults()); -// } finally { -// this.deleteProject("P1"); -// this.deleteProject("P2"); -// JavaScriptCore.setOptions(oldOptions); -// } -//} -// -//public void testAccessRestriction2() throws Exception { -// Hashtable oldOptions = JavaScriptCore.getOptions(); -// try { -// Hashtable options = new Hashtable(oldOptions); -// options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.IGNORE); -// options.put(JavaScriptCore.COMPILER_PB_DISCOURAGED_REFERENCE, JavaScriptCore.IGNORE); -// options.put(JavaScriptCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaScriptCore.DISABLED); -// options.put(JavaScriptCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaScriptCore.DISABLED); -// JavaScriptCore.setOptions(options); -// -// // create variable -//// JavaScriptCore.setClasspathVariables( -//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, -//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, -//// null); -// -// // create P1 -// this.createJavaProject( -// "P1", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// "bin"); -// -// this.createFolder("/P1/src/a"); -// this.createFile( -// "/P1/src/a/XX1.js", -// "package a;\n"+ -// "public class XX1 {\n"+ -// "}"); -// -// this.createFolder("/P1/src/b"); -// this.createFile( -// "/P1/src/b/XX2.js", -// "package b;\n"+ -// "public class XX2 {\n"+ -// "}"); -// -// // create P2 -// this.createJavaProject( -// "P2", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// null, -// null, -// new String[]{"/P1"}, -// new String[][]{{}}, -// new String[][]{{"a/*"}}, -// new boolean[]{false}, -// "bin", -// null, -// null, -// null, -// "1.4"); -// this.createFile( -// "/P2/src/YY.js", -// "public class YY {\n"+ -// " void foo() {\n"+ -// " XX\n"+ -// " }\n"+ -// "}"); -// -// waitUntilIndexesReady(); -// -// // do completion -// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); -// IJavaScriptUnit cu= getCompilationUnit("P2", "src", "", "YY.js"); -// -// String str = cu.getSource(); -// String completeBehind = "XX"; -// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); -// cu.codeComplete(cursorLocation, requestor); -// -// assertResults( -// "XX1[TYPE_REF]{a.XX1, a, La.XX1;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + -// "XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", -// requestor.getResults()); -// } finally { -// this.deleteProject("P1"); -// this.deleteProject("P2"); -// JavaScriptCore.setOptions(oldOptions); -// } -//} -//public void testAccessRestriction3() throws Exception { -// Hashtable oldOptions = JavaScriptCore.getOptions(); -// try { -// Hashtable options = new Hashtable(oldOptions); -// options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.ERROR); -// options.put(JavaScriptCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaScriptCore.DISABLED); -// options.put(JavaScriptCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaScriptCore.DISABLED); -// JavaScriptCore.setOptions(options); -// -// // create variable -//// JavaScriptCore.setClasspathVariables( -//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, -//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, -//// null); -// -// // create P1 -// this.createJavaProject( -// "P1", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// "bin"); -// -// this.createFolder("/P1/src/a"); -// this.createFile( -// "/P1/src/a/XX1.js", -// "package a;\n"+ -// "public class XX1 {\n"+ -// "}"); -// -// this.createFolder("/P1/src/b"); -// this.createFile( -// "/P1/src/b/XX2.js", -// "package b;\n"+ -// "public class XX2 {\n"+ -// "}"); -// -// // create P2 -// this.createJavaProject( -// "P2", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// null, -// null, -// new String[]{"/P1"}, -// new String[][]{{}}, -// new String[][]{{"a/*"}}, -// new boolean[]{false}, -// "bin", -// null, -// null, -// null, -// "1.4"); -// this.createFile( -// "/P2/src/YY.js", -// "public class YY {\n"+ -// " void foo() {\n"+ -// " XX\n"+ -// " }\n"+ -// "}"); -// -// waitUntilIndexesReady(); -// -// // do completion -// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); -// IJavaScriptUnit cu= getCompilationUnit("P2", "src", "", "YY.js"); -// -// String str = cu.getSource(); -// String completeBehind = "XX"; -// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); -// cu.codeComplete(cursorLocation, requestor); -// -// assertResults( -// "XX1[TYPE_REF]{a.XX1, a, La.XX1;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE) + "}\n" + -// "XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", -// requestor.getResults()); -// } finally { -// this.deleteProject("P1"); -// this.deleteProject("P2"); -// JavaScriptCore.setOptions(oldOptions); -// } -//} -//public void testAccessRestriction4() throws Exception { -// Hashtable oldOptions = JavaScriptCore.getOptions(); -// try { -// Hashtable options = new Hashtable(oldOptions); -// options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.IGNORE); -// options.put(JavaScriptCore.COMPILER_PB_DISCOURAGED_REFERENCE, JavaScriptCore.IGNORE); -// options.put(JavaScriptCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaScriptCore.ENABLED); -// options.put(JavaScriptCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaScriptCore.DISABLED); -// JavaScriptCore.setOptions(options); -// -// // create variable -//// JavaScriptCore.setClasspathVariables( -//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, -//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, -//// null); -// -// // create P1 -// this.createJavaProject( -// "P1", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// "bin"); -// -// this.createFolder("/P1/src/a"); -// this.createFile( -// "/P1/src/a/XX1.js", -// "package a;\n"+ -// "public class XX1 {\n"+ -// "}"); -// -// this.createFolder("/P1/src/b"); -// this.createFile( -// "/P1/src/b/XX2.js", -// "package b;\n"+ -// "public class XX2 {\n"+ -// "}"); -// -// // create P2 -// this.createJavaProject( -// "P2", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// null, -// null, -// new String[]{"/P1"}, -// new String[][]{{}}, -// new String[][]{{"a/*"}}, -// new boolean[]{false}, -// "bin", -// null, -// null, -// null, -// "1.4"); -// this.createFile( -// "/P2/src/YY.js", -// "public class YY {\n"+ -// " void foo() {\n"+ -// " XX\n"+ -// " }\n"+ -// "}"); -// -// waitUntilIndexesReady(); -// -// // do completion -// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); -// IJavaScriptUnit cu= getCompilationUnit("P2", "src", "", "YY.js"); -// -// String str = cu.getSource(); -// String completeBehind = "XX"; -// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); -// cu.codeComplete(cursorLocation, requestor); -// -// assertResults( -// "XX1[TYPE_REF]{a.XX1, a, La.XX1;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + -// "XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", -// requestor.getResults()); -// } finally { -// this.deleteProject("P1"); -// this.deleteProject("P2"); -// JavaScriptCore.setOptions(oldOptions); -// } -//} -//public void testAccessRestriction5() throws Exception { -// Hashtable oldOptions = JavaScriptCore.getOptions(); -// try { -// Hashtable options = new Hashtable(oldOptions); -// options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.ERROR); -// options.put(JavaScriptCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaScriptCore.ENABLED); -// options.put(JavaScriptCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaScriptCore.DISABLED); -// JavaScriptCore.setOptions(options); -// -// // create variable -//// JavaScriptCore.setClasspathVariables( -//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, -//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, -//// null); -// -// // create P1 -// this.createJavaProject( -// "P1", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// "bin"); -// -// this.createFolder("/P1/src/a"); -// this.createFile( -// "/P1/src/a/XX1.js", -// "package a;\n"+ -// "public class XX1 {\n"+ -// "}"); -// -// this.createFolder("/P1/src/b"); -// this.createFile( -// "/P1/src/b/XX2.js", -// "package b;\n"+ -// "public class XX2 {\n"+ -// "}"); -// -// // create P2 -// this.createJavaProject( -// "P2", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// null, -// null, -// new String[]{"/P1"}, -// new String[][]{{}}, -// new String[][]{{"a/*"}}, -// new boolean[]{false}, -// "bin", -// null, -// null, -// null, -// "1.4"); -// this.createFile( -// "/P2/src/YY.js", -// "public class YY {\n"+ -// " void foo() {\n"+ -// " XX\n"+ -// " }\n"+ -// "}"); -// -// waitUntilIndexesReady(); -// -// // do completion -// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); -// IJavaScriptUnit cu= getCompilationUnit("P2", "src", "", "YY.js"); -// -// String str = cu.getSource(); -// String completeBehind = "XX"; -// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); -// cu.codeComplete(cursorLocation, requestor); -// -// assertResults( -// "XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", -// requestor.getResults()); -// } finally { -// this.deleteProject("P1"); -// this.deleteProject("P2"); -// JavaScriptCore.setOptions(oldOptions); -// } -//} -//public void testAccessRestriction6() throws Exception { -// Hashtable oldOptions = JavaScriptCore.getOptions(); -// try { -// Hashtable options = new Hashtable(oldOptions); -// options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.ERROR); -// options.put(JavaScriptCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaScriptCore.ENABLED); -// options.put(JavaScriptCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaScriptCore.DISABLED); -// JavaScriptCore.setOptions(options); -// -// // create variable -//// JavaScriptCore.setClasspathVariables( -//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, -//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, -//// null); -// -// // create P1 -// this.createJavaProject( -// "P1", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// "bin"); -// -// this.createFolder("/P1/src/a"); -// this.createFile( -// "/P1/src/a/XX1.js", -// "package a;\n"+ -// "public class XX1 {\n"+ -// "}"); -// -// this.createFolder("/P1/src/b"); -// this.createFile( -// "/P1/src/b/XX2.js", -// "package b;\n"+ -// "public class XX2 {\n"+ -// "}"); -// -// this.createFolder("/P1/src/c"); -// this.createFile( -// "/P1/src/c/XX3.js", -// "package c;\n"+ -// "public class XX3 {\n"+ -// "}"); -// -// // create P2 -// this.createJavaProject( -// "P2", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// null, -// null, -// new String[]{"/P1"}, -// new String[][]{{}}, -// new String[][]{{"a/*"}}, -// new boolean[]{true}, -// "bin", -// null, -// null, -// null, -// "1.4"); -// -// // create P3 -// this.createJavaProject( -// "P3", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// null, -// null, -// new String[]{"/P2"}, -// new String[][]{{}}, -// new String[][]{{"b/*"}}, -// new boolean[]{false}, -// "bin", -// null, -// null, -// null, -// "1.4"); -// -// this.createFile( -// "/P3/src/YY.js", -// "public class YY {\n"+ -// " void foo() {\n"+ -// " XX\n"+ -// " }\n"+ -// "}"); -// -// waitUntilIndexesReady(); -// -// // do completion -// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); -// IJavaScriptUnit cu= getCompilationUnit("P3", "src", "", "YY.js"); -// -// String str = cu.getSource(); -// String completeBehind = "XX"; -// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); -// cu.codeComplete(cursorLocation, requestor); -// -// assertResults( -// "XX3[TYPE_REF]{c.XX3, c, Lc.XX3;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", -// requestor.getResults()); -// } finally { -// this.deleteProject("P1"); -// this.deleteProject("P2"); -// this.deleteProject("P3"); -// JavaScriptCore.setOptions(oldOptions); -// } -//} -//public void testAccessRestriction7() throws Exception { -// Hashtable oldOptions = JavaScriptCore.getOptions(); -// try { -// Hashtable options = new Hashtable(oldOptions); -// options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.ERROR); -// options.put(JavaScriptCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaScriptCore.ENABLED); -// options.put(JavaScriptCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaScriptCore.DISABLED); -// JavaScriptCore.setOptions(options); -// -// // create variable -//// JavaScriptCore.setClasspathVariables( -//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, -//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, -//// null); -// -// // create P1 -// this.createJavaProject( -// "P1", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// "bin"); -// -// this.createFolder("/P1/src/a"); -// this.createFile( -// "/P1/src/a/XX1.js", -// "package a;\n"+ -// "public class XX1 {\n"+ -// "}"); -// -// this.createFolder("/P1/src/b"); -// this.createFile( -// "/P1/src/b/XX2.js", -// "package b;\n"+ -// "public class XX2 {\n"+ -// "}"); -// -// // create P2 -// this.createJavaProject( -// "P2", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// null, -// null, -// new String[]{"/P1", "/P3"}, -// new String[][]{{}, {}}, -// new String[][]{{"a/*"}, {}}, -// new boolean[]{false, false}, -// "bin", -// null, -// null, -// null, -// "1.4"); -// this.createFile( -// "/P2/src/YY.js", -// "public class YY {\n"+ -// " void foo() {\n"+ -// " XX\n"+ -// " }\n"+ -// "}"); -// -// // create P3 -// this.createJavaProject( -// "P3", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// null, -// null, -// new String[]{"/P1"}, -// new String[][]{{}}, -// new String[][]{{}}, -// new boolean[]{true}, -// "bin", -// null, -// null, -// null, -// "1.4"); -// -// waitUntilIndexesReady(); -// -// // do completion -// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); -// IJavaScriptUnit cu= getCompilationUnit("P2", "src", "", "YY.js"); -// -// String str = cu.getSource(); -// String completeBehind = "XX"; -// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); -// cu.codeComplete(cursorLocation, requestor); -// -// assertResults( -// "XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", -// requestor.getResults()); -// } finally { -// this.deleteProject("P1"); -// this.deleteProject("P2"); -// this.deleteProject("P3"); -// JavaScriptCore.setOptions(oldOptions); -// } -//} -//public void testAccessRestriction8() throws Exception { -// Hashtable oldOptions = JavaScriptCore.getOptions(); -// try { -// Hashtable options = new Hashtable(oldOptions); -// options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.ERROR); -// options.put(JavaScriptCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaScriptCore.ENABLED); -// options.put(JavaScriptCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaScriptCore.DISABLED); -// JavaScriptCore.setOptions(options); -// -// // create variable -//// JavaScriptCore.setClasspathVariables( -//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, -//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, -//// null); -// -// // create P1 -// this.createJavaProject( -// "P1", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// "bin"); -// -// this.createFolder("/P1/src/a"); -// this.createFile( -// "/P1/src/a/XX1.js", -// "package a;\n"+ -// "public class XX1 {\n"+ -// "}"); -// -// this.createFolder("/P1/src/b"); -// this.createFile( -// "/P1/src/b/XX2.js", -// "package b;\n"+ -// "public class XX2 {\n"+ -// "}"); -// -// // create P2 -// this.createJavaProject( -// "P2", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// null, -// null, -// new String[]{"/P3", "/P1"}, -// new String[][]{{}, {}}, -// new String[][]{{}, {"a/*"}}, -// new boolean[]{false, false}, -// "bin", -// null, -// null, -// null, -// "1.4"); -// this.createFile( -// "/P2/src/YY.js", -// "public class YY {\n"+ -// " void foo() {\n"+ -// " XX\n"+ -// " }\n"+ -// "}"); -// -// // create P3 -// this.createJavaProject( -// "P3", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// null, -// null, -// new String[]{"/P1"}, -// new String[][]{{}}, -// new String[][]{{}}, -// new boolean[]{true}, -// "bin", -// null, -// null, -// null, -// "1.4"); -// -// waitUntilIndexesReady(); -// -// // do completion -// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); -// IJavaScriptUnit cu= getCompilationUnit("P2", "src", "", "YY.js"); -// -// String str = cu.getSource(); -// String completeBehind = "XX"; -// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); -// cu.codeComplete(cursorLocation, requestor); -// -// assertResults( -// "XX1[TYPE_REF]{a.XX1, a, La.XX1;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + -// "XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", -// requestor.getResults()); -// } finally { -// this.deleteProject("P1"); -// this.deleteProject("P2"); -// this.deleteProject("P3"); -// JavaScriptCore.setOptions(oldOptions); -// } -//} -//public void testAccessRestriction9() throws Exception { -// Hashtable oldOptions = JavaScriptCore.getOptions(); -// try { -// Hashtable options = new Hashtable(oldOptions); -// options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.ERROR); -// options.put(JavaScriptCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaScriptCore.ENABLED); -// options.put(JavaScriptCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaScriptCore.DISABLED); -// JavaScriptCore.setOptions(options); -// -// // create variable -//// JavaScriptCore.setClasspathVariables( -//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, -//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, -//// null); -// -// // create P1 -// this.createJavaProject( -// "P1", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// "bin"); -// -// this.createFolder("/P1/src/p11"); -// this.createFile( -// "/P1/src/p11/XX11.js", -// "package p11;\n"+ -// "public class XX11 {\n"+ -// "}"); -// -// this.createFolder("/P1/src/p12"); -// this.createFile( -// "/P1/src/p12/XX12.js", -// "package p12;\n"+ -// "public class XX12 {\n"+ -// "}"); -// -// // create P2 -// this.createJavaProject( -// "P2", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// null, -// null, -// new String[]{"/P1", "/P3"}, -// new String[][]{{}, {}}, -// new String[][]{{"p11/*"}, {"p31/*"}}, -// new boolean[]{true, true}, -// "bin", -// null, -// null, -// null, -// "1.4"); -// -// this.createFolder("/P2/src/p21"); -// this.createFile( -// "/P2/src/p21/XX21.js", -// "package p21;\n"+ -// "public class XX21 {\n"+ -// "}"); -// -// this.createFolder("/P2/src/p22"); -// this.createFile( -// "/P2/src/p22/XX22.js", -// "package p22;\n"+ -// "public class XX22 {\n"+ -// "}"); -// -// // create P3 -// this.createJavaProject( -// "P3", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// null, -// null, -// new String[]{"/P1"}, -// new String[][]{{}}, -// new String[][]{{"p12/*"}}, -// new boolean[]{true}, -// "bin", -// null, -// null, -// null, -// "1.4"); -// -// this.createFolder("/P3/src/p31"); -// this.createFile( -// "/P3/src/p31/XX31.js", -// "package p31;\n"+ -// "public class XX31 {\n"+ -// "}"); -// -// this.createFolder("/P3/src/p32"); -// this.createFile( -// "/P3/src/p32/XX32.js", -// "package p32;\n"+ -// "public class XX32 {\n"+ -// "}"); -// -// // create PX -// this.createJavaProject( -// "PX", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// null, -// null, -// new String[]{"/P2"}, -// null, -// null, -// new boolean[]{false}, -// "bin", -// null, -// null, -// null, -// "1.4"); -// -// this.createFile( -// "/PX/src/X.js", -// "public class X {\n"+ -// " void foo() {\n"+ -// " XX\n"+ -// " }\n"+ -// "}"); -// -// waitUntilIndexesReady(); -// -// // do completion -// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); -// IJavaScriptUnit cu= getCompilationUnit("PX", "src", "", "X.js"); -// -// String str = cu.getSource(); -// String completeBehind = "XX"; -// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); -// cu.codeComplete(cursorLocation, requestor); -// -// assertResults( -// "XX12[TYPE_REF]{p12.XX12, p12, Lp12.XX12;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + -// "XX21[TYPE_REF]{p21.XX21, p21, Lp21.XX21;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + -// "XX22[TYPE_REF]{p22.XX22, p22, Lp22.XX22;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + -// "XX32[TYPE_REF]{p32.XX32, p32, Lp32.XX32;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", -// requestor.getResults()); -// } finally { -// this.deleteProject("P1"); -// this.deleteProject("P2"); -// this.deleteProject("P3"); -// this.deleteProject("PX"); -// JavaScriptCore.setOptions(oldOptions); -// } -//} -//public void testAccessRestriction10() throws Exception { -// Hashtable oldOptions = JavaScriptCore.getOptions(); -// try { -// Hashtable options = new Hashtable(oldOptions); -// options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.ERROR); -// options.put(JavaScriptCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaScriptCore.DISABLED); -// options.put(JavaScriptCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaScriptCore.DISABLED); -// JavaScriptCore.setOptions(options); -// -// // create variable -//// JavaScriptCore.setClasspathVariables( -//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, -//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, -//// null); -// -// // create P1 -// this.createJavaProject( -// "P1", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// "bin"); -// -// this.createFolder("/P1/src/p11"); -// this.createFile( -// "/P1/src/p11/XX11.js", -// "package p11;\n"+ -// "public class XX11 {\n"+ -// "}"); -// -// this.createFolder("/P1/src/p12"); -// this.createFile( -// "/P1/src/p12/XX12.js", -// "package p12;\n"+ -// "public class XX12 {\n"+ -// "}"); -// -// // create P2 -// this.createJavaProject( -// "P2", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// null, -// null, -// new String[]{"/P1", "/P3"}, -// new String[][]{{}, {}}, -// new String[][]{{"p11/*"}, {"p31/*"}}, -// new boolean[]{true, true}, -// "bin", -// null, -// null, -// null, -// "1.4"); -// -// this.createFolder("/P2/src/p21"); -// this.createFile( -// "/P2/src/p21/XX21.js", -// "package p21;\n"+ -// "public class XX21 {\n"+ -// "}"); -// -// this.createFolder("/P2/src/p22"); -// this.createFile( -// "/P2/src/p22/XX22.js", -// "package p22;\n"+ -// "public class XX22 {\n"+ -// "}"); -// -// // create P3 -// this.createJavaProject( -// "P3", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// null, -// null, -// new String[]{"/P1"}, -// new String[][]{{}}, -// new String[][]{{"p12/*"}}, -// new boolean[]{true}, -// "bin", -// null, -// null, -// null, -// "1.4"); -// -// this.createFolder("/P3/src/p31"); -// this.createFile( -// "/P3/src/p31/XX31.js", -// "package p31;\n"+ -// "public class XX31 {\n"+ -// "}"); -// -// this.createFolder("/P3/src/p32"); -// this.createFile( -// "/P3/src/p32/XX32.js", -// "package p32;\n"+ -// "public class XX32 {\n"+ -// "}"); -// -// // create PX -// this.createJavaProject( -// "PX", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// null, -// null, -// new String[]{"/P2"}, -// null, -// null, -// new boolean[]{false}, -// "bin", -// null, -// null, -// null, -// "1.4"); -// -// this.createFile( -// "/PX/src/X.js", -// "public class X {\n"+ -// " void foo() {\n"+ -// " XX\n"+ -// " }\n"+ -// "}"); -// -// waitUntilIndexesReady(); -// -// // do completion -// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); -// IJavaScriptUnit cu= getCompilationUnit("PX", "src", "", "X.js"); -// -// String str = cu.getSource(); -// String completeBehind = "XX"; -// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); -// cu.codeComplete(cursorLocation, requestor); -// -// assertResults( -// "XX11[TYPE_REF]{p11.XX11, p11, Lp11.XX11;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE) + "}\n" + -// "XX31[TYPE_REF]{p31.XX31, p31, Lp31.XX31;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE) + "}\n" + -// "XX12[TYPE_REF]{p12.XX12, p12, Lp12.XX12;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + -// "XX21[TYPE_REF]{p21.XX21, p21, Lp21.XX21;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + -// "XX22[TYPE_REF]{p22.XX22, p22, Lp22.XX22;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + -// "XX32[TYPE_REF]{p32.XX32, p32, Lp32.XX32;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", -// requestor.getResults()); -// } finally { -// this.deleteProject("P1"); -// this.deleteProject("P2"); -// this.deleteProject("P3"); -// this.deleteProject("PX"); -// JavaScriptCore.setOptions(oldOptions); -// } -//} -//public void testAccessRestriction11() throws Exception { -// Hashtable oldOptions = JavaScriptCore.getOptions(); -// try { -// Hashtable options = new Hashtable(oldOptions); -// options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.ERROR); -// options.put(JavaScriptCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaScriptCore.ENABLED); -// options.put(JavaScriptCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaScriptCore.DISABLED); -// JavaScriptCore.setOptions(options); -// -// // create variable -//// JavaScriptCore.setClasspathVariables( -//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, -//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, -//// null); -// -// // create P1 -// this.createJavaProject( -// "P1", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// "bin"); -// -// this.createFolder("/P1/src/x/y/z/p11"); -// this.createFile( -// "/P1/src/x/y/z/p11/XX11.js", -// "package x.y.z.p11;\n"+ -// "public class XX11 {\n"+ -// "}"); -// -// this.createFolder("/P1/src/x/y/z/p12"); -// this.createFile( -// "/P1/src/x/y/z/p12/XX12.js", -// "package x.y.z.p12;\n"+ -// "public class XX12 {\n"+ -// "}"); -// -// // create P2 -// this.createJavaProject( -// "P2", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// null, -// null, -// new String[]{"/P3", "/P1"}, -// new String[][]{{}, {}}, -// new String[][]{{"x/y/z/p31/*"}, {"x/y/z/p11/*"}}, -// new boolean[]{true, true}, -// "bin", -// null, -// null, -// null, -// "1.4"); -// -// this.createFolder("/P2/src/x/y/z/p21"); -// this.createFile( -// "/P2/src/x/y/z/p21/XX21.js", -// "package x.y.z.p21;\n"+ -// "public class XX21 {\n"+ -// "}"); -// -// this.createFolder("/P2/src/x/y/z/p22"); -// this.createFile( -// "/P2/src/x/y/z/p22/XX22.js", -// "package x.y.z.p22;\n"+ -// "public class XX22 {\n"+ -// "}"); -// -// // create P3 -// this.createJavaProject( -// "P3", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// null, -// null, -// new String[]{"/P1"}, -// new String[][]{{}}, -// new String[][]{{"x/y/z/p12/*"}}, -// new boolean[]{true}, -// "bin", -// null, -// null, -// null, -// "1.4"); -// -// this.createFolder("/P3/src/x/y/z/p31"); -// this.createFile( -// "/P3/src/x/y/z/p31/XX31.js", -// "package x.y.z.p31;\n"+ -// "public class XX31 {\n"+ -// "}"); -// -// this.createFolder("/P3/src/x/y/z/p32"); -// this.createFile( -// "/P3/src/x/y/z/p32/XX32.js", -// "package x.y.z.p32;\n"+ -// "public class XX32 {\n"+ -// "}"); -// -// // create PX -// this.createJavaProject( -// "PX", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// null, -// null, -// new String[]{"/P2"}, -// null, -// null, -// new boolean[]{false}, -// "bin", -// null, -// null, -// null, -// "1.4"); -// -// this.createFile( -// "/PX/src/X.js", -// "public class X {\n"+ -// " void foo() {\n"+ -// " XX\n"+ -// " }\n"+ -// "}"); -// -// waitUntilIndexesReady(); -// -// // do completion -// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); -// IJavaScriptUnit cu= getCompilationUnit("PX", "src", "", "X.js"); -// -// String str = cu.getSource(); -// String completeBehind = "XX"; -// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); -// cu.codeComplete(cursorLocation, requestor); -// -// assertResults( -// "XX11[TYPE_REF]{x.y.z.p11.XX11, x.y.z.p11, Lx.y.z.p11.XX11;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + -// "XX21[TYPE_REF]{x.y.z.p21.XX21, x.y.z.p21, Lx.y.z.p21.XX21;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + -// "XX22[TYPE_REF]{x.y.z.p22.XX22, x.y.z.p22, Lx.y.z.p22.XX22;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + -// "XX32[TYPE_REF]{x.y.z.p32.XX32, x.y.z.p32, Lx.y.z.p32.XX32;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", -// requestor.getResults()); -// } finally { -// this.deleteProject("P1"); -// this.deleteProject("P2"); -// this.deleteProject("P3"); -// this.deleteProject("PX"); -// JavaScriptCore.setOptions(oldOptions); -// } -//} -//public void testAccessRestriction12() throws Exception { -// Hashtable oldOptions = JavaScriptCore.getOptions(); -// try { -// Hashtable options = new Hashtable(oldOptions); -// options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.ERROR); -// options.put(JavaScriptCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaScriptCore.DISABLED); -// options.put(JavaScriptCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaScriptCore.DISABLED); -// JavaScriptCore.setOptions(options); -// -// // create variable -//// JavaScriptCore.setClasspathVariables( -//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, -//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, -//// null); -// -// // create P1 -// this.createJavaProject( -// "P1", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// "bin"); -// -// this.createFolder("/P1/src/p11"); -// this.createFile( -// "/P1/src/p11/XX11.js", -// "package p11;\n"+ -// "public class XX11 {\n"+ -// "}"); -// -// this.createFolder("/P1/src/p12"); -// this.createFile( -// "/P1/src/p12/XX12.js", -// "package p12;\n"+ -// "public class XX12 {\n"+ -// "}"); -// -// // create P2 -// this.createJavaProject( -// "P2", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// null, -// null, -// new String[]{"/P3", "/P1"}, -// new String[][]{{}, {}}, -// new String[][]{{"p31/*"}, {"p11/*"}}, -// new boolean[]{true, true}, -// "bin", -// null, -// null, -// null, -// "1.4"); -// -// this.createFolder("/P2/src/p21"); -// this.createFile( -// "/P2/src/p21/XX21.js", -// "package p21;\n"+ -// "public class XX21 {\n"+ -// "}"); -// -// this.createFolder("/P2/src/p22"); -// this.createFile( -// "/P2/src/p22/XX22.js", -// "package p22;\n"+ -// "public class XX22 {\n"+ -// "}"); -// -// // create P3 -// this.createJavaProject( -// "P3", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// null, -// null, -// new String[]{"/P1"}, -// new String[][]{{}}, -// new String[][]{{"p12/*"}}, -// new boolean[]{true}, -// "bin", -// null, -// null, -// null, -// "1.4"); -// -// this.createFolder("/P3/src/p31"); -// this.createFile( -// "/P3/src/p31/XX31.js", -// "package p31;\n"+ -// "public class XX31 {\n"+ -// "}"); -// -// this.createFolder("/P3/src/p32"); -// this.createFile( -// "/P3/src/p32/XX32.js", -// "package p32;\n"+ -// "public class XX32 {\n"+ -// "}"); -// -// // create PX -// this.createJavaProject( -// "PX", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// null, -// null, -// new String[]{"/P2"}, -// null, -// null, -// new boolean[]{false}, -// "bin", -// null, -// null, -// null, -// "1.4"); -// -// this.createFile( -// "/PX/src/X.js", -// "public class X {\n"+ -// " void foo() {\n"+ -// " XX\n"+ -// " }\n"+ -// "}"); -// -// waitUntilIndexesReady(); -// -// // do completion -// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); -// IJavaScriptUnit cu= getCompilationUnit("PX", "src", "", "X.js"); -// -// String str = cu.getSource(); -// String completeBehind = "XX"; -// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); -// cu.codeComplete(cursorLocation, requestor); -// -// assertResults( -// "XX12[TYPE_REF]{p12.XX12, p12, Lp12.XX12;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE) + "}\n" + -// "XX31[TYPE_REF]{p31.XX31, p31, Lp31.XX31;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE) + "}\n" + -// "XX11[TYPE_REF]{p11.XX11, p11, Lp11.XX11;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + -// "XX21[TYPE_REF]{p21.XX21, p21, Lp21.XX21;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + -// "XX22[TYPE_REF]{p22.XX22, p22, Lp22.XX22;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + -// "XX32[TYPE_REF]{p32.XX32, p32, Lp32.XX32;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", -// requestor.getResults()); -// } finally { -// this.deleteProject("P1"); -// this.deleteProject("P2"); -// this.deleteProject("P3"); -// this.deleteProject("PX"); -// JavaScriptCore.setOptions(oldOptions); -// } -//} -//public void testAccessRestriction13() throws Exception { -// Hashtable oldOptions = JavaScriptCore.getOptions(); -// try { -// Hashtable options = new Hashtable(oldOptions); -// options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.WARNING); -// options.put(JavaScriptCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaScriptCore.ENABLED); -// options.put(JavaScriptCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaScriptCore.DISABLED); -// JavaScriptCore.setOptions(options); -// -// // create variable -//// JavaScriptCore.setClasspathVariables( -//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, -//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, -//// null); -// -// // create P1 -// this.createJavaProject( -// "P1", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// "bin"); -// -// this.createFolder("/P1/src/a"); -// this.createFile( -// "/P1/src/a/XX1.js", -// "package a;\n"+ -// "public class XX1 {\n"+ -// "}"); -// -// this.createFolder("/P1/src/b"); -// this.createFile( -// "/P1/src/b/XX2.js", -// "package b;\n"+ -// "public class XX2 {\n"+ -// "}"); -// -// // create P2 -// this.createJavaProject( -// "P2", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// null, -// null, -// new String[]{"/P1"}, -// new String[][]{{}}, -// new String[][]{{"a/*"}}, -// new boolean[]{false}, -// "bin", -// null, -// null, -// null, -// "1.4"); -// this.createFile( -// "/P2/src/YY.js", -// "public class YY {\n"+ -// " void foo() {\n"+ -// " XX\n"+ -// " }\n"+ -// "}"); -// -// waitUntilIndexesReady(); -// -// // do completion -// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); -// IJavaScriptUnit cu= getCompilationUnit("P2", "src", "", "YY.js"); -// -// String str = cu.getSource(); -// String completeBehind = "XX"; -// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); -// cu.codeComplete(cursorLocation, requestor); -// -// assertResults( -// "XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", -// requestor.getResults()); -// } finally { -// this.deleteProject("P1"); -// this.deleteProject("P2"); -// JavaScriptCore.setOptions(oldOptions); -// } -//} -//public void testAccessRestriction14() throws Exception { -// Hashtable oldOptions = JavaScriptCore.getOptions(); -// try { -// Hashtable options = new Hashtable(oldOptions); -// options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.WARNING); -// options.put(JavaScriptCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaScriptCore.ENABLED); -// options.put(JavaScriptCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaScriptCore.ENABLED); -// JavaScriptCore.setOptions(options); -// -// // create variable -//// JavaScriptCore.setClasspathVariables( -//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, -//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, -//// null); -// -// // create P1 -// this.createJavaProject( -// "P1", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// "bin"); -// -// this.createFolder("/P1/src/a"); -// this.createFile( -// "/P1/src/a/XX1.js", -// "package a;\n"+ -// "public class XX1 {\n"+ -// "}"); -// -// this.createFolder("/P1/src/b"); -// this.createFile( -// "/P1/src/b/XX2.js", -// "package b;\n"+ -// "public class XX2 {\n"+ -// "}"); -// -// // create P2 -// this.createJavaProject( -// "P2", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// null, -// null, -// new String[]{"/P1"}, -// new String[][]{{}}, -// new String[][]{{"a/*"}}, -// new boolean[]{false}, -// "bin", -// null, -// null, -// null, -// "1.4"); -// this.createFile( -// "/P2/src/YY.js", -// "public class YY {\n"+ -// " void foo() {\n"+ -// " XX\n"+ -// " }\n"+ -// "}"); -// -// waitUntilIndexesReady(); -// -// // do completion -// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); -// IJavaScriptUnit cu= getCompilationUnit("P2", "src", "", "YY.js"); -// -// String str = cu.getSource(); -// String completeBehind = "XX"; -// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); -// cu.codeComplete(cursorLocation, requestor); -// -// assertResults( -// "XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", -// requestor.getResults()); -// } finally { -// this.deleteProject("P1"); -// this.deleteProject("P2"); -// JavaScriptCore.setOptions(oldOptions); -// } -//} -//public void testAccessRestrictionX() throws Exception { -// Hashtable oldOptions = JavaScriptCore.getOptions(); -// try { -// Hashtable options = new Hashtable(oldOptions); -// options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.ERROR); -// options.put(JavaScriptCore.CODEASSIST_RESTRICTIONS_CHECK, JavaScriptCore.DISABLED); -// JavaScriptCore.setOptions(options); -// -// // create variable -// JavaScriptCore.setClasspathVariables( -// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, -// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, -// null); -// -// // create P1 -// this.createJavaProject( -// "P1", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// "bin"); -// -// this.createFolder("/P1/src/a"); -// this.createFile( -// "/P1/src/a/XX1.js", -// "package a;\n"+ -// "public class XX1 {\n"+ -// " public void foo() {\n"+ -// " }\n"+ -// "}"); -// -// // create P2 -// this.createJavaProject( -// "P2", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// null, -// null, -// new String[]{"/P1"}, -// new String[][]{{}}, -// new String[][]{{"a/*"}}, -// new boolean[]{false}, -// "bin", -// null, -// null, -// null, -// "1.4"); -// this.createFile( -// "/P2/src/YY.js", -// "public class YY {\n"+ -// " void foo() {\n"+ -// " a.XX1 x;\n"+ -// " x.fo\n"+ -// " }\n"+ -// "}"); -// -// waitUntilIndexesReady(); -// -// // do completion -// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); -// IJavaScriptUnit cu= getCompilationUnit("P2", "src", "", "YY.js"); -// -// String str = cu.getSource(); -// String completeBehind = "x.fo"; -// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); -// cu.codeComplete(cursorLocation, requestor); -// -// assertResults( -// "foo[FUNCTION_REF]{foo(), La.XX1;, ()V, foo, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC) + "}", -// requestor.getResults()); -// } finally { -// this.deleteProject("P1"); -// this.deleteProject("P2"); -// JavaScriptCore.setOptions(oldOptions); -// } -//} -//public void testBug96950() throws Exception { -// try { -// // create variable -//// JavaScriptCore.setClasspathVariables( -//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, -//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, -//// null); -// -// // create P1 -// this.createJavaProject( -// "P1", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// "bin"); -// this.createFile( -// "/P1/src/Taratata.js", -// "public class Taratata {\n"+ -// "}"); -// -// // create P2 -// this.createJavaProject( -// "P2", -// new String[]{"src"}, -// new String[]{"JCL_LIB"}, -// null, -// null, -// new String[]{"/P1"}, -// new String[][]{{}}, -// new String[][]{{"**/*"}}, -// new boolean[]{false}, -// "bin", -// null, -// null, -// null, -// "1.4"); -// this.createFile( -// "/P2/src/BreakRules.js", -// "public class BreakRules {\n"+ -// " Tara\n"+ -// "}"); -// -// waitUntilIndexesReady(); -// -// // do completion -// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); -// IJavaScriptUnit cu= getCompilationUnit("P2", "src", "", "BreakRules.js"); -// -// String str = cu.getSource(); -// String completeBehind = "Tara"; -// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); -// cu.codeComplete(cursorLocation, requestor); -// -// assertResults( -// "Tara[POTENTIAL_METHOD_DECLARATION]{Tara, LBreakRules;, ()V, Tara, "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}", -// requestor.getResults()); -// } finally { -// this.deleteProject("P1"); -// this.deleteProject("P2"); -// } -//} -/** - * @bug 162621: [model][delta] Validation errors do not clear after replacing jar file - * @test Ensures that changing an internal jar and refreshing takes the change into account - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=162621" - */ -//public void testChangeInternalJar() throws CoreException, IOException { -// -// -// IJavaScriptProject p = this.createJavaProject( -// "P1", -// new String[]{"/"}, -// new String[]{}, -// ""); -// -// -// -// -// try { -// // Create jar file with a class with 2 methods doXXX -// String[] pathAndContents = new String[] { -// "pack/Util.js", -// "package pack;\n" + -// "public class Util {\n" + -// " public void doit2A(int x, int y) { }\n" + -// " public void doit2B(int x) { }\n" + -// "}\n" -// }; -// addLibrary(jarName, "b162621_src.zip", pathAndContents, JavaScriptCore.VERSION_1_4); -// -// // Wait a little bit to be sure file system is aware of zip file creation -// try { -// Thread.sleep(1000); -// } -// catch (InterruptedException ie) { -// // skip -// } -// -// // Create compilation unit in which completion occurs -// String path = "/Completion/src/test/Test.js"; -// String source = "package test;\n" + -// "import pack.*;\n" + -// "public class Test {\n" + -// " public void foo() {\n" + -// " Util test = new Util();\n" + -// " test.doit2A(1, 2);\n" + -// " }\n" + -// "}\n"; -// createFolder("/Completion/src/test"); -// createFile(path, source); -// -// // first completion -// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); -// IJavaScriptUnit unit = getCompilationUnit(path); -// String completeBehind = "test.do"; -// int cursorLocation = source.lastIndexOf(completeBehind) + completeBehind.length(); -// unit.codeComplete(cursorLocation, requestor); -// assertResults( -// "doit2A[FUNCTION_REF]{doit2A, Lpack.Util;, (II)V, doit2A, "+(R_DEFAULT + R_CASE + R_INTERESTING + R_NON_RESTRICTED + R_NON_STATIC) + "}\n" + -// "doit2B[FUNCTION_REF]{doit2B, Lpack.Util;, (I)V, doit2B, "+(R_DEFAULT + R_CASE + R_INTERESTING + R_NON_RESTRICTED + R_NON_STATIC) + "}", -// requestor.getResults()); -// -// // change class file to add a third doXXX method and refresh -// String projectLocation = this.currentProject.getProject().getLocation().toOSString(); -// String jarPath = projectLocation + File.separator + jarName; -// org.eclipse.wst.jsdt.core.tests.util.Util.createJar(new String[] { -// "pack/Util.js", -// "package pack;\n" + -// "public class Util {\n" + -// " public void doit2A(int x, int y) { }\n" + -// " public void doit2B(int x) { }\n" + -// " public void doit2C(int x) { }\n" + -// "}\n" -// }, jarPath, "1.4"); -// this.currentProject.getProject().refreshLocal(IResource.DEPTH_INFINITE, null); -// -// try { -// Thread.sleep(1000); -// } -// catch (InterruptedException ie) { -// // skip -// } -// -// // second completion -// requestor = new CompletionTestsRequestor2(); -// unit.codeComplete(cursorLocation, requestor); -// assertResults( -// "doit2A[FUNCTION_REF]{doit2A, Lpack.Util;, (II)V, doit2A, "+(R_DEFAULT + R_CASE + R_INTERESTING + R_NON_RESTRICTED + R_NON_STATIC) + "}\n" + -// "doit2B[FUNCTION_REF]{doit2B, Lpack.Util;, (I)V, doit2B, "+(R_DEFAULT + R_CASE + R_INTERESTING + R_NON_RESTRICTED + R_NON_STATIC) + "}\n" + -// "doit2C[FUNCTION_REF]{doit2C, Lpack.Util;, (I)V, doit2C, "+(R_DEFAULT + R_CASE + R_INTERESTING + R_NON_RESTRICTED + R_NON_STATIC) + "}", -// requestor.getResults()); -// } finally { -// removeLibraryEntry(this.currentProject, new Path(jarName)); -// deleteFile(new File(jarName)); -// } -//} -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionTestsRequestor.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionTestsRequestor.java deleted file mode 100644 index 17ec125..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionTestsRequestor.java +++ /dev/null @@ -1,193 +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.Vector; - -import org.eclipse.wst.jsdt.core.CompletionProposal; -import org.eclipse.wst.jsdt.core.CompletionRequestor; -import org.eclipse.wst.jsdt.core.Signature; - -public class CompletionTestsRequestor extends CompletionRequestor { - private Vector fElements = new Vector(); - private Vector fCompletions = new Vector(); - private Vector fRelevances = new Vector(); - private Vector fCompletionStart = new Vector(); - private Vector fCompletionEnd = new Vector(); - - public boolean fDebug = false; - - private void acceptCommon(CompletionProposal proposal) { - fCompletions.addElement(new String(proposal.getCompletion())); - fRelevances.addElement(String.valueOf(proposal.getRelevance())); - fCompletionStart.addElement(String.valueOf(proposal.getReplaceStart())); - fCompletionEnd.addElement(String.valueOf(proposal.getReplaceEnd())); - } - public void accept(CompletionProposal proposal) { - char[] typeName = null; - switch(proposal.getKind()) { - case CompletionProposal.ANONYMOUS_CLASS_DECLARATION : - typeName = Signature.getSignatureSimpleName(proposal.getDeclarationSignature()); - fElements.addElement(new String(typeName)); - this.acceptCommon(proposal); - if (fDebug) - System.out.println("anonymous type " + new String(typeName)); - break; - - case CompletionProposal.TYPE_REF : - typeName = Signature.getSignatureSimpleName(proposal.getSignature()); - fElements.addElement(new String(typeName)); - this.acceptCommon(proposal); - if (fDebug) { - System.out.println("Class " + new String(typeName)); - } - break; - - case CompletionProposal.FIELD_REF : - fElements.addElement(new String(proposal.getName())); - this.acceptCommon(proposal); - if (fDebug) - System.out.println("Field " + new String(proposal.getName())); - break; - - case CompletionProposal.KEYWORD: - fElements.addElement(new String(proposal.getName())); - this.acceptCommon(proposal); - if (fDebug) - System.out.println("Keyword " + new String(proposal.getName())); - break; - - case CompletionProposal.LABEL_REF: - fElements.addElement(new String(proposal.getName())); - this.acceptCommon(proposal); - if (fDebug) - System.out.println("Label " + new String(proposal.getName())); - break; - - case CompletionProposal.LOCAL_VARIABLE_REF: - fElements.addElement(new String(proposal.getName())); - this.acceptCommon(proposal); - if (fDebug) - System.out.println("Local variable " + new String(proposal.getName())); - break; - - case CompletionProposal.METHOD_REF: - fElements.addElement(new String(proposal.getName())); - this.acceptCommon(proposal); - if (fDebug) - System.out.println("method " + new String(proposal.getName())); - break; - - case CompletionProposal.METHOD_DECLARATION: - fElements.addElement(new String(proposal.getName())); - this.acceptCommon(proposal); - if (fDebug) - System.out.println("method declaration " + new String(proposal.getName())); - break; - - case CompletionProposal.PACKAGE_REF: - fElements.addElement(new String(proposal.getDeclarationSignature())); - this.acceptCommon(proposal); - if (fDebug) - System.out.println("package " + new String(proposal.getDeclarationSignature())); - break; - - case CompletionProposal.VARIABLE_DECLARATION: - fElements.addElement(new String(proposal.getName())); - this.acceptCommon(proposal); - if (fDebug) - System.out.println("variable name " + new String(proposal.getName())); - break; - } - - } - - public String getResults() { - return getResults(true, false); - } - - public String getResultsWithPosition(){ - return getResults(true, true); - } - - public String getResults(boolean relevance, boolean position) { - StringBuffer result = new StringBuffer(); - int size = fElements.size(); - - if (size == 1) { - result.append(getResult(0, relevance, position)); - } else if (size > 1) { - String[] sortedBucket = new String[size]; - for (int i = 0; i < size; i++) { - sortedBucket[i] = getResult(i, relevance, position); - } - quickSort(sortedBucket, 0, size - 1); - for (int j = 0; j < sortedBucket.length; j++) { - if (result.length() > 0) result.append("\n"); - result.append(sortedBucket[j]); - } - } - - return result.toString(); - } - - private String getResult(int i, boolean relevance, boolean position) { - if(i < 0 || i >= fElements.size()) - return ""; - - StringBuffer buffer = new StringBuffer(); - buffer.append("element:"); - buffer.append(fElements.elementAt(i)); - buffer.append(" completion:"); - buffer.append(fCompletions.elementAt(i)); - if(position) { - buffer.append(" position:["); - buffer.append(fCompletionStart.elementAt(i)); - buffer.append(","); - buffer.append(fCompletionEnd.elementAt(i)); - buffer.append("]"); - } - if(relevance) { - buffer.append(" relevance:"); - buffer.append(fRelevances.elementAt(i)); - } - return buffer.toString(); - } - - protected String[] quickSort(String[] collection, int left, int right) { - int original_left = left; - int original_right = right; - String mid = collection[ (left + right) / 2]; - do { - while (mid.compareTo(collection[left]) > 0) - // s[left] >= mid - left++; - while (mid.compareTo(collection[right]) < 0) - // s[right] <= mid - right--; - if (left <= right) { - String tmp = collection[left]; - collection[left] = collection[right]; - collection[right] = tmp; - left++; - right--; - } - } while (left <= right); - if (original_left < right) - collection = quickSort(collection, original_left, right); - if (left < original_right) - collection = quickSort(collection, left, original_right); - return collection; - } - public String toString() { - return getResults(); - } -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionTestsRequestor2.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionTestsRequestor2.java deleted file mode 100644 index 158c21d..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionTestsRequestor2.java +++ /dev/null @@ -1,446 +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.model; - -import java.util.Arrays; -import java.util.Comparator; - -import org.eclipse.wst.jsdt.core.CompletionContext; -import org.eclipse.wst.jsdt.core.CompletionProposal; -import org.eclipse.wst.jsdt.core.CompletionRequestor; -import org.eclipse.wst.jsdt.core.Signature; -import org.eclipse.wst.jsdt.core.compiler.IProblem; - -public class CompletionTestsRequestor2 extends CompletionRequestor { - private final char[] NULL_LITERAL = "null".toCharArray();//$NON-NLS-1$ - - private CompletionContext context; - public int proposalsPtr = -1; - private final static int PROPOSALS_INCREMENT = 10; - private CompletionProposal[] proposals = new CompletionProposal[PROPOSALS_INCREMENT]; - private IProblem problem; - - private boolean showParameterNames; - private boolean showUniqueKeys; - private boolean showPositions; - private boolean shortContext; - private boolean showMissingTypes; - - public boolean fDebug = false; - - public CompletionTestsRequestor2() { - this(false, false); - } - public CompletionTestsRequestor2(boolean showParamNames) { - this(showParamNames, false, false); - } - public CompletionTestsRequestor2(boolean showParamNames, boolean showUniqueKeys) { - this(showParamNames, showUniqueKeys, false); - } - public CompletionTestsRequestor2(boolean showParamNames, boolean showUniqueKeys, boolean showPositions) { - this(showParamNames, showUniqueKeys, showPositions, true, false); - } - - public CompletionTestsRequestor2(boolean showParamNames, boolean showUniqueKeys, boolean showPositions, boolean shortContext) { - this(showParamNames, showUniqueKeys, showPositions, shortContext, false); - } - public CompletionTestsRequestor2(boolean showParamNames, boolean showUniqueKeys, boolean showPositions, boolean shortContext, boolean showMissingTypes) { - this.showParameterNames = showParamNames; - this.showUniqueKeys = showUniqueKeys; - this.showPositions = showPositions; - this.shortContext = shortContext; - this.showMissingTypes = showMissingTypes; - } - public void acceptContext(CompletionContext cc) { - this.context = cc; - } - public void accept(CompletionProposal proposal) { - int length = this.proposals.length; - if (++this.proposalsPtr== length) { - System.arraycopy(this.proposals, 0, this.proposals = new CompletionProposal[length+PROPOSALS_INCREMENT], 0, length); - } - this.proposals[this.proposalsPtr] = proposal; - } - - public void allowAllRequiredProposals() { - for (int i = CompletionProposal.ANONYMOUS_CLASS_DECLARATION; i <= CompletionProposal.TYPE_IMPORT; i++) { - for (int j = CompletionProposal.ANONYMOUS_CLASS_DECLARATION; j <= CompletionProposal.TYPE_IMPORT; j++) { - this.setAllowsRequiredProposals(i, j, true); - } - } - } - - public void completionFailure(IProblem p) { - this.problem = p; - } - - public String getContext() { - if(this.context == null) return ""; - - StringBuffer buffer = new StringBuffer(); - - if(!this.shortContext) { - buffer.append("completion offset="); - buffer.append(context.getOffset()); - buffer.append('\n'); - - buffer.append("completion range=["); - buffer.append(context.getTokenStart()); - buffer.append(", "); - buffer.append(context.getTokenEnd()); - buffer.append("]\n"); - - char[] token = context.getToken(); - buffer.append("completion token="); - if(token == null) { - buffer.append("null"); - } else { - buffer.append('\"'); - buffer.append(token); - buffer.append('\"'); - } - buffer.append('\n'); - - buffer.append("completion token kind="); - int tokenKind = context.getTokenKind(); - if(tokenKind == CompletionContext.TOKEN_KIND_STRING_LITERAL) { - buffer.append("TOKEN_KIND_STRING_LITERAL"); - } else if(tokenKind == CompletionContext.TOKEN_KIND_NAME) { - buffer.append("TOKEN_KIND_NAME"); - } else { - buffer.append("TOKEN_KIND_UNKNOWN"); - } - buffer.append('\n'); - } - char[][] expectedTypesSignatures = this.context.getExpectedTypesSignatures(); - buffer.append("expectedTypesSignatures="); - if(expectedTypesSignatures == null) { - buffer.append(NULL_LITERAL); - } else { - buffer.append('{'); - for (int i = 0; i < expectedTypesSignatures.length; i++) { - if(i > 0) buffer.append(','); - buffer.append(expectedTypesSignatures[i]); - - } - buffer.append('}'); - } - buffer.append('\n'); - - char[][] expectedTypesKeys = this.context.getExpectedTypesKeys(); - buffer.append("expectedTypesKeys="); - if(expectedTypesSignatures == null) { - buffer.append(NULL_LITERAL); - } else { - buffer.append('{'); - for (int i = 0; i < expectedTypesKeys.length; i++) { - if(i > 0) buffer.append(','); - buffer.append(expectedTypesKeys[i]); - - } - buffer.append('}'); - } - //buffer.append('\n'); - - - return buffer.toString(); - } - public String getProblem() { - return this.problem == null ? "" : this.problem.getMessage(); - } - - /* - * Get sorted results in ascending order - */ - public String getResults() { - if(this.proposalsPtr < 0) return ""; - quickSort(this.proposals, 0, this.proposalsPtr); - return getResultsWithoutSorting(); - } - - /* - * Get sorted results in ascending order - */ - public String getReversedResults() { - if(this.proposalsPtr < 0) return ""; - Arrays.sort(this.proposals, new Comparator() { - public int compare(Object o1, Object o2) { - if (o1 instanceof CompletionProposal && o2 instanceof CompletionProposal) { - CompletionProposal p1 = (CompletionProposal) o1; - CompletionProposal p2 = (CompletionProposal) o2; - int relDif = p2.getRelevance() - p1.getRelevance(); - if(relDif != 0) return relDif; - String name1 = getElementName(p1); - String name2 = getElementName(p2); - return name1.compareTo(name2); - } - return -1; - } - }); - return getResultsWithoutSorting(); - } - - /* - * Get unsorted results (ie. same order as they were accepted by requestor) - */ - public String getResultsWithoutSorting() { - if(this.proposalsPtr < 0) return ""; - StringBuffer buffer = printProposal(this.proposals[0]); - for(int i = 1; i <=this.proposalsPtr; i++) { - if(i > 0) buffer.append('\n'); - buffer.append(printProposal(this.proposals[i])); - } - return buffer.toString(); - } - public String[] getStringsResult() { - if(this.proposalsPtr < 0) { - return new String[0]; - } - String[] strings = new String[this.proposalsPtr+1]; - for (int i=0; i<=this.proposalsPtr; i++) { - strings[i] = printProposal(this.proposals[i]).toString(); - } - return strings; - } - - protected StringBuffer printProposal(CompletionProposal proposal) { - StringBuffer buffer = new StringBuffer(); - return printProposal(proposal, 0, buffer); - } - - protected StringBuffer printProposal(CompletionProposal proposal, int tab, StringBuffer buffer) { - for (int i = 0; i < tab; i++) { - buffer.append(" "); //$NON-NLS-1$ - } - buffer.append(getElementName(proposal)); - buffer.append('['); - switch(proposal.getKind()) { - case CompletionProposal.ANONYMOUS_CLASS_DECLARATION : - buffer.append("ANONYMOUS_CLASS_DECLARATION"); //$NON-NLS-1$ - break; - case CompletionProposal.FIELD_REF : - buffer.append("FIELD_REF"); //$NON-NLS-1$ - break; - case CompletionProposal.KEYWORD : - buffer.append("KEYWORD"); //$NON-NLS-1$ - break; - case CompletionProposal.LABEL_REF : - buffer.append("LABEL_REF"); //$NON-NLS-1$ - break; - case CompletionProposal.LOCAL_VARIABLE_REF : - buffer.append("LOCAL_VARIABLE_REF"); //$NON-NLS-1$ - break; - case CompletionProposal.METHOD_DECLARATION : - buffer.append("FUNCTION_DECLARATION"); //$NON-NLS-1$ - if(proposal.isConstructor()) { - buffer.append(""); //$NON-NLS-1$ - } - break; - case CompletionProposal.METHOD_REF : - buffer.append("FUNCTION_REF"); //$NON-NLS-1$ - if(proposal.isConstructor()) { - buffer.append(""); //$NON-NLS-1$ - } - break; - case CompletionProposal.PACKAGE_REF : - buffer.append("PACKAGE_REF"); //$NON-NLS-1$ - break; - case CompletionProposal.TYPE_REF : - buffer.append("TYPE_REF"); //$NON-NLS-1$ - break; - case CompletionProposal.VARIABLE_DECLARATION : - buffer.append("VARIABLE_DECLARATION"); //$NON-NLS-1$ - break; - case CompletionProposal.POTENTIAL_METHOD_DECLARATION : - buffer.append("POTENTIAL_METHOD_DECLARATION"); //$NON-NLS-1$ - break; - case CompletionProposal.METHOD_NAME_REFERENCE : - buffer.append("METHOD_IMPORT"); //$NON-NLS-1$ - break; - case CompletionProposal.JSDOC_BLOCK_TAG : - buffer.append("JSDOC_BLOCK_TAG"); //$NON-NLS-1$ - break; - case CompletionProposal.JSDOC_INLINE_TAG : - buffer.append("JSDOC_INLINE_TAG"); //$NON-NLS-1$ - break; - case CompletionProposal.JSDOC_FIELD_REF: - buffer.append("JSDOC_FIELD_REF"); //$NON-NLS-1$ - break; - case CompletionProposal.JSDOC_METHOD_REF : - buffer.append("JSDOC_METHOD_REF"); //$NON-NLS-1$ - break; - case CompletionProposal.JSDOC_TYPE_REF : - buffer.append("JSDOC_TYPE_REF"); //$NON-NLS-1$ - break; - case CompletionProposal.JSDOC_PARAM_REF : - buffer.append("JSDOC_PARAM_REF"); //$NON-NLS-1$ - break; - case CompletionProposal.FIELD_IMPORT : - buffer.append("FIELD_IMPORT"); //$NON-NLS-1$ - break; - case CompletionProposal.METHOD_IMPORT : - buffer.append("METHOD_IMPORT"); //$NON-NLS-1$ - break; - case CompletionProposal.TYPE_IMPORT : - buffer.append("TYPE_IMPORT"); //$NON-NLS-1$ - break; - default : - buffer.append("PROPOSAL"); //$NON-NLS-1$ - break; - - } - buffer.append("]{"); - buffer.append(proposal.getCompletion() == null ? NULL_LITERAL : proposal.getCompletion()); - buffer.append(", "); - buffer.append(proposal.getDeclarationSignature() == null ? NULL_LITERAL : proposal.getDeclarationSignature()); - buffer.append(", "); - buffer.append(proposal.getSignature() == null ? NULL_LITERAL : proposal.getSignature()); - if(this.showUniqueKeys) { - buffer.append(", "); - buffer.append(proposal.getDeclarationKey() == null ? NULL_LITERAL : proposal.getDeclarationKey()); - buffer.append(", "); - buffer.append(proposal.getKey() == null ? NULL_LITERAL : proposal.getKey()); - } - buffer.append(", "); - buffer.append(proposal.getName() == null ? NULL_LITERAL : proposal.getName()); - if(this.showParameterNames) { - char[][] parameterNames = proposal.findParameterNames(null); - buffer.append(", "); - if(parameterNames == null || parameterNames.length <= 0) { - buffer.append(NULL_LITERAL); - } else { - buffer.append("("); - for (int i = 0; i < parameterNames.length; i++) { - if(i > 0) buffer.append(", "); - buffer.append(parameterNames[i]); - } - buffer.append(")"); - } - } - if(this.showPositions) { - buffer.append(", ["); - buffer.append(proposal.getReplaceStart()); - buffer.append(", "); - buffer.append(proposal.getReplaceEnd()); - buffer.append("]"); - } - buffer.append(", "); - buffer.append(proposal.getRelevance()); - buffer.append('}'); - if(this.showMissingTypes) { - CompletionProposal[] requiredProposals = proposal.getRequiredProposals(); - if (requiredProposals != null) { - int length = requiredProposals.length; - System.arraycopy(requiredProposals, 0, requiredProposals = new CompletionProposal[length], 0, length); - quickSort(requiredProposals, 0, length - 1); - for (int i = 0; i < length; i++) { - buffer.append('\n'); - printProposal(requiredProposals[i], tab + 1, buffer); - } - } - } - return buffer; - } - - protected CompletionProposal[] quickSort(CompletionProposal[] collection, int left, int right) { - int original_left = left; - int original_right = right; - CompletionProposal mid = collection[ (left + right) / 2]; - do { - while (compare(mid, collection[left]) > 0) - // s[left] >= mid - left++; - while (compare(mid, collection[right]) < 0) - // s[right] <= mid - right--; - if (left <= right) { - CompletionProposal tmp = collection[left]; - collection[left] = collection[right]; - collection[right] = tmp; - left++; - right--; - } - } while (left <= right); - if (original_left < right) - collection = quickSort(collection, original_left, right); - if (left < original_right) - collection = quickSort(collection, left, original_right); - return collection; - } - - protected int compare(CompletionProposal proposal1, CompletionProposal proposal2) { - int relDif = proposal1.getRelevance() - proposal2.getRelevance(); - if(relDif != 0) return relDif; - String name1 = getElementName(proposal1); - String name2 = getElementName(proposal2); - int nameDif = name1.compareTo(name2); - if(nameDif != 0) return nameDif; - int kindDif = proposal1.getKind() - proposal2.getKind(); - if(kindDif != 0) return kindDif; - String completion1 = new String(proposal1.getCompletion()); - String completion2 = new String(proposal2.getCompletion()); - int completionDif = completion1.compareTo(completion2); - if(completionDif != 0) return completionDif; - char[] temp = proposal1.getSignature(); - String signature1 = temp == null ? null: new String(temp); - temp = proposal2.getSignature(); - String signature2 = temp == null ? null: new String(temp); - int signatureDif = 0; - if(signature1 != null && signature2 != null) { - signatureDif = signature1.compareTo(signature2); - } - if(signatureDif != 0) return signatureDif; - temp = proposal1.getDeclarationSignature(); - String declarationSignature1 = temp == null ? null: new String(temp); - temp = proposal2.getDeclarationSignature(); - String declarationSignature2 = temp == null ? null: new String(temp); - int declarationSignatureDif = 0; - if(declarationSignature1 != null && declarationSignature2 != null) { - declarationSignatureDif = declarationSignature1.compareTo(declarationSignature2); - } - if(declarationSignatureDif != 0) return declarationSignatureDif; - return 0; - } - - protected String getElementName(CompletionProposal proposal) { - switch(proposal.getKind()) { - case CompletionProposal.ANONYMOUS_CLASS_DECLARATION : - return new String(Signature.getSignatureSimpleName(proposal.getDeclarationSignature())); - case CompletionProposal.TYPE_REF : - case CompletionProposal.TYPE_IMPORT : - case CompletionProposal.JSDOC_TYPE_REF : - return new String(Signature.getSignatureSimpleName(proposal.getSignature())); - case CompletionProposal.FIELD_REF : - case CompletionProposal.KEYWORD: - case CompletionProposal.LABEL_REF: - case CompletionProposal.LOCAL_VARIABLE_REF: - case CompletionProposal.METHOD_REF: - case CompletionProposal.METHOD_DECLARATION: - case CompletionProposal.VARIABLE_DECLARATION: - case CompletionProposal.POTENTIAL_METHOD_DECLARATION: - case CompletionProposal.METHOD_NAME_REFERENCE: - case CompletionProposal.JSDOC_BLOCK_TAG : - case CompletionProposal.JSDOC_INLINE_TAG : - case CompletionProposal.JSDOC_FIELD_REF: - case CompletionProposal.JSDOC_METHOD_REF : - case CompletionProposal.JSDOC_PARAM_REF : - case CompletionProposal.FIELD_IMPORT : - case CompletionProposal.METHOD_IMPORT : - return new String(proposal.getName()); - case CompletionProposal.PACKAGE_REF: - return new String(proposal.getDeclarationSignature()); - } - return ""; - } - public String toString() { - return getResults(); - } -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionWithMissingTypesTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionWithMissingTypesTests.java deleted file mode 100644 index 28c5df6..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionWithMissingTypesTests.java +++ /dev/null @@ -1,1415 +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.util.Hashtable; - -import org.eclipse.wst.jsdt.core.*; -import org.eclipse.wst.jsdt.internal.codeassist.RelevanceConstants; - -import junit.framework.*; - -public class CompletionWithMissingTypesTests extends AbstractJavaModelCompletionTests implements RelevanceConstants { - -public CompletionWithMissingTypesTests(String name) { - super(name); -} -public void setUpSuite() throws Exception { - if (COMPLETION_PROJECT == null) { - COMPLETION_PROJECT = setUpJavaProject("Completion"); - } else { - setUpProjectCompliance(COMPLETION_PROJECT, "1.4"); - } - super.setUpSuite(); -} -public void tearDownSuite() throws Exception { - super.tearDownSuite(); -} -static { -// TESTS_NAMES = new String[] { "testZZZ"}; -} -public static Test suite() { - return buildModelTestSuite(CompletionWithMissingTypesTests.class); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0001() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " void foo() {\n" + - " MissingType m = null;\n" + - " m.b\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " public void bar() {}\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; - int start1 = str.lastIndexOf("m.b") + "m.".length(); - int end1 = start1 + "b".length(); - int start2 = str.lastIndexOf("MissingType"); - int end2 = start2 + "MissingType".length(); - assertResults( - "bar[FUNCTION_REF]{bar(), Lmissing.MissingType;, ()V, bar, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0002() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " void foo() {\n" + - " MissingType m = null;\n" + - " m.b\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " public int bar;\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; - int start1 = str.lastIndexOf("m.b") + "m.".length(); - int end1 = start1 + "b".length(); - int start2 = str.lastIndexOf("MissingType"); - int end2 = start2 + "MissingType".length(); - assertResults( - "bar[FIELD_REF]{bar, Lmissing.MissingType;, I, bar, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0003() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[3]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " void foo() {\n" + - " MissingType m = null;\n" + - " m.b\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType extends SuperType {\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/SuperType.js", - "package missing;"+ - "public class SuperType {\n" + - " public int bar;\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; - int start1 = str.lastIndexOf("m.b") + "m.".length(); - int end1 = start1 + "b".length(); - int start2 = str.lastIndexOf("MissingType"); - int end2 = start2 + "MissingType".length(); - assertResults( - "bar[FIELD_REF]{bar, Lmissing.SuperType;, I, bar, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0004() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " void foo() {\n" + - " MissingType[] m = null;\n" + - " m.\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " public void bar() {};\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m."; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_NO_PROBLEMS; - int relevance2 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; - int start1 = str.lastIndexOf("m.") + "m.".length(); - int end1 = start1; - int start2 = str.lastIndexOf("MissingType"); - int end2 = start2 + "MissingType".length(); - assertResults( - "length[FIELD_REF]{length, [Lmissing.MissingType;, I, length, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}\n" + - "clone[FUNCTION_REF]{clone(), [Lmissing.MissingType;, ()Ljava.lang.Object;, clone, null, ["+start1+", "+end1+"], " + (relevance2) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance2) + "}\n" + - "equals[FUNCTION_REF]{equals(), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), ["+start1+", "+end1+"], " + (relevance2) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance2) + "}\n" + - "finalize[FUNCTION_REF]{finalize(), Ljava.lang.Object;, ()V, finalize, null, ["+start1+", "+end1+"], " + (relevance2) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance2) + "}\n" + - "getClass[FUNCTION_REF]{getClass(), Ljava.lang.Object;, ()Ljava.lang.Class;, getClass, null, ["+start1+", "+end1+"], " + (relevance2) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance2) + "}\n" + - "hashCode[FUNCTION_REF]{hashCode(), Ljava.lang.Object;, ()I, hashCode, null, ["+start1+", "+end1+"], " + (relevance2) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance2) + "}\n" + - "notify[FUNCTION_REF]{notify(), Ljava.lang.Object;, ()V, notify, null, ["+start1+", "+end1+"], " + (relevance2) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance2) + "}\n" + - "notifyAll[FUNCTION_REF]{notifyAll(), Ljava.lang.Object;, ()V, notifyAll, null, ["+start1+", "+end1+"], " + (relevance2) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance2) + "}\n" + - "toString[FUNCTION_REF]{toString(), Ljava.lang.Object;, ()Ljava.lang.String;, toString, null, ["+start1+", "+end1+"], " + (relevance2) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance2) + "}\n" + - "wait[FUNCTION_REF]{wait(), Ljava.lang.Object;, ()V, wait, null, ["+start1+", "+end1+"], " + (relevance2) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance2) + "}\n" + - "wait[FUNCTION_REF]{wait(), Ljava.lang.Object;, (J)V, wait, (millis), ["+start1+", "+end1+"], " + (relevance2) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance2) + "}\n" + - "wait[FUNCTION_REF]{wait(), Ljava.lang.Object;, (JI)V, wait, (millis, nanos), ["+start1+", "+end1+"], " + (relevance2) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance2) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0005() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " MissingType m;\n" + - " void foo() {\n" + - " m.b\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " public void bar() {}\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; - int start1 = str.lastIndexOf("m.b") + "m.".length(); - int end1 = start1 + "b".length(); - int start2 = str.lastIndexOf("MissingType"); - int end2 = start2 + "MissingType".length(); - assertResults( - "bar[FUNCTION_REF]{bar(), Lmissing.MissingType;, ()V, bar, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0006() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " MissingType m;\n" + - " public class Test1 {\n" + - " void foo() {\n" + - " m.b\n" + - " }\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " public void bar() {}\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; - int start1 = str.lastIndexOf("m.b") + "m.".length(); - int end1 = start1 + "b".length(); - int start2 = str.lastIndexOf("MissingType"); - int end2 = start2 + "MissingType".length(); - assertResults( - "bar[FUNCTION_REF]{bar(), Lmissing.MissingType;, ()V, bar, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0007() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[3]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " MissingType m;\n" + - " public class Test1 extends test.SuperType {\n" + - " void foo() {\n" + - " m.e\n" + - " }\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " public void bar() {}\n" + - "}\n"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/test/SuperType.js", - "package test;"+ - "public class SuperType {\n" + - " public Object m;\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.e"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; - int start1 = str.lastIndexOf("m.e") + "m.".length(); - int end1 = start1 + "e".length(); - assertResults( - "equals[FUNCTION_REF]{equals(), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), ["+start1+", "+end1+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0008() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[3]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " MissingType m;\n" + - " public class Test1 extends test.SuperType {\n" + - " void foo() {\n" + - " m.b\n" + - " }\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " public void bar() {}\n" + - "}\n"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/test/SuperType.js", - "package test;"+ - "public class SuperType {\n" + - " public Object m;\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0009() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[3]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " void foo() {\n" + - " MissingType m = null;\n" + - " m.b\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " public void bar() {}\n" + - "}\n"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/missing2/MissingType.js", - "package missing2;"+ - "public class MissingType {\n" + - " public void bar() {}\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; - int start1 = str.lastIndexOf("m.b") + "m.".length(); - int end1 = start1 + "b".length(); - int start2 = str.lastIndexOf("MissingType"); - int end2 = start2 + "MissingType".length(); - assertResults( - "bar[FUNCTION_REF]{bar(), Lmissing.MissingType;, ()V, bar, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}\n" + - "bar[FUNCTION_REF]{bar(), Lmissing2.MissingType;, ()V, bar, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType[TYPE_REF]{missing2.MissingType, missing2, Lmissing2.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0010() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " void foo() {\n" + - " MissingMemberType m = null;\n" + - " m.b\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " public class MissingMemberType {\n" + - " public void bar() {}\n" + - " }\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; - int start1 = str.lastIndexOf("m.b") + "m.".length(); - int end1 = start1 + "b".length(); - int start2 = str.lastIndexOf("MissingMemberType"); - int end2 = start2 + "MissingMemberType".length(); - assertResults( - "bar[FUNCTION_REF]{bar(), Lmissing.MissingType$MissingMemberType;, ()V, bar, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType.MissingMemberType[TYPE_REF]{missing.MissingType.MissingMemberType, missing, Lmissing.MissingType$MissingMemberType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0011() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " MissingType m() {return null;}\n" + - " void foo() {\n" + - " m().b\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " public void bar() {}\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m().b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; - int start1 = str.lastIndexOf("m().b") + "m().".length(); - int end1 = start1 + "b".length(); - int start2 = str.lastIndexOf("MissingType"); - int end2 = start2 + "MissingType".length(); - assertResults( - "bar[FUNCTION_REF]{bar(), Lmissing.MissingType;, ()V, bar, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0012() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " MissingType m(int i) {return null;}\n" + - " void foo() {\n" + - " m(0).b\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " public void bar() {}\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = ".b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; - int start1 = str.lastIndexOf("m(0).b") + "m(0).".length(); - int end1 = start1 + "b".length(); - int start2 = str.lastIndexOf("MissingType"); - int end2 = start2 + "MissingType".length(); - assertResults( - "bar[FUNCTION_REF]{bar(), Lmissing.MissingType;, ()V, bar, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0013() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[3]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " MissingType m() {return null;}\n" + - " public class Inner extends missing.SuperType{\n" + - " void foo() {\n" + - " m().e\n" + - " }\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " public void bar() {}\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/SuperType.js", - "package missing;"+ - "public class SuperType {\n" + - " public Object m() {return null;}\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m().e"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; - int start1 = str.lastIndexOf("m().e") + "m().".length(); - int end1 = start1 + "e".length(); - assertResults( - "equals[FUNCTION_REF]{equals(), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), ["+start1+", "+end1+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0014() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[3]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " MissingType m() {return null;}\n" + - " public class Inner extends missing.SuperType{\n" + - " void foo() {\n" + - " m().b\n" + - " }\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " public void bar() {}\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/SuperType.js", - "package missing;"+ - "public class SuperType {\n" + - " public Object m() {return null;}\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m().b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0015() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[3]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " MissingType m() {return null;}\n" + - " public class Inner extends missing.SuperType{\n" + - " void foo() {\n" + - " m().b\n" + - " }\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " public void bar() {}\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/SuperType.js", - "package missing;"+ - "public class SuperType {\n" + - " public Object m(int i) {return null;}\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m().b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; - int start1 = str.lastIndexOf("m().b") + "m().".length(); - int end1 = start1 + "b".length(); - int start2 = str.lastIndexOf("MissingType"); - int end2 = start2 + "MissingType".length(); - assertResults( - "bar[FUNCTION_REF]{bar(), Lmissing.MissingType;, ()V, bar, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0016() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " void foo() {\n" + - " MissingType.MissingMemberType m = null;\n" + - " m.b\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " public class MissingMemberType {\n" + - " public void bar() {}\n" + - " }\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; - int start1 = str.lastIndexOf("m.b") + "m.".length(); - int end1 = start1 + "b".length(); - int start2 = str.lastIndexOf("MissingType"); - int end2 = start2 + "MissingType".length(); - assertResults( - "bar[FUNCTION_REF]{bar(), Lmissing.MissingType$MissingMemberType;, ()V, bar, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0017() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " void foo() {\n" + - " missing2.MissingType.MissingMemberType m = null;\n" + - " m.b\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing1/missing2/MissingType.js", - "package missing1.missing2;"+ - "public class MissingType {\n" + - " public class MissingMemberType {\n" + - " public void bar() {}\n" + - " }\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0018() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " void foo() {\n" + - " missing2.missing3.MissingType.MissingMemberType m = null;\n" + - " m.b\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing1/missing2/missing3/MissingType.js", - "package missing1.missing2.missing3;"+ - "public class MissingType {\n" + - " public class MissingMemberType {\n" + - " public void bar() {}\n" + - " }\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0019() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " void foo() {\n" + - " MissingType.MissingMemberType[] m = null;\n" + - " m.e\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " public class MissingMemberType {\n" + - " public void bar() {}\n" + - " }\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.e"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; - int start1 = str.lastIndexOf("m.e") + "m.".length(); - int end1 = start1 + "e".length(); - int start2 = str.lastIndexOf("MissingType"); - int end2 = start2 + "MissingType".length(); - assertResults( - "equals[FUNCTION_REF]{equals(), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0020() throws JavaScriptModelException { - this.oldOptions = JavaScriptCore.getOptions(); - - try { - Hashtable options = new Hashtable(this.oldOptions); - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, JavaScriptCore.DISABLED); - JavaScriptCore.setOptions(options); - - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n"+ - "public class Test {\n"+ - " void foo() {\n"+ - " MissingMemberType m = null;\n"+ - " m.b\n"+ - " }\n"+ - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " /** @deprecated */\n" + - " public class MissingMemberType {\n" + - " public void bar() {}\n" + - " }\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; - int start1 = str.lastIndexOf("m.b") + "m.".length(); - int end1 = start1 + "b".length(); - int start2 = str.lastIndexOf("MissingMemberType"); - int end2 = start2 + "MissingMemberType".length(); - assertResults( - "bar[FUNCTION_REF]{bar(), Lmissing.MissingType$MissingMemberType;, ()V, bar, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType.MissingMemberType[TYPE_REF]{missing.MissingType.MissingMemberType, missing, Lmissing.MissingType$MissingMemberType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); - } finally { - JavaScriptCore.setOptions(oldOptions); - } -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0021() throws JavaScriptModelException { - this.oldOptions = JavaScriptCore.getOptions(); - - try { - Hashtable options = new Hashtable(this.oldOptions); - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, JavaScriptCore.ENABLED); - JavaScriptCore.setOptions(options); - - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n"+ - "public class Test {\n"+ - " void foo() {\n"+ - " MissingMemberType m = null;\n"+ - " m.b\n"+ - " }\n"+ - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " /** @deprecated */\n" + - " public class MissingMemberType {\n" + - " public void bar() {}\n" + - " }\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "", - requestor.getResults()); - } finally { - JavaScriptCore.setOptions(oldOptions); - } -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0022() throws JavaScriptModelException { - this.oldOptions = JavaScriptCore.getOptions(); - - try { - Hashtable options = new Hashtable(this.oldOptions); - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, JavaScriptCore.DISABLED); - JavaScriptCore.setOptions(options); - - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n"+ - "public class Test {\n"+ - " void foo() {\n"+ - " MissingMemberMemberType m = null;\n"+ - " m.b\n"+ - " }\n"+ - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " /** @deprecated */\n" + - " public class MissingMemberType {\n" + - " public class MissingMemberMemberType {\n" + - " public void bar() {}\n" + - " }\n" + - " }\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; - int start1 = str.lastIndexOf("m.b") + "m.".length(); - int end1 = start1 + "b".length(); - int start2 = str.lastIndexOf("MissingMemberMemberType"); - int end2 = start2 + "MissingMemberMemberType".length(); - assertResults( - "bar[FUNCTION_REF]{bar(), Lmissing.MissingType$MissingMemberType$MissingMemberMemberType;, ()V, bar, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType.MissingMemberType.MissingMemberMemberType[TYPE_REF]{missing.MissingType.MissingMemberType.MissingMemberMemberType, missing, Lmissing.MissingType$MissingMemberType$MissingMemberMemberType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); - } finally { - JavaScriptCore.setOptions(oldOptions); - } -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0023() throws JavaScriptModelException { - this.oldOptions = JavaScriptCore.getOptions(); - - try { - Hashtable options = new Hashtable(this.oldOptions); - options.put(JavaScriptCore.CODEASSIST_DEPRECATION_CHECK, JavaScriptCore.ENABLED); - JavaScriptCore.setOptions(options); - - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n"+ - "public class Test {\n"+ - " void foo() {\n"+ - " MissingMemberMemberType m = null;\n"+ - " m.b\n"+ - " }\n"+ - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " /** @deprecated */\n" + - " public class MissingMemberType {\n" + - " public class MissingMemberMemberType {\n" + - " public void bar() {}\n" + - " }\n" + - " }\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "", - requestor.getResults()); - } finally { - JavaScriptCore.setOptions(oldOptions); - } -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void _test0024() throws JavaScriptModelException { - this.oldOptions = JavaScriptCore.getOptions(); - - try { - Hashtable options = new Hashtable(this.oldOptions); - options.put(JavaScriptCore.CODEASSIST_VISIBILITY_CHECK, JavaScriptCore.DISABLED); - JavaScriptCore.setOptions(options); - - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n"+ - "public class Test {\n"+ - " void foo() {\n"+ - " MissingMemberType m = null;\n"+ - " m.b\n"+ - " }\n"+ - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " private class MissingMemberType {\n" + - " public void bar() {}\n" + - " }\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; - int start1 = str.lastIndexOf("m.b") + "m.".length(); - int end1 = start1 + "b".length(); - int start2 = str.lastIndexOf("MissingMemberType"); - int end2 = start2 + "MissingMemberType".length(); - assertResults( - "bar[FUNCTION_REF]{bar(), Lmissing.MissingType$MissingMemberType;, ()V, bar, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType.MissingMemberType[TYPE_REF]{missing.MissingType.MissingMemberType, missing, Lmissing.MissingType$MissingMemberType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); - } finally { - JavaScriptCore.setOptions(oldOptions); - } -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0025() throws JavaScriptModelException { - this.oldOptions = JavaScriptCore.getOptions(); - - try { - Hashtable options = new Hashtable(this.oldOptions); - options.put(JavaScriptCore.CODEASSIST_VISIBILITY_CHECK, JavaScriptCore.ENABLED); - JavaScriptCore.setOptions(options); - - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n"+ - "public class Test {\n"+ - " void foo() {\n"+ - " MissingMemberType m = null;\n"+ - " m.b\n"+ - " }\n"+ - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " private class MissingMemberType {\n" + - " public void bar() {}\n" + - " }\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "", - requestor.getResults()); - } finally { - JavaScriptCore.setOptions(oldOptions); - } -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void _test0026() throws JavaScriptModelException { - this.oldOptions = JavaScriptCore.getOptions(); - - try { - Hashtable options = new Hashtable(this.oldOptions); - options.put(JavaScriptCore.CODEASSIST_VISIBILITY_CHECK, JavaScriptCore.DISABLED); - JavaScriptCore.setOptions(options); - - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n"+ - "public class Test {\n"+ - " void foo() {\n"+ - " MissingMemberMemberType m = null;\n"+ - " m.b\n"+ - " }\n"+ - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " private class MissingMemberType {\n" + - " public class MissingMemberMemberType {\n" + - " public void bar() {}\n" + - " }\n" + - " }\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; - int start1 = str.lastIndexOf("m.b") + "m.".length(); - int end1 = start1 + "b".length(); - int start2 = str.lastIndexOf("MissingMemberMemberType"); - int end2 = start2 + "MissingMemberMemberType".length(); - assertResults( - "bar[FUNCTION_REF]{bar(), Lmissing.MissingType$MissingMemberType$MissingMemberMemberType;, ()V, bar, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType.MissingMemberType.MissingMemberMemberType[TYPE_REF]{missing.MissingType.MissingMemberType.MissingMemberMemberType, missing, Lmissing.MissingType$MissingMemberType$MissingMemberMemberType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); - } finally { - JavaScriptCore.setOptions(oldOptions); - } -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0027() throws JavaScriptModelException { - this.oldOptions = JavaScriptCore.getOptions(); - - try { - Hashtable options = new Hashtable(this.oldOptions); - options.put(JavaScriptCore.CODEASSIST_VISIBILITY_CHECK, JavaScriptCore.ENABLED); - JavaScriptCore.setOptions(options); - - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;\n"+ - "public class Test {\n"+ - " void foo() {\n"+ - " MissingMemberMemberType m = null;\n"+ - " m.b\n"+ - " }\n"+ - "}"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " private class MissingMemberType {\n" + - " public class MissingMemberMemberType {\n" + - " public void bar() {}\n" + - " }\n" + - " }\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "", - requestor.getResults()); - } finally { - JavaScriptCore.setOptions(oldOptions); - } -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0028() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[3]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "import known.KnownType;\n"+ - "public class Test {\n" + - " void foo() {\n" + - " MissingType m = null;\n" + - " m.field.b\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " public known.KnownType field\n" + - "}\n"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/test/known/KnownType.js", - "package known;"+ - "public class KnownType {\n" + - " public void bar() {}\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.field.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0029() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[3]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "import known.KnownType;\n"+ - "public class Test {\n" + - " MissingType m = null;\n" + - " void foo() {\n" + - " m.field.b\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " public known.KnownType field\n" + - "}\n"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/test/known/KnownType.js", - "package known;"+ - "public class KnownType {\n" + - " public void bar() {}\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.field.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0030() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[3]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "import known.KnownType;\n"+ - "public class Test {\n" + - " MissingType m(){return null;}\n" + - " void foo() {\n" + - " m().field.b\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " public known.KnownType field\n" + - "}\n"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/test/known/KnownType.js", - "package known;"+ - "public class KnownType {\n" + - " public void bar() {}\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m().field.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test031() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[3]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "import known.KnownType;\n"+ - "public class Test {\n" + - " void foo() {\n" + - " MissingType m = null;\n" + - " m.method().b\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " public known.KnownType method() {return null;}\n" + - "}\n"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/test/known/KnownType.js", - "package known;"+ - "public class KnownType {\n" + - " public void bar() {}\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.method().b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0032() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[3]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "import known.KnownType;\n"+ - "public class Test {\n" + - " MissingType m(){return null;}\n" + - " void foo() {\n" + - " m().method().b\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " public known.KnownType method() {return null;}\n" + - "}\n"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/test/known/KnownType.js", - "package known;"+ - "public class KnownType {\n" + - " public void bar() {}\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m().method().b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0033() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[3]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " /** @see MissingType#b */\n" + - " void foo() {\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " public void bar()\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "MissingType#b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "", - requestor.getResults()); -} -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionWithMissingTypesTests2.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionWithMissingTypesTests2.java deleted file mode 100644 index 2e5980b..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionWithMissingTypesTests2.java +++ /dev/null @@ -1,249 +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.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.Hashtable; - -import org.eclipse.wst.jsdt.core.IJavaScriptUnit; -import org.eclipse.wst.jsdt.core.JavaScriptCore; -import org.eclipse.wst.jsdt.internal.codeassist.RelevanceConstants; - -import junit.framework.*; - -public class CompletionWithMissingTypesTests2 extends ModifyingResourceTests implements RelevanceConstants { - -public CompletionWithMissingTypesTests2(String name) { - super(name); -} -public void setUpSuite() throws Exception { - super.setUpSuite(); - - setUpJavaProject("Completion"); -} -public void tearDownSuite() throws Exception { - deleteProject("Completion"); - - super.tearDownSuite(); -} - -protected static void assertResults(String expected, String actual) { - try { - assertEquals(expected, actual); - } catch(ComparisonFailure c) { - System.out.println(actual); - System.out.println(); - throw c; - } -} -static { -// TESTS_NAMES = new String[] { "testBug96950" }; -} -public static Test suite() { - return buildModelTestSuite(CompletionWithMissingTypesTests2.class); -} - -File createFile(File parent, String name, String content) throws IOException { - File file = new File(parent, name); - FileOutputStream out = new FileOutputStream(file); - out.write(content.getBytes()); - out.close(); - return file; -} -File createDirectory(File parent, String name) { - File dir = new File(parent, name); - dir.mkdirs(); - return dir; -} - -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0001() throws Exception { - Hashtable oldOptions = JavaScriptCore.getOptions(); - try { - Hashtable options = new Hashtable(oldOptions); - options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.ERROR); - options.put(JavaScriptCore.COMPILER_PB_DISCOURAGED_REFERENCE, JavaScriptCore.WARNING); - options.put(JavaScriptCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaScriptCore.DISABLED); - options.put(JavaScriptCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaScriptCore.DISABLED); - JavaScriptCore.setOptions(options); - - // create variable -// JavaScriptCore.setClasspathVariables( -// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, -// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, -// null); - - // create P1 - this.createJavaProject( - "P1", - new String[]{"src"}, - new String[]{"JCL_LIB"}); - - this.createFolder("/P1/src/a"); - this.createFile( - "/P1/src/a/XX.js", - "package a;\n"+ - "public class XX {\n"+ - " void foo() {}\n"+ - "}"); - - this.createFolder("/P1/src/b"); - this.createFile( - "/P1/src/b/XX.js", - "package b;\n"+ - "public class XX {\n"+ - " void foo() {}\n"+ - "}"); - - // create P2 - this.createJavaProject( - "P2", - new String[]{"src"}, - new String[]{"JCL_LIB"}, - null, - null, - new String[]{"/P1"}, - new String[][]{{}}, - new String[][]{{"a/*"}}, - new boolean[]{false}, - null, - null, - "1.4"); - this.createFile( - "/P2/src/YY.js", - "public class YY {\n"+ - " void foo() {\n"+ - " XX x = null;\n"+ - " x.fo\n"+ - " }\n"+ - "}"); - - waitUntilIndexesReady(); - - // do completion - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - IJavaScriptUnit cu= getCompilationUnit("P2", "src", "", "YY.js"); - - String str = cu.getSource(); - String completeBehind = "x.fo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; - int start1 = str.lastIndexOf("x.fo") + "x.".length(); - int end1 = start1 + "fo".length(); - int start2 = str.lastIndexOf("XX"); - int end2 = start2 + "XX".length(); - assertResults( - "foo[FUNCTION_REF]{foo(), La.XX;, ()V, foo, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " XX[TYPE_REF]{a.XX, a, La.XX;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}\n" + - "foo[FUNCTION_REF]{foo(), Lb.XX;, ()V, foo, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " XX[TYPE_REF]{b.XX, b, Lb.XX;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); - } finally { - this.deleteProject("P1"); - this.deleteProject("P2"); - JavaScriptCore.setOptions(oldOptions); - } -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0002() throws Exception { - Hashtable oldOptions = JavaScriptCore.getOptions(); - try { - Hashtable options = new Hashtable(oldOptions); - options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.ERROR); - options.put(JavaScriptCore.COMPILER_PB_DISCOURAGED_REFERENCE, JavaScriptCore.WARNING); - options.put(JavaScriptCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaScriptCore.ENABLED); - options.put(JavaScriptCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaScriptCore.DISABLED); - JavaScriptCore.setOptions(options); - - // create variable -// JavaScriptCore.setClasspathVariables( -// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, -// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, -// null); - - // create P1 - this.createJavaProject( - "P1", - new String[]{"src"}, - new String[]{"JCL_LIB"}); - - this.createFolder("/P1/src/a"); - this.createFile( - "/P1/src/a/XX.js", - "package a;\n"+ - "public class XX {\n"+ - " void foo() {}\n"+ - "}"); - - this.createFolder("/P1/src/b"); - this.createFile( - "/P1/src/b/XX.js", - "package b;\n"+ - "public class XX {\n"+ - " void foo() {}\n"+ - "}"); - - // create P2 - this.createJavaProject( - "P2", - new String[]{"src"}, - new String[]{"JCL_LIB"}, - null, - null, - new String[]{"/P1"}, - new String[][]{{}}, - new String[][]{{"a/*"}}, - new boolean[]{false}, - null, - null, - "1.4"); - this.createFile( - "/P2/src/YY.js", - "public class YY {\n"+ - " void foo() {\n"+ - " XX x = null;\n"+ - " x.fo\n"+ - " }\n"+ - "}"); - - waitUntilIndexesReady(); - - // do completion - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - IJavaScriptUnit cu= getCompilationUnit("P2", "src", "", "YY.js"); - - String str = cu.getSource(); - String completeBehind = "x.fo"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; - int start1 = str.lastIndexOf("x.fo") + "x.".length(); - int end1 = start1 + "fo".length(); - int start2 = str.lastIndexOf("XX"); - int end2 = start2 + "XX".length(); - assertResults( - "foo[FUNCTION_REF]{foo(), Lb.XX;, ()V, foo, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " XX[TYPE_REF]{b.XX, b, Lb.XX;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); - } finally { - this.deleteProject("P1"); - this.deleteProject("P2"); - JavaScriptCore.setOptions(oldOptions); - } -} -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionWithMissingTypesTests_1_5.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionWithMissingTypesTests_1_5.java deleted file mode 100644 index aefc2b3..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionWithMissingTypesTests_1_5.java +++ /dev/null @@ -1,569 +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 org.eclipse.wst.jsdt.core.*; -import org.eclipse.wst.jsdt.internal.codeassist.RelevanceConstants; - -import junit.framework.*; - -public class CompletionWithMissingTypesTests_1_5 extends AbstractJavaModelCompletionTests implements RelevanceConstants { - static { -// TESTS_NAMES = new String[]{"test0040"}; - } -public CompletionWithMissingTypesTests_1_5(String name) { - super(name); -} -public void setUpSuite() throws Exception { - if (COMPLETION_PROJECT == null) { - COMPLETION_PROJECT = setUpJavaProject("Completion", "1.5"); - } else { - setUpProjectCompliance(COMPLETION_PROJECT, "1.5"); - } - super.setUpSuite(); -} - -public void tearDownSuite() throws Exception { - super.tearDownSuite(); -} -public static Test suite() { - return buildModelTestSuite(CompletionWithMissingTypesTests_1_5.class); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0001() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " void foo() {\n" + - " MissingType m = null;\n" + - " m.b\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " public void bar() {};\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; - int start1 = str.lastIndexOf("m.b") + "m.".length(); - int end1 = start1 + "b".length(); - int start2 = str.lastIndexOf("MissingType"); - int end2 = start2 + "MissingType".length(); - assertResults( - "bar[FUNCTION_REF]{bar(), Lmissing.MissingType;, ()V, bar, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0002() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[3]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " void foo() {\n" + - " MissingType m = null;\n" + - " m.b\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " public void bar() {};\n" + - " public void bar(T t) {};\n" + - "}\n"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/missing/MissingType2.js", - "package missing;"+ - "public class MissingType2 {\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; - int start1 = str.lastIndexOf("m.b") + "m.".length(); - int end1 = start1 + "b".length(); - int start2 = str.lastIndexOf("MissingType2"); - int end2 = start2 + "MissingType2".length(); - int start3 = str.lastIndexOf("MissingType<"); - int end3 = start3 + "MissingType".length(); - assertResults( - "bar[FUNCTION_REF]{bar(), Lmissing.MissingType;, ()V, bar, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType2[TYPE_REF]{missing.MissingType2, missing, Lmissing.MissingType2;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start3+", "+end3+"], " + (relevance1) + "}\n" + - "bar[FUNCTION_REF]{bar(), Lmissing.MissingType;, (Lmissing.MissingType2;)V, bar, (t), ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType2[TYPE_REF]{missing.MissingType2, missing, Lmissing.MissingType2;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start3+", "+end3+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0003() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[3]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "import missing.MissingType;"+ - "public class Test {\n" + - " void foo() {\n" + - " MissingType m = null;\n" + - " m.b\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " public void bar() {};\n" + - " public void bar(T t) {};\n" + - "}\n"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/missing/MissingType2.js", - "package missing;"+ - "public class MissingType2 {\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; - int start1 = str.lastIndexOf("m.b") + "m.".length(); - int end1 = start1 + "b".length(); - int start2 = str.lastIndexOf("MissingType2"); - int end2 = start2 + "MissingType2".length(); - assertResults( - "bar[FUNCTION_REF]{bar(), Lmissing.MissingType;, ()V, bar, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType2[TYPE_REF]{missing.MissingType2, missing, Lmissing.MissingType2;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}\n" + - "bar[FUNCTION_REF]{bar(), Lmissing.MissingType;, (Lmissing.MissingType2;)V, bar, (t), ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType2[TYPE_REF]{missing.MissingType2, missing, Lmissing.MissingType2;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0004() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[3]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "import missing.MissingType2;"+ - "public class Test {\n" + - " void foo() {\n" + - " MissingType m = null;\n" + - " m.b\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " public void bar() {};\n" + - " public void bar(T t) {};\n" + - "}\n"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/missing/MissingType2.js", - "package missing;"+ - "public class MissingType2 {\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; - int start1 = str.lastIndexOf("m.b") + "m.".length(); - int end1 = start1 + "b".length(); - int start2 = str.lastIndexOf("MissingType<"); - int end2 = start2 + "MissingType".length(); - assertResults( - "bar[FUNCTION_REF]{bar(), Lmissing.MissingType;, ()V, bar, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}\n" + - "bar[FUNCTION_REF]{bar(), Lmissing.MissingType;, (Lmissing.MissingType2;)V, bar, (t), ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0005() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[6]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " void foo() {\n" + - " MissingType m = null;\n" + - " m.b\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " public void bar(T t, U u) {};\n" + - "}\n"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/missing/MissingType1.js", - "package missing;"+ - "public class MissingType1 {\n" + - "}\n"); - - this.workingCopies[3] = getWorkingCopy( - "/Completion/src/missing/MissingType2.js", - "package missing;"+ - "public class MissingType2 {\n" + - "}\n"); - - this.workingCopies[4] = getWorkingCopy( - "/Completion/src/missing2/MissingType1.js", - "package missing2;"+ - "public class MissingType1 {\n" + - "}\n"); - - this.workingCopies[5] = getWorkingCopy( - "/Completion/src/missing2/MissingType2.js", - "package missing2;"+ - "public class MissingType2 {\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; - int start1 = str.lastIndexOf("m.b") + "m.".length(); - int end1 = start1 + "b".length(); - int start2 = str.lastIndexOf("MissingType1"); - int end2 = start2 + "MissingType1".length(); - int start3 = str.lastIndexOf("MissingType2"); - int end3 = start3 + "MissingType2".length(); - int start4 = str.lastIndexOf("MissingType<"); - int end4 = start4 + "MissingType".length(); - assertResults( - "bar[FUNCTION_REF]{bar(), Lmissing.MissingType;, (Lmissing.MissingType1;Lmissing.MissingType2;)V, bar, (t, u), ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType1[TYPE_REF]{missing.MissingType1, missing, Lmissing.MissingType1;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}\n" + - " MissingType2[TYPE_REF]{missing.MissingType2, missing, Lmissing.MissingType2;, null, null, ["+start3+", "+end3+"], " + (relevance1) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start4+", "+end4+"], " + (relevance1) + "}\n" + - "bar[FUNCTION_REF]{bar(), Lmissing.MissingType;, (Lmissing.MissingType1;Lmissing2.MissingType2;)V, bar, (t, u), ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType1[TYPE_REF]{missing.MissingType1, missing, Lmissing.MissingType1;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}\n" + - " MissingType2[TYPE_REF]{missing2.MissingType2, missing2, Lmissing2.MissingType2;, null, null, ["+start3+", "+end3+"], " + (relevance1) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start4+", "+end4+"], " + (relevance1) + "}\n" + - "bar[FUNCTION_REF]{bar(), Lmissing.MissingType;, (Lmissing2.MissingType1;Lmissing.MissingType2;)V, bar, (t, u), ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType1[TYPE_REF]{missing2.MissingType1, missing2, Lmissing2.MissingType1;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}\n" + - " MissingType2[TYPE_REF]{missing.MissingType2, missing, Lmissing.MissingType2;, null, null, ["+start3+", "+end3+"], " + (relevance1) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start4+", "+end4+"], " + (relevance1) + "}\n" + - "bar[FUNCTION_REF]{bar(), Lmissing.MissingType;, (Lmissing2.MissingType1;Lmissing2.MissingType2;)V, bar, (t, u), ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType1[TYPE_REF]{missing2.MissingType1, missing2, Lmissing2.MissingType1;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}\n" + - " MissingType2[TYPE_REF]{missing2.MissingType2, missing2, Lmissing2.MissingType2;, null, null, ["+start3+", "+end3+"], " + (relevance1) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start4+", "+end4+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0006() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " MissingType m(int ... i) {return null;}\n" + - " void foo() {\n" + - " m(0, 0).b\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " public void bar() {}\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = ".b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; - int start1 = str.lastIndexOf("m(0, 0).b") + "m(0, 0).".length(); - int end1 = start1 + "b".length(); - int start2 = str.lastIndexOf("MissingType"); - int end2 = start2 + "MissingType".length(); - assertResults( - "bar[FUNCTION_REF]{bar(), Lmissing.MissingType;, ()V, bar, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0007() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[3]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " void foo() {\n" + - " AType m = null;\n" + - " m.b\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/test/AType.js", - "package tezt;"+ - "public class AType {\n" + - " public void bar(T t) {};\n" + - "}\n"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; - int start1 = str.lastIndexOf("m.b") + "m.".length(); - int end1 = start1 + "b".length(); - int start2 = str.lastIndexOf("MissingType"); - int end2 = start2 + "MissingType".length(); - assertResults( - "bar[FUNCTION_REF]{bar(), Ltest.AType;, (!+Lmissing.MissingType;)V, bar, (t), ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0008() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " void foo() {\n" + - " MissingType.MissingMemberType m = null;\n" + - " m.b\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " public class MissingMemberType {\n" + - " public void bar() {};\n" + - " }\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; - int start1 = str.lastIndexOf("m.b") + "m.".length(); - int end1 = start1 + "b".length(); - int start2 = str.lastIndexOf("MissingType"); - int end2 = start2 + "MissingType".length(); - assertResults( - "bar[FUNCTION_REF]{bar(), Lmissing.MissingType$MissingMemberType;, ()V, bar, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0009() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " void foo() {\n" + - " missing2.MissingType m = null;\n" + - " m.b\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing1/missing2/MissingType.js", - "package missing1.missing2;"+ - "public class MissingType {\n" + - " public void bar() {};\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0010() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " void foo() {\n" + - " MissingType.MissingMemberType m = null;\n" + - " m.b\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " public class MissingMemberType {\n" + - " public void bar() {};\n" + - " }\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; - int start1 = str.lastIndexOf("m.b") + "m.".length(); - int end1 = start1 + "b".length(); - int start2 = str.lastIndexOf("MissingType"); - int end2 = start2 + "MissingType".length(); - assertResults( - "bar[FUNCTION_REF]{bar(), Lmissing.MissingType.MissingMemberType;, ()V, bar, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 -public void test0011() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[2]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " void foo() {\n" + - " MissingMemberType m = null;\n" + - " m.b\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing/MissingType.js", - "package missing;"+ - "public class MissingType {\n" + - " public class MissingMemberType {\n" + - " public void bar() {};\n" + - " }\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - assertResults( - "", - requestor.getResults()); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=161204 -public void test0012() throws JavaScriptModelException { - this.workingCopies = new IJavaScriptUnit[3]; - this.workingCopies[0] = getWorkingCopy( - "/Completion/src/test/Test.js", - "package test;"+ - "public class Test {\n" + - " void foo() {\n" + - " MissingType m = null;\n" + - " m.b\n" + - " }\n" + - "}\n"); - - this.workingCopies[1] = getWorkingCopy( - "/Completion/src/missing1/MissingType.js", - "package missing1;"+ - "public class MissingType {\n" + - " public void bar() {};\n" + - "}\n"); - - this.workingCopies[2] = getWorkingCopy( - "/Completion/src/missing2/MissingType.js", - "package missing2;"+ - "public class MissingType {\n" + - " public void bar() {};\n" + - "}\n"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); - requestor.allowAllRequiredProposals(); - String str = this.workingCopies[0].getSource(); - String completeBehind = "m.b"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); - - int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; - int relevance2 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; - int start1 = str.lastIndexOf("m.b") + "m.".length(); - int end1 = start1 + "b".length(); - int start2 = str.lastIndexOf("MissingType"); - int end2 = start2 + "MissingType".length(); - assertResults( - "bar[FUNCTION_REF]{bar(), Lmissing1.MissingType;, ()V, bar, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + - " MissingType[TYPE_REF]{missing1.MissingType, missing1, Lmissing1.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}\n" + - "bar[FUNCTION_REF]{bar(), Lmissing2.MissingType;, ()V, bar, null, ["+start1+", "+end1+"], " + (relevance2) + "}\n" + - " MissingType[TYPE_REF]{missing2.MissingType, missing2, Lmissing2.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance2) + "}", - requestor.getResults()); -} -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ContainerInitializer.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ContainerInitializer.java deleted file mode 100644 index 038c4a6..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ContainerInitializer.java +++ /dev/null @@ -1,48 +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 org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.wst.jsdt.core.JsGlobalScopeContainerInitializer; -import org.eclipse.wst.jsdt.core.IJsGlobalScopeContainer; -import org.eclipse.wst.jsdt.core.IJavaScriptProject; -import org.eclipse.wst.jsdt.core.compiler.libraries.LibraryLocation; - -public class ContainerInitializer extends JsGlobalScopeContainerInitializer { - public static ITestInitializer initializer; - - public static interface ITestInitializer { - public void initialize(IPath containerPath, IJavaScriptProject project) throws CoreException; - public boolean allowFailureContainer(); - } - - public static void setInitializer(ITestInitializer initializer) { - ContainerInitializer.initializer = initializer; - } - - public IJsGlobalScopeContainer getFailureContainer(IPath containerPath, IJavaScriptProject project) { - if (initializer == null || !initializer.allowFailureContainer()) return null; - return super.getFailureContainer(containerPath, project); - } - - public void initialize(IPath containerPath, IJavaScriptProject project) throws CoreException { - if (initializer == null) return; - initializer.initialize(containerPath, project); - } - - /* (non-Javadoc) - * @see org.eclipse.wst.jsdt.core.IJsGlobalScopeContainerInitialzer#getLibraryLocation() - */ - public LibraryLocation getLibraryLocation() { - return null; - } -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CopyMoveElementsTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CopyMoveElementsTests.java deleted file mode 100644 index 042c329..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CopyMoveElementsTests.java +++ /dev/null @@ -1,2743 +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 junit.framework.Test; - -import org.eclipse.core.resources.IncrementalProjectBuilder; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.wst.jsdt.core.*; - -public class CopyMoveElementsTests extends CopyMoveTests { -public CopyMoveElementsTests(String name) { - super(name); -} -public void setUpSuite() throws Exception { - super.setUpSuite(); - - IJavaScriptProject project = this.createJavaProject("BinaryProject", new String[] {"src"}, new String[] {"JCL_LIB"}); - this.createFile( - "/BinaryProject/src/X.js", - "public class X {\n" + - " int bar;\n" + - " public void foo() {\n" + - " }\n" + - "}" - ); - project.getProject().build(IncrementalProjectBuilder.FULL_BUILD, null); - waitForAutoBuild(); -} -/** - * Setup for the next test. - */ -public void setUp() throws Exception { - super.setUp(); - - this.createJavaProject("P", new String[] {"src"}, new String[] {"/BinaryProject/bin"}); -} -// Use this static initializer to specify subset for tests -// All specified tests which do not belong to the class are skipped... -static { - // Names of tests to run: can be "testBugXXXX" or "BugXXXX") -// TESTS_PREFIX = "testCombineAccessRestrictions"; -// TESTS_NAMES = new String[] {"testCopyFieldWithPositioning"}; -// TESTS_NUMBERS = new int[] { 5, 6 }; -// TESTS_RANGE = new int[] { 21, 38 }; -} -public static Test suite() { - return buildModelTestSuite(CopyMoveElementsTests.class); -} -/** - * Cleanup after the previous test. - */ -public void tearDown() throws Exception { - this.deleteProject("P"); - - super.tearDown(); -} -public void tearDownSuite() throws Exception { - this.deleteProject("BinaryProject"); - super.tearDownSuite(); -} -/** - * Ensures that a binary field cannot be renamed. - */ -//public void testCopyBinaryField() throws JavaScriptModelException { -// IClassFile cf = getClassFile("P", "/BinaryProject/bin", "", "X.class"); -// IField binaryField = cf.getType().getField("bar"); -// copyNegative(binaryField, cf, null, "bar2", false, IJavaScriptModelStatusConstants.READ_ONLY); -//} -///** -// * Ensures that a binary method cannot be renamed. -// */ -//public void testCopyBinaryMethod() throws JavaScriptModelException { -// IClassFile cf = getClassFile("P", "/BinaryProject/bin", "", "X.class"); -// IFunction binaryMethod = cf.getType().getMethod("foo", new String[] {}); -// copyNegative(binaryMethod, cf, null, "foo2", false, IJavaScriptModelStatusConstants.READ_ONLY); -//} -///** -// * Ensures that a binary type cannot be copied. -// */ -//public void testCopyBinaryType() throws JavaScriptModelException { -// IClassFile cf = getClassFile("P", "/BinaryProject/bin", "", "X.class"); -// IType binaryType = cf.getType(); -// copyNegative(binaryType, cf, null, "Y", false, IJavaScriptModelStatusConstants.READ_ONLY); -//} -/** - * Ensures that a constructor can be copied to a different type. The constructor - * should be automatically renamed to that of the destination type. - */ -//public void testCopyConstructor() throws CoreException { -// this.createFile( -// "/P/src/X.js", -// "public class X {\n" + -// " X(String s) {\n" + -// " }\n" + -// "}" -// ); -// IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); -// IFunction methodSource = typeSource.getMethod("X", new String[] {"QString;"}); -// -// this.createFile( -// "/P/src/Y.js", -// "public class Y {\n" + -// "}" -// ); -// IType typeDest = getCompilationUnit("/P/src/Y.js").getType("Y"); -// -// copyPositive(methodSource, typeDest, null, null, false); -//} -///** -// * Ensures that a constructor can be copied to a different type across projects. -// * The constructor should be automatically renamed to that of the destination type. -// */ -//public void testCopyConstructorInDifferentProject() throws CoreException { -// try { -// this.createFile( -// "/P/src/X.js", -// "public class X {\n" + -// " X(String s) {\n" + -// " }\n" + -// "}" -// ); -// IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); -// IFunction methodSource = typeSource.getMethod("X", new String[] {"QString;"}); -// -// this.createJavaProject("P2", new String[] {"src"}, "bin"); -// this.createFile( -// "/P2/src/Y.js", -// "public class Y {\n" + -// "}" -// ); -// IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); -// -// copyPositive(methodSource, typeDest, null, null, false); -// -// } finally { -// this.deleteProject("P2"); -// } -//} -/** - * Ensures that a field can be copied to a different type. - */ -public void testCopyField() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IField fieldSource= typeSource.getField("foo"); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P/src/Y.js").getType("Y"); - - copyPositive(fieldSource, typeDest, null, null, false); -} -/** - * Ensures that a field can be copied to a different type replacing an existing field. - */ -public void testCopyFieldForce() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IField fieldSource= typeSource.getField("foo"); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - " boolean foo;\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P/src/Y.js").getType("Y"); - - copyPositive(fieldSource, typeDest, null, null, true); -} -/** - * Ensures that a field can be copied to a different type across projects - * replacing an existing field. - */ -public void testCopyFieldForceInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int bar;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IField fieldSource= typeSource.getField("bar"); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - " boolean bar;\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - copyPositive(fieldSource, typeDest, null, null, true); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a field can be copied to a different type in a different project. - */ -public void testCopyFieldInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int bar;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IField fieldSource= typeSource.getField("bar"); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - copyPositive(fieldSource, typeDest, null, null, false); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a field can be copied to a different type, - * and renamed. - */ -public void testCopyFieldRename() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IField fieldSource= typeSource.getField("foo"); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P/src/Y.js").getType("Y"); - - copyPositive(fieldSource, typeDest, null, "bar", false); -} -/** - * Ensures that a field can be copied to a different type, - * and renamed, overwriting an existing field. - */ -public void testCopyFieldRenameForce() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IField fieldSource= typeSource.getField("foo"); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - " boolean bar;\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P/src/Y.js").getType("Y"); - - copyPositive(fieldSource, typeDest, null, "bar", true); -} -/** - * Ensures that a field can be copied to a different type across two different - * projects, and renamed, overwriting an existing field. - */ -public void testCopyFieldRenameForceInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IField fieldSource= typeSource.getField("foo"); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - " boolean bar;\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - copyPositive(fieldSource, typeDest, null, "bar", true); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a field can be copied to a different type across two different - * projects, and renamed. - */ -public void testCopyFieldRenameInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IField fieldSource= typeSource.getField("foo"); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - copyPositive(fieldSource, typeDest, null, "bar", false); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a field can be duplicated in the same type. - */ -public void testCopyFieldSameParent() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IField fieldSource= typeSource.getField("foo"); - - copyPositive(fieldSource, typeSource, null, "bar", false); -} -/** - * Ensures that a multi status exception is generated when copying fields. - */ -public void testCopyFieldsMultiStatus() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - " Object bar;\n" + - " char[] fred;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P/src/Y.js").getType("Y"); - - IField[] fieldsSource = typeSource.getFields(); - IJavaScriptElement[] dests = new IJavaScriptElement[fieldsSource.length]; - for (int i = 0; i < dests.length; i++) { - dests[i] = typeDest; - } - dests[1] = fieldsSource[0]; //invalid destination - dests[2]= fieldsSource[0]; - - try { - startDeltas(); - boolean e= false; - try { - typeDest.getJavaScriptModel().copy(fieldsSource, dests, null, null, false, null); - } catch (JavaScriptModelException jme) { - assertTrue("Should be multistatus", jme.getStatus().isMultiStatus()); - assertTrue("Should be an invalid destination", ((IJavaScriptModelStatus)jme.getStatus().getChildren()[0]).getCode()== IJavaScriptModelStatusConstants.INVALID_DESTINATION); - e = true; - } - assertTrue("Should have been an exception", e); - - assertDeltas( - "Unexpected delta", - "P[*]: {CHILDREN}\n" + - " src[*]: {CHILDREN}\n" + - " [*]: {CHILDREN}\n" + - " Y.js[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" + - " Y[*]: {CHILDREN | FINE GRAINED}\n" + - " foo[+]: {}" - ); - - IJavaScriptElement copy= generateHandle(fieldsSource[0], null, typeDest); - assertTrue("Copy should exist", copy.exists()); - } finally { - stopDeltas(); - } -} -/** - * Ensures that a multi status exception is generated when copying fields. - */ -public void testCopyFieldsMultiStatusInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - " Object bar;\n" + - " char[] fred;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - IField[] fieldsSource = typeSource.getFields(); - IJavaScriptElement[] dests = new IJavaScriptElement[fieldsSource.length]; - for (int i = 0; i < dests.length; i++) { - dests[i] = typeDest; - } - dests[1] = fieldsSource[0]; //invalid destination - dests[2]= fieldsSource[0]; - - startDeltas(); - boolean e= false; - try { - typeDest.getJavaScriptModel().copy(fieldsSource, dests, null, null, false, null); - } catch (JavaScriptModelException jme) { - assertTrue("Should be multistatus", jme.getStatus().isMultiStatus()); - assertTrue("Should be an invalid destination", ((IJavaScriptModelStatus)jme.getStatus().getChildren()[0]).getCode()== IJavaScriptModelStatusConstants.INVALID_DESTINATION); - e = true; - } - assertTrue("Should have been an exception", e); - - assertDeltas( - "Unexpected delta", - "P2[*]: {CHILDREN}\n" + - " src[*]: {CHILDREN}\n" + - " [*]: {CHILDREN}\n" + - " Y.js[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" + - " Y[*]: {CHILDREN | FINE GRAINED}\n" + - " foo[+]: {}" - ); - - IJavaScriptElement copy= generateHandle(fieldsSource[0], null, typeDest); - assertTrue("Copy should exist", copy.exists()); - } finally { - stopDeltas(); - this.deleteProject("P2"); - } -} -/** - * Ensures that a field cannot be copied to a different type replacing an existing field if - * no force. - */ -public void testCopyFieldWithCollision() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IField fieldSource= typeSource.getField("foo"); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - " boolean foo;\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P/src/Y.js").getType("Y"); - - copyNegative(fieldSource, typeDest, null, null, false, IJavaScriptModelStatusConstants.NAME_COLLISION); -} -/** - * Ensures that a field cannot be copied to a different type across different projects - * replacing an existing field if no force. - */ -public void testCopyFieldWithCollisionInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int bar;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IField fieldSource= typeSource.getField("bar"); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - " boolean bar;\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - copyNegative(fieldSource, typeDest, null, null, false, IJavaScriptModelStatusConstants.NAME_COLLISION); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a field cannot be copied to an invalid destination. - */ -public void testCopyFieldWithInvalidDestination() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IField fieldSource= typeSource.getField("foo"); - - IClassFile cf = getClassFile("P", "/BinaryProject/bin", "", "X.class"); - - copyNegative(fieldSource, cf.getType(), null, null, false, IJavaScriptModelStatusConstants.INVALID_DESTINATION); -} -/** - * Ensures that a field cannot be copied to an invalid destination. - */ -public void testCopyFieldWithInvalidDestinationInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IField fieldSource= typeSource.getField("foo"); - - this.createJavaProject("P2", new String[] {"src"}, new String[] {"/BinaryProject/bin"}); - IClassFile cf = getClassFile("P2", "/BinaryProject/bin", "", "X.class"); - - copyNegative(fieldSource, cf.getType(), null, null, false, IJavaScriptModelStatusConstants.INVALID_DESTINATION); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a field cannot be copied to a different type with an invalid sibling - * used for positioning. - */ -public void testCopyFieldWithInvalidPositioning() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IField fieldSource= typeSource.getField("foo"); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P/src/Y.js").getType("Y"); - - copyNegative( - fieldSource, - typeDest, - typeDest.getField("invalid"), - null, - false, - IJavaScriptModelStatusConstants.INVALID_SIBLING); -} -/** - * Ensures that a field cannot be copied to a different type with an invalid sibling - * used for positioning. - */ -public void testCopyFieldWithInvalidPositioningInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IField fieldSource= typeSource.getField("foo"); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - copyNegative( - fieldSource, - typeDest, - typeDest.getField("invalid"), - null, - false, - IJavaScriptModelStatusConstants.INVALID_SIBLING); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a field can be copied to a different type with positioning. - */ -public void testCopyFieldWithPositioning() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IField fieldSource= typeSource.getField("foo"); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - " boolean bar;\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P/src/Y.js").getType("Y"); - - copyPositive(fieldSource, typeDest, typeDest.getField("bar"), null, false); -} -/** - * Ensures that a field can be copied to a different type across different projects - * with positioning. - */ -public void testCopyFieldWithPositioningInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IField fieldSource= typeSource.getField("foo"); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - " boolean bar;\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - copyPositive(fieldSource, typeDest, typeDest.getField("bar"), null, false); - } finally { - this.deleteProject("P2"); - } -} - -/* - * Ensures that an import can be copied to a different cu. - */ -public void testCopyImport() throws CoreException { - this.createFile( - "/P/src/X.js", - "import java.util.*;\n" + - "public class X {\n" + - "}" - ); - IImportDeclaration importSource = getCompilationUnit("/P/src/X.js").getImport("java.util.*"); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - "}" - ); - IJavaScriptUnit cuDest = getCompilationUnit("/P/src/Y.js"); - - copyPositive(importSource, cuDest, null, null, false); -} -/* - * Ensures that a static import can be copied to a different cu. - */ -public void testCopyImportStatic() throws CoreException { - this.createFile( - "/P/src/X.js", - "import static java.lang.Math;\n" + - "public class X {\n" + - " int foo;\n" + - " {\n" + - " foo = 10;\n" + - " }\n" + - "}" - ); - IImportDeclaration importSource = getCompilationUnit("/P/src/X.js").getImport("java.lang.Math"); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - "}" - ); - IJavaScriptUnit cuDest = getCompilationUnit("/P/src/Y.js"); - - copyPositive(importSource, cuDest, null, null, false); - assertEquals("Copied import should be static", Flags.AccStatic, cuDest.getImport("java.lang.Math").getFlags()); -} - -/** - * Ensures that a initializer can be copied to a different type. - */ -public void testCopyInitializer() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - " {\n" + - " foo = 10;\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IInitializer initializerSource= typeSource.getInitializer(1); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P/src/Y.js").getType("Y"); - - copyPositive(initializerSource, typeDest, null, null, false); -} -/** - * Ensures that a initializer can be copied to a different type across two different - * projects. - */ -public void testCopyInitializerInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - " {\n" + - " foo = 10;\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IInitializer initializerSource= typeSource.getInitializer(1); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - copyPositive(initializerSource, typeDest, null, null, false); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a initializer cannot be copied and renamed. - */ -public void testCopyInitializerRename() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - " {\n" + - " foo = 10;\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IInitializer initializerSource= typeSource.getInitializer(1); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P/src/Y.js").getType("Y"); - - copyNegative(initializerSource, typeDest, null, "newName", false, IJavaScriptModelStatusConstants.INVALID_NAME); -} -/** - * Ensures that a initializer cannot be copied and renamed. - */ -public void testCopyInitializerRenameInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - " {\n" + - " foo = 10;\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IInitializer initializerSource= typeSource.getInitializer(1); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - copyNegative(initializerSource, typeDest, null, "newName", false, IJavaScriptModelStatusConstants.INVALID_NAME); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a initializer can be copied to a different type across two different - * projects with positioning. - */ -public void testCopyInitializerWithPositioningInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - " {\n" + - " foo = 10;\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IInitializer initializerSource= typeSource.getInitializer(1); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - " int bar;\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - copyPositive(initializerSource, typeDest, typeDest.getField("bar"), null, false); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that an inner type can be copied with positioning. - */ -public void testCopyInnerTypeWithPositioningInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " class Inner {\n" + - " }" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X").getType("Inner"); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - " void foo() {\n" + - " }\n" + - "}" - ); - IJavaScriptUnit cuDest = getCompilationUnit("/P2/src/Y.js"); - IType typeDest = cuDest.getType("Y"); - - copyPositive(typeSource, typeDest, typeDest.getFunction("foo", new String[] {}), null, false); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a local type can be copied. - */ -public void testCopyLocalType() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo() {\n" + - " class Z {\n" + - " }\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X").getFunction("foo", new String[0]).getType("Z", 1); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - "}" - ); - IJavaScriptUnit cuDest = getCompilationUnit("/P/src/Y.js"); - - copyPositive(typeSource, cuDest, null, null, false); -} -/** - * Ensures that a main type can be copied. - */ -public void testCopyMainType() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - "}" - ); - IJavaScriptUnit cuDest = getCompilationUnit("/P/src/Y.js"); - - copyPositive(typeSource, cuDest, null, null, false); -} -/** - * Ensures that a main type can be copied across two different projects. - */ -public void testCopyMainTypeInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - "}" - ); - IJavaScriptUnit cuDest = getCompilationUnit("/P2/src/Y.js"); - - copyPositive(typeSource, cuDest, null, null, false); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a method can be copied to a different type. - */ -public void testCopyMethod() throws CoreException{ - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource= typeSource.getFunction("foo", new String[] {"QString;"}); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P/src/Y.js").getType("Y"); - - copyPositive(methodSource, typeDest, null, null, false); -} -/** - * Ensures that a method can be copied to a different type, forcing - * an overwrite when there is a name collision - */ -public void testCopyMethodForce() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource= typeSource.getFunction("foo", new String[] {"QString;"}); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - " int foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P/src/Y.js").getType("Y"); - - copyPositive(methodSource, typeDest, null, null, true); -} -/** - * Ensures that a method can be copied to a different type across different projects, - * forcing an overwrite when there is a name collision - */ -public void testCopyMethodForceInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource= typeSource.getFunction("foo", new String[] {"QString;"}); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - " int foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - copyPositive(methodSource, typeDest, null, null, true); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a method can be copied to a different type across different projects. - */ -public void testCopyMethodInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource= typeSource.getFunction("foo", new String[] {"QString;"}); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - copyPositive(methodSource, typeDest, null, null, false); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a method can be copied to a different type, renamed - * simaltaneously. - */ -public void testCopyMethodRename() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource= typeSource.getFunction("foo", new String[] {"QString;"}); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P/src/Y.js").getType("Y"); - - copyPositive(methodSource, typeDest, null, "bar", false); -} -/** - * Ensures that a method can be copied to a different type, renamed - * simaltaneously, overwriting an existing method. - */ -public void testCopyMethodRenameForce() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource= typeSource.getFunction("foo", new String[] {"QString;"}); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - " void bar(String s) {\n" + - " }\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P/src/Y.js").getType("Y"); - - copyPositive(methodSource, typeDest, null, "bar", true); -} -/** - * Ensures that a method can be copied to a different type across different projects, - * renamed simaltaneously, overwriting an existing method. - */ -public void testCopyMethodRenameForceInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource= typeSource.getFunction("foo", new String[] {"QString;"}); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - " void bar(String s) {\n" + - " }\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - copyPositive(methodSource, typeDest, null, "bar", true); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a method can be copied to a different type across different projects, - * renamed simaltaneously. - */ -public void testCopyMethodRenameInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource= typeSource.getFunction("foo", new String[] {"QString;"}); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - copyPositive(methodSource, typeDest, null, "bar", false); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a method can be copied to the same type, renamed - * simaltaneously. - */ -public void testCopyMethodSameParent() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource= typeSource.getFunction("foo", new String[] {"QString;"}); - - copyPositive(methodSource, typeSource, null, "bar", false); -} -/** - * Ensures that a method cannot be copied to a different type, when not forcing - * an overwrite when there is a name collision - */ -public void testCopyMethodWithCollision() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource= typeSource.getFunction("foo", new String[] {"QString;"}); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - " void foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P/src/Y.js").getType("Y"); - - copyNegative(methodSource, typeDest, null, null, false, IJavaScriptModelStatusConstants.NAME_COLLISION); -} -/** - * Ensures that a method cannot be copied to a different type across different projects, - * when not forcing an overwrite when there is a name collision - */ -public void testCopyMethodWithCollisionInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource= typeSource.getFunction("foo", new String[] {"QString;"}); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - " void foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - copyNegative(methodSource, typeDest, null, null, false, IJavaScriptModelStatusConstants.NAME_COLLISION); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a method cannot be copied to an invalid destination. - */ -public void testCopyMethodWithInvalidDestination() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource= typeSource.getFunction("foo", new String[] {"QString;"}); - - copyNegative(methodSource, methodSource, null, null, false, IJavaScriptModelStatusConstants.INVALID_DESTINATION); -} -/** - * Ensures that a method cannot be copied to an invalid destination. - */ -public void testCopyMethodWithInvalidDestinationInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource = typeSource.getFunction("foo", new String[] {"QString;"}); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - " void bar() {\n" + - " }\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - IFunction methodDest = typeDest.getFunction("bar", new String[] {}); - - copyNegative(methodSource, methodDest, null, null, false, IJavaScriptModelStatusConstants.INVALID_DESTINATION); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a method can be copied to a different type with positioning. - */ -public void testCopyMethodWithPositioningInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource = typeSource.getFunction("foo", new String[] {"QString;"}); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - " boolean bar() {\n" + - " }\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - copyPositive(methodSource, typeDest, typeDest.getFunction("bar", new String[] {}), null, false); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that attempting to rename with an incorrect number of renamings fails - */ -public void testCopyMoveWithInvalidRenamings() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " public void foo() {\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource = typeSource.getFunction("foo", new String[]{}); - copyNegative( - new IJavaScriptElement[] {methodSource}, - new IJavaScriptElement[] {typeSource}, - null, - new String[] {"bar", "fred"}, - false, - IJavaScriptModelStatusConstants.INDEX_OUT_OF_BOUNDS); -} -/** - * Ensures that a method with syntax errors can be copied to a different type. - */ -public void testCopySyntaxErrorMethod() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo(String s\n" + // syntax error - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource= typeSource.getFunction("foo", new String[] {"QString;"}); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P/src/Y.js").getType("Y"); - - copyPositive(methodSource, typeDest, null, null, false); -} -/** - * Ensures that a method with syntax errors can be copied to a different type across different - * projects. - */ -public void testCopySyntaxErrorMethodInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo(String s\n" + // syntax error - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource= typeSource.getFunction("foo", new String[] {"QString;"}); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - copyPositive(methodSource, typeDest, null, null, false); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a type can be copied. - */ -public void testCopyType() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - "}\n" + - "class Z {\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("Z"); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - "}" - ); - IJavaScriptUnit cuDest = getCompilationUnit("/P/src/Y.js"); - - copyPositive(typeSource, cuDest, null, null, false); -} -/** - * Ensures that a type can be copied. - */ -public void testCopyTypeInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - "}\n" + - "class Z {\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("Z"); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - "}" - ); - IJavaScriptUnit cuDest = getCompilationUnit("/P2/src/Y.js"); - - copyPositive(typeSource, cuDest, null, null, false); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a type can be copied with positioning. - */ -public void testCopyTypeWithPositioningInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - "}\n" + - "class Z {\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("Z"); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - "}" - ); - IJavaScriptUnit cuDest = getCompilationUnit("/P2/src/Y.js"); - - copyPositive(typeSource, cuDest, cuDest.getType("Y"), null, false); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a constructor can be moved to a different type. The constructor - * should be automatically renamed to that of the destination type. - */ -public void testMoveConstructor() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " X(String s) {\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource= typeSource.getFunction("X", new String[] {"QString;"}); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P/src/Y.js").getType("Y"); - - movePositive(methodSource, typeDest, null, null, false); - - // test that the constructor has been renamed - assertTrue( - "Constructor was not renamed", - typeDest.getFunction("Y", new String[] {"QString;"}).exists()); -} -/** - * Ensures that a constructor can be moved to a different type across different projects. - * The constructor should be automatically renamed to that of the destination type. - */ -public void testMoveConstructorInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " X(String s) {\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource= typeSource.getFunction("X", new String[] {"QString;"}); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - movePositive(methodSource, typeDest, null, null, false); - - // test that the constructor has been renamed - assertTrue( - "Constructor was not renamed", - typeDest.getFunction("Y", new String[] {"QString;"}).exists()); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a field can be moved to a different type. - */ -public void testMoveField() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IField fieldSource= typeSource.getField("foo"); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P/src/Y.js").getType("Y"); - - movePositive(fieldSource, typeDest, null, null, false); -} -/** - * Ensures that a field can be moved to a different type replacing an existing field. - */ -public void testMoveFieldForce() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IField fieldSource= typeSource.getField("foo"); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - " boolean foo;\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P/src/Y.js").getType("Y"); - - movePositive(fieldSource, typeDest, null, null, true); -} -/** - * Ensures that a field can be moved to a different type across differnt projects - * replacing an existing field. - */ -public void testMoveFieldForceInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int bar;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IField fieldSource= typeSource.getField("bar"); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - " boolean bar;\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - movePositive(fieldSource, typeDest, null, null, true); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a field can be moved to a different type across differnt projects. - */ -public void testMoveFieldInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int bar;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IField fieldSource= typeSource.getField("bar"); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - movePositive(fieldSource, typeDest, null, null, false); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a field can be moved to a different type, - * and renamed. - */ -public void testMoveFieldRename() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IField fieldSource= typeSource.getField("foo"); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P/src/Y.js").getType("Y"); - - movePositive(fieldSource, typeDest, null, "fred", false); -} -/** - * Ensures that a field can be moved to a different type, - * and renamed, overwriting an existing field. - */ -public void testMoveFieldRenameForce() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IField fieldSource= typeSource.getField("foo"); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - " boolean bar;\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P/src/Y.js").getType("Y"); - - movePositive(fieldSource, typeDest, null, "bar", true); -} -/** - * Ensures that a field can be moved to a different type across differnt projects, - * and renamed, overwriting an existing field. - */ -public void testMoveFieldRenameForceInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IField fieldSource= typeSource.getField("foo"); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - " boolean bar;\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - movePositive(fieldSource, typeDest, null, "bar", true); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a field can be moved to a different type across different projects, - * and renamed. - */ -public void testMoveFieldRenameInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IField fieldSource= typeSource.getField("foo"); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - movePositive(fieldSource, typeDest, null, "bar", false); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a field can be copied to a different type across different projects - * with positioning. - */ -public void testMoveFieldRenameForceWithPositioningInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IField fieldSource= typeSource.getField("foo"); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - " boolean bar;\n" + - " char fred;\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - movePositive(fieldSource, typeDest, typeDest.getField("bar"), "fred", true); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a field can be moved in the same type. - */ -public void testMoveFieldSameParent() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IField fieldSource= typeSource.getField("foo"); - - movePositive(fieldSource, typeSource, null, "bar", false); -} -/** - * Ensures that a field cannot be moved to a different type replacing an existing field if - * not forced. - */ -public void testMoveFieldWithCollision() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IField fieldSource= typeSource.getField("foo"); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - " boolean foo;\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P/src/Y.js").getType("Y"); - - moveNegative(fieldSource, typeDest, null, null, false, IJavaScriptModelStatusConstants.NAME_COLLISION); -} -/** - * Ensures that a field cannot be moved to a different type across differnt projects - * replacing an existing field if not forced. - */ -public void testMoveFieldWithCollisionInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int bar;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IField fieldSource= typeSource.getField("bar"); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - " boolean bar;\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - moveNegative(fieldSource, typeDest, null, null, false, IJavaScriptModelStatusConstants.NAME_COLLISION); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a field cannot be moved to an invalid destination - */ -public void testMoveFieldWithInvalidDestination() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IField fieldSource= typeSource.getField("foo"); - - IClassFile cf = getClassFile("P", "/BinaryProject/bin", "", "X.class"); - - moveNegative(fieldSource, cf.getType(), null, null, false, IJavaScriptModelStatusConstants.INVALID_DESTINATION); -} -/** - * Ensures that a field cannot be moved to an invalid destination. - */ -public void testMoveFieldWithInvalidDestinationInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IField fieldSource= typeSource.getField("foo"); - - this.createJavaProject("P2", new String[] {"src"}, new String[] {"/BinaryProject/bin"}); - IClassFile cf = getClassFile("P2", "/BinaryProject/bin", "", "X.class"); - - moveNegative(fieldSource, cf.getType(), null, null, false, IJavaScriptModelStatusConstants.INVALID_DESTINATION); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a field can be copied to a different type across different projects - * with positioning. - */ -public void testMoveFieldWithPositioningInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IField fieldSource= typeSource.getField("foo"); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - " boolean bar;\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - movePositive(fieldSource, typeDest, typeDest.getField("bar"), null, false); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a initializer can be moved to a different type. - */ -public void testMoveInitializer() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - " {\n" + - " foo = 10;\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IInitializer initializerSource= typeSource.getInitializer(1); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P/src/Y.js").getType("Y"); - - movePositive(initializerSource, typeDest, null, null, false); -} -/** - * Ensures that a initializer can be copied to a different type that is in a different - * projects=. - */ -public void testMoveInitializerInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - " {\n" + - " foo = 10;\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IInitializer initializerSource= typeSource.getInitializer(1); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - movePositive(initializerSource, typeDest, null, null, false); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a initializer cannot be moved and renamed. - */ -public void testMoveInitializerRename() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - " {\n" + - " foo = 10;\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IInitializer initializerSource= typeSource.getInitializer(1); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P/src/Y.js").getType("Y"); - - moveNegative(initializerSource, typeDest, null, "newName", false, IJavaScriptModelStatusConstants.INVALID_NAME); -} -/** - * Ensures that a initializer cannot be moved and renamed. - */ -public void testMoveInitializerRenameInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - " {\n" + - " foo = 10;\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IInitializer initializerSource= typeSource.getInitializer(1); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - moveNegative(initializerSource, typeDest, null, "newName", false, IJavaScriptModelStatusConstants.INVALID_NAME); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a initializer can be moved to a different type in a different project - * with positioning. - */ -public void testMoveInitializerWithPositioningInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo;\n" + - " {\n" + - " foo = 10;\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IInitializer initializerSource= typeSource.getInitializer(1); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - " int bar;\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - movePositive(initializerSource, typeDest, typeDest.getField("bar"), null, false); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that an inner type can be moved and renamed to a type that is in different project - * with positioning. - */ -public void testMoveInnerTypeRenameWithPositioningInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " class Inner {\n" + - " }" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X").getType("Inner"); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - " void foo() {\n" + - " }\n" + - "}" - ); - IJavaScriptUnit cuDest = getCompilationUnit("/P2/src/Y.js"); - IType typeDest = cuDest.getType("Y"); - - movePositive(typeSource, typeDest, typeDest.getFunction("foo", new String[] {}), "T", false); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that an inner type can be moved to a type that is in different project - * with positioning. - */ -public void testMoveInnerTypeWithPositioningInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " class Inner {\n" + - " }" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X").getType("Inner"); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - " void foo() {\n" + - " }\n" + - "}" - ); - IJavaScriptUnit cuDest = getCompilationUnit("/P2/src/Y.js"); - IType typeDest = cuDest.getType("Y"); - - movePositive(typeSource, typeDest, typeDest.getFunction("foo", new String[] {}), null, false); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that main types can be moved and renamed (within the same parent). - */ -public void testMoveMainTypes() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - "}" - ); - IPackageFragment pkg = getPackage("/P/src"); - IJavaScriptUnit cu = pkg.getJavaScriptUnit("X.js"); - IType typeSource = cu.getType("X"); - - movePositive( - new IJavaScriptElement[] {typeSource}, - new IJavaScriptElement[]{cu}, - null, - new String[] {"Y"}, - false); - - // test that both the compilation unit and the main type have been renamed. - IJavaScriptUnit renamedCU = pkg.getJavaScriptUnit("Y.js"); - assertTrue("Renamed element should be present", renamedCU.getType("Y").exists()); -} -/** - * Ensures that a method can be moved to a different type. - */ -public void testMoveMethod() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource= typeSource.getFunction("foo", new String[] {"QString;"}); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P/src/Y.js").getType("Y"); - - movePositive(methodSource, typeDest, null, null, false); -} -/** - * Ensures that a method can be moved to a different type, forcing - * an overwrite when there is a name collision - */ -public void testMoveMethodForce() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource= typeSource.getFunction("foo", new String[] {"QString;"}); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - " int foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P/src/Y.js").getType("Y"); - - movePositive(methodSource, typeDest, null, null, true); -} -/** - * Ensures that a method can be moved to a different type across different projects, - * forcing an overwrite when there is a name collision - */ -public void testMoveMethodForceInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource= typeSource.getFunction("foo", new String[] {"QString;"}); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - " int foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - movePositive(methodSource, typeDest, null, null, true); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a method can be moved to a different type in a different project. - */ -public void testMoveMethodInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource= typeSource.getFunction("foo", new String[] {"QString;"}); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - movePositive(methodSource, typeDest, null, null, false); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a method can be moved to a different type, renamed - * simaltaneously. - */ -public void testMoveMethodRename() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource= typeSource.getFunction("foo", new String[] {"QString;"}); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P/src/Y.js").getType("Y"); - - movePositive(methodSource, typeDest, null, "bar", false); -} -/** - * Ensures that a method can be moved to a different type, renamed - * simaltaneously, overwriting an existing method. - */ -public void testMoveMethodRenameForce() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource= typeSource.getFunction("foo", new String[] {"QString;"}); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - " void bar(String s) {\n" + - " }\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P/src/Y.js").getType("Y"); - - movePositive(methodSource, typeDest, null, "bar", true); -} -/** - * Ensures that a method can be moved to a different type across different projects, - * renamed simaltaneously, overwriting an existing method. - */ -public void testMoveMethodRenameForceInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource= typeSource.getFunction("foo", new String[] {"QString;"}); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - " void bar(String s) {\n" + - " }\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - movePositive(methodSource, typeDest, null, "bar", true); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a method can be moved to a different type across different projects, - * renamed simaltaneously. - */ -public void testMoveMethodRenameInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource= typeSource.getFunction("foo", new String[] {"QString;"}); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - movePositive(methodSource, typeDest, null, "bar", false); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a method can be moved and renamed to a different type across two different projects - * with positioning. - */ -public void testMoveMethodRenameWithPositioningInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource = typeSource.getFunction("foo", new String[] {"QString;"}); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - " boolean bar() {\n" + - " }\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - movePositive(methodSource, typeDest, typeDest.getFunction("bar", new String[] {}), "fred", false); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a method can be moved to the same type. - */ -public void testMoveMethodSameParent() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource= typeSource.getFunction("foo", new String[] {"QString;"}); - - movePositive(methodSource, typeSource, null, "bar", false); -} -/** - * Ensures that a method moves can be cancelled. - */ -public void testMoveMethodsWithCancel() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo(String s) {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - "}" - ); - final IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - " void foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P/src/Y.js").getType("Y"); - - boolean isCanceled = false; - try { - TestProgressMonitor monitor = TestProgressMonitor.getInstance(); - monitor.setCancelledCounter(1); - movePositive(typeSource.getFunctions(), new IJavaScriptElement[] {typeDest}, null, null, false, monitor); - } catch (OperationCanceledException e) { - isCanceled = true; - } - assertTrue("Operation should have thrown an operation canceled exception", isCanceled); -} -/** - * Ensures that a method moves across differnt projects can be cancelled. - */ -public void testMoveMethodsWithCancelInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo(String s) {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - "}" - ); - final IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - " void foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - boolean isCanceled = false; - try { - TestProgressMonitor monitor = TestProgressMonitor.getInstance(); - monitor.setCancelledCounter(1); - movePositive(typeSource.getFunctions(), new IJavaScriptElement[] {typeDest}, null, null, false, monitor); - } catch (OperationCanceledException e) { - isCanceled = true; - } - assertTrue("Operation should have thrown an operation canceled exception", isCanceled); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a method cannot be moved to a different type, when not forcing - * an overwrite when there is a name collision - */ -public void testMoveMethodWithCollision() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource= typeSource.getFunction("foo", new String[] {"QString;"}); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - " void foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P/src/Y.js").getType("Y"); - - moveNegative(methodSource, typeDest, null, null, false, IJavaScriptModelStatusConstants.NAME_COLLISION); -} -/** - * Ensures that a method cannot be moved to a different type, when not forcing - * an overwrite when there is a name collision - */ -public void testMoveMethodWithCollisionInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource= typeSource.getFunction("foo", new String[] {"QString;"}); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - " void foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - moveNegative(methodSource, typeDest, null, null, false, IJavaScriptModelStatusConstants.NAME_COLLISION); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a method cannot be moved to an invalid destination. - */ -public void testMoveMethodWithInvalidDestination() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource= typeSource.getFunction("foo", new String[] {"QString;"}); - - moveNegative(methodSource, methodSource, null, null, false, IJavaScriptModelStatusConstants.INVALID_DESTINATION); -} -/** - * Ensures that a method cannot be moved to an invalid destination. - */ -public void testMoveMethodWithInvalidDestinationInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource = typeSource.getFunction("foo", new String[] {"QString;"}); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - " void bar() {\n" + - " }\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - IFunction methodDest = typeDest.getFunction("bar", new String[] {}); - - moveNegative(methodSource, methodDest, null, null, false, IJavaScriptModelStatusConstants.INVALID_DESTINATION); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a method can be moved to a different type that is in a different project - * with positioning. - */ -public void testMoveMethodWithPositioningInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " int foo(String s) {\n" + - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource = typeSource.getFunction("foo", new String[] {"QString;"}); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - " boolean bar() {\n" + - " }\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - movePositive(methodSource, typeDest, typeDest.getFunction("bar", new String[] {}), null, false); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a method with syntax errors can be moved to a different type. - */ -public void testMoveSyntaxErrorMethod() throws CoreException { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo(String s\n" + // syntax error - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource= typeSource.getFunction("foo", new String[] {"QString;"}); - - this.createFile( - "/P/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P/src/Y.js").getType("Y"); - - movePositive(methodSource, typeDest, null, null, false); -} -/** - * Ensures that a method with syntax errors can be moved to a different type - * that is in a different project. - */ -public void testMoveSyntaxErrorMethodInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - " void foo(String s\n" + // syntax error - " }\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("X"); - IFunction methodSource= typeSource.getFunction("foo", new String[] {"QString;"}); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - "}" - ); - IType typeDest = getCompilationUnit("/P2/src/Y.js").getType("Y"); - - movePositive(methodSource, typeDest, null, null, false); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a type can be moved and renamed across projects to a specified position. - */ -public void testMoveTypeRenameWithPositioningInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - "}\n" + - "class Z {\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("Z"); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - "}" - ); - IJavaScriptUnit cuDest = getCompilationUnit("/P2/src/Y.js"); - - movePositive(typeSource, cuDest, cuDest.getType("Y"), "T", false); - } finally { - this.deleteProject("P2"); - } -} -/** - * Ensures that a type that is in a different project can be moved to a specified position. - */ -public void testMoveTypeWithPositioningInDifferentProject() throws CoreException { - try { - this.createFile( - "/P/src/X.js", - "public class X {\n" + - "}\n" + - "class Z {\n" + - "}" - ); - IType typeSource = getCompilationUnit("/P/src/X.js").getType("Z"); - - this.createJavaProject("P2", new String[] {"src"}); - this.createFile( - "/P2/src/Y.js", - "public class Y {\n" + - "}" - ); - IJavaScriptUnit cuDest = getCompilationUnit("/P2/src/Y.js"); - - movePositive(typeSource, cuDest, cuDest.getType("Y"), null, false); - } finally { - this.deleteProject("P2"); - } -} -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CopyMoveResourcesTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CopyMoveResourcesTests.java deleted file mode 100644 index 3bd5801..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CopyMoveResourcesTests.java +++ /dev/null @@ -1,933 +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 junit.framework.Test; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.QualifiedName; -import org.eclipse.wst.jsdt.core.*; -import org.eclipse.wst.jsdt.internal.core.util.Util; - -public class CopyMoveResourcesTests extends CopyMoveTests { -/** - */ -public CopyMoveResourcesTests(String name) { - super(name); -} -/** - * Copies the element to the container with optional rename - * and forcing. The operation should succeed, so any exceptions - * encountered are thrown. - */ -public IJavaScriptElement copyPositive(IJavaScriptElement element, IJavaScriptElement container, IJavaScriptElement sibling, String rename, boolean force) throws JavaScriptModelException { - try { - startDeltas(); - - // if forcing, ensure that a name collision exists - if (force) { - IJavaScriptElement collision = generateHandle(element, rename, container); - assertTrue("Collision does not exist", collision.exists()); - } - - // copy - ((ISourceManipulation) element).copy(container, sibling, rename, force, null); - - // ensure the original element still exists - assertTrue("The original element must still exist", element.exists()); - - // generate the new element handle - IJavaScriptElement copy = generateHandle(element, rename, container); - assertTrue("Copy should exist", copy.exists()); - //ensure correct position - if (element.getElementType() > IJavaScriptElement.JAVASCRIPT_UNIT) { - ensureCorrectPositioning((IParent) container, sibling, copy); - } - IJavaScriptElementDelta destDelta = getDeltaFor(container, true); - assertTrue("Destination container not changed", destDelta != null && destDelta.getKind() == IJavaScriptElementDelta.CHANGED); - IJavaScriptElementDelta[] deltas = destDelta.getAddedChildren(); - // FIXME: not strong enough - boolean found = false; - for (int i = 0; i < deltas.length; i++) { - if (deltas[i].getElement().equals(copy)) - found = true; - } - assertTrue("Added children not correct for element copy", found); - return copy; - } finally { - stopDeltas(); - } -} - -/** - * Moves the elements to the containers with optional renaming - * and forcing. The operation should succeed, so any exceptions - * encountered are thrown. - */ -public void movePositive(IJavaScriptElement[] elements, IJavaScriptElement[] destinations, IJavaScriptElement[] siblings, String[] names, boolean force, IProgressMonitor monitor) throws JavaScriptModelException { - try { - startDeltas(); - - // if forcing, ensure that a name collision exists - int i; - if (force) { - for (i = 0; i < elements.length; i++) { - IJavaScriptElement e = elements[i]; - IJavaScriptElement collision = null; - if (names == null) { - collision = generateHandle(e, null, destinations[i]); - } else { - collision = generateHandle(e, names[i], destinations[i]); - } - assertTrue("Collision does not exist", collision.exists()); - } - } - - // move - getJavaModel().move(elements, destinations, siblings, names, force, monitor); - - for (i = 0; i < elements.length; i++) { - IJavaScriptElement element = elements[i]; - IJavaScriptElement moved = null; - if (names == null) { - moved = generateHandle(element, null, destinations[i]); - } else { - moved = generateHandle(element, names[i], destinations[i]); - } - // ensure the original element no longer exists, unless moving within the same container, or moving a primary working copy - if (!destinations[i].equals(element.getParent())) { - if (element.getElementType() != IJavaScriptElement.JAVASCRIPT_UNIT || !((IJavaScriptUnit) element).isWorkingCopy()) - assertTrue("The original element must not exist", !element.exists()); - } - assertTrue("Moved element should exist", moved.exists()); - - IJavaScriptElementDelta destDelta = null; - if (isMainType(element, destinations[i]) && names != null && names[i] != null) { //moved/renamed main type to same cu - destDelta = getDeltaFor(moved.getParent()); - assertTrue("Renamed compilation unit as result of main type not added", destDelta != null && destDelta.getKind() == IJavaScriptElementDelta.ADDED); - IJavaScriptElementDelta[] deltas = destDelta.getAddedChildren(); - assertTrue("Added children not correct for element copy", deltas[0].getElement().equals(moved)); - assertTrue("flag should be F_MOVED_FROM", (deltas[0].getFlags() & IJavaScriptElementDelta.F_MOVED_FROM) > 0); - assertTrue("moved from handle should be original", deltas[0].getMovedFromElement().equals(element)); - } else { - destDelta = getDeltaFor(destinations[i], true); - assertTrue("Destination container not changed", destDelta != null && destDelta.getKind() == IJavaScriptElementDelta.CHANGED); - IJavaScriptElementDelta[] deltas = destDelta.getAddedChildren(); - for (int j = 0; j < deltas.length - 1; j++) { - // side effect packages added - IJavaScriptElement pkg = deltas[j].getElement(); - assertTrue("Side effect child should be a package fragment", pkg.getElementType() == IJavaScriptElement.PACKAGE_FRAGMENT); - assertTrue("Side effect child should be an enclosing package", element.getElementName().startsWith(pkg.getElementName())); - } - IJavaScriptElementDelta pkgDelta = deltas[deltas.length - 1]; - assertTrue("Added children not correct for element copy", pkgDelta.getElement().equals(moved)); - assertTrue("flag should be F_MOVED_FROM", (pkgDelta.getFlags() & IJavaScriptElementDelta.F_MOVED_FROM) > 0); - assertTrue("moved from handle shoud be original", pkgDelta.getMovedFromElement().equals(element)); - IJavaScriptElementDelta sourceDelta = getDeltaFor(element, true); - assertTrue("moved to handle should be original", sourceDelta.getMovedToElement().equals(moved)); - } - } - } finally { - stopDeltas(); - } -} -/** - * Setup for the next test. - */ -public void setUp() throws Exception { - super.setUp(); - - this.createJavaProject("P", new String[] {"src", "src2"}); -} -static { -// TESTS_NAMES = new String[] { "testCopyWorkingCopyDestination"}; -} -public static Test suite() { - return buildModelTestSuite(CopyMoveResourcesTests.class); -} -/** - * Cleanup after the previous test. - */ -public void tearDown() throws Exception { - this.deleteProject("P"); - - super.tearDown(); -} -/** - * This operation should fail as copying a CU and a CU member at the - * same time is not supported. - */ -public void testCopyCUAndType() throws CoreException { - this.createFolder("/P/src/p1"); - this.createFile( - "/P/src/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}" - ); - IJavaScriptUnit cuSource = getCompilationUnit("/P/src/p1/X.js"); - - copyNegative( - new IJavaScriptElement[]{cuSource, cuSource.getType("X")}, - new IJavaScriptElement[]{cuSource.getParent(), cuSource}, - null, - new String[]{"Y.js", "Y"}, - false, - IJavaScriptModelStatusConstants.INVALID_ELEMENT_TYPES); -} -/** - * Ensures that a CU can be copied to a different package, replacing an existing CU. - */ -public void testCopyCUForce() throws CoreException { - this.createFolder("/P/src/p1"); - this.createFile( - "/P/src/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}" - ); - IJavaScriptUnit cuSource = getCompilationUnit("/P/src/p1/X.js"); - - this.createFolder("/P/src/p2"); - this.createFile( - "/P/src/p2/X.js", - "package p2;\n" + - "public class X {\n" + - "}" - ); - IPackageFragment pkgDest = getPackage("/P/src/p2"); - - copyPositive(cuSource, pkgDest, null, null, true); -} -/** - * Ensures that a CU can be copied to a different package, - * and be renamed. - */ -public void testCopyCURename() throws CoreException { - this.createFolder("/P/src/p1"); - this.createFile( - "/P/src/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}" - ); - IJavaScriptUnit cuSource = getCompilationUnit("/P/src/p1/X.js"); - - this.createFolder("/P/src/p2"); - IPackageFragment pkgDest = getPackage("/P/src/p2"); - - copyPositive(cuSource, pkgDest, null, "Y.js", false); -} -/** - * Ensures that a read-only CU can be copied to a different package. - */ -public void testCopyCUReadOnly() throws CoreException { - if (!Util.isReadOnlySupported()) { - // Do not test if file system does not support read-only attribute - return; - } - IFile file = null; - IFile file2 = null; - try { - this.createFolder("/P/src/p1"); - file = this.createFile( - "/P/src/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}" - ); - Util.setReadOnly(file, true); - IJavaScriptUnit cuSource = getCompilationUnit("/P/src/p1/X.js"); - - this.createFolder("/P/src/p2"); - IPackageFragment pkgDest = getPackage("/P/src/p2"); - - copyPositive(cuSource, pkgDest, null, null, false); - - file2 = getFile("/P/src/p2/X.js"); - assertTrue("Destination cu should be read-only", file2.isReadOnly()); - } finally { - if (file != null) { - Util.setReadOnly(file, false); - } - if (file2 != null) { - Util.setReadOnly(file2, false); - } - deleteFolder("/P/src/p1"); - deleteFolder("/P/src/p2"); - } -} -/** - * Ensures that a CU can be copied to a different package, - * and be renamed, overwriting an existing CU - */ -public void testCopyCURenameForce() throws CoreException { - this.createFolder("/P/src/p1"); - this.createFile( - "/P/src/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}" - ); - IJavaScriptUnit cuSource = getCompilationUnit("/P/src/p1/X.js"); - - this.createFolder("/P/src/p2"); - this.createFile( - "/P/src/p2/Y.js", - "package p2;\n" + - "public class Y {\n" + - "}" - ); - IPackageFragment pkgDest = getPackage("/P/src/p2"); - - copyPositive(cuSource, pkgDest, null, "Y.js", true); -} -/** - * Ensures that a CU cannot be copied to a different package,over an existing CU when no force. - */ -public void testCopyCUWithCollision() throws CoreException { - this.createFolder("/P/src/p1"); - this.createFile( - "/P/src/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}" - ); - IJavaScriptUnit cuSource = getCompilationUnit("/P/src/p1/X.js"); - - this.createFolder("/P/src/p2"); - this.createFile( - "/P/src/p2/X.js", - "package p2;\n" + - "public class X {\n" + - "}" - ); - IPackageFragment pkgDest = getPackage("/P/src/p2"); - - copyNegative(cuSource, pkgDest, null, null, false, IJavaScriptModelStatusConstants.NAME_COLLISION); -} -/** - * Ensures that a CU cannot be copied to an invalid destination - */ -public void testCopyCUWithInvalidDestination() throws CoreException { - this.createFolder("/P/src/p1"); - this.createFile( - "/P/src/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}" - ); - IJavaScriptUnit cuSource = getCompilationUnit("/P/src/p1/X.js"); - - copyNegative(cuSource, cuSource, null, null, false, IJavaScriptModelStatusConstants.INVALID_DESTINATION); -} -/** - * Ensures that a CU can be copied to a null container - */ -public void testCopyCUWithNullContainer() throws CoreException { - this.createFolder("/P/src/p1"); - this.createFile( - "/P/src/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}" - ); - IJavaScriptUnit cuSource = getCompilationUnit("/P/src/p1/X.js"); - - try { - cuSource.copy(null, null, null, false, null); - } catch (IllegalArgumentException iae) { - return; - } - assertTrue("Should not be able to move a cu to a null container", false); -} -/** - * Ensures that a CU can be copied to along with its server properties. - * (Regression test for PR #1G56QT9) - */ -public void testCopyCUWithServerProperties() throws CoreException { - this.createFolder("/P/src/p1"); - this.createFile( - "/P/src/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}" - ); - IJavaScriptUnit cuSource = getCompilationUnit("/P/src/p1/X.js"); - - QualifiedName qualifiedName = new QualifiedName("x.y.z", "a property"); - cuSource.getUnderlyingResource().setPersistentProperty( - qualifiedName, - "some value"); - - this.createFolder("/P/src/p2"); - IPackageFragment pkgDest = getPackage("/P/src/p2"); - - copyPositive(cuSource, pkgDest, null, null, false); - IJavaScriptUnit cu= pkgDest.getJavaScriptUnit("X.js"); - String propertyValue = cu.getUnderlyingResource().getPersistentProperty(qualifiedName); - assertEquals( - "Server property should be copied with cu", - "some value", - propertyValue - ); -} -/** - * Ensures that a package fragment can be copied to a different package fragment root. - */ -public void testCopyPackageFragment() throws CoreException { - this.createFolder("/P/src/p1"); - this.createFile( - "/P/src/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}" - ); - IPackageFragment pkgSource = getPackage("/P/src/p1"); - - IPackageFragmentRoot rootDest= getPackageFragmentRoot("P", "src2"); - - copyPositive(pkgSource, rootDest, null, null, false); -} -/** - * Ensures that a package fragment can be copied to a different package fragment root. - */ -public void testCopyReadOnlyPackageFragment() throws CoreException { - if (!Util.isReadOnlySupported()) { - // Do not test if file system does not support read-only attribute - return; - } - IPackageFragment pkgSource = null; - IPackageFragment pkg2 = null; - try { - this.createFolder("/P/src/p1/p2/p3"); - this.createFile( - "/P/src/p1/p2/p3/X.js", - "package p1.p2.p3;\n" + - "public class X {\n" + - "}" - ); - Util.setReadOnly(getFile("/P/src/p1/p2/p3/X.js"), true); - pkgSource = getPackage("/P/src/p1"); - Util.setReadOnly(pkgSource.getResource(), true); - pkg2 = getPackage("/P/src/p1/p2/p3"); - Util.setReadOnly(pkg2.getResource(), true); - - IPackageFragmentRoot rootDest= getPackageFragmentRoot("P", "src2"); - - copyPositive(pkg2, rootDest, null, null, false); - - assertTrue("Not readOnly", Util.isReadOnly(getPackage("/P/src2/p1").getResource())); - assertTrue("Is readOnly", !Util.isReadOnly(getPackage("/P/src2/p1/p2").getResource())); - assertTrue("Not readOnly", Util.isReadOnly(getPackage("/P/src2/p1/p2/p3").getResource())); - assertTrue("Is readOnly", Util.isReadOnly(getFile("/P/src2/p1/p2/p3/X.js"))); - } finally { - IFile xSrcFile = getFile("/P/src/p1/p2/p3/X.js"); - if (xSrcFile != null) { - Util.setReadOnly(xSrcFile, false); - } - if (pkg2 != null) { - Util.setReadOnly(pkg2.getResource(), false); - } - if (pkgSource != null) { - Util.setReadOnly(pkgSource.getResource(), false); - } - IPackageFragment p1Fragment = getPackage("/P/src2/p1"); - if (p1Fragment != null) { - Util.setReadOnly(p1Fragment.getResource(), false); - } - IPackageFragment p3Fragment = getPackage("/P/src2/p1/p2/p3"); - if (p3Fragment != null) { - Util.setReadOnly(p3Fragment.getResource(), false); - } - IFile xFile = getFile("/P/src2/p1/p2/p3/X.js"); - if (xFile != null) { - Util.setReadOnly(xFile, false); - } - deleteFolder("/P/src/p1"); - } -} -/** - * Ensures that a WorkingCopy can be copied to a different package. - */ -public void testCopyWorkingCopy() throws CoreException { - IJavaScriptUnit copy = null; - try { - this.createFolder("/P/src/p1"); - this.createFile( - "/P/src/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}" - ); - IJavaScriptUnit cuSource = getCompilationUnit("/P/src/p1/X.js"); - copy = cuSource.getWorkingCopy(null); - - this.createFolder("/P/src/p2"); - IPackageFragment pkgDest = getPackage("/P/src/p2"); - - copyPositive(copy, pkgDest, null, null, false); - } finally { - if (copy != null) copy.discardWorkingCopy(); - } -} -/* - * Ensures that a CU can be copied over an existing primary working copy in a different package. - * (regression test for bug 117282 Package declaration inserted on wrong CU while copying class if names collide and editor opened) - */ -public void testCopyWorkingCopyDestination() throws CoreException { - IJavaScriptUnit copy = null; - try { - createFolder("/P/src/p1"); - createFile( - "/P/src/p1/X.js", - "package p1;\n" + - "public class X {\n" + - " void foo() {}\n" + - "}" - ); - IJavaScriptUnit cuSource = getCompilationUnit("/P/src/p1/X.js"); - - createFolder("/P/src/p2"); - IPackageFragment pkgDest = getPackage("/P/src/p2"); - createFile( - "/P/src/p2/X.js", - "\n" + - "package p1;\n" + - "public class X {\n" + - "}" - ); - copy = getCompilationUnit("/P/src/p2/X.js"); - copy.becomeWorkingCopy(null); - - copyPositive(cuSource, pkgDest, null, null, true/*force*/); - } finally { - if (copy != null) copy.discardWorkingCopy(); - } -} -/** - * Ensures that a WorkingCopy can be copied to a different package, replacing an existing WorkingCopy. - */ -public void testCopyWorkingCopyForce() throws CoreException { - IJavaScriptUnit copy = null; - try { - this.createFolder("/P/src/p1"); - this.createFile( - "/P/src/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}" - ); - IJavaScriptUnit cuSource = getCompilationUnit("/P/src/p1/X.js"); - copy = cuSource.getWorkingCopy(null); - - this.createFolder("/P/src/p2"); - this.createFile( - "/P/src/p2/X.js", - "package p2;\n" + - "public class X {\n" + - "}" - ); - IPackageFragment pkgDest = getPackage("/P/src/p2"); - - copyPositive(copy, pkgDest, null, null, true); - } finally { - if (copy != null) copy.discardWorkingCopy(); - } -} -/** - * Ensures that a WorkingCopy can be copied to a different package, - * and be renamed. - */ -public void testCopyWorkingCopyRename() throws CoreException { - IJavaScriptUnit copy = null; - try { - this.createFolder("/P/src/p1"); - this.createFile( - "/P/src/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}" - ); - IJavaScriptUnit cuSource = getCompilationUnit("/P/src/p1/X.js"); - copy = cuSource.getWorkingCopy(null); - - this.createFolder("/P/src/p2"); - IPackageFragment pkgDest = getPackage("/P/src/p2"); - - copyPositive(copy, pkgDest, null, "Y.js", false); - } finally { - if (copy != null) copy.discardWorkingCopy(); - } -} -/** - * Ensures that a WorkingCopy can be copied to a different package, - * and be renamed, overwriting an existing WorkingCopy - */ -public void testCopyWorkingCopyRenameForce() throws CoreException { - IJavaScriptUnit copy = null; - try { - this.createFolder("/P/src/p1"); - this.createFile( - "/P/src/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}" - ); - IJavaScriptUnit cuSource = getCompilationUnit("/P/src/p1/X.js"); - copy = cuSource.getWorkingCopy(null); - - this.createFolder("/P/src/p2"); - this.createFile( - "/P/src/p2/Y.js", - "package p2;\n" + - "public class Y {\n" + - "}" - ); - IPackageFragment pkgDest = getPackage("/P/src/p2"); - - copyPositive(copy, pkgDest, null, "Y.js", true); - } finally { - if (copy != null) copy.discardWorkingCopy(); - } -} -/** - * Ensures that a WorkingCopy cannot be copied to a different package,over an existing WorkingCopy when no force. - */ -public void testCopyWorkingCopyWithCollision() throws CoreException { - IJavaScriptUnit copy = null; - try { - this.createFolder("/P/src/p1"); - this.createFile( - "/P/src/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}" - ); - IJavaScriptUnit cuSource = getCompilationUnit("/P/src/p1/X.js"); - copy = cuSource.getWorkingCopy(null); - - this.createFolder("/P/src/p2"); - this.createFile( - "/P/src/p2/X.js", - "package p2;\n" + - "public class X {\n" + - "}" - ); - IPackageFragment pkgDest = getPackage("/P/src/p2"); - - copyNegative(copy, pkgDest, null, null, false, IJavaScriptModelStatusConstants.NAME_COLLISION); - } finally { - if (copy != null) copy.discardWorkingCopy(); - } -} -/** - * Ensures that a WorkingCopy cannot be copied to an invalid destination - */ -public void testCopyWorkingCopyWithInvalidDestination() throws CoreException { - IJavaScriptUnit copy = null; - try { - this.createFolder("/P/src/p1"); - this.createFile( - "/P/src/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}" - ); - IJavaScriptUnit cuSource = getCompilationUnit("/P/src/p1/X.js"); - copy = cuSource.getWorkingCopy(null); - - copyNegative(copy, cuSource, null, null, false, IJavaScriptModelStatusConstants.INVALID_DESTINATION); - } finally { - if (copy != null) copy.discardWorkingCopy(); - } -} -/** - * This operation should fail as moving a CU and a CU member at the - * same time is not supported. - */ -public void testMoveCUAndType() throws CoreException { - this.createFolder("/P/src/p1"); - this.createFile( - "/P/src/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}" - ); - IJavaScriptUnit cuSource = getCompilationUnit("/P/src/p1/X.js"); - - moveNegative( - new IJavaScriptElement[]{cuSource, cuSource.getType("X")}, - new IJavaScriptElement[]{cuSource.getParent(), cuSource}, - null, - new String[]{"Y.js", "Y"}, - false, - IJavaScriptModelStatusConstants.INVALID_ELEMENT_TYPES); -} -/** - * Ensures that a CU can be moved to a different package, replacing an - * existing CU. - */ -public void testMoveCUForce() throws CoreException { - this.createFolder("/P/src/p1"); - this.createFile( - "/P/src/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}" - ); - IJavaScriptUnit cuSource = getCompilationUnit("/P/src/p1/X.js"); - - this.createFolder("/P/src/p2"); - this.createFile( - "/P/src/p2/X.js", - "package p2;\n" + - "public class X {\n" + - "}" - ); - IPackageFragment pkgDest = getPackage("/P/src/p2"); - - movePositive(cuSource, pkgDest, null, null, true); -} -/** - * Ensures that a CU can be moved to a different package, - * be renamed - */ -public void testMoveCURename() throws CoreException { - this.createFolder("/P/src/p1"); - this.createFile( - "/P/src/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}" - ); - IJavaScriptUnit cuSource = getCompilationUnit("/P/src/p1/X.js"); - - this.createFolder("/P/src/p2"); - IPackageFragment pkgDest = getPackage("/P/src/p2"); - - movePositive(cuSource, pkgDest, null, "Y.js", false); -} -/** - * Ensures that a CU can be moved to a different package, - * be renamed, overwriting an existing resource. - */ -public void testMoveCURenameForce() throws CoreException { - this.createFolder("/P/src/p1"); - this.createFile( - "/P/src/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}" - ); - IJavaScriptUnit cuSource = getCompilationUnit("/P/src/p1/X.js"); - - this.createFolder("/P/src/p2"); - this.createFile( - "/P/src/p2/Y.js", - "package p2;\n" + - "public class Y {\n" + - "}" - ); - IPackageFragment pkgDest = getPackage("/P/src/p2"); - - movePositive(cuSource, pkgDest, null, "Y.js", true); -} -/** - * Ensures that a CU cannot be moved to a different package, replacing an - * existing CU when not forced. - */ -public void testMoveCUWithCollision() throws CoreException { - this.createFolder("/P/src/p1"); - this.createFile( - "/P/src/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}" - ); - IJavaScriptUnit cuSource = getCompilationUnit("/P/src/p1/X.js"); - - this.createFolder("/P/src/p2"); - this.createFile( - "/P/src/p2/X.js", - "package p2;\n" + - "public class X {\n" + - "}" - ); - IPackageFragment pkgDest = getPackage("/P/src/p2"); - - moveNegative(cuSource, pkgDest, null, null, false, IJavaScriptModelStatusConstants.NAME_COLLISION); -} -/** - * Ensures that a CU cannot be moved to an invalid destination. - */ -public void testMoveCUWithInvalidDestination() throws CoreException { - this.createFolder("/P/src/p1"); - this.createFile( - "/P/src/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}" - ); - IJavaScriptUnit cuSource = getCompilationUnit("/P/src/p1/X.js"); - - moveNegative(cuSource, cuSource, null, null, false, IJavaScriptModelStatusConstants.INVALID_DESTINATION); -} -/** - * Ensures that a CU cannot be moved to a null container - */ -public void testMoveCUWithNullContainer() throws CoreException { - this.createFolder("/P/src/p1"); - this.createFile( - "/P/src/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}" - ); - IJavaScriptUnit cuSource = getCompilationUnit("/P/src/p1/X.js"); - - try { - cuSource.move(null, null, null, false, null); - } catch (IllegalArgumentException iae) { - return; - } - assertTrue("Should not be able to move a cu to a null container", false); -} -/** - * Ensures that a package fragment can be moved to a different package fragment root. - */ -public void testMovePackageFragment() throws CoreException { - this.createFolder("/P/src/p1"); - this.createFile( - "/P/src/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}" - ); - IPackageFragment pkgSource = getPackage("/P/src/p1"); - - IPackageFragmentRoot rootDest= getPackageFragmentRoot("P", "src2"); - - movePositive(pkgSource, rootDest, null, null, false); -} -/** - * Ensures that a package fragment can be copied to a different package fragment root. - */ -public void testMoveReadOnlyPackageFragment() throws CoreException { - if (!Util.isReadOnlySupported()) { - // Do not test if file system does not support read-only attribute - return; - } - IPackageFragment pkgSource = null; - IPackageFragment pkg2 = null; - try { - this.createFolder("/P/src/p1/p2/p3"); - this.createFile( - "/P/src/p1/p2/p3/X.js", - "package p1.p2.p3;\n" + - "public class X {\n" + - "}" - ); - Util.setReadOnly(getFile("/P/src/p1/p2/p3/X.js"), true); - pkgSource = getPackage("/P/src/p1"); - Util.setReadOnly(pkgSource.getResource(), true); - pkg2 = getPackage("/P/src/p1/p2/p3"); - Util.setReadOnly(pkg2.getResource(), true); - - IPackageFragmentRoot rootDest= getPackageFragmentRoot("P", "src2"); - - movePositive(pkg2, rootDest, null, null, false); - - assertTrue("Not readOnly", Util.isReadOnly(getPackage("/P/src2/p1").getResource())); - assertTrue("Is readOnly", !Util.isReadOnly(getPackage("/P/src2/p1/p2").getResource())); - assertTrue("Not readOnly", Util.isReadOnly(getPackage("/P/src2/p1/p2/p3").getResource())); - assertTrue("Is readOnly", Util.isReadOnly(getFile("/P/src2/p1/p2/p3/X.js"))); - } finally { - IFile xSrcFile = getFile("/P/src/p1/p2/p3/X.js"); - if (xSrcFile != null) { - Util.setReadOnly(xSrcFile, false); - } - if (pkg2 != null) { - Util.setReadOnly(pkg2.getResource(), false); - } - if (pkgSource != null) { - Util.setReadOnly(pkgSource.getResource(), false); - } - IPackageFragment p1Fragment = getPackage("/P/src2/p1"); - if (p1Fragment != null) { - Util.setReadOnly(p1Fragment.getResource(), false); - } - IPackageFragment p3Fragment = getPackage("/P/src2/p1/p2/p3"); - if (p3Fragment != null) { - Util.setReadOnly(p3Fragment.getResource(), false); - } - IFile xFile = getFile("/P/src2/p1/p2/p3/X.js"); - if (xFile != null) { - Util.setReadOnly(xFile, false); - } - deleteFolder("/P/src/p1"); - } -} -/** - * Ensures that a WorkingCopy cannot be moved to a different package. - */ -public void testMoveWorkingCopy() throws CoreException { - IJavaScriptUnit copy = null; - try { - this.createFolder("/P/src/p1"); - this.createFile( - "/P/src/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}" - ); - IJavaScriptUnit cuSource = getCompilationUnit("/P/src/p1/X.js"); - copy = cuSource.getWorkingCopy(null); - - this.createFolder("/P/src/p2"); - IPackageFragment pkgDest = getPackage("/P/src/p2"); - - moveNegative(copy, pkgDest, null, null, false, IJavaScriptModelStatusConstants.INVALID_ELEMENT_TYPES); - } finally { - if (copy != null) copy.discardWorkingCopy(); - } -} - -/* - * Ensures that a primary working copy can be moved to a different package - * and that its buffer doesn't contain unsaved changed after the move. - * (regression test for bug 83599 CU dirty after move refactoring) - */ -public void testMoveWorkingCopy2() throws CoreException { - IJavaScriptUnit copy = null; - try { - this.createFolder("/P/src/p1"); - this.createFile( - "/P/src/p1/X.js", - "package p1;\n" + - "public class X {\n" + - "}" - ); - copy = getCompilationUnit("/P/src/p1/X.js"); - copy.becomeWorkingCopy(null); - - this.createFolder("/P/src/p2"); - IPackageFragment pkgDest = getPackage("/P/src/p2"); - - movePositive(copy, pkgDest, null, null, false); - assertTrue("Should not have unsaved changes", !copy.getBuffer().hasUnsavedChanges()); - } finally { - if (copy != null) copy.discardWorkingCopy(); - } -} -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CopyMoveTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CopyMoveTests.java deleted file mode 100644 index 7fcce84..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CopyMoveTests.java +++ /dev/null @@ -1,307 +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 org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.wst.jsdt.core.*; - -abstract public class CopyMoveTests extends ModifyingResourceTests { -public CopyMoveTests(String name) { - super(name); -} -/** - * Attempts to copy the element with optional - * forcing. The operation should fail with the failure code. - */ -public void copyNegative(IJavaScriptElement element, IJavaScriptElement destination, IJavaScriptElement sibling, String rename, boolean force, int failureCode) { - try { - ((ISourceManipulation)element).copy(destination, sibling, rename, force, null); - } catch (JavaScriptModelException jme) { - assertTrue("Code not correct for JavaScriptModelException: " + jme, jme.getStatus().getCode() == failureCode); - return; - } - assertTrue("The copy should have failed for: " + element, false); - return; -} -/** - * Attempts to copy the elements with optional - * forcing. The operation should fail with the failure code. - */ -public void copyNegative(IJavaScriptElement[] elements, IJavaScriptElement[] destinations, IJavaScriptElement[] siblings, String[] renames, boolean force, int failureCode) { - try { - getJavaModel().copy(elements, destinations, siblings, renames, force, null); - } catch (JavaScriptModelException jme) { - assertTrue("Code not correct for JavaScriptModelException: " + jme, jme.getStatus().getCode() == failureCode); - return; - } - assertTrue("The move should have failed for for multiple elements: ", false); - return; -} -/** - * Copies the element to the container with optional rename - * and forcing. The operation should succeed, so any exceptions - * encountered are thrown. - */ -public IJavaScriptElement copyPositive(IJavaScriptElement element, IJavaScriptElement container, IJavaScriptElement sibling, String rename, boolean force) throws JavaScriptModelException { - // if forcing, ensure that a name collision exists - if (force) { - IJavaScriptElement collision = generateHandle(element, rename, container); - assertTrue("Collision does not exist", collision.exists()); - } - - IJavaScriptElement copy; - try { - startDeltas(); - - // copy - ((ISourceManipulation) element).copy(container, sibling, rename, force, null); - - // ensure the original element still exists - assertTrue("The original element must still exist", element.exists()); - - // generate the new element handle - copy = generateHandle(element, rename, container); - assertTrue("Copy should exist", copy.exists()); - - //ensure correct position - if (element.getElementType() > IJavaScriptElement.JAVASCRIPT_UNIT) { - ensureCorrectPositioning((IParent) container, sibling, copy); - } - if (copy.getElementType() == IJavaScriptElement.IMPORT_DECLARATION) - container = ((IJavaScriptUnit) container).getImportContainer(); - IJavaScriptElementDelta destDelta = getDeltaFor(container, true); - assertTrue("Destination container not changed", destDelta != null && destDelta.getKind() == IJavaScriptElementDelta.CHANGED); - IJavaScriptElementDelta[] deltas = destDelta.getAddedChildren(); - assertTrue("Added children not correct for element copy", deltas[0].getElement().equals(copy)); - } finally { - stopDeltas(); - } - return copy; -} -/** - * Generates a new handle to the original element in - * its new container. - */ -public IJavaScriptElement generateHandle(IJavaScriptElement original, String rename, IJavaScriptElement container) { - String name = original.getElementName(); - if (rename != null) { - name = rename; - } - switch (container.getElementType()) { - case IJavaScriptElement.PACKAGE_FRAGMENT_ROOT : - switch (original.getElementType()) { - case IJavaScriptElement.PACKAGE_FRAGMENT : - return ((IPackageFragmentRoot) container).getPackageFragment(name); - default : - assertTrue("illegal child type", false); - break; - } - break; - case IJavaScriptElement.PACKAGE_FRAGMENT : - switch (original.getElementType()) { - case IJavaScriptElement.JAVASCRIPT_UNIT : - return ((IPackageFragment) container).getJavaScriptUnit(name); - default : - assertTrue("illegal child type", false); - break; - } - break; - case IJavaScriptElement.JAVASCRIPT_UNIT : - switch (original.getElementType()) { - case IJavaScriptElement.IMPORT_DECLARATION : - return ((IJavaScriptUnit) container).getImport(name); - case IJavaScriptElement.TYPE : - if (isMainType(original, container)) { - //the cu has been renamed as well - container = ((IPackageFragment) container.getParent()).getJavaScriptUnit(name + ".js"); - } - return ((IJavaScriptUnit) container).getType(name); - default : - assertTrue("illegal child type", false); - break; - } - break; - case IJavaScriptElement.TYPE : - switch (original.getElementType()) { - case IJavaScriptElement.METHOD : - if (name.equals(original.getParent().getElementName())) { - //method is a constructor - return ((IType) container).getFunction(container.getElementName(), ((IFunction) original).getParameterTypes()); - } - return ((IType) container).getFunction(name, ((IFunction) original).getParameterTypes()); - case IJavaScriptElement.FIELD : - return ((IType) container).getField(name); - case IJavaScriptElement.TYPE : - return ((IType) container).getType(name); - case IJavaScriptElement.INITIALIZER : - //hack to return the first initializer - return ((IType) container).getInitializer(1); - default : - assertTrue("illegal child type", false); - break; - } - break; - default : - assertTrue("unsupported container type", false); - break; - } - assertTrue("should not get here", false); - return null; -} -/** - * Returns true if this element is the main type of its compilation unit. - */ -protected boolean isMainType(IJavaScriptElement element, IJavaScriptElement parent) { - if (parent instanceof IJavaScriptUnit) { - if (element instanceof IType) { - IJavaScriptUnit cu= (IJavaScriptUnit)parent; - String typeName = cu.getElementName(); - typeName = typeName.substring(0, typeName.length() - 5); - return element.getElementName().equals(typeName) && element.getParent().equals(cu); - } - } - return false; -} -/** - * Attempts to move the element with optional - * forcing. The operation should fail with the failure code. - */ -public void moveNegative(IJavaScriptElement element, IJavaScriptElement destination, IJavaScriptElement sibling, String rename, boolean force, int failureCode) { - try { - ((ISourceManipulation)element).move(destination, sibling, rename, force, null); - } catch (JavaScriptModelException jme) { - assertTrue("Code not correct for JavaScriptModelException: " + jme, jme.getStatus().getCode() == failureCode); - return; - } - assertTrue("The move should have failed for: " + element, false); - return; -} -/** - * Attempts to move the element with optional - * forcing. The operation should fail with the failure code. - */ -public void moveNegative(IJavaScriptElement[] elements, IJavaScriptElement[] destinations, IJavaScriptElement[] siblings, String[] renames, boolean force, int failureCode) { - try { - getJavaModel().move(elements, destinations, siblings, renames, force, null); - } catch (JavaScriptModelException jme) { - assertTrue("Code not correct for JavaScriptModelException: " + jme, jme.getStatus().getCode() == failureCode); - return; - } - assertTrue("The move should have failed for for multiple elements: ", false); - return; -} -/** - * Moves the element to the container with optional rename - * and forcing. The operation should succeed, so any exceptions - * encountered are thrown. - */ -public void movePositive(IJavaScriptElement element, IJavaScriptElement container, IJavaScriptElement sibling, String rename, boolean force) throws JavaScriptModelException { - IJavaScriptElement[] siblings = new IJavaScriptElement[] {sibling}; - String[] renamings = new String[] {rename}; - if (sibling == null) { - siblings = null; - } - if (rename == null) { - renamings = null; - } - movePositive(new IJavaScriptElement[] {element}, new IJavaScriptElement[] {container}, siblings, renamings, force); -} -/** - * Moves the elements to the containers with optional renaming - * and forcing. The operation should succeed, so any exceptions - * encountered are thrown. - */ -public void movePositive(IJavaScriptElement[] elements, IJavaScriptElement[] destinations, IJavaScriptElement[] siblings, String[] names, boolean force) throws JavaScriptModelException { - movePositive(elements, destinations, siblings, names, force, null); -} -/** - * Moves the elements to the containers with optional renaming - * and forcing. The operation should succeed, so any exceptions - * encountered are thrown. - */ -public void movePositive(IJavaScriptElement[] elements, IJavaScriptElement[] destinations, IJavaScriptElement[] siblings, String[] names, boolean force, IProgressMonitor monitor) throws JavaScriptModelException { - // if forcing, ensure that a name collision exists - int i; - if (force) { - for (i = 0; i < elements.length; i++) { - IJavaScriptElement e = elements[i]; - IJavaScriptElement collision = null; - if (names == null) { - collision = generateHandle(e, null, destinations[i]); - } else { - collision = generateHandle(e, names[i], destinations[i]); - } - assertTrue("Collision does not exist", collision.exists()); - } - } - - try { - startDeltas(); - - // move - getJavaModel().move(elements, destinations, siblings, names, force, monitor); - for (i = 0; i < elements.length; i++) { - IJavaScriptElement element = elements[i]; - IJavaScriptElement moved = null; - if (names == null) { - moved = generateHandle(element, null, destinations[i]); - } else { - moved = generateHandle(element, names[i], destinations[i]); - } - // ensure the original element no longer exists, unless moving within the same container - if (!destinations[i].equals(element.getParent())) { - if (element.getElementType() == IJavaScriptElement.PACKAGE_FRAGMENT) { - //moving a package fragment does not necessary mean that it no longer exists - //it could have members that are not part of the Java Model - try { - IResource[] members = ((IContainer) element.getUnderlyingResource()).members(); - if (members.length == 0) { - assertTrue("The original element must not exist", !element.exists()); - } - } catch (CoreException ce) { - throw new JavaScriptModelException(ce); - } - } else { - assertTrue("The original element must not exist", !element.exists()); - } - } - assertTrue("Moved element should exist", moved.exists()); - - //ensure correct position - if (element.getElementType() > IJavaScriptElement.JAVASCRIPT_UNIT) { - if (siblings != null && siblings.length > 0) { - ensureCorrectPositioning((IParent) moved.getParent(), siblings[i], moved); - } - } - IJavaScriptElementDelta destDelta = null; - if (isMainType(element, destinations[i]) && names != null && names[i] != null) { //moved/renamed main type to same cu - destDelta = getDeltaFor(moved.getParent()); - assertTrue("Renamed compilation unit as result of main type not added", destDelta != null && destDelta.getKind() == IJavaScriptElementDelta.ADDED); - assertTrue("flag should be F_MOVED_FROM", (destDelta.getFlags() & IJavaScriptElementDelta.F_MOVED_FROM) > 0); - assertTrue("moved from handle should be original", destDelta.getMovedFromElement().equals(element.getParent())); - } else { - destDelta = getDeltaFor(destinations[i], true); - assertTrue("Destination container not changed", destDelta != null && destDelta.getKind() == IJavaScriptElementDelta.CHANGED); - IJavaScriptElementDelta[] deltas = destDelta.getAddedChildren(); - assertTrue("Added children not correct for element copy", deltas[i].getElement().equals(moved)); - assertTrue("should be K_ADDED", deltas[i].getKind() == IJavaScriptElementDelta.ADDED); - IJavaScriptElementDelta sourceDelta= getDeltaFor(element, false); - assertTrue("should be K_REMOVED", sourceDelta.getKind() == IJavaScriptElementDelta.REMOVED); - } - } - } finally { - stopDeltas(); - } -} -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CreateCompilationUnitTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CreateCompilationUnitTests.java deleted file mode 100644 index 0895d12..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CreateCompilationUnitTests.java +++ /dev/null @@ -1,341 +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.File; -import java.io.IOException; - -import junit.framework.Test; - -import org.eclipse.core.resources.IWorkspaceRunnable; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.wst.jsdt.core.IImportDeclaration; -import org.eclipse.wst.jsdt.core.IJavaScriptModelStatusConstants; -import org.eclipse.wst.jsdt.core.IJavaScriptUnit; -import org.eclipse.wst.jsdt.core.IPackageFragment; -import org.eclipse.wst.jsdt.core.IType; -import org.eclipse.wst.jsdt.core.JavaScriptModelException; - -public class CreateCompilationUnitTests extends ModifyingResourceTests { -public CreateCompilationUnitTests(String name) { - super(name); -} -public static Test suite() { - return buildModelTestSuite(CreateCompilationUnitTests.class); -} -public void setUp() throws Exception { - super.setUp(); - createJavaProject("P"); - createFolder("/P/p"); - startDeltas(); -} -public void tearDown() throws Exception { - stopDeltas(); - deleteProject("P"); - super.tearDown(); -} -/** - * Ensures that a compilation unit can be created with specified source - * in a package. - * Verifies that the proper change deltas are generated as a side effect - * of running the operation. - * Ensure that the import container has been created correctly. - */ -//no imports in JS -public void _testCUAndImportContainer() throws JavaScriptModelException { - IPackageFragment pkg = getPackage("/P/p"); - IJavaScriptUnit cu= pkg.createCompilationUnit("HelloImports.js", - ("package p;\n" + - "\n" + - "import java.util.Enumeration;\n" + - "import java.util.Vector;\n" + - "\n" + - "public class HelloImports {\n" + - "\n" + - " public static main(String[] args) {\n" + - " System.out.println(\"HelloWorld\");\n" + - " }\n" + - "}\n"), false,null); - assertCreation(cu); - assertDeltas( - "Unexpected delta", - "P[*]: {CHILDREN}\n" + - " [*]: {CHILDREN}\n" + - " p[*]: {CHILDREN}\n" + - " HelloImports.js[+]: {}" - ); - IImportDeclaration[] imprts= cu.getImports(); - assertTrue("Import does not exist", imprts.length == 2 && imprts[0].exists()); - cu.close(); - imprts= cu.getImports(); - assertTrue("Import does not exist", imprts.length == 2 && imprts[0].exists()); -} -/** - * Ensures that a default compilation unit is created for a type if - * it does not yet exist. - */ -public void testDefaultCU() throws CoreException { - IPackageFragment pkg = getPackage("/P/p"); - IJavaScriptUnit cu= pkg.getJavaScriptUnit("Default.js"); - IType type= cu.createType("function Default (){this.foo = \"\";}", null, false, null); - assertCreation(cu); - assertCreation(type); - assertDeltas( - "Unexpected delta", - "P[*]: {CHILDREN}\n" + - " [*]: {CHILDREN}\n" + - " p[*]: {CHILDREN}\n" + - " Default.js[+]: {}\n" + - "\n" + - "P[*]: {CHILDREN}\n" + - " [*]: {CHILDREN}\n" + - " p[*]: {CHILDREN}\n" + - " Default.js[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" + - " Default[+]: {}" - ); - // CU should have a package statement and type - assertElementDescendants( - "Unexpected children", - "Default.js\n" + - " function Default()\n" + - " class Default\n" + - " var foo\n" + - " Default()", - cu); - - // should fail if we try again - try { - pkg.createCompilationUnit("Default.js", "", false, null); - } catch (JavaScriptModelException jme) { - assertTrue("Exception status not correct for creating a cu that already exists", jme.getStatus().getCode() == IJavaScriptModelStatusConstants.NAME_COLLISION); - } - // should fail if we try again - try { - pkg.createCompilationUnit("Default.js", "public class Default {}", true, null); - return; - } catch (JavaScriptModelException jme) { - } - assertTrue("Creation should not fail if the compilation unit already exists", false); -} -/** - * Ensures that a default compilation unit is created for a type if - * it does not yet exist. - */ -public void testEmptyCU() { - IPackageFragment pkg = getPackage("/P/p"); - // should fail if we try again - try { - pkg.createCompilationUnit("Empty.js", "", true, null); - } catch (JavaScriptModelException jme) { - } - IJavaScriptUnit cu= pkg.getJavaScriptUnit("Empty.js"); - assertCreation(cu); -} -/* - * Ensures that a compilation unit can be created even if a file already exists on the file system. - * (regression test for bug 41611 CreateCompilationUnitOperation.executeOperation() should probably force creation more agressively) - */ -public void testForce() throws JavaScriptModelException, IOException { - IPackageFragment pkg = getPackage("/P/p"); - File folder = pkg.getResource().getLocation().toFile(); - new File(folder, "X.js").createNewFile(); - IJavaScriptUnit cu = pkg.createCompilationUnit( - "X.js", - "function X() {\n" + - " \"\".toLowerCase();\n" + - "}", - true, // force, - null); - assertCreation(cu); - assertDeltas( - "Unexpected delta", - "P[*]: {CHILDREN}\n" + - " [*]: {CHILDREN}\n" + - " p[*]: {CHILDREN}\n" + - " X.js[+]: {}" - ); -} -/** - * Ensures that a compilation unit cannot be created with an invalid name - * in a package. - */ -public void testInvalidName() { - IPackageFragment pkg = getPackage("/P/p"); - try { - pkg.createCompilationUnit("HelloWorld.j", null, false, null); - } catch (JavaScriptModelException jme) { - assertTrue("Incorrect JavaScriptModelException thrown for creating a cu with invalid name", jme.getStatus().getCode() == IJavaScriptModelStatusConstants.INVALID_NAME); - try { - pkg.createCompilationUnit(null, null, false,null); - } catch (JavaScriptModelException jme2) { - assertTrue("Incorrect JavaScriptModelException thrown for creating a cu with invalid name", jme2.getStatus().getCode() == IJavaScriptModelStatusConstants.INVALID_NAME); - return; - } - } - assertTrue("No JavaScriptModelException thrown for creating a cu with an invalid name", false); -} -/** - * Ensures that a compilation unit cannot be created with null source - * in a package. - */ -public void testNullContents() { - IPackageFragment pkg = getPackage("/P/p"); - try { - pkg.createCompilationUnit("HelloWorld.js", null, false, null); - } catch (JavaScriptModelException jme) { - assertTrue("Incorrect JavaScriptModelException thrown for creating a cu with null contents: " + jme, jme.getStatus().getCode() == IJavaScriptModelStatusConstants.INVALID_CONTENTS); - return; - } - assertTrue("No JavaScriptModelException thrown for creating a cu with null contents", false); -} -/** - * Ensures that a compilation unit can be created with specified source - * in a package. - * Verifies that the proper change deltas are generated as a side effect - * of running the operation. - */ -public void testSimpleCreation() throws JavaScriptModelException { - IPackageFragment pkg = getPackage("/P/p"); - IJavaScriptUnit cu= pkg.createCompilationUnit("HelloWorld.js", - ("function HelloWorld() {\n" + - "\n" + - " this.main = function(String[] args) {\n" + - " \"HelloWorld\".toLowerCase();\n" + - " }\n" + - "}\n"), false, null); - assertCreation(cu); - assertDeltas( - "Unexpected delta", - "P[*]: {CHILDREN}\n" + - " [*]: {CHILDREN}\n" + - " p[*]: {CHILDREN}\n" + - " HelloWorld.js[+]: {}" - ); -} -/** - * Ensures that a default compilation unit is created for a type if - * it does not yet exist. - */ -public void testDefaultCUNewFolder() throws CoreException { - createFolder("/P/z"); - IPackageFragment pkg = getPackage("/P/z"); - IJavaScriptUnit cu= pkg.getJavaScriptUnit("Default.js"); - IType type= cu.createType("function Default2 (){this.foo = \"\";}", null, false, null); - assertCreation(cu); - assertCreation(type); - assertDeltas( - "Unexpected delta", - "P[*]: {CHILDREN}\n" + - " [*]: {CHILDREN}\n" + - " z[+]: {}\n"+ - "\n"+ - "P[*]: {CHILDREN}\n" + - " [*]: {CHILDREN}\n" + - " z[*]: {CHILDREN}\n" + - " Default.js[+]: {}\n" + - "\n" + - "P[*]: {CHILDREN}\n" + - " [*]: {CHILDREN}\n" + - " z[*]: {CHILDREN}\n" + - " Default.js[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" + - " Default2[+]: {}" - ); - // CU should have a package statement and type - assertElementDescendants( - "Unexpected children", - "Default.js\n" + - " function Default2()\n" + - " class Default2\n" + - " var foo\n" + - " Default2()", - cu); - - // should fail if we try again - try { - pkg.createCompilationUnit("Default.js", "", false, null); - } catch (JavaScriptModelException jme) { - assertTrue("Exception status not correct for creating a cu that already exists", jme.getStatus().getCode() == IJavaScriptModelStatusConstants.NAME_COLLISION); - } - // should fail if we try again - try { - pkg.createCompilationUnit("Default.js", "public class Default {}", true, null); - return; - } catch (JavaScriptModelException jme) { - } - assertTrue("Creation should not fail if the compilation unit already exists", false); -} - -/** - * Ensures that creating a folder, compilation unit, and types results in - * minimized deltas if in a workspace runnable, but that element info is - * still made available. - */ -public void testDefaultCUNewFolderOperation() throws CoreException { - IWorkspaceRunnable testRun = new IWorkspaceRunnable(){ - public void run(IProgressMonitor monitor) throws CoreException { - createFolder("/P/z"); - IPackageFragment pkg = getPackage("/P/z"); - IJavaScriptUnit cu= pkg.getJavaScriptUnit("Default.js"); - IType type= cu.createType("function Default2 (){this.foo = \"\";}", null, false, null); - assertCreation(cu); - assertCreation(type); - } - }; - ResourcesPlugin.getWorkspace().run(testRun, null); - - assertDeltas( - "Unexpected delta", - "P[*]: {CHILDREN}\n" + - " [*]: {CHILDREN}\n" + - " z[+]: {}"//\n"+ -// "\n"+ -// "P[*]: {CHILDREN}\n" + -// " [*]: {CHILDREN}\n" + -// " z[*]: {CHILDREN}\n" + -// " Default.js[+]: {}\n" + -// "\n" + -// "P[*]: {CHILDREN}\n" + -// " [*]: {CHILDREN}\n" + -// " z[*]: {CHILDREN}\n" + -// " Default.js[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" + -// " Default2[+]: {}" - ); - - IPackageFragment pkg = getPackage("/P/z"); - IJavaScriptUnit cu= pkg.getJavaScriptUnit("Default.js"); - - // CU should have a package statement and type - assertElementDescendants( - "Unexpected children", - "Default.js\n" + - " function Default2()\n" + - " class Default2\n" + - " var foo\n" + - " Default2()", - cu); - - // should fail if we try again - try { - pkg.createCompilationUnit("Default.js", "", false, null); - } catch (JavaScriptModelException jme) { - assertTrue("Exception status not correct for creating a cu that already exists", jme.getStatus().getCode() == IJavaScriptModelStatusConstants.NAME_COLLISION); - } - // should fail if we try again - try { - pkg.createCompilationUnit("Default.js", "public class Default {}", true, null); - return; - } catch (JavaScriptModelException jme) { - } - assertTrue("Creation should not fail if the compilation unit already exists", false); -} -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CreateMembersTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CreateMembersTests.java deleted file mode 100644 index 160ddc1..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CreateMembersTests.java +++ /dev/null @@ -1,144 +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 junit.framework.Test; - -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.wst.jsdt.core.IJavaScriptUnit; -import org.eclipse.wst.jsdt.core.IField; -import org.eclipse.wst.jsdt.core.IFunction; -import org.eclipse.wst.jsdt.core.IType; -import org.eclipse.wst.jsdt.core.JavaScriptModelException; - -public class CreateMembersTests extends AbstractJavaModelTests { - - public CreateMembersTests(String name) { - super(name); - } - - public static Test suite() { - return buildModelTestSuite(CreateMembersTests.class, 1/*sort ascending order*/); - } - public void setUpSuite() throws Exception { - super.setUpSuite(); - setUpJavaProject("CreateMembers", "1.5"); - } - public void tearDownSuite() throws Exception { - deleteProject("CreateMembers"); - - super.tearDownSuite(); - } - - public void test001() throws JavaScriptModelException { - IJavaScriptUnit compilationUnit = getCompilationUnit("CreateMembers", "src", "", "A.js"); - assertNotNull("No compilation unit", compilationUnit); -// IType[] types = compilationUnit.getTypes(); -// assertNotNull("No types", types); -// assertEquals("Wrong size", 1, types.length); -// IType type = types[0]; - compilationUnit.createMethod("\tfunction foo() {\n\t\tSystem.out.println(\"Hello World\");\n\t}\n", null, true, new NullProgressMonitor()); - String expectedSource = - "var aVar;\n" + - "\n" + - "function foo() {\n" + - "\tSystem.out.println(\"Hello World\");\n" + - "}" + - ""; - assertSourceEquals("Unexpected source", expectedSource, compilationUnit.getSource()); - } - - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=86906 - public void test002() throws JavaScriptModelException { - IJavaScriptUnit compilationUnit = getCompilationUnit("CreateMembers", "src", "", "A2.js"); - assertNotNull("No compilation unit", compilationUnit); -// IType[] types = compilationUnit.getTypes(); -// assertNotNull("No types", types); -// assertEquals("Wrong size", 1, types.length); -// IType type = types[0]; - IField sibling = compilationUnit.getField("aVar"); - compilationUnit.createField("var i;", sibling, true, null); - String expectedSource = - "var i;\n" + - "\n" + - "var aVar;" + - ""; - assertSourceEquals("Unexpected source", expectedSource, compilationUnit.getSource()); - } - - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=86906 - public void test003() throws JavaScriptModelException { - IJavaScriptUnit compilationUnit = getCompilationUnit("CreateMembers", "src", "", "Annot.js"); - assertNotNull("No compilation unit", compilationUnit); - IType[] types = compilationUnit.getTypes(); - assertNotNull("No types", types); - assertEquals("Wrong size", 1, types.length); - IType type = types[0]; - IFunction sibling = type.getFunction("foo", new String[]{}); - type.createMethod("String bar();", sibling, true, null); - String expectedSource = - "public @interface Annot {\n" + - " String bar();\n" + - "\n" + - " String foo();\n" + - "}"; - assertSourceEquals("Unexpected source", expectedSource, type.getSource()); - } - - /* - * Ensures that the handle for a created method that has varargs type arguments is correct. - * (regression test for bug 93487 IType#findMethods fails on vararg methods) - */ - public void test004() throws JavaScriptModelException { - IType type = getCompilationUnit("/CreateMembers/src/A.js").getType("A"); - IFunction method = type.createMethod( - "void bar(String... args) {}", - null, // no siblings - false, // don't force - null // no progress monitor - ); - assertTrue("Method should exist", method.exists()); - } - - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=95580 - public void test005() throws JavaScriptModelException { - IJavaScriptUnit compilationUnit = getCompilationUnit("CreateMembers", "src", "", "E2.js"); - assertNotNull("No compilation unit", compilationUnit); - IType[] types = compilationUnit.getTypes(); - assertNotNull("No types", types); - assertEquals("Wrong size", 1, types.length); - IType type = types[0]; - type.createField("int i;", null, true, null); - String expectedSource = - "public enum E2 {\n" + - " A, B, C;\n\n" + - " int i;\n" + - "}"; - assertSourceEquals("Unexpected source", expectedSource, type.getSource()); - } - - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=95580 - public void test006() throws JavaScriptModelException { - IJavaScriptUnit compilationUnit = getCompilationUnit("CreateMembers", "src", "", "E3.js"); - assertNotNull("No compilation unit", compilationUnit); - IType[] types = compilationUnit.getTypes(); - assertNotNull("No types", types); - assertEquals("Wrong size", 1, types.length); - IType type = types[0]; - type.createType("class DD {}", null, true, null); - String expectedSource = - "public enum E3 {\n" + - " A, B, C;\n\n" + - " class DD {}\n" + - "}"; - assertSourceEquals("Unexpected source", expectedSource, type.getSource()); - } -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CreatePackageTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CreatePackageTests.java deleted file mode 100644 index 98427ee..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CreatePackageTests.java +++ /dev/null @@ -1,133 +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 org.eclipse.core.runtime.CoreException; -import org.eclipse.wst.jsdt.core.*; - -import junit.framework.Test; - -public class CreatePackageTests extends ModifyingResourceTests { -public CreatePackageTests(String name) { - super(name); -} -public static Test suite() { - return buildModelTestSuite(CreatePackageTests.class); -} -public void setUp() throws Exception { - super.setUp(); - createJavaProject("P"); - createFolder("/P/p"); - startDeltas(); -} -public void tearDown() throws Exception { - stopDeltas(); - deleteProject("P"); - super.tearDown(); -} -/** - * Ensures that a package fragment can be created in a package - * fragment root. - * Verifies that the proper change deltas are generated as a side effect - * of running the operation. - */ -public void testCreatePackageFragment1() throws JavaScriptModelException { - IPackageFragmentRoot root= getPackageFragmentRoot("P", ""); - IPackageFragment frag= root.createPackageFragment("one.two.three", false, null); - assertCreation(frag); - assertTrue("Fragment return not correct", frag.getElementName().equals("one.two.three")); - assertDeltas( - "Unexpected delta", - "P[*]: {CHILDREN}\n" + - " [*]: {CHILDREN}\n" + - " one[+]: {}\n" + - " one.two[+]: {}\n" + - " one.two.three[+]: {}" - ); -} -/** - * Ensures that a package fragment that shares a prefix path with - * an existing package fragment can be created in a package - * fragment root. - * Verifies that the proper change deltas are generated as a side effect - * of running the operation. - */ -public void testCreatePackageFragment2() throws JavaScriptModelException { - IPackageFragmentRoot root = getPackageFragmentRoot("P", ""); - IPackageFragment frag= root.createPackageFragment("one.two.three.four", false, null); - assertCreation(frag); - assertDeltas( - "Unexpected delta", - "P[*]: {CHILDREN}\n" + - " [*]: {CHILDREN}\n" + - " one[+]: {}\n" + - " one.two[+]: {}\n" + - " one.two.three[+]: {}\n" + - " one.two.three.four[+]: {}" - ); -} -/** - * Ensures that a package fragment can be created for the default package - */ -public void testCreatePackageFragment3() throws JavaScriptModelException { - IPackageFragmentRoot root= getPackageFragmentRoot("P", ""); - IPackageFragment frag= root.createPackageFragment("", false, null); - assertCreation(frag); - assertTrue("Fragment return not correct", frag.getElementName().equals("")); -} -/** - * Ensures that a package fragment can be created even if its name is unconventional. - * (regression test for 9479 exception on package creation (discouraged name)) - */ -public void testCreatePackageFragment4() throws JavaScriptModelException { - IPackageFragmentRoot root= getPackageFragmentRoot("P", ""); - IPackageFragment frag= root.createPackageFragment("A", false, null); - assertCreation(frag); - assertTrue("Fragment return not correct", frag.getElementName().equals("A")); -} -/** - * Ensures that a package fragment that already exists is not duplicated in the package - * fragment root. - */ -public void testDuplicatePackageFragment() throws JavaScriptModelException { - IPackageFragmentRoot root= getPackageFragmentRoot("P", ""); - IPackageFragment frag= root.createPackageFragment("p", false, null); - assertCreation(frag); - assertDeltas( - "Unexpected delta", - "" - ); -} -/** - * Ensures that a package fragment cannot be created with an invalid parameters. - */ -public void testInvalidPackageFragment() throws CoreException { - createFile("/P/p/other", ""); - IPackageFragmentRoot root = getPackageFragmentRoot("P", ""); - try { - root.createPackageFragment(null, false, null); - } catch (JavaScriptModelException jme) { - assertTrue("Incorrect JavaScriptModelException thrown for creating an package fragment with invalid name", jme.getStatus().getCode() == IJavaScriptModelStatusConstants.INVALID_NAME); - try { - root.createPackageFragment("java.jfg.", false, null); - } catch (JavaScriptModelException jme2) { - assertTrue("Incorrect JavaScriptModelException thrown for creating a package fragment with invalid name", jme2.getStatus().getCode() == IJavaScriptModelStatusConstants.INVALID_NAME); - try { - root.createPackageFragment("p.other", false, null); - } catch (JavaScriptModelException jme3) { - assertTrue("Incorrect JavaScriptModelException thrown for creating a package fragment that collides with a file", jme3.getStatus().getCode() == IJavaScriptModelStatusConstants.NAME_COLLISION); - return; - } - } - } - assertTrue("No JavaScriptModelException thrown for creating a package fragment with an invalid parameters", false); -} -} diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/DefaultJavaElementComparator.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/DefaultJavaElementComparator.java deleted file mode 100644 index 385264b..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/DefaultJavaElementComparator.java +++ /dev/null @@ -1,295 +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.util.Comparator; -import java.util.List; - -import org.eclipse.wst.jsdt.core.Flags; -import org.eclipse.wst.jsdt.core.dom.ASTNode; -import org.eclipse.wst.jsdt.core.dom.AbstractTypeDeclaration; -import org.eclipse.wst.jsdt.core.dom.ArrayType; -import org.eclipse.wst.jsdt.core.dom.BodyDeclaration; -import org.eclipse.wst.jsdt.core.dom.FieldDeclaration; -import org.eclipse.wst.jsdt.core.dom.FunctionDeclaration; -import org.eclipse.wst.jsdt.core.dom.Initializer; -import org.eclipse.wst.jsdt.core.dom.Name; -import org.eclipse.wst.jsdt.core.dom.PrimitiveType; -import org.eclipse.wst.jsdt.core.dom.QualifiedName; -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.Type; -import org.eclipse.wst.jsdt.core.dom.VariableDeclarationFragment; -import org.eclipse.wst.jsdt.core.util.JavaScriptUnitSorter; - -import com.ibm.icu.text.Collator; - -/** - * The class DefaultJavaElementComparator is a standard - * implementation of a comparator. - *

- *