[384319] CPU utilization to 100% when this is appended to new object definition
diff --git a/tests/org.eclipse.wst.jsdt.web.core.tests/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.wst.jsdt.web.core.tests/.settings/org.eclipse.jdt.core.prefs index 33e4d64..53cf527 100644 --- a/tests/org.eclipse.wst.jsdt.web.core.tests/.settings/org.eclipse.jdt.core.prefs +++ b/tests/org.eclipse.wst.jsdt.web.core.tests/.settings/org.eclipse.jdt.core.prefs
@@ -1,12 +1,394 @@ -#Mon Dec 07 03:23:26 EST 2009 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled +#Tue Jul 17 18:19:32 EDT 2012 +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.4 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.compiler.problem.emptyStatement=error +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.classpath.exclusionPatterns=enabled +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=3 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=64 +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=78 +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.builder.cleanOutputFolder=clean +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.continuation_indentation=3 +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.compiler.problem.invalidJavadoc=ignore +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=enabled +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.incompleteClasspath=error +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=insert +org.eclipse.jdt.core.circularClasspath=error +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert +org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.compiler.problem.deprecation=ignore +org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=48 +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.compiler.problem.unusedImport=error +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.compiler.problem.unusedLabel=error +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.builder.invalidClasspath=ignore +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.incompatibleJDKLevel=ignore +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.compiler.problem.nullReference=error +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.alignment_for_compact_if=32 +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=ignore +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=3 +org.eclipse.jdt.core.formatter.lineSplit=999 +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled +org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 org.eclipse.jdt.core.compiler.source=1.3 +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.builder.duplicateResourceTask=warning +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.compiler.doc.comment.support=enabled +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=64 +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_field=0
diff --git a/tests/org.eclipse.wst.jsdt.web.core.tests/.settings/org.eclipse.jdt.ui.prefs b/tests/org.eclipse.wst.jsdt.web.core.tests/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 0000000..f342af0 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.core.tests/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,4 @@ +#Mon Mar 05 17:40:09 EST 2012 +eclipse.preferences.version=1 +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*******************************************************************************\r\n * Licensed Materials - Property of IBM\r\n * \u00A9 Copyright IBM Corporation ${year}. All Rights Reserved.\r\n * U.S. Government Users Restricted Rights - Use, duplication or disclosure\r\n * restricted by GSA ADP Schedule Contract with IBM Corp. \r\n *******************************************************************************/\r\n</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
diff --git a/tests/org.eclipse.wst.jsdt.web.core.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.wst.jsdt.web.core.tests/META-INF/MANIFEST.MF index 603b051..3cdb648 100644 --- a/tests/org.eclipse.wst.jsdt.web.core.tests/META-INF/MANIFEST.MF +++ b/tests/org.eclipse.wst.jsdt.web.core.tests/META-INF/MANIFEST.MF
@@ -2,13 +2,13 @@ Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.wst.jsdt.web.core.tests;singleton:=true -Bundle-Version: 1.0.201.qualifier +Bundle-Version: 1.0.300.qualifier Bundle-Activator: org.eclipse.wst.jsdt.web.core.tests.Activator Require-Bundle: org.eclipse.core.runtime, org.junit, org.eclipse.wst.sse.core, - org.eclipse.wst.jsdt.core, org.eclipse.wst.jsdt.web.core, + org.eclipse.wst.jsdt.core, org.eclipse.core.resources, org.eclipse.wst.xml.core Bundle-ActivationPolicy: lazy
diff --git a/tests/org.eclipse.wst.jsdt.web.core.tests/src/org/eclipse/wst/jsdt/web/core/tests/AllWebCoreTests.java b/tests/org.eclipse.wst.jsdt.web.core.tests/src/org/eclipse/wst/jsdt/web/core/tests/AllWebCoreTests.java index 39f1ba7..b223909 100644 --- a/tests/org.eclipse.wst.jsdt.web.core.tests/src/org/eclipse/wst/jsdt/web/core/tests/AllWebCoreTests.java +++ b/tests/org.eclipse.wst.jsdt.web.core.tests/src/org/eclipse/wst/jsdt/web/core/tests/AllWebCoreTests.java
@@ -1,12 +1,22 @@ +/******************************************************************************* + * Copyright (c) 2009, 2011 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.web.core.tests; import junit.framework.Test; -import junit.framework.TestCase; import junit.framework.TestSuite; import org.eclipse.wst.jsdt.web.core.tests.translation.TestHtmlTranslation; -public class AllWebCoreTests extends TestCase { +public class AllWebCoreTests extends TestSuite { public AllWebCoreTests() { super("JSDT Web Core Tests"); } @@ -17,6 +27,7 @@ //$JUnit-END$ suite.addTestSuite(TestHtmlTranslation.class); + suite.addTestSuite(PathUtilsTests.class); return suite; }
diff --git a/tests/org.eclipse.wst.jsdt.web.core.tests/src/org/eclipse/wst/jsdt/web/core/tests/PathUtilsTests.java b/tests/org.eclipse.wst.jsdt.web.core.tests/src/org/eclipse/wst/jsdt/web/core/tests/PathUtilsTests.java new file mode 100644 index 0000000..8426b42 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.core.tests/src/org/eclipse/wst/jsdt/web/core/tests/PathUtilsTests.java
@@ -0,0 +1,310 @@ +/******************************************************************************* + * Copyright (c) 2011 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.web.core.tests; + +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.wst.jsdt.web.core.internal.PathUtils; + +import junit.framework.Assert; +import junit.framework.TestCase; + +/** + * <p>Unit tests for the {@link PathUtils} class.</p> + * + */ +public class PathUtilsTests extends TestCase { + + /** + * <p>Default constructor</p> + */ + public PathUtilsTests() { + super("Path Utils Tests"); + } + + public void testOneSegmentParentWithOneSegmentPattern_SegmentCountTest_0() { + runCountPatternSegmentsThatMatchParentTest("foo", "foo", 1); + } + + public void testOneSegmentParentWithOneSegmentPattern_SegmentCountTest_1() { + runCountPatternSegmentsThatMatchParentTest("/foo", "foo", 1); + } + + public void testOneSegmentParentWithOneSegmentPattern_SegmentCountTest_2() { + runCountPatternSegmentsThatMatchParentTest("/foo", "foo", 1); + } + + public void testOneSegmentParentWithOneSegmentPattern_SegmentCountTest_3() { + runCountPatternSegmentsThatMatchParentTest("foo", "/foo", 1); + } + + public void testOneSegmentParentWithOneSegmentPattern_SegmentCountTest_4() { + runCountPatternSegmentsThatMatchParentTest("/foo", "/foo", 1); + } + + public void testOneSegmentParentWithTwoSegmentPattern_SegmentCountTest_0() { + runCountPatternSegmentsThatMatchParentTest("foo/bar", "foo", 1); + } + + public void testOneSegmentParentWithTwoSegmentPattern_SegmentCountTest_1() { + runCountPatternSegmentsThatMatchParentTest("/foo/bar", "foo", 1); + } + + public void testOneSegmentParentWithTwoSegmentPattern_SegmentCountTest_2() { + runCountPatternSegmentsThatMatchParentTest("/foo/bar", "foo", 1); + } + + public void testOneSegmentParentWithTwoSegmentPattern_SegmentCountTest_3() { + runCountPatternSegmentsThatMatchParentTest("foo/bar", "/foo", 1); + } + + public void testOneSegmentParentWithTwoSegmentPattern_SegmentCountTest_4() { + runCountPatternSegmentsThatMatchParentTest("/foo/bar", "/foo", 1); + } + + public void testOneSegmentParentWithTwoSegmentPattern_SegmentCountTest_5() { + runCountPatternSegmentsThatMatchParentTest("foo/bar/", "foo", 1); + } + + public void testOneSegmentParentWithTwoSegmentPattern_SegmentCountTest_6() { + runCountPatternSegmentsThatMatchParentTest("/foo/bar/", "foo", 1); + } + + public void testOneSegmentParentWithTwoSegmentPattern_SegmentCountTest_7() { + runCountPatternSegmentsThatMatchParentTest("/foo/bar/", "foo", 1); + } + + public void testOneSegmentParentWithTwoSegmentPattern_SegmentCountTest_8() { + runCountPatternSegmentsThatMatchParentTest("foo/bar/", "/foo", 1); + } + + public void testOneSegmentParentWithTwoSegmentPattern_SegmentCountTest_9() { + runCountPatternSegmentsThatMatchParentTest("/foo/bar/", "/foo", 1); + } + + public void testOneSegmentParentWithTwoSegmentPattern_SegmentCountTest_10() { + runCountPatternSegmentsThatMatchParentTest("/foo/bar/", "/boo", 0); + } + + public void testTwoSegmentParentWithThreeSegmentPattern_SegmentCountTest_0() { + runCountPatternSegmentsThatMatchParentTest("/foo/bar/blarg", "/foo/bar", 2); + } + + public void testStar_SegmentCountTest_0() { + runCountPatternSegmentsThatMatchParentTest("/foo/*/blarg", "foo/bar", 2); + } + + public void testStar_SegmentCountTest_1() { + runCountPatternSegmentsThatMatchParentTest("/foo/*", "foo", 1); + } + + public void testStar_SegmentCountTest_2() { + runCountPatternSegmentsThatMatchParentTest("/foo/*", "foo/blarg", 2); + } + + public void testStar_SegmentCountTest_3() { + runCountPatternSegmentsThatMatchParentTest("/foo/*", "foo", 1); + } + + public void testStarStar_SegmentCountTest_0() { + runCountPatternSegmentsThatMatchParentTest("/foo/**", "foo", 1); + } + + public void testStarStar_SegmentCountTest_1() { + runCountPatternSegmentsThatMatchParentTest("/foo/**", "foo/bar", 2); + } + + public void testStarStar_SegmentCountTest_2() { + runCountPatternSegmentsThatMatchParentTest("/foo/**", "foo/bar/blarg", 3); + } + + public void testStarStar_SegmentCountTest_3() { + runCountPatternSegmentsThatMatchParentTest("/foo/**/blarg", "foo/bar/blarg", 3); + } + + public void testStarStar_SegmentCountTest_4() { + runCountPatternSegmentsThatMatchParentTest("/foo/**/blarg", "foo/bar/boo/blarg", 3); + } + + public void testStarStar_SegmentCountTest_5() { + runCountPatternSegmentsThatMatchParentTest("/foo/**/blarg/nerg", "foo/bar/boo/blarg", 3); + } + + public void testQuestionMark_SegmentCountTest_0() { + runCountPatternSegmentsThatMatchParentTest("foo?bar", "/fooZbar", 1); + } + + public void testQuestionMark_SegmentCountTest_1() { + runCountPatternSegmentsThatMatchParentTest("foo?bar", "/foobar", 0); + } + + public void testOneSegmentParentWithOneSegmentPattern_TransformPatternTest_0() { + runMakePatternRelativeToParentTest("foo", "foo", null); + } + + public void testOneSegmentParentWithOneSegmentPattern_TransformPatternTest_1() { + runMakePatternRelativeToParentTest("/foo", "foo", null); + } + + public void testOneSegmentParentWithOneSegmentPattern_TransformPatternTest_2() { + runMakePatternRelativeToParentTest("/foo", "foo", null); + } + + public void testOneSegmentParentWithOneSegmentPattern_TransformPatternTest_3() { + runMakePatternRelativeToParentTest("foo", "foo", null); + } + + public void testOneSegmentParentWithOneSegmentPattern_TransformPatternTest_4() { + runMakePatternRelativeToParentTest("/foo", "foo", null); + } + + public void testOneSegmentParentWithTwoSegmentPattern_TransformPatternTest_0() { + runMakePatternRelativeToParentTest("foo/bar", "foo", "bar/"); + } + + public void testOneSegmentParentWithTwoSegmentPattern_TransformPatternTest_1() { + runMakePatternRelativeToParentTest("/foo/bar", "foo", "bar/"); + } + + public void testOneSegmentParentWithTwoSegmentPattern_TransformPatternTest_2() { + runMakePatternRelativeToParentTest("/foo/bar", "foo", "bar/"); + } + + public void testOneSegmentParentWithTwoSegmentPattern_TransformPatternTest_3() { + runMakePatternRelativeToParentTest("foo/bar", "/foo", "bar/"); + } + + public void testOneSegmentParentWithTwoSegmentPattern_TransformPatternTest_4() { + runMakePatternRelativeToParentTest("/foo/bar", "/foo", "bar/"); + } + + public void testOneSegmentParentWithTwoSegmentPattern_TransformPatternTest_5() { + runMakePatternRelativeToParentTest("foo/bar/", "foo", "bar/"); + } + + public void testOneSegmentParentWithTwoSegmentPattern_TransformPatternTest_6() { + runMakePatternRelativeToParentTest("/foo/bar/", "foo", "bar/"); + } + + public void testOneSegmentParentWithTwoSegmentPattern_TransformPatternTest_7() { + runMakePatternRelativeToParentTest("/foo/bar/", "foo", "bar/"); + } + + public void testOneSegmentParentWithTwoSegmentPattern_TransformPatternTest_8() { + runMakePatternRelativeToParentTest("foo/bar/", "/foo", "bar/"); + } + + public void testOneSegmentParentWithTwoSegmentPattern_TransformPatternTest_9() { + runMakePatternRelativeToParentTest("/foo/bar/", "/foo", "bar/"); + } + + public void testOneSegmentParentWithTwoSegmentPattern_TransformPatternTest_10() { + runMakePatternRelativeToParentTest("/foo/bar/", "/boo", null); + } + + public void testTwoSegmentParentWithThreeSegmentPattern_TransformPatternTest_0() { + runMakePatternRelativeToParentTest("/foo/bar/blarg", "/foo/bar", "blarg/"); + } + + public void testStar_TransformPatternTest_0() { + runMakePatternRelativeToParentTest("/foo/*/blarg", "foo/bar", "blarg/"); + } + + public void testStar_TransformPatternTest_1() { + runMakePatternRelativeToParentTest("/foo/*", "foo", "*/"); + } + + public void testStar_TransformPatternTest_2() { + runMakePatternRelativeToParentTest("/foo/*", "foo/blarg/", null); + } + + public void testStar_TransformPatternTest_3() { + runMakePatternRelativeToParentTest("/foo/*", "foo", "*/"); + } + + public void testStarStar_TransformPatternTest_0() { + runMakePatternRelativeToParentTest("/foo/**", "foo", "**/"); + } + + public void testStarStar_TransformPatternTest_1() { + runMakePatternRelativeToParentTest("/foo/**", "foo/bar/", null); + } + + public void testStarStar_TransformPatternTest_2() { + runMakePatternRelativeToParentTest("/foo/**", "foo/bar/blarg/", null); + } + + public void testStarStar_TransformPatternTest_3() { + runMakePatternRelativeToParentTest("/foo/**/blarg", "foo/bar/blarg/", null); + } + + public void testStarStar_TransformPatternTest_4() { + runMakePatternRelativeToParentTest("/foo/**/blarg", "foo/bar/boo/blarg/", null); + } + + public void testStarStar_TransformPatternTest_5() { + runMakePatternRelativeToParentTest("/foo/**/blarg/nerg", "foo/bar/boo/blarg", "nerg/"); + } + + public void testQuestionMark_TransformPatternTest_0() { + runMakePatternRelativeToParentTest("foo?bar", "/fooZbar", null); + } + + public void testQuestionMark_TransformPatternTest_1() { + runMakePatternRelativeToParentTest("foo?bar", "/foobar", null); + } + + public void testQuestionMark_TransformPatternTest_2() { + runMakePatternRelativeToParentTest("foo?bar/awesome", "/fooZbar", "awesome/"); + } + + public void testQuestionMark_TransformPatternTest_3() { + runMakePatternRelativeToParentTest("foo?bar/awesome", "/foobar", null); + } + + /** + * <p>Runs a test on {@link PathUtils#countPatternSegmentsThatMatchParent(IPath, IPath)}</p> + * + * @param pattern the pattern path to test + * @param parentPath the parent path to test + * @param expectedMatchedSegments the expected number of segments in the pattern that match the parent + */ + private static void runCountPatternSegmentsThatMatchParentTest(String pattern, String parentPath, + int expectedMatchedSegments) { + int matchedSegments = PathUtils.countPatternSegmentsThatMatchParent( + new Path(pattern), new Path(parentPath)); + + Assert.assertEquals("Number of matched path segments does not equal expected.", //$NON-NLS-1$ + expectedMatchedSegments, matchedSegments); + } + + /** + * + * <p>Runs a test on {@link PathUtils#makePatternRelativeToParent(IPath, IPath)}</p> + * + * @param pattern the pattern path to test + * @param parent the parent path to test + * @param expected the expected pattern path made relative to the parent path + */ + private static void runMakePatternRelativeToParentTest(String pattern, String parent, String expected) { + IPath transformedPattern = PathUtils.makePatternRelativeToParent( + new Path(pattern), new Path(parent)); + + IPath expectedPath = null; + if(expected != null) { + expectedPath = new Path(expected); + } + + Assert.assertEquals("Transformed pattern does not match expected.", + expectedPath, transformedPattern); + } +} \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.wst.jsdt.web.ui.tests/.settings/org.eclipse.jdt.core.prefs index 5dcf314..53cf527 100644 --- a/tests/org.eclipse.wst.jsdt.web.ui.tests/.settings/org.eclipse.jdt.core.prefs +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/.settings/org.eclipse.jdt.core.prefs
@@ -1,93 +1,394 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore -org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault -org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable -org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.4 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.deadCode=warning -org.eclipse.jdt.core.compiler.problem.deprecation=ignore -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore -org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore -org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning -org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore -org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore -org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=ignore -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error -org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error -org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore -org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning -org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning -org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore -org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore -org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore -org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +#Tue Jul 17 18:19:32 EDT 2012 org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.compiler.problem.emptyStatement=error +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.classpath.exclusionPatterns=enabled +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=3 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=64 +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=78 +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.builder.cleanOutputFolder=clean +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.continuation_indentation=3 +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.compiler.problem.invalidJavadoc=ignore +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=enabled +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.incompleteClasspath=error +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=insert +org.eclipse.jdt.core.circularClasspath=error +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert +org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.compiler.problem.deprecation=ignore +org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=48 +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.compiler.problem.unusedImport=error +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.compiler.problem.unusedLabel=error +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.builder.invalidClasspath=ignore +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.incompatibleJDKLevel=ignore +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.compiler.problem.nullReference=error +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.alignment_for_compact_if=32 +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=ignore +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=3 +org.eclipse.jdt.core.formatter.lineSplit=999 +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled +org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 org.eclipse.jdt.core.compiler.source=1.3 +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.builder.duplicateResourceTask=warning +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.compiler.doc.comment.support=enabled +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=64 +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_field=0
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/.settings/org.eclipse.jdt.ui.prefs b/tests/org.eclipse.wst.jsdt.web.ui.tests/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 0000000..cf98329 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,4 @@ +#Mon Mar 05 17:40:24 EST 2012 +eclipse.preferences.version=1 +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*******************************************************************************\r\n * Licensed Materials - Property of IBM\r\n * \u00A9 Copyright IBM Corporation ${year}. All Rights Reserved.\r\n * U.S. Government Users Restricted Rights - Use, duplication or disclosure\r\n * restricted by GSA ADP Schedule Contract with IBM Corp. \r\n *******************************************************************************/\r\n</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.wst.jsdt.web.ui.tests/META-INF/MANIFEST.MF index 6d5e593..bd00d3b 100644 --- a/tests/org.eclipse.wst.jsdt.web.ui.tests/META-INF/MANIFEST.MF +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/META-INF/MANIFEST.MF
@@ -19,6 +19,7 @@ org.eclipse.wst.xml.core, org.eclipse.wst.xml.ui, org.eclipse.wst.jsdt.web.ui, + org.eclipse.wst.html.core, org.eclipse.jface.text, org.eclipse.wst.html.ui Bundle-RequiredExecutionEnvironment: J2SE-1.4
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/OSGI-INF/l10n/bundle.properties b/tests/org.eclipse.wst.jsdt.web.ui.tests/OSGI-INF/l10n/bundle.properties index f62e94b..1e0fd8d 100644 --- a/tests/org.eclipse.wst.jsdt.web.ui.tests/OSGI-INF/l10n/bundle.properties +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/OSGI-INF/l10n/bundle.properties
@@ -1,3 +1,5 @@ #Properties file for org.eclipse.wst.jsdt.web.ui.tests Bundle-Name = JSDT Web UI Tests -providerName=Eclipse Web Tools Platform \ No newline at end of file +providerName=Eclipse Web Tools Platform +_UI_SHOW_TRANSLATION=Show JavaScript Translation +_UI_RUN=Run Snippet
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/build.properties b/tests/org.eclipse.wst.jsdt.web.ui.tests/build.properties index 43f47a9..30d5673 100644 --- a/tests/org.eclipse.wst.jsdt.web.ui.tests/build.properties +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/build.properties
@@ -3,8 +3,7 @@ bin.includes = META-INF/,\ .,\ plugin.xml,\ - plugin.properties,\ test.xml,\ - OSGI-INF/,\ + OSGI-INF/l10n/,\ about.html,\ testFiles/
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/plugin.properties b/tests/org.eclipse.wst.jsdt.web.ui.tests/plugin.properties deleted file mode 100644 index 73f8bb2..0000000 --- a/tests/org.eclipse.wst.jsdt.web.ui.tests/plugin.properties +++ /dev/null
@@ -1 +0,0 @@ -_UI_SHOW_TRANSLATION=Show Translation
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/plugin.xml b/tests/org.eclipse.wst.jsdt.web.ui.tests/plugin.xml index 6e359b5..106ab9b 100644 --- a/tests/org.eclipse.wst.jsdt.web.ui.tests/plugin.xml +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/plugin.xml
@@ -5,7 +5,7 @@ point="org.eclipse.ui.commands"> <command id="org.eclipse.wst.jsdt.web.showTranslation" - name="Show JavaScript Translation"> + name="%_UI_SHOW_TRANSLATION"> </command> <command id="org.eclipse.wst.jsdt.web.runCode"
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/AllWebUITests.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/AllWebUITests.java index 7a128a0..8c32a4f 100644 --- a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/AllWebUITests.java +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/AllWebUITests.java
@@ -13,14 +13,15 @@ import junit.framework.Test; -import junit.framework.TestCase; import junit.framework.TestSuite; -import org.eclipse.wst.jsdt.web.ui.tests.conversion.IncludePathTests; +import org.eclipse.core.runtime.Platform; +import org.eclipse.wst.jsdt.web.ui.tests.contentassist.AllContentAssistTests; import org.eclipse.wst.jsdt.web.ui.tests.format.FormattingTests; +import org.eclipse.wst.jsdt.web.ui.tests.format.TestJSPContentFormatter; import org.eclipse.wst.jsdt.web.ui.tests.style.StyleTests; -public class AllWebUITests extends TestCase { +public class AllWebUITests extends TestSuite { public AllWebUITests() { super("JSDT Web UI Tests"); } @@ -28,9 +29,13 @@ public static Test suite() { TestSuite suite = new TestSuite("JSDT Web UI Tests"); // $JUnit-BEGIN$ - suite.addTestSuite(IncludePathTests.class); - suite.addTest(FormattingTests.suite()); suite.addTestSuite(StyleTests.class); + suite.addTest(AllContentAssistTests.suite()); + suite.addTest(FormattingTests.suite()); + + if (Platform.getBundle("org.eclipse.jst.jsp.ui") != null) { + suite.addTest(TestJSPContentFormatter.suite()); + } // $JUnit-END$ return suite; }
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/AllContentAssistTests.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/AllContentAssistTests.java new file mode 100644 index 0000000..c141e16 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/AllContentAssistTests.java
@@ -0,0 +1,89 @@ +/******************************************************************************* + * Copyright (c) 2011, 2012 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.web.ui.tests.contentassist; + +import junit.framework.Test; +import junit.framework.TestSuite; + +import org.eclipse.wst.jsdt.web.ui.tests.internal.TestProjectSetup; + +/** + * <p> + * Test suite containing all JSDT web content assist tests. + * </p> + */ +public class AllContentAssistTests extends TestSuite { + private static final String TEST_NAME = "All JSDT Web Content Assist Tests"; + + /** + * <p> + * Default constructor + * <p> + * <p> + * Use {@link #suite()} + * </p> + * + * @see #suite() + */ + public AllContentAssistTests() { + this(TEST_NAME); + } + + /** + * <p> + * Constructor that takes a test name. + * </p> + * <p> + * Use {@link #suite()} + * </p> + * + * @param name + * The name this test run should have. + * + * @see #suite() + */ + public AllContentAssistTests(String name) { + super(name); + } + + public static Test suite() { + TestSuite all = new TestSuite(TEST_NAME); + all.addTest(BrowserLibraryTests.suite()); + all.addTest(CamelCasingTests.suite()); + all.addTest(CamelCasingTests_Edited.suite()); + all.addTest(ClosureTests.suite()); + all.addTest(ConstructorTests.suite()); + all.addTest(ConstructorTests_Edited.suite()); + all.addTest(DoublyNestedFunctionTests.suite()); + all.addTest(DoublyNestedFunctionTests_Edited.suite()); + all.addTest(DuplicatesTests.suite()); + all.addTest(GlobalFunctionTests.suite()); + all.addTest(GlobalFunctionTests_Edited.suite()); + all.addTest(GlobalObjectLiteralTests.suite()); + all.addTest(GlobalVariableTests.suite()); + all.addTest(GlobalVariableTests_Edited.suite()); + all.addTest(InnerFunctionTests.suite()); + all.addTest(InnerFunctionTests_Edited.suite()); + all.addTest(LocalVarDefinedInFunctionInObjectLiteralTests.suite()); + all.addTest(OtherContentAssistTests.suite()); + all.addTest(ProposalInfoTest.suite()); + all.addTest(ProposalInfoTest_Edited.suite()); + all.addTest(StaticTests.suite()); + all.addTest(StaticTests_Edited.suite()); + all.addTest(TemplateTests.suite()); + all.addTest(SingleLineSriptTagTests.suite()); + all.addTest(TypeTests.suite()); + all.addTest(TypeTests_Edited.suite()); + + //delete the project after running all JSDT content assist tests + return new TestProjectSetup(all, "JSDTWebContentAssist", "WebContent", true); + } +} \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/BrowserLibraryTests.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/BrowserLibraryTests.java new file mode 100644 index 0000000..3aa9060 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/BrowserLibraryTests.java
@@ -0,0 +1,100 @@ +/******************************************************************************* + * Copyright (c) 2011, 2013 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.web.ui.tests.contentassist; + +import junit.extensions.TestSetup; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.wst.jsdt.web.ui.tests.internal.TestProjectSetup; + +public class BrowserLibraryTests extends TestCase { + + private static final String TEST_NAME = "Test Elements defined by Browser Library"; + + /** + * <p> + * Test project setup for this test. + * </p> + */ + private static TestProjectSetup fTestProjectSetup; + + /** + * <p> + * Default constructor + * <p> + * <p> + * Use {@link #suite()} + * </p> + * + * @see #suite() + */ + public BrowserLibraryTests() { + super(TEST_NAME); + } + + /** + * <p> + * Constructor that takes a test name. + * </p> + * <p> + * Use {@link #suite()} + * </p> + * d + * @param name + * The name this test run should have. + * + * @see #suite() + */ + public BrowserLibraryTests(String name) { + super(name); + } + + /** + * <p> + * Use this method to add these tests to a larger test suite so set up and tear down can be + * performed + * </p> + * + * @return a {@link TestSetup} that will run all of the tests in this class + * with set up and tear down. + */ + + public static Test suite() { + TestSuite ts = new TestSuite(BrowserLibraryTests.class, TEST_NAME); + + fTestProjectSetup = new TestProjectSetup(ts, "JSDTWebContentAssist", "WebContent", false); + + return fTestProjectSetup; + } + + public void testDocumentDotG() throws Exception { + String[][] expectedProposals = + new String[][] { { "getElementById(String elementId) : Element - Document", + "getElementsByName(String elementName) : NodeList - HTMLDocument", + "getElementsByTagName(String tagname) : NodeList - Document", + "getElementsByTagNameNS(String namespaceURI, String localName) : NodeList - Document" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "BrowserLibrary.html", 7, 10, expectedProposals); + } + + public void testAlert() throws Exception { + String[][] expectedProposals = new String[][] { { "alert(String message) - Window" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "BrowserLibrary.html", 9, 2, expectedProposals); + } + + public void testDocument() throws Exception { + String[][] expectedProposals = new String[][] { { "document : HTMLDocument - Window" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "BrowserLibrary.html", 11, 3, expectedProposals); + } +} \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/CamelCasingTests.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/CamelCasingTests.java new file mode 100644 index 0000000..361a73f --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/CamelCasingTests.java
@@ -0,0 +1,125 @@ +/******************************************************************************* + * Copyright (c) 2011, 2012 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.web.ui.tests.contentassist; + +import junit.extensions.TestSetup; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.wst.jsdt.web.ui.tests.internal.TestProjectSetup; + +public class CamelCasingTests extends TestCase { + + private static final String TEST_NAME = "Test Camel Casing JavaScript Content Assist."; + + /** + * <p> + * Test project setup for this test. + * </p> + */ + private static TestProjectSetup fTestProjectSetup; + + /** + * <p> + * Default constructor + * <p> + * <p> + * Use {@link #suite()} + * </p> + * + * @see #suite() + */ + public CamelCasingTests() { + super(TEST_NAME); + } + + /** + * <p> + * Constructor that takes a test name. + * </p> + * <p> + * Use {@link #suite()} + * </p> + * + * @param name + * The name this test run should have. + * + * @see #suite() + */ + public CamelCasingTests(String name) { + super(name); + } + + /** + * <p> + * Use this method to add these tests to a larger test suite so set up and tear down can be + * performed + * </p> + * + * @return a {@link TestSetup} that will run all of the tests in this class + * with set up and tear down. + */ + + public static Test suite() { + TestSuite ts = new TestSuite(CamelCasingTests.class, TEST_NAME); + + fTestProjectSetup = new TestProjectSetup(ts, "JSDTWebContentAssist", "WebContent", false); + + return fTestProjectSetup; + } + + + public void testCamelCasing_Expression1() throws Exception { + String[][] expectedProposals = + new String[][] { { "mail.inbox.iGotStarredFun(param1) - mail.inbox.iGotStarredFun", + "mail.iGotSpam(a, b) - mail.iGotSpam", "iGotMessage(param1) - iGotMessage" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "ConstructorCamelCase.html", 8, 6, expectedProposals); + } + + public void testCamelCasing_Expression2() throws Exception { + String[][] expectedProposals = + new String[][] { { "mail.inbox.iGotStarredFun(param1) - mail.inbox.iGotStarredFun", + "mail.iGotSpam(a, b) - mail.iGotSpam" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "ConstructorCamelCase.html", 10, 7, expectedProposals); + } + + public void testCamelCasing_Expression2_NegativeTest() throws Exception { + String[][] expectedProposals = new String[][] { { "iGotMessage(param1)" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "ConstructorCamelCase.html", 2, 7, expectedProposals, true, + false); + } + + public void testCamelCasing_Expression3() throws Exception { + String[][] expectedProposals = + new String[][] { { "mail.inbox.iGotStarredFun(param1) - mail.inbox.iGotStarredFun" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "ConstructorCamelCase.html", 12, 8, expectedProposals); + } + + public void testGlobalVar_Expresssion1() throws Exception { + String[][] expectedProposals = new String[][] { { "globalVarNum : Number - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "Global.html", 12, 3, expectedProposals); + } + + public void testGlobalVar_Expresssion2() throws Exception { + String[][] expectedProposals = + new String[][] { { "globalVarNum : Number - Global", "globalVar - Global", + "globalVarObject : {} - Global", "globalVarString : String - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "Global.html", 14, 2, expectedProposals); + } + + public void testDoublyNestedFunc_CamelCasing_Expression2() throws Exception { + String[][] expectedProposals = new String[][] { { "outerFunc() - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "InnerOuter.html", 8, 2, expectedProposals); + } +} \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/CamelCasingTests_Edited.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/CamelCasingTests_Edited.java new file mode 100644 index 0000000..c61d33e --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/CamelCasingTests_Edited.java
@@ -0,0 +1,145 @@ +/******************************************************************************* + * Copyright (c) 2011, 2012 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.web.ui.tests.contentassist; + +import junit.extensions.TestSetup; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.wst.jsdt.web.ui.tests.internal.TestProjectSetup; + +public class CamelCasingTests_Edited extends TestCase { + + private static final String TEST_NAME = "Test Camel Casing JavaScript Content Assist"; + + /** + * <p> + * Test project setup for this test. + * </p> + */ + private static TestProjectSetup fTestProjectSetup; + + /** + * <p> + * Default constructor + * <p> + * <p> + * Use {@link #suite()} + * </p> + * + * @see #suite() + */ + public CamelCasingTests_Edited() { + super(TEST_NAME); + } + + /** + * <p> + * Constructor that takes a test name. + * </p> + * <p> + * Use {@link #suite()} + * </p> + * + * @param name + * The name this test run should have. + * + * @see #suite() + */ + public CamelCasingTests_Edited(String name) { + super(name); + } + + /** + * <p> + * Use this method to add these tests to a larger test suite so set up and tear down can be + * performed + * </p> + * + * @return a {@link TestSetup} that will run all of the tests in this class + * with set up and tear down. + */ + + public static Test suite() { + TestSuite ts = new TestSuite(CamelCasingTests_Edited.class, TEST_NAME); + + fTestProjectSetup = new TestProjectSetup(ts, "JSDTWebContentAssist", "WebContent", false) { + /** + * @see org.eclipse.wst.jsdt.web.ui.tests.contentassist.ContentAssistTestUtilities.ContentAssistTestsSetup#additionalSetUp() + */ + public void additionalSetUp() throws Exception { + /* file -> ConstructorCamelCase.js + * iGotMessage -> iSentMessage */ + this.editFile("ConstructorCamelCase.js", 0, 4, 11, "iGotSentMessage"); + this.editFile("ConstructorCamelCase.js", 0, 31, 11, "iGotSentMessage"); + + this.editFile("Global.js", 1, 4, 12, "globalEditedNumber"); + this.editFile("Global.js", 7, 0, 12, "globalEditedString"); + this.editFile("Global.js", 11, 6, 1, "E"); + this.editFile("Global.js", 15, 1, 1, "E"); + this.editFile("Global.js", 17, 1, 1, "E"); + + this.editFile("Global.html", 10, 6, 1, "E"); + this.editFile("Global.html", 12, 1, 1, "E"); + this.editFile("Global.html", 14, 1, 1, "E"); + + this.editFile("InnerOuter.js", 7, 11, 6, "edited"); + this.editFile("InnerOuter.js", 0, 9, 9, "editedFunc"); + } + }; + + return fTestProjectSetup; + } + + public void testCamelCasing_AfterEdit_Expression1_NegativeTest() throws Exception { + String[][] expectedProposals = new String[][] { { "iGotMessage(param1)[]" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "ConstructorCamelCase.html", 8, 6, expectedProposals, true, + false); + } + + public void testCamelCasing_AterEdit_Expression2_NegativeTest() throws Exception { + String[][] expectedProposals = new String[][] { { "iGotMessage(param1)" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "ConstructorCamelCase.html", 10, 7, expectedProposals, true, + false); + } + + public void testCamelCasing_AfterEdit_Expression3_NegativeTest() throws Exception { + String[][] expectedProposals = new String[][] { { "iGotMessage(param1)" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "ConstructorCamelCase.html", 12, 8, expectedProposals, true, + false); + } + + public void testCamelCasing_AfterEdit_Expression1() throws Exception { + String[][] expectedProposals = + new String[][] { { "mail.inbox.iGotStarredFun(param1) - mail.inbox.iGotStarredFun", + "mail.iGotSpam(a, b) - mail.iGotSpam", "iGotSentMessage(param1) - iGotSentMessage" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "ConstructorCamelCase.html", 8, 6, expectedProposals); + } + + public void testCamelCasing_AfterEdit_Expresssion1() throws Exception { + String[][] expectedProposals = new String[][] { { "globalEditedNumber : Number - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "Global.html", 12, 3, expectedProposals); + } + + public void testCamelCasing_AfterEdit_Expresssion2() throws Exception { + String[][] expectedProposals = + new String[][] { { "globalEditedString : String - Global", "globalEditedNumber : Number - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "Global.html", 14, 2, expectedProposals); + } + + public void testCamelCasing_AfterEdit_Expression3() throws Exception { + String[][] expectedProposals = new String[][] { { "editedFunc() - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "InnerOuter.html", 12, 2, expectedProposals); + } +} \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/ClosureTests.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/ClosureTests.java new file mode 100644 index 0000000..f4fe9bd --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/ClosureTests.java
@@ -0,0 +1,105 @@ +/******************************************************************************* + * Copyright (c) 2011, 2012 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.web.ui.tests.contentassist; + +import junit.extensions.TestSetup; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.wst.jsdt.web.ui.tests.internal.TestProjectSetup; + +public class ClosureTests extends TestCase { + /** + * <p> + * This tests name + * </p> + */ + private static final String TEST_NAME = "Test Elements Defined in Closures JavaScript Content Assist"; + + /** + * <p> + * Test project setup for this test. + * </p> + */ + private static TestProjectSetup fTestProjectSetup; + + /** + * <p> + * Default constructor + * <p> + * <p> + * Use {@link #suite()} + * </p> + * + * @see #suite() + */ + public ClosureTests() { + super(TEST_NAME); + } + + /** + * <p> + * Constructor that takes a test name. + * </p> + * <p> + * Use {@link #suite()} + * </p> + * d + * @param name + * The name this test run should have. + * + * @see #suite() + */ + public ClosureTests(String name) { + super(name); + } + + /** + * <p> + * Use this method to add these tests to a larger test suite so set up and tear down can be + * performed + * </p> + * + * @return a {@link TestSetup} that will run all of the tests in this class + * with set up and tear down. + */ + + public static Test suite() { + TestSuite ts = new TestSuite(ClosureTests.class, TEST_NAME); + + fTestProjectSetup = new TestProjectSetup(ts, "JSDTWebContentAssist", "WebContent", false); + + return fTestProjectSetup; + } + + public void testClosures_EmptyLine() throws Exception { + String[][] expectedProposals = new String[][] { { "closure : {} - Global", "closure2 : {} - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "GlobalVarsDefinedInClosure.html", 7, 0, expectedProposals); + } + + public void testClosures_ExpressionStarted_0() throws Exception { + String[][] expectedProposals = new String[][] { { "closure : {} - Global", "closure2 : {} - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "GlobalVarsDefinedInClosure.html", 9, 3, expectedProposals); + } + + public void _testClosures_ExpressionStarted_1() throws Exception { + String[][] expectedProposals = new String[][] { { "nifty : Number - {}" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "GlobalVarsDefinedInClosure.html", 11, 9, expectedProposals); + } + + public void _testClosures_ExpressionStarted_2() throws Exception { + String[][] expectedProposals = new String[][] { { "burg : String - {}" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "GlobalVarsDefinedInClosure.html", 13, 10, expectedProposals); + } +} \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/ConstructorTests.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/ConstructorTests.java new file mode 100644 index 0000000..fd2af8d --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/ConstructorTests.java
@@ -0,0 +1,181 @@ +/******************************************************************************* + * Copyright (c) 2011, 2012 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.web.ui.tests.contentassist; + +import junit.extensions.TestSetup; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.wst.jsdt.web.ui.tests.internal.TestProjectSetup; + +public class ConstructorTests extends TestCase { + /** + * <p> + * This tests name + * </p> + */ + private static final String TEST_NAME = "Test Constructor JavaScript Content Assist"; + + /** + * <p> + * Test project setup for this test. + * </p> + */ + private static TestProjectSetup fTestProjectSetup; + + /** + * <p> + * Default constructor + * <p> + * <p> + * Use {@link #suite()} + * </p> + * + * @see #suite() + */ + public ConstructorTests() { + super(TEST_NAME); + } + + /** + * <p> + * Constructor that takes a test name. + * </p> + * <p> + * Use {@link #suite()} + * </p> + * + * @param name + * The name this test run should have. + * + * @see #suite() + */ + public ConstructorTests(String name) { + super(name); + } + + /** + * <p> + * Use this method to add these tests to a larger test suite so set up and tear down can be + * performed + * </p> + * + * @return a {@link TestSetup} that will run all of the tests in this class + * with set up and tear down. + */ + public static Test suite() { + TestSuite ts = new TestSuite(ConstructorTests.class, TEST_NAME); + + fTestProjectSetup = new TestProjectSetup(ts, "JSDTWebContentAssist", "WebContent", false) { + /** + * @see org.eclipse.wst.jsdt.ui.tests.contentassist.ContentAssistTestUtilities.ContentAssistTestsSetup#additionalSetUp() + */ + public void additionalSetUp() throws Exception { + // for some reason this test suite wants an extra second before running otherwise + // the first test fails... + Thread.sleep(1000); + } + }; + + return fTestProjectSetup; + } + + public void testFindConstructors_ExpressionStarted_0() throws Exception { + String[][] expectedProposals = new String[][] { { "Awesome(param1, param2) - Awesome" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "JSClasses.html", 8, 5, expectedProposals); + } + + public void testFindConstructors_ExpressionStarted_1() throws Exception { + String[][] expectedProposals = + new String[][] { { "bar.Class1(a, b) - bar.Class1", "bar.Class2(c, d, e) - bar.Class2", + "bar.foo.Class3(param1, param2, param3, param4) - bar.foo.Class3" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "JSClasses.html", 10, 6, expectedProposals); + } + + public void testFindConstructors_ExpressionStarted_2() throws Exception { + String[][] expectedProposals = + new String[][] { { "bar.Class1(a, b) - bar.Class1", "bar.Class2(c, d, e) - bar.Class2" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "JSClasses.html", 12, 9, expectedProposals); + } + + public void testFindConstructors_Expression_2_NegativeTest() throws Exception { + String[][] expectedProposals = new String[][] { { "bar : {}" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "JSClasses.html", 12, 9, expectedProposals, true, false); + } + + public void testFindConstructors_ExpressionStarted_3() throws Exception { + String[][] expectedProposals = + new String[][] { { "bar.foo.Class3(param1, param2, param3, param4) - bar.foo.Class3" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "JSClasses.html", 14, 10, expectedProposals); + } + + public void testFindConstructors_ExpressionStarted_4() throws Exception { + String[][] expectedProposals = + new String[][] { { "bar.foo.Class3(param1, param2, param3, param4) - bar.foo.Class3" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "JSClasses.html", 16, 13, expectedProposals); + } + + public void testFindConstructors_ExpressionStarted_5() throws Exception { + String[][] expectedProposals = + new String[][] { { "bar.Class1(a, b) - bar.Class1", "bar.Class2(c, d, e) - bar.Class2", + "bar.foo.Class3(param1, param2, param3, param4) - bar.foo.Class3" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "JSClasses.html", 18, 5, expectedProposals); + } + + public void testFindConstructors_ExpressionStarted_6() throws Exception { + String[][] expectedProposals = + new String[][] { { "bar.Class1(a, b) - bar.Class1", "bar.Class2(c, d, e) - bar.Class2", + "bar.foo.Class3(param1, param2, param3, param4) - bar.foo.Class3" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "JSClasses.html", 20, 8, expectedProposals); + } + + public void testFindConstructors_ExpressionStarted_7_NegativeTest() throws Exception { + String[][] proposals = new String[][] { { "bar.foo.Class3(param1, param2, param3, param4) - bar.foo.Class3" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "JSClasses.html", 12, 9, proposals, true, false); + } + + public void testDuplicateFindConstructors_ExpressionStarted_6() throws Exception { + ContentAssistTestUtilities.verifyNoDuplicates(fTestProjectSetup, "JSClasses.html", 20, 8); + } + + public void testFindConstructors_VarDeclaration_ExpressionStarted_0() throws Exception { + String[][] expectedProposals = new String[][] { { "MyClass1(a) - MyClass1", "MyClass2() - MyClass2" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "ClassTest2.html", 7, 8, expectedProposals); + } + + public void testFindConstructors_ArrayReferenceDeclaration_ExpressionStarted_0() + throws Exception { + String[][] expectedProposals = new String[][] { { "test.Foo(x, y, z) - test.Foo" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "Test.html", 8, 7, expectedProposals); + } + + public void testFindConstructors_ThisReferenceInStaticFunction() throws Exception { + String[][] expectedProposals = new String[][] { { "ParentType0.func2(b) - ParentType0.func2" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "ReferenceInMemberAndStaticFunctions.html", 7, 6, + expectedProposals); + } + + public void testFindConstructors_ThisReferenceInMemberFunction_NegativeTest() throws Exception { + String[][] expectedProposals = new String[][] { { "ParentType0.func1(a)" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "ReferenceInMemberAndStaticFunctions.html", 7, 6, + expectedProposals, true, false); + } + + public void testFindDuplicateConstructors_AnonymousConstructorFunctionAssignedToSingleNameReference() + throws Exception { + ContentAssistTestUtilities.verifyNoDuplicates(fTestProjectSetup, "ReferenceInMemberAndStaticFunctions.html", 9, 7); + } +} \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/ConstructorTests_Edited.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/ConstructorTests_Edited.java new file mode 100644 index 0000000..23fda93 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/ConstructorTests_Edited.java
@@ -0,0 +1,167 @@ +/******************************************************************************* + * Copyright (c) 2011, 2012 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.web.ui.tests.contentassist; + +import junit.extensions.TestSetup; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.wst.jsdt.web.ui.tests.internal.TestProjectSetup; + +public class ConstructorTests_Edited extends TestCase { + /** + * <p> + * This tests name + * </p> + */ + private static final String TEST_NAME = "Test Constructor JavaScript Content Assist after Edit"; + + /** + * <p> + * Test project setup for this test. + * </p> + */ + private static TestProjectSetup fTestProjectSetup; + + /** + * <p> + * Default constructor + * <p> + * <p> + * Use {@link #suite()} + * </p> + * + * @see #suite() + */ + public ConstructorTests_Edited() { + super(TEST_NAME); + } + + /** + * <p> + * Constructor that takes a test name. + * </p> + * <p> + * Use {@link #suite()} + * </p> + * + * @param name + * The name this test run should have. + * + * @see #suite() + */ + public ConstructorTests_Edited(String name) { + super(name); + } + + /** + * <p> + * Use this method to add these tests to a larger test suite so set up and tear down can be + * performed + * </p> + * + * @return a {@link TestSetup} that will run all of the tests in this class + * with set up and tear down. + */ + public static Test suite() { + TestSuite ts = + new TestSuite(ConstructorTests_Edited.class, TEST_NAME); + + fTestProjectSetup = new TestProjectSetup(ts, "JSDTWebContentAssist", "WebContent", false) { + public void additionalSetUp() throws Exception { + /* file -> JSClasses.js + * Awesome -> Awesomeness + * Class1 -> ClassOne + * Class2 -> ClassTwo + * Class3 -> ClassThree */ + this.editFile("JSClasses.js", 0, 9, 7, "Awesomeness"); + this.editFile("JSClasses.js", 10, 4, 6, "ClassOne"); + this.editFile("JSClasses.js", 11, 4, 6, "ClassOne"); + this.editFile("JSClasses.js", 12, 4, 6, "ClassTwo"); + this.editFile("JSClasses.js", 13, 4, 6, "ClassTwo"); + this.editFile("JSClasses.js", 14, 8, 6, "ClassThree"); + this.editFile("JSClasses.js", 15, 8, 6, "ClassThree"); + + /* file -> ClassTest2.js + * MyClass1 -> MyClassEdit1 + * MyClass2 -> MyClassEdit2 */ + this.editFile("ClassTest1.js", 0, 9, 8, "MyClassEdit1"); + this.editFile("ClassTest1.js", 4, 4, 8, "MyClassEdit2"); + this.editFile("ClassTest1.js", 5, 0, 8, "MyClassEdit2"); + + /* file -> Test.js + * test -> testEdit */ + this.editFile("Test.js", 0, 4, 4, "testEdit"); + this.editFile("Test.js", 1, 0, 4, "testEdit"); + } + }; + + return fTestProjectSetup; + } + + public void testFindConstructors_AfterEdit_ExpressionStarted_0() throws Exception { + String[][] expectedProposals = new String[][] { { "Awesomeness(param1, param2) - Awesomeness" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "JSClasses.html", 8, 6, expectedProposals); + } + + public void testFindConstructors_AfterEdit_ExpressionStarted_1() throws Exception { + String[][] expectedProposals = + new String[][] { { "bar.ClassOne(a, b) - bar.ClassOne", "bar.ClassTwo(c, d, e) - bar.ClassTwo", + "bar.foo.ClassThree(param1, param2, param3, param4) - bar.foo.ClassThree" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "JSClasses.html", 10, 6, expectedProposals); + } + + public void testFindConstructors_AfterEdit_ExpressionStarted_2() throws Exception { + String[][] expectedProposals = + new String[][] { { "bar.ClassOne(a, b) - bar.ClassOne", "bar.ClassTwo(c, d, e) - bar.ClassTwo" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "JSClasses.html", 12, 9, expectedProposals); + } + + public void testFindConstructors_AfterEdit_ExpressionStarted_3() throws Exception { + String[][] expectedProposals = + new String[][] { { "bar.foo.ClassThree(param1, param2, param3, param4) - bar.foo.ClassThree" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "JSClasses.html", 14, 10, expectedProposals); + } + + public void testFindConstructors_AfterEdit_ExpressionStarted_4() throws Exception { + String[][] expectedProposals = + new String[][] { { "bar.foo.ClassThree(param1, param2, param3, param4) - bar.foo.ClassThree" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "JSClasses.html", 16, 13, expectedProposals); + } + + public void testFindConstructors_AfterEdit_ExpressionStarted_5() throws Exception { + String[][] expectedProposals = + new String[][] { { "bar.ClassOne(a, b) - bar.ClassOne", "bar.ClassTwo(c, d, e) - bar.ClassTwo", + "bar.foo.ClassThree(param1, param2, param3, param4) - bar.foo.ClassThree" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "JSClasses.html", 18, 5, expectedProposals); + } + + public void testFindConstructors_AfterEdit_ExpressionStarted_6() throws Exception { + String[][] expectedProposals = + new String[][] { { "bar.ClassOne(a, b) - bar.ClassOne", "bar.ClassTwo(c, d, e) - bar.ClassTwo", + "bar.foo.ClassThree(param1, param2, param3, param4) - bar.foo.ClassThree" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "JSClasses.html", 20, 9, expectedProposals); + } + + public void testFindConstructors_AfterEdit_VarDeclaration_ExpressionStarted_0() throws Exception { + String[][] expectedProposals = + new String[][] { { "MyClassEdit1(a) - MyClassEdit1", "MyClassEdit2() - MyClassEdit2" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "ClassTest2.html", 7, 8, expectedProposals); + } + + public void testFindConstructors_AfterEdit_ArrayReferenceDeclaration_ExpressionStarted_0() + throws Exception { + String[][] expectedProposals = new String[][] { { "testEdit.Foo(x, y, z) - testEdit.Foo" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "Test.html", 8, 7, expectedProposals); + } +}
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/ContentAssistTestUtilities.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/ContentAssistTestUtilities.java new file mode 100644 index 0000000..fd3f123 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/ContentAssistTestUtilities.java
@@ -0,0 +1,530 @@ +/******************************************************************************* + * Copyright (c) 2011, 2012 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.web.ui.tests.contentassist; + +import java.io.IOException; +import java.io.StringReader; +import java.lang.reflect.Method; +import java.util.HashSet; +import java.util.Set; + +import junit.framework.Assert; + +import org.eclipse.core.resources.IFile; +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.contentassist.ContentAssistant; +import org.eclipse.jface.text.contentassist.ICompletionProposal; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.jface.text.contentassist.IContentAssistant; +import org.eclipse.jface.text.source.ISourceViewer; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.ide.IDE; +import org.eclipse.ui.texteditor.AbstractTextEditor; +import org.eclipse.ui.texteditor.ITextEditor; +import org.eclipse.wst.html.ui.StructuredTextViewerConfigurationHTML; +import org.eclipse.wst.jsdt.internal.ui.JavaScriptPlugin; +import org.eclipse.wst.jsdt.internal.ui.javaeditor.JavaEditor; +import org.eclipse.wst.jsdt.internal.ui.text.html.HTML2TextReader; +import org.eclipse.wst.jsdt.ui.text.IJavaScriptPartitions; +import org.eclipse.wst.jsdt.ui.text.JavaScriptSourceViewerConfiguration; +import org.eclipse.wst.jsdt.web.ui.tests.internal.TestProjectSetup; +import org.eclipse.wst.sse.ui.StructuredTextEditor; +import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration; +import org.eclipse.wst.sse.ui.internal.StructuredTextViewer; + +/** + * <p> + * Helpful utilities for running content assist tests. + * </p> + * + * @see org.ecliplse.wst.jsdt.ui.tests.contentassist.ContentAssistUtilities + * @see org.eclipse.wst.jsdt.web.ui.tests.contentassist.ContentAssistUtilities + */ +public class ContentAssistTestUtilities { + /** + * <p> + * Run a proposal test by opening the given file and invoking content assist for each expected + * proposal count at the given line number and line character offset and then compare the number + * of proposals for each invocation (pages) to the expected number of proposals. + * </p> + * + * @param testProject + * @param filePath + * @param lineNum + * @param lineRelativeCharOffset + * @param expectedProposalCounts + * @throws Exception + */ + public static void runProposalTest(TestProjectSetup testProject, String filePath, int lineNum, int lineRelativeCharOffset, + String[][] expectedProposals) throws Exception { + + runProposalTest(testProject, filePath, lineNum, lineRelativeCharOffset, expectedProposals, false, true); + } + + /** + * <p> + * Run a proposal test by opening the given file and invoking content assist for each expected + * proposal count at the given line number and line character offset and then compare the number + * of proposals for each invocation (pages) to the expected number of proposals. + * </p> + * + * @param testProject + * @param filePath + * @param lineNum + * @param lineRelativeCharOffset + * @param expectedProposalCounts + * @param negativeTest + * <code>true</code> if expectedProposals should not be found, <code>false</code> if + * they should be found + * @param exactMatch + * <code>true</code> if expectedProposals should be compared to actual proposals with + * {@link String#equals(Object)}, <code>false</code> if {@link String#indexOf(int)} + * should be used + * @throws Exception + */ + public static void runProposalTest(TestProjectSetup testProject, String filePath, int lineNum, int lineRelativeCharOffset, + String[][] expectedProposals, boolean negativeTest, boolean exactMatch) throws Exception { + + ICompletionProposal[][] pages = getProposals(testProject, filePath, lineNum, lineRelativeCharOffset, + expectedProposals.length); + verifyExpectedProposal(pages, expectedProposals, negativeTest, exactMatch, false); + } + + /** + * <p> + * Run a proposal test by opening the given file and invoking content assist for each expected + * proposal count at the given line number and line character offset and then compare the number + * of proposals for each invocation (pages) to the expected number of proposals. + * </p> + * + * @param testProject + * @param filePath + * @param lineNum + * @param lineRelativeCharOffset + * @param expectedProposalCounts + * @param negativeTest + * <code>true</code> if expectedProposals should not be found, <code>false</code> if + * they should be found + * @param exactMatch + * <code>true</code> if expectedProposals should be compared to actual proposals with + * {@link String#equals(Object)}, <code>false</code> if {@link String#indexOf(int)} + * should be used + * @param inOrder + * <code>true</code> if <code>expectedProposals</code> should be found in the order + * they are given, <code>false</code> if order does not matter + * + * @throws Exception + */ + public static void runProposalTest(TestProjectSetup testProject, String filePath, int lineNum, int lineRelativeCharOffset, + String[][] expectedProposals, boolean negativeTest, boolean exactMatch, boolean inOrder) throws Exception { + + ICompletionProposal[][] pages = getProposals(testProject, filePath, lineNum, lineRelativeCharOffset, + expectedProposals.length); + verifyExpectedProposal(pages, expectedProposals, negativeTest, exactMatch, inOrder); + } + + /** + * <p> + * Run a proposal info test by opening the given file and invoking content assist for each + * expected proposal count at the given line number and line character offset and then compare + * the proposal Info for each invocation (pages) with its expected Proposal Info . + * </p> + * + * @param testProject + * @param filePath + * @param lineNum + * @param lineRelativeCharOffset + * @param expectedProposalInfo + * @throws Exception + */ + public static void runProposalInfoTest(TestProjectSetup testProject, String filePath, int lineNum, int lineRelativeCharOffset, + String[][] expectedProposals, String[][] expectedProposalInfo) throws Exception { + + ICompletionProposal[][] pages = getProposals(testProject, filePath, lineNum, lineRelativeCharOffset, + expectedProposals.length); + verifyExpectedProposalInfo(pages, expectedProposals, expectedProposalInfo); + } + + /** + * <p> + * Runs a test for finding whether duplicate proposals are generated when content assist is + * invoked. + * </p> + * + * @param testProject + * @param filePath + * @param lineNum + * @param lineRelativeOffset + */ + public static void verifyNoDuplicates(TestProjectSetup testProject, String filePath, int lineNum, int lineRelativeCharOffset) throws Exception { + + int numOfPages = 1; + ICompletionProposal[][] pages = getProposals(testProject, filePath, lineNum, lineRelativeCharOffset, numOfPages); + checkForDuplicates(pages, numOfPages); + } + + /** + * <p> + * Run a proposal test by opening the given file and invoking content assist for each expected + * proposal count at the given line number and line character offset and then compare the number + * of proposals for each invocation (pages) to the expected number of proposals. + * </p> + * + * @param testProject + * @param filePath + * @param lineNum + * @param lineRelativeCharOffset + * @param expectedProposalCounts + * @param negativeTest + * <code>true</code> if expectedProposals should not be found, <code>false</code> if + * they should be found + * @param exactMatch + * <code>true</code> if expectedProposals should be compared to actual proposals with + * {@link String#equals(Object)}, <code>false</code> if {@link String#indexOf(int)} + * should be used + * @throws Exception + */ + public static void runHTMLProposalTest(TestProjectSetup testProject, String filePath, int lineNum, int lineRelativeCharOffset, + String[][] expectedProposals, boolean negativeTest, boolean exactMatch) throws Exception { + + ICompletionProposal[][] pages = getHTMLProposals(testProject, filePath, lineNum, lineRelativeCharOffset, + expectedProposals.length); + verifyExpectedProposal(pages, expectedProposals, negativeTest, exactMatch, false); + } + + /** + * <p> + * Returns the content assist proposals when invoked at the offset provided. + * </p> + * + * @param fileNum + * @param lineNum + * @param lineRelativeCharOffset + * @param numOfPages + */ + private static ICompletionProposal[][] getProposals(TestProjectSetup testProject, String filePath, int lineNum, int lineRelativeCharOffset, + int numOfPages) throws Exception { + + IFile file = testProject.getFile(filePath); + AbstractTextEditor editor = testProject.getEditor(file); + IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput()); + int offset = doc.getLineOffset(lineNum) + lineRelativeCharOffset; + + ICompletionProposal[][] pages = getProposals(editor, offset, numOfPages); + return pages; + } + + /** + * <p> + * Invoke content assist on the given editor at the given offset, for the given number of pages + * and return the results of each page + * </p> + */ + private static ICompletionProposal[][] getProposals(AbstractTextEditor editor, int offset, int pageCount) + throws Exception { + + ICompletionProposal[][] pages = null; + + /* if JS editor + * else if HTML editor */ + if(editor instanceof JavaEditor) { + // setup the viewer + ISourceViewer viewer = ((JavaEditor) editor).getViewer(); + JavaScriptSourceViewerConfiguration configuration = new JavaScriptSourceViewerConfiguration( + JavaScriptPlugin.getDefault().getJavaTextTools().getColorManager(), + JavaScriptPlugin.getDefault().getCombinedPreferenceStore(), editor, + IJavaScriptPartitions.JAVA_PARTITIONING); + + ContentAssistant contentAssistant = (ContentAssistant) configuration.getContentAssistant(viewer); + + // get the processor + String partitionTypeID = viewer.getDocument().getPartition(offset).getType(); + IContentAssistProcessor processor = contentAssistant.getContentAssistProcessor(partitionTypeID); + + // fire content assist session about to start + Method privateFireSessionBeginEventMethod = ContentAssistant.class.getDeclaredMethod( + "fireSessionBeginEvent", new Class[] { boolean.class }); + privateFireSessionBeginEventMethod.setAccessible(true); + privateFireSessionBeginEventMethod.invoke(contentAssistant, new Object[] { Boolean.TRUE }); + + // get content assist suggestions + pages = new ICompletionProposal[pageCount][]; + for(int p = 0; p < pageCount; ++p) { + pages[p] = processor.computeCompletionProposals(viewer, offset); + } + + // fire content assist session ending + Method privateFireSessionEndEventMethod = ContentAssistant.class.getDeclaredMethod("fireSessionEndEvent", + null); + privateFireSessionEndEventMethod.setAccessible(true); + privateFireSessionEndEventMethod.invoke(contentAssistant, null); + + } else if(editor instanceof StructuredTextEditor) { + //setup the viewer + StructuredTextViewer viewer = ((StructuredTextEditor) editor).getTextViewer(); + StructuredTextViewerConfigurationHTML configuration = new StructuredTextViewerConfigurationHTML(); + ContentAssistant contentAssistant = (ContentAssistant) configuration.getContentAssistant(viewer); + viewer.configure(configuration); + viewer.setSelectedRange(offset, 0); + + //get the processor + String partitionTypeID = viewer.getDocument().getPartition(offset).getType(); + IContentAssistProcessor processor = contentAssistant.getContentAssistProcessor(partitionTypeID); + + //fire content assist session about to start + Method privateFireSessionBeginEventMethod = ContentAssistant.class.getDeclaredMethod( + "fireSessionBeginEvent", new Class[] { boolean.class }); + privateFireSessionBeginEventMethod.setAccessible(true); + privateFireSessionBeginEventMethod.invoke(contentAssistant, new Object[] { Boolean.TRUE }); + + //get content assist suggestions + pages = new ICompletionProposal[pageCount][]; + for(int p = 0; p < pageCount; ++p) { + pages[p] = processor.computeCompletionProposals(viewer, offset); + } + + //fire content assist session ending + Method privateFireSessionEndEventMethod = ContentAssistant.class.getDeclaredMethod("fireSessionEndEvent", + null); + privateFireSessionEndEventMethod.setAccessible(true); + privateFireSessionEndEventMethod.invoke(contentAssistant, null); + } + + return pages; + } + + /** + * @param pages + * @param expectedProposals + * @param negativeTest + * <code>true</code> if <code>expectedProposals</code> should not be found, + * <code>false</code> if + * they should be found + * @param exactMatch + * <code>true</code> if expectedProposals should be compared to actual proposals with + * {@link String#equals(Object)}, <code>false</code> if {@link String#indexOf(int)} + * should be used + * @param inOrder + * <code>true</code> if <code>expectedProposals</code> should be found in the order + * they are given, <code>false</code> if order does not matter + */ + private static void verifyExpectedProposal(ICompletionProposal[][] pages, String[][] expectedProposals, + boolean negativeTest, boolean exactMatch, boolean inOrder) { + + StringBuffer error = new StringBuffer(); + int lastFoundIndex = -1; + String lastFoundProposal = ""; + for(int page = 0; page < expectedProposals.length; ++page) { + for(int expected = 0; expected < expectedProposals[page].length; ++expected) { + String expectedProposal = expectedProposals[page][expected]; + boolean found = false; + int suggestion = 0; + for( ; suggestion < pages[page].length && !found; ++suggestion) { + String displayString = pages[page][suggestion].getDisplayString(); + found = exactMatch ? + displayString.equals(expectedProposal) : displayString.indexOf(expectedProposal) != -1; + } + + /* error if checking for in order and this expected proposal was + * found at an index lower then the last found proposal */ + if(inOrder && found && suggestion < lastFoundIndex) { + error.append("\nProposal was found out of order: " + expectedProposal + " found before " + lastFoundProposal); + } + + if(found && negativeTest) { + error.append("\nUnexpected proposal was found on page " + page + ": '" + expectedProposal + "'"); + } else if(!found && !negativeTest) { + error.append("\n Expected proposal was not found on page " + page + ": '" + expectedProposal + "'"); + } + + if(found) { + lastFoundProposal = expectedProposal; + lastFoundIndex = suggestion; + } + } + } + + // if errors report them + if(error.length() > 0) { + StringBuffer expected = new StringBuffer(); + for(int i = 0; i < expectedProposals.length; i++) { + for(int j = 0; j < expectedProposals[i].length; j++) { + expected.append(expectedProposals[i][j]); + expected.append('\n'); + } + } + StringBuffer actual = new StringBuffer(); + for(int i = 0; i < pages.length; i++) { + for(int j = 0; j < pages[i].length; j++) { + actual.append(pages[i][j].getDisplayString()); + actual.append('\n'); + } + } + Assert.assertEquals(error.toString(), expected.toString(), actual.toString()); + } + } + + /** + * + * <p> + * Compares the expected proposal Info with the one generated from the JavaDoc + * </p> + * + * @param pages + * @param expectedProposalInfo + */ + + private static void verifyExpectedProposalInfo(ICompletionProposal[][] pages, String[][] expectedProposals, + String[][] expectedProposalsInfo) { + StringBuffer error = new StringBuffer(); + String proposalInfo = new String(); + for(int page = 0; page < expectedProposals.length; ++page) { + for(int expected = 0; expected < expectedProposals[page].length; ++expected) { + String expectedProposal = expectedProposals[page][expected]; + String expectedProposalInfo = expectedProposalsInfo[page][expected]; + boolean found = false; + for(int suggestion = 0; suggestion < pages[page].length && !found; ++suggestion) { + found = pages[page][suggestion].getDisplayString().equals(expectedProposal); + if(found) { + proposalInfo = pages[page][suggestion].getAdditionalProposalInfo(); + + if(proposalInfo == null || proposalInfo.indexOf(expectedProposalInfo) < 0) { + error.append("\n" + "Required proposal info for " + expectedProposal + " does not exist."); + } + break; + } + + } + } + + } + + // if errors report them + if(error.length() > 0) { + StringBuffer expected = new StringBuffer(); + for(int i = 0; i < expectedProposalsInfo.length; i++) { + for(int j = 0; j < expectedProposalsInfo[i].length; j++) { + expected.append(expectedProposalsInfo[i][j]); + expected.append('\n'); + } + } + StringBuffer actual = new StringBuffer(); + for(int i = 0; i < pages.length; i++) { + for(int j = 0; j < pages[i].length; j++) { + try { + actual.append(new HTML2TextReader(new StringReader(pages[i][j].getAdditionalProposalInfo()), + null).getString().trim()); + } catch(IOException e) { + e.printStackTrace(); + } + actual.append('\n'); + } + } + Assert.assertEquals(error.toString(), expected.toString(), actual.toString()); + } + } + + /** + * <p> + * Checks for Duplicates and reports an error if found. + * </p> + * + * @param pages + * @param numOfPages + */ + private static void checkForDuplicates(ICompletionProposal[][] pages, int numOfPages) { + Set set = new HashSet(); + StringBuffer error = new StringBuffer(); + + for(int suggestion = 0; suggestion < pages[0].length; ++suggestion) { + if(set.contains(pages[0][suggestion].toString())) { + error.append("\nDuplicate proposal found: '" + pages[0][suggestion] + "'"); + } else { + set.add(pages[0][suggestion].toString()); + } + } + + if(error.length() > 0) { + Assert.fail(error.toString()); + } + + set.clear(); + } + + /** + * <p> + * Returns the content assist proposals when invoked at the offset provided. + * </p> + * + * @param fileNum + * @param lineNum + * @param lineRelativeCharOffset + * @param numOfPages + */ + private static ICompletionProposal[][] getHTMLProposals(TestProjectSetup testProject, String filePath, int lineNum, int lineRelativeCharOffset, + int numOfPages) throws Exception { + + IFile file = testProject.getFile(filePath); + + IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + IWorkbenchPage page = workbenchWindow.getActivePage(); + IEditorPart part = IDE.openEditor(page, file, "org.eclipse.wst.html.core.htmlsource.source"); + StructuredTextEditor editor = (StructuredTextEditor) part.getAdapter(ITextEditor.class); + + IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput()); + int offset = doc.getLineOffset(lineNum) + lineRelativeCharOffset; + + ICompletionProposal[][] pages = getHTMLProposals(editor, offset, numOfPages); + return pages; + } + + /** + * <p> + * Invoke content assist on the given editor at the given offset, for the given number of pages + * and return the results of each page + * </p> + */ + private static ICompletionProposal[][] getHTMLProposals(StructuredTextEditor editor, int offset, int pageCount) throws Exception { + // setup the viewer + ISourceViewer viewer = editor.getTextViewer(); + Method getSourceViewerConfiguration = AbstractTextEditor.class.getDeclaredMethod("getSourceViewerConfiguration", new Class[0]); + getSourceViewerConfiguration.setAccessible(true); + StructuredTextViewerConfiguration configuration = (StructuredTextViewerConfiguration) getSourceViewerConfiguration.invoke(editor, null); + IContentAssistant contentAssistant = configuration.getContentAssistant(viewer); + + // get the processor + String partitionTypeID = viewer.getDocument().getPartition(offset).getType(); + IContentAssistProcessor processor = contentAssistant.getContentAssistProcessor(partitionTypeID); + + // fire content assist session about to start + Method privateFireSessionBeginEventMethod = ContentAssistant.class.getDeclaredMethod("fireSessionBeginEvent", + new Class[] { boolean.class }); + privateFireSessionBeginEventMethod.setAccessible(true); + privateFireSessionBeginEventMethod.invoke(contentAssistant, new Object[] { Boolean.TRUE }); + + // get content assist suggestions + ICompletionProposal[][] pages = new ICompletionProposal[pageCount][]; + for(int p = 0; p < pageCount; ++p) { + pages[p] = processor.computeCompletionProposals(viewer, offset); + } + + // fire content assist session ending + Method privateFireSessionEndEventMethod = ContentAssistant.class.getDeclaredMethod("fireSessionEndEvent", null); + privateFireSessionEndEventMethod.setAccessible(true); + privateFireSessionEndEventMethod.invoke(contentAssistant, null); + + editor.close(false); + return pages; + } +} \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/DoublyNestedFunctionTests.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/DoublyNestedFunctionTests.java new file mode 100644 index 0000000..fb393e1 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/DoublyNestedFunctionTests.java
@@ -0,0 +1,99 @@ +/******************************************************************************* + * Copyright (c) 2011, 2012 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.web.ui.tests.contentassist; + +import junit.extensions.TestSetup; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.wst.jsdt.web.ui.tests.internal.TestProjectSetup; + +public class DoublyNestedFunctionTests extends TestCase { + /** + * <p> + * This tests name + * </p> + */ + private static final String TEST_NAME = "Test Doubly Nested Functions JavaScript Content Assist"; + + /** + * <p> + * Test project setup for this test. + * </p> + */ + private static TestProjectSetup fTestProjectSetup; + + /** + * <p> + * Default constructor + * <p> + * <p> + * Use {@link #suite()} + * </p> + * + * @see #suite() + */ + public DoublyNestedFunctionTests() { + super(TEST_NAME); + } + + /** + * <p> + * Constructor that takes a test name. + * </p> + * <p> + * Use {@link #suite()} + * </p> + * + * @param name + * The name this test run should have. + * + * @see #suite() + */ + public DoublyNestedFunctionTests(String name) { + super(name); + } + + /** + * <p> + * Use this method to add these tests to a larger test suite so set up and tear down can be + * performed + * </p> + * + * @return a {@link TestSetup} that will run all of the tests in this class + * with set up and tear down. + */ + + public static Test suite() { + TestSuite ts = + new TestSuite(DoublyNestedFunctionTests.class, TEST_NAME); + + fTestProjectSetup = new TestProjectSetup(ts, "JSDTWebContentAssist", "WebContent", false); + + return fTestProjectSetup; + } + + public void testFindInnerFunctions2_ExpressionNotStarted() throws Exception { + String[][] expectedProposals = new String[][] { { "outerFunc() - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "InnerOuter.html", 6, 0, expectedProposals); + } + + public void test_FindInnerFunctions2_NegativeTest_ExpressionStarted_1() throws Exception { + String[][] unexpectedProposals = + new String[][] { { "innerFunc()", "insideInnerFunc()", "localInnerFunc : Function", + "localInnerFunc(param1)" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "InnerOuter.html", 4, 1, unexpectedProposals, true, false); + } +} \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/DoublyNestedFunctionTests_Edited.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/DoublyNestedFunctionTests_Edited.java new file mode 100644 index 0000000..2e4eb6c --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/DoublyNestedFunctionTests_Edited.java
@@ -0,0 +1,103 @@ +/******************************************************************************* + * Copyright (c) 2011, 2012 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.web.ui.tests.contentassist; + +import junit.extensions.TestSetup; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.wst.jsdt.web.ui.tests.internal.TestProjectSetup; + +public class DoublyNestedFunctionTests_Edited extends TestCase { + /** + * <p> + * This tests name + * </p> + */ + private static final String TEST_NAME = "Test Doubly Nested Functions JavaScript Content Assist after Edit"; + + /** + * <p> + * Test project setup for this test. + * </p> + */ + private static TestProjectSetup fTestProjectSetup; + + /** + * <p> + * Default constructor + * <p> + * <p> + * Use {@link #suite()} + * </p> + * + * @see #suite() + */ + public DoublyNestedFunctionTests_Edited() { + super(TEST_NAME); + } + + /** + * <p> + * Constructor that takes a test name. + * </p> + * <p> + * Use {@link #suite()} + * </p> + * + * @param name + * The name this test run should have. + * + * @see #suite() + */ + public DoublyNestedFunctionTests_Edited(String name) { + super(name); + } + + /** + * <p> + * Use this method to add these tests to a larger test suite so set up and tear down can be + * performed + * </p> + * + * @return a {@link TestSetup} that will run all of the tests in this class + * with set up and tear down. + */ + + public static Test suite() { + TestSuite ts = + new TestSuite(DoublyNestedFunctionTests_Edited.class, TEST_NAME); + + fTestProjectSetup = new TestProjectSetup(ts, "JSDTWebContentAssist", "WebContent", false) { + public void additionalSetUp() throws Exception { + this.editFile("InnerOuter.js", 7, 11, 6, "edited"); + this.editFile("InnerOuter.js", 0, 9, 9, "editedFunc"); + } + }; + + return fTestProjectSetup; + } + + public void testFindInnerFunctions2_AfterEdit_ExpressionNotStarted() throws Exception { + String[][] expectedProposals = new String[][] { { "editedFunc() - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "InnerOuter.html", 6, 0, expectedProposals); + } + + public void testMustFail_FindInnerFunctions2_AfterEdit_ExpressionStarted_1() throws Exception { + String[][] unexpectedProposals = + new String[][] { { "innerFunc()", "editedInnerFunc()", "localInnerFunc : Function", + "localInnerFunc(param1)" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "InnerOuter.html", 10, 1, unexpectedProposals, true, false); + } +} \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/DuplicatesTests.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/DuplicatesTests.java new file mode 100644 index 0000000..d17faaf --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/DuplicatesTests.java
@@ -0,0 +1,143 @@ +/******************************************************************************* + * Copyright (c) 2011, 2012 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.web.ui.tests.contentassist; + +import junit.extensions.TestSetup; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.wst.jsdt.web.ui.tests.internal.TestProjectSetup; + +public class DuplicatesTests extends TestCase { + /** + * <p> + * This tests name + * </p> + */ + private static final String TEST_NAME = "Test for Duplicate Content Assist Proposals"; + + /** + * <p> + * Test project setup for this test. + * </p> + */ + private static TestProjectSetup fTestProjectSetup; + + /** + * <p> + * Default constructor + * <p> + * <p> + * Use {@link #suite()} + * </p> + * + * @see #suite() + */ + public DuplicatesTests() { + super(TEST_NAME); + } + + /** + * <p> + * Constructor that takes a test name. + * </p> + * <p> + * Use {@link #suite()} + * </p> + * + * @param name + * The name this test run should have. + * + * @see #suite() + */ + public DuplicatesTests(String name) { + super(name); + } + + /** + * <p> + * Use this method to add these tests to a larger test suite so set up and tear down can be + * performed + * </p> + * + * @return a {@link TestSetup} that will run all of the tests in this class + * with set up and tear down. + */ + + public static Test suite() { + TestSuite ts = new TestSuite(DuplicatesTests.class, TEST_NAME); + + fTestProjectSetup = new TestProjectSetup(ts, "JSDTWebContentAssist", "WebContent", false); + + return fTestProjectSetup; + } + + public void testForDuplicates_Expression1() throws Exception { + ContentAssistTestUtilities.verifyNoDuplicates(fTestProjectSetup, "ConstructorCamelCase.html", 10, 7); + } + + public void testForDuplicates_Expression2() throws Exception { + ContentAssistTestUtilities.verifyNoDuplicates(fTestProjectSetup, "ConstructorCamelCase.html", 12, 8); + } + + public void testForDuplicates_Expression3() throws Exception { + ContentAssistTestUtilities.verifyNoDuplicates(fTestProjectSetup, "JSClasses.html", 10, 6); + } + + public void testForDuplicates_Expression4() throws Exception { + ContentAssistTestUtilities.verifyNoDuplicates(fTestProjectSetup, "JSClasses.html", 14, 10); + } + + public void testForDuplicates_Expression5() throws Exception { + ContentAssistTestUtilities.verifyNoDuplicates(fTestProjectSetup, "JSClasses.html", 18, 5); + } + + public void testForDuplicates_Expression6() throws Exception { + ContentAssistTestUtilities.verifyNoDuplicates(fTestProjectSetup, "Test.html", 8, 7); + } + + public void testForDuplicates_Expression7() throws Exception { + ContentAssistTestUtilities.verifyNoDuplicates(fTestProjectSetup, "ReferenceInMemberAndStaticFunctions.html", 7, 6); + } + + public void testForDuplicates_Expression8() throws Exception { + ContentAssistTestUtilities.verifyNoDuplicates(fTestProjectSetup, "InnerOuter.html", 10, 1); + } + + public void testForDuplicates_Expression9() throws Exception { + ContentAssistTestUtilities.verifyNoDuplicates(fTestProjectSetup, "GlobalFunctions.html", 10, 3); + } + + public void testForDuplicates_Expression10() throws Exception { + ContentAssistTestUtilities.verifyNoDuplicates(fTestProjectSetup, "GlobalFunctions.html", 12, 5); + } + + public void testForDuplicates_Expression11() throws Exception { + ContentAssistTestUtilities.verifyNoDuplicates(fTestProjectSetup, "NamedFunctionAssignedToVariables.html", 8, 1); + } + + public void testForDuplicates_Expression12() throws Exception { + ContentAssistTestUtilities.verifyNoDuplicates(fTestProjectSetup, "NamedFunctionAssignedToVariables.html", 8, 0); + } + + public void testForDuplicates_Expression13() throws Exception { + ContentAssistTestUtilities.verifyNoDuplicates(fTestProjectSetup, "Global.html", 6, 0); + } + + public void testForDuplicates_Expression14() throws Exception { + ContentAssistTestUtilities.verifyNoDuplicates(fTestProjectSetup, "Global.html", 10, 7); + } + + public void testForDuplicates_Expression15() throws Exception { + ContentAssistTestUtilities.verifyNoDuplicates(fTestProjectSetup, "Crazy.html", 10, 4); + } +} \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/GlobalFunctionTests.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/GlobalFunctionTests.java new file mode 100644 index 0000000..9340599 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/GlobalFunctionTests.java
@@ -0,0 +1,146 @@ +/******************************************************************************* + * Copyright (c) 2011, 2012 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.web.ui.tests.contentassist; + +import org.eclipse.wst.jsdt.web.ui.tests.internal.TestProjectSetup; + +import junit.extensions.TestSetup; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +public class GlobalFunctionTests extends TestCase { + + private static final String TEST_NAME = "Test Global Functions JavaScript Content Assist"; + + /** + * <p> + * Test project setup for this test. + * </p> + */ + private static TestProjectSetup fTestProjectSetup; + + /** + * <p> + * Default constructor + * <p> + * <p> + * Use {@link #suite()} + * </p> + * + * @see #suite() + */ + public GlobalFunctionTests() { + super(TEST_NAME); + } + + /** + * <p> + * Constructor that takes a test name. + * </p> + * <p> + * Use {@link #suite()} + * </p> + * + * @param name + * The name this test run should have. + * + * @see #suite() + */ + public GlobalFunctionTests(String name) { + super(name); + } + + /** + * <p> + * Use this method to add these tests to a larger test suite so set up and tear down can be + * performed + * </p> + * + * @return a {@link TestSetup} that will run all of the tests in this class + * with set up and tear down. + */ + + public static Test suite() { + TestSuite ts = new TestSuite(GlobalFunctionTests.class, TEST_NAME); + + fTestProjectSetup = new TestProjectSetup(ts, "JSDTWebContentAssist", "WebContent", false); + + return fTestProjectSetup; + } + + public void testFindFunctions_ExpressionStarted_0() throws Exception { + String[][] expectedProposals = + new String[][] { { "funcOne() - Global", "funcTwo() : String - Global", "funcThree(paramOne) - Global", + "funcFour(paramOne, paramTwo) : Number - Global", + "funcFive(Number paramOne, String paramTwo) : String - Global", + "funcSix(paramOne, String paramTwo) : Number - Global", + "funcSeven(String paramOne, paramTwo) : Number - Global", + "funcEight(paramOne) : String - Global", "funcNine(paramOne) : Number - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "GlobalFunctions.html", 6, 0, expectedProposals); + } + + public void testFindFunctions_ExpressionStarted_1() throws Exception { + String[][] expectedProposals = + new String[][] { { "funcOne() - Global", "funcTwo() : String - Global", "funcThree(paramOne) - Global", + "funcFour(paramOne, paramTwo) : Number - Global", + "funcFive(Number paramOne, String paramTwo) : String - Global", + "funcSix(paramOne, String paramTwo) : Number - Global", + "funcSeven(String paramOne, paramTwo) : Number - Global", + "funcEight(paramOne) : String - Global", "funcNine(paramOne) : Number - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "GlobalFunctions.html", 8, 1, expectedProposals); + } + + public void testFindFunctions_ExpressionStarted_2() throws Exception { + String[][] expectedProposals = + new String[][] { { "funcTwo() : String - Global", "funcThree(paramOne) - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "GlobalFunctions.html", 10, 5, expectedProposals); + } + + public void testFindFunctions_ExpressionStarted_CamelCase() throws Exception { + String[][] expectedProposals = + new String[][] { { "funcTwo() : String - Global", "funcThree(paramOne) - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "GlobalFunctions.html", 12, 2, expectedProposals); + } + + + public void testNamedFunctionsAssignedToVariables_ExpressionNotStarted() throws Exception { + String[][] expectedProposals = + new String[][] { { "foo1 : Function - Global", "foo1(param2) - Global", "foo2 : Function - Global", + "foo2(param3, param4) - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "NamedFunctionAssignedToVariables.html", 6, 0, + expectedProposals); + } + + public void testNamedFunctionsAssignedToVariables_ExpressionStarted1() throws Exception { + String[][] expectedProposals = + new String[][] { { "foo1 : Function - Global", "foo1(param2) - Global", "foo2 : Function - Global", + "foo2(param3, param4) - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "NamedFunctionAssignedToVariables.html", 8, 1, + expectedProposals); + } + + public void testNamedFunctionsAssignedToVariables_ExpressionNotStarted_NegativeTest() + throws Exception { + String[][] expectedProposals = new String[][] { { "foo1Ignored", "foo2Ignored" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "NamedFunctionAssignedToVariables.html", 6, 0, + expectedProposals, true, false); + } + + public void testNamedFunctionsAssignedToVariables_ExpressionStarted1_NegativeTest() + throws Exception { + String[][] expectedProposals = new String[][] { { "foo1Ignored", "foo2Ignored" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "NamedFunctionAssignedToVariables.html", 8, 1, + expectedProposals, true, false); + } +} \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/GlobalFunctionTests_Edited.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/GlobalFunctionTests_Edited.java new file mode 100644 index 0000000..304d7fd --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/GlobalFunctionTests_Edited.java
@@ -0,0 +1,165 @@ +/******************************************************************************* + * Copyright (c) 2011, 2012 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.web.ui.tests.contentassist; + +import junit.extensions.TestSetup; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.wst.jsdt.web.ui.tests.internal.TestProjectSetup; + +public class GlobalFunctionTests_Edited extends TestCase { + /** + * <p> + * This tests name + * </p> + */ + private static final String TEST_NAME = "Test Global Functions JavaScript Content Assist after Edit"; + + /** + * <p> + * Test project setup for this test. + * </p> + */ + private static TestProjectSetup fTestProjectSetup; + + /** + * <p> + * Default constructor + * <p> + * <p> + * Use {@link #suite()} + * </p> + * + * @see #suite() + */ + public GlobalFunctionTests_Edited() { + super(TEST_NAME); + } + + /** + * <p> + * Constructor that takes a test name. + * </p> + * <p> + * Use {@link #suite()} + * </p> + * + * @param name + * The name this test run should have. + * + * @see #suite() + */ + public GlobalFunctionTests_Edited(String name) { + super(name); + } + + /** + * <p> + * Use this method to add these tests to a larger test suite so set up and tear down can be + * performed + * </p> + * + * @return a {@link TestSetup} that will run all of the tests in this class + * with set up and tear down. + */ + + public static Test suite() { + TestSuite ts = + new TestSuite(GlobalFunctionTests_Edited.class, TEST_NAME); + + fTestProjectSetup = new TestProjectSetup(ts, "JSDTWebContentAssist", "WebContent", false) { + /** + * @see org.eclipse.wst.jsdt.ui.tests.contentassist.ContentAssistTestUtilities.ContentAssistTestsSetup#additionalSetUp() + */ + public void additionalSetUp() throws Exception { + /* file -> GlobalFunctions.js + * funcOne -> functionOne + * funcTwo -> functionTwo */ + this.editFile("GlobalFunctions.js", 0, 9, 4, "function"); + this.editFile("GlobalFunctions.js", 4, 9, 4, "function"); + + this.editFile("NamedFunctionAssignedToVariables.js", 0, 4, 4, "foo1Edit"); + this.editFile("NamedFunctionAssignedToVariables.js", 0, 24, 4, "foo1Edit"); + this.editFile("NamedFunctionAssignedToVariables.js", 4, 0, 4, "foo2Edit"); + this.editFile("NamedFunctionAssignedToVariables.js", 4, 20, 4, "foo2Edit"); + } + }; + + return fTestProjectSetup; + } + + public void testFindFunctions_ExpressionStarted_0() throws Exception { + String[][] expectedProposals = + new String[][] { { "functionOne() - Global", "functionTwo() : String - Global", + "funcThree(paramOne) - Global", "funcFour(paramOne, paramTwo) : Number - Global", + "funcFive(Number paramOne, String paramTwo) : String - Global", + "funcSix(paramOne, String paramTwo) : Number - Global", + "funcSeven(String paramOne, paramTwo) : Number - Global", + "funcEight(paramOne) : String - Global", "funcNine(paramOne) : Number - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "GlobalFunctions.html", 8, 1, expectedProposals); + } + + public void testFindFunctions_ExpressionStarted_1() throws Exception { + String[][] expectedProposals = + new String[][] { { "functionOne() - Global", "functionTwo() : String - Global", + "funcThree(paramOne) - Global", "funcFour(paramOne, paramTwo) : Number - Global", + "funcFive(Number paramOne, String paramTwo) : String - Global", + "funcSix(paramOne, String paramTwo) : Number - Global", + "funcSeven(String paramOne, paramTwo) : Number - Global", + "funcEight(paramOne) : String - Global", "funcNine(paramOne) : Number - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "GlobalFunctions.html", 10, 4, expectedProposals); + } + + public void testFindFunctions_ExpressionStarted_2() throws Exception { + String[][] expectedProposals = + new String[][] { { "functionTwo() : String - Global", "funcThree(paramOne) - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "GlobalFunctions.html", 12, 5, expectedProposals); + } + + public void testNamedFunctionsAssignedToVariables_ExpressionNotStarted() throws Exception { + String[][] expectedProposals = + new String[][] { { "foo1Edit : Function - Global", "foo1Edit(param2) - Global", + "foo2Edit : Function - Global", "foo2Edit(param3, param4) - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "NamedFunctionAssignedToVariables.html", 6, 0, + expectedProposals); + } + + public void testNamedFunctionsAssignedToVariables_ExpressionStarted1() throws Exception { + String[][] expectedProposals = + new String[][] { { "foo1Edit : Function - Global", "foo1Edit(param2) - Global", + "foo2Edit : Function - Global", "foo2Edit(param3, param4) - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "NamedFunctionAssignedToVariables.html", 8, 1, + expectedProposals); + } + + public void testNamedFunctionsAssignedToVariables_ExpressionNotStarted_NegativeTest() + throws Exception { + String[][] expectedProposals = + new String[][] { { "foo1Ignored", "foo2Ignored", "foo1EditIgnored", "foo2EditIgnored", + "foo1 : Function - Global", "foo1(param2) - Global", "foo2 : Function - Global", + "foo2(param3, param4) - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "NamedFunctionAssignedToVariables.html", 6, 0, + expectedProposals, true, false); + } + + public void testNamedFunctionsAssignedToVariables_ExpressionStarted1_NegativeTest() + throws Exception { + String[][] expectedProposals = + new String[][] { { "foo1Ignored", "foo2Ignored", "foo1EditIgnored", "foo2EditIgnored", + "foo1 : Function - Global", "foo1(param2) - Global", "foo2 : Function - Global", + "foo2(param3, param4) - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "NamedFunctionAssignedToVariables.html", 8, 1, + expectedProposals, true, false); + } +} \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/GlobalObjectLiteralTests.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/GlobalObjectLiteralTests.java new file mode 100644 index 0000000..d94392a --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/GlobalObjectLiteralTests.java
@@ -0,0 +1,125 @@ +/******************************************************************************* + * Copyright (c) 2011, 2012 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.web.ui.tests.contentassist; + +import junit.extensions.TestSetup; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.wst.jsdt.web.ui.tests.internal.TestProjectSetup; + +public class GlobalObjectLiteralTests extends TestCase { + + private static final String TEST_NAME = "Test Global Object Literals JavaScript Content Assist"; + + /** + * <p> + * Test project setup for this test. + * </p> + */ + private static TestProjectSetup fTestProjectSetup; + + /** + * <p> + * Default constructor + * <p> + * <p> + * Use {@link #suite()} + * </p> + * + * @see #suite() + */ + public GlobalObjectLiteralTests() { + super(TEST_NAME); + } + + /** + * <p> + * Constructor that takes a test name. + * </p> + * <p> + * Use {@link #suite()} + * </p> + * + * @param name + * The name this test run should have. + * + * @see #suite() + */ + public GlobalObjectLiteralTests(String name) { + super(name); + } + + /** + * <p> + * Use this method to add these tests to a larger test suite so set up and tear down can be + * performed + * </p> + * + * @return a {@link TestSetup} that will run all of the tests in this class + * with set up and tear down. + */ + + public static Test suite() { + TestSuite ts = new TestSuite(GlobalObjectLiteralTests.class, TEST_NAME); + + fTestProjectSetup = new TestProjectSetup(ts, "JSDTWebContentAssist", "WebContent", false); + + return fTestProjectSetup; + } + public void testFindGlobalObjectLiteral_0() throws Exception { + String[][] expectedProposals = new String[][] { { "org : {} - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "GlobalObjectLiterals.html", 6, 0, expectedProposals); + } + + public void testFindGlobalObjectLiteral_1() throws Exception { + String[][] expectedProposals = new String[][] { { "org : {} - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "GlobalObjectLiterals.html", 8, 1, expectedProposals); + } + + public void _testFindFieldOnGlobalObjectLiteral_0() throws Exception { + String[][] expectedProposals = new String[][] { { "eclipse : {} - {}", "eclipse2 : {} - {}" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "GlobalObjectLiterals.html", 10, 4, expectedProposals); + } + + public void _testFindFieldOnGlobalObjectLiteral_1() throws Exception { + String[][] expectedProposals = new String[][] { { "eclipse : {} - {}", "eclipse2 : {} - {}" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "GlobalObjectLiterals.html", 10, 5, expectedProposals); + } + + public void _testFindFunctionOnFieldOnGlobalObjectLiteral_0() throws Exception { + String[][] expectedProposals = new String[][] { { "fun() - {}", "crazy() - {}" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "GlobalOjectLiterals.html", 12, 12, expectedProposals); + } + + public void testFindDuplicateGlobalObjectLiteral_Expression_0() throws Exception { + ContentAssistTestUtilities.verifyNoDuplicates(fTestProjectSetup, "GlobalObjectLiterals.html", 6, 0); + } + + public void testFindDuplicateGlobalObjectLiteral_Expression_1() throws Exception { + ContentAssistTestUtilities.verifyNoDuplicates(fTestProjectSetup, "GlobalObjectLiterals.html", 8, 1); + } + + public void testFindDuplicateFieldOnGlobalObjectLiteral_Expression_2() throws Exception { + ContentAssistTestUtilities.verifyNoDuplicates(fTestProjectSetup, "GlobalObjectLiterals.html", 10, 4); + } + + public void testFindDuplicateFieldOnGlobalObjectLiteral_0() throws Exception { + ContentAssistTestUtilities.verifyNoDuplicates(fTestProjectSetup, "GlobalObjectLiterals.html", 10, 5); + } + + public void testFindDuplicateFunctionOnFieldOnGlobalObjectLiteral_1() throws Exception { + ContentAssistTestUtilities.verifyNoDuplicates(fTestProjectSetup, "GlobalObjectLiterals.html", 12, 12); + } +} \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/GlobalVariableTests.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/GlobalVariableTests.java new file mode 100644 index 0000000..ecd0d1d --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/GlobalVariableTests.java
@@ -0,0 +1,112 @@ +/******************************************************************************* + * Copyright (c) 2011, 2012 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.web.ui.tests.contentassist; + +import junit.extensions.TestSetup; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.wst.jsdt.web.ui.tests.internal.TestProjectSetup; + +public class GlobalVariableTests extends TestCase { + /** + * <p> + * This tests name + * </p> + */ + private static final String TEST_NAME = "Test Global Field Variables JavaScript Content Assist"; + + /** + * <p> + * Test project setup for this test. + * </p> + */ + private static TestProjectSetup fTestProjectSetup; + + /** + * <p> + * Default constructor + * <p> + * <p> + * Use {@link #suite()} + * </p> + * + * @see #suite() + */ + public GlobalVariableTests() { + super(TEST_NAME); + } + + /** + * <p> + * Constructor that takes a test name. + * </p> + * <p> + * Use {@link #suite()} + * </p> + * + * @param name + * The name this test run should have. + * + * @see #suite() + */ + public GlobalVariableTests(String name) { + super(name); + } + + /** + * <p> + * Use this method to add these tests to a larger test suite so set up and tear down can be + * performed + * </p> + * + * @return a {@link TestSetup} that will run all of the tests in this class + * with set up and tear down. + */ + public static Test suite() { + TestSuite ts = new TestSuite(GlobalVariableTests.class, TEST_NAME); + + fTestProjectSetup = new TestProjectSetup(ts, "JSDTWebContentAssist", "WebContent", false); + + return fTestProjectSetup; + } + + public void testFindGlobalVariables_Expression_NotStarted() throws Exception { + String[][] expectedProposals = + new String[][] { { "globalNum : Number - Global", "globalString : String - Global", + "globalVar - Global", "globalVarNum : Number - Global", "globalVarObject : {} - Global", + "globalVarString : String - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "Global.html", 6, 0, expectedProposals); + } + + public void testFindGlobalVariables_ExpressionStarted_1() throws Exception { + String[][] expectedProposals = + new String[][] { { "globalNum : Number - Global", "globalString : String - Global", + "globalVar - Global", "globalVarNum : Number - Global", "globalVarObject : {} - Global", + "globalVarString : String - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "Global.html", 8, 1, expectedProposals); + } + + public void testFindGlobalVariables_NegativeTest_1() throws Exception { + String[][] expectedProposals = + new String[][] { { "globalNum : Number - Global", "globalString : String - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "Global.html", 10, 7, expectedProposals, true, false); + } + + public void testFindGlobalVariables_ExpressionStarted_2() throws Exception { + String[][] expectedProposals = + new String[][] { { "globalVarNum : Number - Global", "globalVarObject : {} - Global", + "globalVarString : String - Global", "globalVar - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "Global.html", 10, 7, expectedProposals); + } +} \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/GlobalVariableTests_Edited.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/GlobalVariableTests_Edited.java new file mode 100644 index 0000000..ab9f09d --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/GlobalVariableTests_Edited.java
@@ -0,0 +1,125 @@ +/******************************************************************************* + * Copyright (c) 2011, 2012 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.web.ui.tests.contentassist; + +import junit.extensions.TestSetup; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.wst.jsdt.web.ui.tests.internal.TestProjectSetup; + +public class GlobalVariableTests_Edited extends TestCase { + /** + * <p> + * This tests name + * </p> + */ + private static final String TEST_NAME = "Test Global Field Variables JavaScript Content Assist after Edit"; + + /** + * <p> + * Test project setup for this test. + * </p> + */ + private static TestProjectSetup fTestProjectSetup; + + /** + * <p> + * Default constructor + * <p> + * <p> + * Use {@link #suite()} + * </p> + * + * @see #suite() + */ + public GlobalVariableTests_Edited() { + super(TEST_NAME); + } + + /** + * <p> + * Constructor that takes a test name. + * </p> + * <p> + * Use {@link #suite()} + * </p> + * + * @param name + * The name this test run should have. + * + * @see #suite() + */ + public GlobalVariableTests_Edited(String name) { + super(name); + } + + /** + * <p> + * Use this method to add these tests to a larger test suite so set up and tear down can be + * performed + * </p> + * + * @return a {@link TestSetup} that will run all of the tests in this class + * with set up and tear down. + */ + public static Test suite() { + TestSuite ts = new TestSuite(GlobalVariableTests_Edited.class, TEST_NAME); + + fTestProjectSetup = new TestProjectSetup(ts, "JSDTWebContentAssist", "WebContent", false) { + public void additionalSetUp() throws Exception { + /* file -> Global.js + * globalNum -> globalEditedNumber + * globalString -> globalEditedString */ + this.editFile("Global.js", 1, 4, 12, "globalEditedNumber"); + this.editFile("Global.js", 7, 0, 12, "globalEditedString"); + + /* file -> Global.js + * globalV -> globalE */ + this.editFile("Global.js", 11, 6, 1, "E"); + this.editFile("Global.js", 15, 1, 1, "E"); + this.editFile("Global.js", 17, 1, 1, "E"); + + /* file -> Global.html + * globalV -> globalE */ + this.editFile("Global.html", 10, 6, 1, "E"); + this.editFile("Global.html", 12, 1, 1, "E"); + this.editFile("Global.html", 14, 1, 1, "E"); + } + }; + + return fTestProjectSetup; + } + + public void testFindFieldSuggestions_AfterEdit_Expression_NotStarted() throws Exception { + String[][] expectedProposals = + new String[][] { { "globalNum : Number - Global", "globalEditedString : String - Global", + "globalEditedNumber : Number - Global", "globalVarObject : {} - Global", + "globalVarString : String - Global", "globalVar - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "Global.html", 6, 0, expectedProposals); + } + + public void testFindFieldSuggestions_AfterEdit_ExpressionStarted_1() throws Exception { + String[][] expectedProposals = + new String[][] { { "globalNum : Number - Global", "globalEditedString : String - Global", + "globalVar - Global", "globalEditedNumber : Number - Global", "globalVarObject : {} - Global", + "globalVarString : String - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "Global.html", 8, 1, expectedProposals); + } + + public void testFindFieldSuggestions_AfterEdit_ExpressionStarted_2() throws Exception { + String[][] expectedProposals = + new String[][] { { "globalEditedNumber : Number - Global", "globalEditedString : String - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "Global.html", 10, 6, expectedProposals); + } +} \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/InnerFunctionTests.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/InnerFunctionTests.java new file mode 100644 index 0000000..ef2da73 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/InnerFunctionTests.java
@@ -0,0 +1,131 @@ +/******************************************************************************* + * Copyright (c) 2011, 2012 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.web.ui.tests.contentassist; + +import junit.extensions.TestSetup; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.wst.jsdt.web.ui.tests.internal.TestProjectSetup; + +public class InnerFunctionTests extends TestCase { + /** + * <p> + * This tests name + * </p> + */ + private static final String TEST_NAME = "Test Inner Functions JavaScript Content Assist"; + + /** + * <p> + * Test project setup for this test. + * </p> + */ + private static TestProjectSetup fTestProjectSetup; + + /** + * <p> + * Default constructor + * <p> + * <p> + * Use {@link #suite()} + * </p> + * + * @see #suite() + */ + public InnerFunctionTests() { + super(TEST_NAME); + } + + /** + * <p> + * Constructor that takes a test name. + * </p> + * <p> + * Use {@link #suite()} + * </p> + * + * @param name + * The name this test run should have. + * + * @see #suite() + */ + public InnerFunctionTests(String name) { + super(name); + } + + /** + * <p> + * Use this method to add these tests to a larger test suite so set up and tear down can be + * performed + * </p> + * + * @return a {@link TestSetup} that will run all of the tests in this class + * with set up and tear down. + */ + + public static Test suite() { + TestSuite ts = new TestSuite(InnerFunctionTests.class, TEST_NAME); + + fTestProjectSetup = new TestProjectSetup(ts, "JSDTWebContentAssist", "WebContent", false); + + return fTestProjectSetup; + } + + public void testFindInnerFunctions_EmptyLine() throws Exception { + String[][] expectedProposals = + new String[][] { { "funcTen(paramEleven, paramTwelve) - Global", "funcTenInner2 : Function - Global", + "funcTenInner2(param1, param2) - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "InnerFunctions.html", 6, 0, expectedProposals); + } + + public void testFindInnerFunctions_ExpressionStarted() throws Exception { + String[][] expectedProposals = + new String[][] { { "funcTen(paramEleven, paramTwelve) - Global", "funcTenInner2 : Function - Global", + "funcTenInner2(param1, param2) - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "InnerFunctions.html", 8, 5, expectedProposals); + } + + public void testFindInnerFunctions_CamelCase() throws Exception { + String[][] expectedProposals = + new String[][] { { "funcTen(paramEleven, paramTwelve) - Global", "funcTenInner2 : Function - Global", + "funcTenInner2(param1, param2) - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "InnerFunctions.html", 10, 2, expectedProposals); + } + + public void testFindInnerFunctions_EmptyLine_NegativeTest() throws Exception { + String[][] expectedProposals = + new String[][] { { "funcTenInner : Function - Global", "funcTenInner1 : Function - Global", + "funcTenInner(newParam111, newParam222) : String - Global", "funcTenInner1(param1) - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "InnerFunctions.html", 6, 0, expectedProposals, true, false); + } + + public void testFindInnerFunctions_ExpresionStarted_NegativeTest() throws Exception { + String[][] expectedProposals = + new String[][] { { "funcTenInner : Function - Global", "funcTenInner1 : Function - Global", + "funcTenInner(newParam111, newParam222) : String - Global", "funcTenInner1(param1) - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "InnerFunctions.html", 8, 5, expectedProposals, true, false); + } + + public void testFindDuplicateInnerFunctions_EmptyLine() throws Exception { + ContentAssistTestUtilities.verifyNoDuplicates(fTestProjectSetup, "InnerFunctions.html", 6, 0); + } + + public void testFindDuplicateInnerFunctions_ExpressionStarted() throws Exception { + ContentAssistTestUtilities.verifyNoDuplicates(fTestProjectSetup, "InnerFunctions.html", 8, 5); + } + + public void testFindDuplicateInnerFunctions_CamelCase() throws Exception { + ContentAssistTestUtilities.verifyNoDuplicates(fTestProjectSetup, "InnerFunctions.html", 10, 2); + } +} \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/InnerFunctionTests_Edited.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/InnerFunctionTests_Edited.java new file mode 100644 index 0000000..ccca9a5 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/InnerFunctionTests_Edited.java
@@ -0,0 +1,141 @@ +/******************************************************************************* + * Copyright (c) 2011, 2012 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.web.ui.tests.contentassist; + +import junit.extensions.TestSetup; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.wst.jsdt.web.ui.tests.internal.TestProjectSetup; + +public class InnerFunctionTests_Edited extends TestCase { + /** + * <p> + * This tests name + * </p> + */ + private static final String TEST_NAME = "Test Inner Functions JavaScript Content Assist after Edit"; + + /** + * <p> + * Test project setup for this test. + * </p> + */ + private static TestProjectSetup fTestProjectSetup; + + /** + * <p> + * Default constructor + * <p> + * <p> + * Use {@link #suite()} + * </p> + * + * @see #suite() + */ + public InnerFunctionTests_Edited() { + super(TEST_NAME); + } + + /** + * <p> + * Constructor that takes a test name. + * </p> + * <p> + * Use {@link #suite()} + * </p> + * + * @param name + * The name this test run should have. + * + * @see #suite() + */ + public InnerFunctionTests_Edited(String name) { + super(name); + } + + /** + * <p> + * Use this method to add these tests to a larger test suite so set up and tear down can be + * performed + * </p> + * + * @return a {@link TestSetup} that will run all of the tests in this class + * with set up and tear down. + */ + + public static Test suite() { + TestSuite ts = new TestSuite(InnerFunctionTests_Edited.class, TEST_NAME); + + fTestProjectSetup = new TestProjectSetup(ts, "JSDTWebContentAssist", "WebContent", false) { + + public void additionalSetUp() throws Exception { + this.editFile("InnerFunctions.js", 1, 22, 0, "Edit"); + this.editFile("InnerFunctions.js", 5, 17, 0, "Edit"); + this.editFile("InnerFunctions.js", 9, 13, 0, "Edit"); + } + }; + + return fTestProjectSetup; + } + + public void testFindInnerFunctions_le_EmptyLine() throws Exception { + String[][] expectedProposals = + new String[][] { { "funcTen(paramEleven, paramTwelve) - Global", + "funcTenInnerEdit2 : Function - Global", "funcTenInnerEdit2(param1, param2) - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "InnerFunctions.html", 6, 0, expectedProposals); + } + + public void testFindInnerFunctions_ExpressionStarted() throws Exception { + String[][] expectedProposals = + new String[][] { { "funcTen(paramEleven, paramTwelve) - Global", + "funcTenInnerEdit2 : Function - Global", "funcTenInnerEdit2(param1, param2) - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "InnerFunctions.html", 8, 5, expectedProposals); + } + + public void testFindInnerFunctions_CamelCase() throws Exception { + String[][] expectedProposals = + new String[][] { { "funcTen(paramEleven, paramTwelve) - Global", + "funcTenInnerEdit2 : Function - Global", "funcTenInnerEdit2(param1, param2) - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "InnerFunctions.html", 10, 2, expectedProposals); + } + + public void testFindInnerFunctions_EmptyLine_NegativeTest() throws Exception { + String[][] expectedProposals = + new String[][] { { "funcTenInnerEdit : Function - Global", "funcTenInnerEdit1 : Function - Global", + "funcTenInnerEdit(newParam111, newParam222) : String - Global", + "funcTenInnerEdit1(param1) - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "InnerFunctions.html", 6, 0, expectedProposals, true, false); + } + + public void testFindInnerFunctions_ExpresionStarted_NegativeTest() throws Exception { + String[][] expectedProposals = + new String[][] { { "funcTenInnerEdit : Function - Global", "funcTenInnerEdit1 : Function - Global", + "funcTenInnerEdit(newParam111, newParam222) : String - Global", + "funcTenInnerEdit1(param1) - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "InnerFunctions.html", 8, 5, expectedProposals, true, false); + } + + public void testFindDuplicateInnerFunctions_EmptyLine() throws Exception { + ContentAssistTestUtilities.verifyNoDuplicates(fTestProjectSetup, "InnerFunctions.html", 6, 0); + } + + public void testFindDuplicateInnerFunctions_ExpressionStarted() throws Exception { + ContentAssistTestUtilities.verifyNoDuplicates(fTestProjectSetup, "InnerFunctions.html", 8, 5); + } + + public void testFindDuplicateInnerFunctions_CamelCase() throws Exception { + ContentAssistTestUtilities.verifyNoDuplicates(fTestProjectSetup, "InnerFunctions.html", 10, 2); + } +} \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/LocalVarDefinedInFunctionInObjectLiteralTests.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/LocalVarDefinedInFunctionInObjectLiteralTests.java new file mode 100644 index 0000000..b345b9f --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/LocalVarDefinedInFunctionInObjectLiteralTests.java
@@ -0,0 +1,91 @@ +/******************************************************************************* + * Copyright (c) 2011, 2012 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.web.ui.tests.contentassist; + +import junit.extensions.TestSetup; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.wst.jsdt.web.ui.tests.internal.TestProjectSetup; + +public class LocalVarDefinedInFunctionInObjectLiteralTests extends TestCase { + /** + * <p> + * This tests name + * </p> + */ + private static final String TEST_NAME = "Test Local Variable Defined in Function in an Object Literal"; + + /** + * <p> + * Test project setup for this test. + * </p> + */ + private static TestProjectSetup fTestProjectSetup; + + /** + * <p> + * Default constructor + * <p> + * <p> + * Use {@link #suite()} + * </p> + * + * @see #suite() + */ + public LocalVarDefinedInFunctionInObjectLiteralTests() { + super(TEST_NAME); + } + + /** + * <p> + * Constructor that takes a test name. + * </p> + * <p> + * Use {@link #suite()} + * </p> + * + * @param name + * The name this test run should have. + * + * @see #suite() + */ + public LocalVarDefinedInFunctionInObjectLiteralTests(String name) { + super(name); + } + + /** + * <p> + * Use this method to add these tests to a larger test suite so set up and tear down can be + * performed + * </p> + * + * @return a {@link TestSetup} that will run all of the tests in this class + * with set up and tear down. + */ + + public static Test suite() { + TestSuite ts = new TestSuite(LocalVarDefinedInFunctionInObjectLiteralTests.class, TEST_NAME); + + fTestProjectSetup = new TestProjectSetup(ts, "JSDTWebContentAssist", "WebContent", false); + + return fTestProjectSetup; + } + + public void testLocalVarDefinedInFuncationInOBjectLiteral_NegativeTest() throws Exception { + String[][] unexpectedProposals = new String[][] { { "ninjaLocal : Number - Global", "ninjaLocal : Number" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "LocalVariableDefinedInFunctionInObjectLiteral.html", 0, 3, + unexpectedProposals, true, false); + } +} \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/OtherContentAssistTests.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/OtherContentAssistTests.java new file mode 100644 index 0000000..4c6e2cc --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/OtherContentAssistTests.java
@@ -0,0 +1,88 @@ +/******************************************************************************* + * Copyright (c) 2011, 2012 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.web.ui.tests.contentassist; + +import org.eclipse.wst.jsdt.web.ui.tests.internal.TestProjectSetup; + +import junit.extensions.TestSetup; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +public class OtherContentAssistTests extends TestCase { + /** + * <p> + * This tests name + * </p> + */ + private static final String TEST_NAME = "Test Other JavaScript Content Assist"; + + /** + * <p> + * Test project setup for this test. + * </p> + */ + private static TestProjectSetup fTestProjectSetup; + + /** + * <p> + * Default constructor + * <p> + * <p> + * Use {@link #suite()} + * </p> + * + * @see #suite() + */ + public OtherContentAssistTests() { + super(TEST_NAME); + } + + /** + * <p> + * Constructor that takes a test name. + * </p> + * <p> + * Use {@link #suite()} + * </p> + * + * @param name + * The name this test run should have. + * + * @see #suite() + */ + public OtherContentAssistTests(String name) { + super(name); + } + + /** + * <p> + * Use this method to add these tests to a larger test suite so set up and tear down can be + * performed + * </p> + * + * @return a {@link TestSetup} that will run all of the tests in this class + * with set up and tear down. + */ + public static Test suite() { + TestSuite ts = new TestSuite(OtherContentAssistTests.class, TEST_NAME); + + fTestProjectSetup = new TestProjectSetup(ts, "JSDTWebContentAssist", "WebContent", false); + + return fTestProjectSetup; + } + + public void testFindFunctionOnType_OtherFile_ExpressionStarted_0() throws Exception { + String[][] expectedProposals = new String[][] { { "myFunc1(Number param1) : Number - Crazy", "foo : String - Crazy" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "Crazy.html", 10, 4, expectedProposals); + } +} \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/ProposalInfoTest.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/ProposalInfoTest.java new file mode 100644 index 0000000..1efd142 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/ProposalInfoTest.java
@@ -0,0 +1,104 @@ +/******************************************************************************* + * Copyright (c) 2011, 2012 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.web.ui.tests.contentassist; + +import junit.extensions.TestSetup; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.wst.jsdt.web.ui.tests.internal.TestProjectSetup; + +public class ProposalInfoTest extends TestCase { + /** + * <p> + * This tests name + * </p> + */ + private static final String TEST_NAME = "Test JavaScript Content Assist Proposal Info"; + + /** + * <p> + * Test project setup for this test. + * </p> + */ + private static TestProjectSetup fTestProjectSetup; + + /** + * <p> + * Default constructor + * <p> + * <p> + * Use {@link #suite()} + * </p> + * + * @see #suite() + */ + public ProposalInfoTest() { + super(TEST_NAME); + } + + /** + * <p> + * Constructor that takes a test name. + * </p> + * <p> + * Use {@link #suite()} + * </p> + * + * @param name + * The name this test run should have. + * + * @see #suite() + */ + public ProposalInfoTest(String name) { + super(name); + } + + /** + * <p> + * Use this method to add these tests to a larger test suite so set up and tear down can be + * performed + * </p> + * + * @return a {@link TestSetup} that will run all of the tests in this class + * with set up and tear down. + */ + public static Test suite() { + TestSuite ts = new TestSuite(ProposalInfoTest.class, TEST_NAME); + + fTestProjectSetup = new TestProjectSetup(ts, "JSDTWebContentAssist", "WebContent", false); + + return fTestProjectSetup; + } + + public void testProposalInfo_Expression_NotStarted() throws Exception { + String[][] expectedProposals = + new String[][] { { "HelloWorld() - Global", "HelloAmerica(State, City) - Global" } }; + String[][] expectedInfo = new String[][] { { "Hello World", "State" } }; + ContentAssistTestUtilities.runProposalInfoTest(fTestProjectSetup, "ProposalInfo.html", 7, 0, expectedProposals, expectedInfo); + } + + public void testProposalInfo_ExpressionStarted_1() throws Exception { + String[][] expectedProposals = + new String[][] { { "HelloWorld() - Global", "HelloAmerica(State, City) - Global" } }; + String[][] expectedInfo = new String[][] { { "Hello World", "State" } }; + ContentAssistTestUtilities.runProposalInfoTest(fTestProjectSetup, "ProposalInfo.html", 9, 3, expectedProposals, expectedInfo); + } + + public void _testProposalInfo_ExpressionStarted_2() throws Exception { + String[][] expectedProposals = new String[][] { { "nodeOne : String - Global" } }; + String[][] expectedInfo = new String[][] { { "nodeOne = test" } }; + ContentAssistTestUtilities.runProposalInfoTest(fTestProjectSetup, "ProposalInfo.html", 11, 3, expectedProposals, expectedInfo); + } +} \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/ProposalInfoTest_Edited.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/ProposalInfoTest_Edited.java new file mode 100644 index 0000000..7074c29 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/ProposalInfoTest_Edited.java
@@ -0,0 +1,116 @@ +/******************************************************************************* + * Copyright (c) 2011, 2012 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.web.ui.tests.contentassist; + +import junit.extensions.TestSetup; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.wst.jsdt.web.ui.tests.internal.TestProjectSetup; + +public class ProposalInfoTest_Edited extends TestCase { + /** + * <p> + * This tests name + * </p> + */ + private static final String TEST_NAME = "Test Edited JavaScript Content Assist Proposal Info"; + + /** + * <p> + * Test project setup for this test. + * </p> + */ + private static TestProjectSetup fTestProjectSetup; + + /** + * <p> + * Default constructor + * <p> + * <p> + * Use {@link #suite()} + * </p> + * + * @see #suite() + */ + public ProposalInfoTest_Edited() { + super(TEST_NAME); + } + + /** + * <p> + * Constructor that takes a test name. + * </p> + * <p> + * Use {@link #suite()} + * </p> + * + * @param name + * The name this test run should have. + * + * @see #suite() + */ + public ProposalInfoTest_Edited(String name) { + super(name); + } + + /** + * <p> + * Use this method to add these tests to a larger test suite so set up and tear down can be + * performed + * </p> + * + * @return a {@link TestSetup} that will run all of the tests in this class + * with set up and tear down. + */ + public static Test suite() { + TestSuite ts = new TestSuite(ProposalInfoTest_Edited.class, TEST_NAME); + + fTestProjectSetup = new TestProjectSetup(ts, "JSDTWebContentAssist", "WebContent", false) { + + public void additionalSetUp() throws Exception { + /* File Edited : ProposalInfo.js + * World -> Earth + * State -> NC + * City -> Wake + * nodeOne = test -> nodeOne = Edit */ + this.editFile("ProposalInfo.js", 1, 9, 5, "Earth"); + this.editFile("ProposalInfo.js", 8, 10, 5, "NC"); + this.editFile("ProposalInfo.js", 18, 13, 4, "Edit"); + } + }; + + return fTestProjectSetup; + } + + public void testProposalInfo_AfterEdit_Expression_NotStarted() throws Exception { + String[][] expectedProposals = + new String[][] { { "HelloWorld() - Global", "HelloAmerica(State, City) - Global" } }; + String[][] expectedInfo = new String[][] { { "Hello Earth", "NC" } }; + ContentAssistTestUtilities.runProposalInfoTest(fTestProjectSetup, "ProposalInfo.html", 7, 0, expectedProposals, expectedInfo); + } + + public void testProposalInfo_AfterEdit_ExpressionStarted_1() throws Exception { + String[][] expectedProposals = + new String[][] { { "HelloWorld() - Global", "HelloAmerica(State, City) - Global" } }; + String[][] expectedInfo = new String[][] { { "Hello Earth", "Wake" } }; + ContentAssistTestUtilities.runProposalInfoTest(fTestProjectSetup, "ProposalInfo.html", 9, 3, expectedProposals, expectedInfo); + } + + public void _testProposalInfo_AfterEdit_ExpressionStarted_2() throws Exception { + String[][] expectedProposals = new String[][] { { "nodeOne : String - Global" } }; + String[][] expectedInfo = new String[][] { { "nodeOne = Edit" } }; + ContentAssistTestUtilities.runProposalInfoTest(fTestProjectSetup, "ProposalInfo.html", 11, 3, expectedProposals, expectedInfo); + } +} \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/SingleLineSriptTagTests.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/SingleLineSriptTagTests.java new file mode 100644 index 0000000..ef49b85 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/SingleLineSriptTagTests.java
@@ -0,0 +1,102 @@ +/******************************************************************************* + * Copyright (c) 2011, 2013 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.web.ui.tests.contentassist; + +import junit.extensions.TestSetup; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.wst.jsdt.web.ui.tests.internal.TestProjectSetup; + +public class SingleLineSriptTagTests extends TestCase { + /** + * <p> + * This tests name + * </p> + */ + private static final String TEST_NAME = "Test Single Line Script Tags Content Assist"; + + /** + * <p> + * Test project setup for this test. + * </p> + */ + private static TestProjectSetup fTestProjectSetup; + + /** + * <p> + * Default constructor + * <p> + * <p> + * Use {@link #suite()} + * </p> + * + * @see #suite() + */ + public SingleLineSriptTagTests() { + super(TEST_NAME); + } + + /** + * <p> + * Constructor that takes a test name. + * </p> + * <p> + * Use {@link #suite()} + * </p> + * + * @param name + * The name this test run should have. + * + * @see #suite() + */ + public SingleLineSriptTagTests(String name) { + super(name); + } + + /** + * <p> + * Use this method to add these tests to a larger test suite so set up and tear down can be + * performed + * </p> + * + * @return a {@link TestSetup} that will run all of the tests in this class + * with set up and tear down. + */ + public static Test suite() { + TestSuite ts = new TestSuite(SingleLineSriptTagTests.class, TEST_NAME); + + fTestProjectSetup = new TestProjectSetup(ts, "JSDTWebContentAssist", "WebContent", false); + + return fTestProjectSetup; + } + + public void testNoSpaceAtEnd() throws Exception { + String[][] expectedProposals = + new String[][] { { "Date(s) - Date"} }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "SingleLineScriptTag.html", 5, 44, expectedProposals); + } + + public void testSpaceAtEnd() throws Exception { + String[][] expectedProposals = + new String[][] { { "Date(s) - Date"} }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "SingleLineScriptTag.html", 6, 44, expectedProposals); + } + + public void testEmptyNoSpace() throws Exception { + String[][] expectedProposals = + new String[][] { { "alert(String message) - Window"} }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "SingleLineScriptTag.html", 7, 31, expectedProposals); + } +} \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/StaticTests.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/StaticTests.java new file mode 100644 index 0000000..cde3efc --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/StaticTests.java
@@ -0,0 +1,121 @@ +/******************************************************************************* + * Copyright (c) 2011, 2013 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.web.ui.tests.contentassist; + +import junit.extensions.TestSetup; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.wst.jsdt.web.ui.tests.internal.TestProjectSetup; + +public class StaticTests extends TestCase { + /** + * <p> + * This tests name + * </p> + */ + private static final String TEST_NAME = "Test Static vs Non Static JavaScript Content Assist"; + + /** + * <p> + * Test project setup for this test. + * </p> + */ + private static TestProjectSetup fTestProjectSetup; + + /** + * <p> + * Default constructor + * <p> + * <p> + * Use {@link #suite()} + * </p> + * + * @see #suite() + */ + public StaticTests() { + super(TEST_NAME); + } + + /** + * <p> + * Constructor that takes a test name. + * </p> + * <p> + * Use {@link #suite()} + * </p> + * + * @param name + * The name this test run should have. + * + * @see #suite() + */ + public StaticTests(String name) { + super(name); + } + + /** + * <p> + * Use this method to add these tests to a larger test suite so set up and tear down can be + * performed + * </p> + * + * @return a {@link TestSetup} that will run all of the tests in this class + * with set up and tear down. + */ + public static Test suite() { + TestSuite ts = new TestSuite(StaticTests.class, TEST_NAME); + + fTestProjectSetup = new TestProjectSetup(ts, "JSDTWebContentAssist", "WebContent", false); + + return fTestProjectSetup; + } + +// public void testCamelCase_ExpressionStarted_1() throws Exception { +// String[][] expectedProposals = new String[][] { { "getServerIP() : String - Server" } }; +// ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "StaticTests.html", 8, 11, expectedProposals); +// } + + public void testStatic_CamelCase_ExpressionStarted_2() throws Exception { + String[][] expectedProposals = new String[][] { { "yahooDotCom : Server - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "StaticTests.html", 10, 3, expectedProposals); + } + + public void testStatic_CamelCase_ExpressionStarted_3() throws Exception { + String[][] expectedProposals = new String[][] { { "clientIP : String - Server" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "StaticTests.html", 12, 15, expectedProposals); + } + +// public void testStatic__ExpressionStarted_4() throws Exception { +// String[][] expectedProposals = +// new String[][] { { "getClientPort() - Server", "getClientIP() : String - Server", +// "getServerIP() : String - Server" } }; +// ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "StaticTests.html", 14, 13, expectedProposals); +// } + + public void testStatic__ExpressionStarted_5() throws Exception { + String[][] expectedProposals = new String[][] { { "serverIP : String - Server" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "StaticTests.html", 16, 8, expectedProposals); + } + + public void testStatic_NegativeTest_ExpressionStarted_4() throws Exception { + String[][] expectedProposals = new String[][] { { "getServerIP() - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "StaticTests.html", 14, 13, expectedProposals, true, false); + } + + public void testStatic_NegativeTest_ExpressionStarted_5() throws Exception { + String[][] expectedProposals = + new String[][] { { "clientIP : String - Server", "getClientIP() - Global", "getClientPort() - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "StaticTests.html", 16, 8, expectedProposals, true, false); + } +} \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/StaticTests_Edited.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/StaticTests_Edited.java new file mode 100644 index 0000000..20d2536 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/StaticTests_Edited.java
@@ -0,0 +1,144 @@ +/******************************************************************************* + * Copyright (c) 2011, 2013 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.web.ui.tests.contentassist; + +import junit.extensions.TestSetup; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.wst.jsdt.web.ui.tests.internal.TestProjectSetup; + +public class StaticTests_Edited extends TestCase { + /** + * <p> + * This tests name + * </p> + */ + private static final String TEST_NAME = "Test Edited for Static vs Non Static JavaScript Content Assist"; + + /** + * <p> + * Test project setup for this test. + * </p> + */ + private static TestProjectSetup fTestProjectSetup; + + /** + * <p> + * Default constructor + * <p> + * <p> + * Use {@link #suite()} + * </p> + * + * @see #suite() + */ + public StaticTests_Edited() { + super(TEST_NAME); + } + + /** + * <p> + * Constructor that takes a test name. + * </p> + * <p> + * Use {@link #suite()} + * </p> + * + * @param name + * The name this test run should have. + * + * @see #suite() + */ + public StaticTests_Edited(String name) { + super(name); + } + + /** + * <p> + * Use this method to add these tests to a larger test suite so set up and tear down can be + * performed + * </p> + * + * @return a {@link TestSetup} that will run all of the tests in this class + * with set up and tear down. + */ + public static Test suite() { + TestSuite ts = new TestSuite(StaticTests_Edited.class, TEST_NAME); + + fTestProjectSetup = new TestProjectSetup(ts, "JSDTWebContentAssist", "WebContent", false) { + public void additionalSetUp() throws Exception { + /* file -> StaticTests.js + * getServerIP -> getRouterIP + * serverIP -> routerIP + * gSIP -> gRIP + * client -> switch + * Client -> Switch + * cIP -> sIP */ + this.editFile("StaticTests.js", 7, 10, 6, "Router"); + this.editFile("StaticTests.js", 10, 7, 8, "routerIP"); + this.editFile("StaticTests.js", 8, 15, 8, "routerIP"); + this.editFile("StaticTests.js", 28, 8, 1, "R"); + this.editFile("StaticTests.js", 14, 20, 6, "Switch"); + this.editFile("StaticTests.js", 17, 17, 8, "switchIP"); + this.editFile("StaticTests.js", 18, 20, 8, "SwitchIP"); + this.editFile("StaticTests.js", 19, 13, 8, "switchIP"); + this.editFile("StaticTests.js", 32, 12, 1, "s"); + + /* file -> StaticTests.html */ + this.editFile("StaticTests.html", 8, 8, 1, "R"); + this.editFile("StaticTests.html", 12, 12, 1, "s"); + } + }; + + return fTestProjectSetup; + } + +// public void testStatic_CamelCase_AfterEdit_ExpressionStarted_1() throws Exception { +// String[][] expectedProposals = new String[][] { { "getRouterIP() : String - Server" } }; +// ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "StaticTests.html", 8, 11, expectedProposals); +// } + + public void testStatic_CamelCase_AfterEdit_ExpressionStarted_2() throws Exception { + String[][] expectedProposals = new String[][] { { "yahooDotCom : Server - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "StaticTests.html", 10, 3, expectedProposals); + } + + public void testStatic_CamelCase_AfterEdit_ExpressionStarted_3() throws Exception { + String[][] expectedProposals = new String[][] { { "switchIP : String - Server" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "StaticTests.html", 12, 15, expectedProposals); + } + + public void testStatic_OtherFile_ExpressionStarted_4() throws Exception { + String[][] expectedProposals = + new String[][] { { "switchIP : String - Server", "port - Server", "prototype - Server", + "getSwitchIP() : String - Server", "getSwitchPort() - Server" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "StaticTests.html", 14, 12, expectedProposals); + } + +// public void testStatic_AfterEdit_ExpressionStarted_5() throws Exception { +// String[][] expectedProposals = new String[][] { { "routerIP : String - Server", "getRouterIP() : String - Server" } }; +// ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "StaticTests.html", 16, 7, expectedProposals); +// } + + public void testStatic_NegativeTest_AfterEdit_ExpressionStarted_4() throws Exception { + String[][] expectedProposals = new String[][] { { "getRouterIP() - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "StaticTests.html", 14, 12, expectedProposals, true, false); + } + + public void testStatic_NegativeTest_AfterEdit_ExpressionStarted_5() throws Exception { + String[][] expectedProposals = + new String[][] { { "switchIP : String - Server", "getSwitchIP() - Global", "getSwitchPort() - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "StaticTests.html", 16, 7, expectedProposals, true, false); + } +} \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/TemplateTests.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/TemplateTests.java new file mode 100644 index 0000000..8eab928 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/TemplateTests.java
@@ -0,0 +1,90 @@ +/******************************************************************************* + * Copyright (c) 2011, 2012 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.web.ui.tests.contentassist; + +import junit.extensions.TestSetup; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.wst.jsdt.web.ui.tests.internal.TestProjectSetup; + +public class TemplateTests extends TestCase { + /** + * <p> + * This tests name + * </p> + */ + private static final String TEST_NAME = "Test JavaScript Temlate Content Assist"; + + /** + * <p> + * Test project setup for this test. + * </p> + */ + private static TestProjectSetup fTestProjectSetup; + + /** + * <p> + * Default constructor + * <p> + * <p> + * Use {@link #suite()} + * </p> + * + * @see #suite() + */ + public TemplateTests() { + super(TEST_NAME); + } + + /** + * <p> + * Constructor that takes a test name. + * </p> + * <p> + * Use {@link #suite()} + * </p> + * + * @param name + * The name this test run should have. + * + * @see #suite() + */ + public TemplateTests(String name) { + super(name); + } + + /** + * <p> + * Use this method to add these tests to a larger test suite so set up and tear down can be + * performed + * </p> + * + * @return a {@link TestSetup} that will run all of the tests in this class + * with set up and tear down. + */ + public static Test suite() { + TestSuite ts = new TestSuite(TemplateTests.class, TEST_NAME); + + fTestProjectSetup = new TestProjectSetup(ts, "JSDTWebContentAssist", "WebContent", false); + + return fTestProjectSetup; + } + + public void testCamelCase_ExpressionStarted_0() throws Exception { + String[][] expectedProposals = + new String[][] { { "function - function"} }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "Template.html", 5, 35, expectedProposals); + } +} \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/TypeTests.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/TypeTests.java new file mode 100644 index 0000000..0d63256 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/TypeTests.java
@@ -0,0 +1,115 @@ +/******************************************************************************* + * Copyright (c) 2011, 2012 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.web.ui.tests.contentassist; + +import junit.extensions.TestSetup; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.wst.jsdt.web.ui.tests.internal.TestProjectSetup; + +public class TypeTests extends TestCase { + /** + * <p> + * This tests name + * </p> + */ + private static final String TEST_NAME = "Test JavaScript Type Content Assist"; + + /** + * <p> + * Test project setup for this test. + * </p> + */ + private static TestProjectSetup fTestProjectSetup; + + /** + * <p> + * Default constructor + * <p> + * <p> + * Use {@link #suite()} + * </p> + * + * @see #suite() + */ + public TypeTests() { + super(TEST_NAME); + } + + /** + * <p> + * Constructor that takes a test name. + * </p> + * <p> + * Use {@link #suite()} + * </p> + * + * @param name + * The name this test run should have. + * + * @see #suite() + */ + public TypeTests(String name) { + super(name); + } + + /** + * <p> + * Use this method to add these tests to a larger test suite so set up and tear down can be + * performed + * </p> + * + * @return a {@link TestSetup} that will run all of the tests in this class + * with set up and tear down. + */ + public static Test suite() { + TestSuite ts = new TestSuite(TypeTests.class, TEST_NAME); + + fTestProjectSetup = new TestProjectSetup(ts, "JSDTWebContentAssist", "WebContent", false); + + return fTestProjectSetup; + } + + public void testCamelCase_ExpressionStarted_0() throws Exception { + String[][] expectedProposals = + new String[][] { { "Computer.proc.IntelDualCore1 - Computer.proc", + "Computer.proc.IntelDualCore2 - Computer.proc" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "JSClassesII.html", 8, 2, expectedProposals); + } + + public void testCamelCase_ExpressionStarted_1() throws Exception { + String[][] expectedProposals = + new String[][] { { "Computer.proc.CeleronXSeries - Computer.proc", + "Installed.CorelXSoftware - Installed" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "JSClassesII.html", 10, 2, expectedProposals); + } + + public void testCamelCase_ExpressionStarted_2() throws Exception { + String[][] expectedProposals = + new String[][] { { "Computer.proc.IntelDualCore1 - Computer.proc", + "Computer.proc.IntelDualCore2 - Computer.proc" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "JSClassesII.html", 12, 3, expectedProposals); + } + + public void testClassProperties_ExpressionStarted_3() throws Exception { + String[][] expectedProposals = new String[][] { { "Computer : {} - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "JSClassesII.html", 14, 4, expectedProposals); + } + + public void testClassProperties_ExpressionStarted_4() throws Exception { + String[][] expectedProposals = new String[][] { { "Installed : {} - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "JSClassesII.html", 16, 3, expectedProposals); + } +} \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/TypeTests_Edited.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/TypeTests_Edited.java new file mode 100644 index 0000000..22cbd91 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/contentassist/TypeTests_Edited.java
@@ -0,0 +1,136 @@ +/******************************************************************************* + * Copyright (c) 2011, 2012 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.web.ui.tests.contentassist; + +import junit.extensions.TestSetup; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.wst.jsdt.web.ui.tests.internal.TestProjectSetup; + +public class TypeTests_Edited extends TestCase { + /** + * <p> + * This tests name + * </p> + */ + private static final String TEST_NAME = "Test Edited JavaScript Type Content Asist Edited"; + + /** + * <p> + * Test project setup for this test. + * </p> + */ + private static TestProjectSetup fTestProjectSetup; + + /** + * <p> + * Default constructor + * <p> + * <p> + * Use {@link #suite()} + * </p> + * + * @see #suite() + */ + public TypeTests_Edited() { + super(TEST_NAME); + } + + /** + * <p> + * Constructor that takes a test name. + * </p> + * <p> + * Use {@link #suite()} + * </p> + * + * @param name + * The name this test run should have. + * + * @see #suite() + */ + public TypeTests_Edited(String name) { + super(name); + } + + /** + * <p> + * Use this method to add these tests to a larger test suite so set up and tear down can be + * performed + * </p> + * + * @return a {@link TestSetup} that will run all of the tests in this class + * with set up and tear down. + */ + public static Test suite() { + TestSuite ts = new TestSuite(TypeTests_Edited.class, TEST_NAME); + + fTestProjectSetup = new TestProjectSetup(ts, "JSDTWebContentAssist", "WebContent", false) { + /** + * @see org.eclipse.wst.jsdt.ui.tests.contentassist.ContentAssistTestUtilities.ContentAssistTestsSetup#additionalSetUp() + */ + public void additionalSetUp() throws Exception { + /* file -> JSClassesII.js + * IntelQuadCore -> IntelCentrino + * IntelDualCore -> IntelXeonProc + * Installed -> Developed */ + this.editFile("JSClassesII.js", 15, 19, 8, "Centrino"); + this.editFile("JSClassesII.js", 9, 19, 8, "XeonProc"); + this.editFile("JSClassesII.js", 12, 19, 8, "XeonProc"); + this.editFile("JSClassesII.js", 7, 4, 9, "Developed"); + this.editFile("JSClassesII.js", 22, 0, 9, "Developed"); + this.editFile("JSClassesII.js", 27, 1, 1, "X"); + this.editFile("JSClassesII.js", 31, 1, 2, "XP"); + this.editFile("JSClassesII.html", 8, 1, 1, "X"); + this.editFile("JSClassesII.js", 35, 0, 3, "Dev"); + this.editFile("JSClassesII.html", 12, 1, 2, "XP"); + this.editFile("JSClassesII.html", 16, 0, 3, "Dev"); + } + }; + + return fTestProjectSetup; + } + + public void testCameCasing_ExpressionStarted_0() throws Exception { + String[][] expectedProposals = + new String[][] { { "Computer.proc.IntelXeonProc1 - Computer.proc", + "Computer.proc.IntelXeonProc2 - Computer.proc" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "JSClassesII.html", 8, 2, expectedProposals); + } + + public void testCamelCasing_ExpressionStarted_1() throws Exception { + String[][] expectedProposals = + new String[][] { { "Computer.proc.CeleronXSeries - Computer.proc", + "Developed.CorelXSoftware - Developed" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "JSClassesII.html", 10, 2, expectedProposals); + } + + public void testCamelCasing_ExpressionStarted_2() throws Exception { + String[][] expectedProposals = + new String[][] { { "Computer.proc.IntelXeonProc1 - Computer.proc", + "Computer.proc.IntelXeonProc2 - Computer.proc" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "JSClassesII.html", 12, 3, expectedProposals); + } + + public void testClassProperties_AfterEdit_ExpressionStarted_3() throws Exception { + String[][] expectedProposals = new String[][] { { "Computer : {} - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "JSClassesII.html", 14, 4, expectedProposals); + } + + public void testClassProperties_AfterEdit_ExpressionStarted_4() throws Exception { + String[][] expectedProposals = new String[][] { { "Developed : {} - Global" } }; + ContentAssistTestUtilities.runProposalTest(fTestProjectSetup, "JSClassesII.html", 16, 3, expectedProposals); + } +} \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/conversion/IncludePathTests.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/conversion/IncludePathTests.java deleted file mode 100644 index c08a661..0000000 --- a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/conversion/IncludePathTests.java +++ /dev/null
@@ -1,129 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2012 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.web.ui.tests.conversion; - -import junit.framework.TestCase; - -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.IPath; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.wst.jsdt.core.IIncludePathEntry; -import org.eclipse.wst.jsdt.core.JavaScriptCore; -import org.eclipse.wst.jsdt.core.JavaScriptModelException; -import org.eclipse.wst.jsdt.internal.ui.util.ConvertAction; - -public class IncludePathTests extends TestCase { - private static IProject createSimpleProject(String name, IPath location, String[] natureIds) { - IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(name); - if (location != null) { - description.setLocation(location); - } - if (natureIds != null) { - description.setNatureIds(natureIds); - } - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name); - try { - project.create(description, new NullProgressMonitor()); - project.open(new NullProgressMonitor()); - } - catch (CoreException e) { - e.printStackTrace(); - } - return project; - } - - private static final ISelection selectionFor(IProject p) { - return new StructuredSelection(new IProject[]{p, ResourcesPlugin.getWorkspace().getRoot().getProject("IncludePathTests")}); - } - - public IncludePathTests() { - this("WEb project Include Path manipulation tests"); - } - - public IncludePathTests(String name) { - super(name); - } - - private void assertConvertedIncludePath(IProject p, String expected) throws JavaScriptModelException { - ConvertAction convertor = new ConvertAction(); - convertor.selectionChanged(null, selectionFor(p)); - convertor.run(null); - - assertIncludePath(p, expected); - } - - private void assertIncludePath(IProject p, String expected) throws JavaScriptModelException { - IIncludePathEntry[] rawIncludepath = JavaScriptCore.create(p).getRawIncludepath(); - StringBuffer b = new StringBuffer(); - for (int i = 0; i < rawIncludepath.length; i++) { - b.append(rawIncludepath[i].toString()); - b.append('\n'); - } - assertEquals("Unexpected Include Path entries", expected, b.toString()); - } - -// public void testAddingModuleCoreToProject() throws CoreException { -// } -// -// public void testAddingWebFacetToJSProject() throws CoreException { -// } -// -// public void testAddingWebFacetToNonJSProject() throws CoreException { -// } -// -// public void testBrowserSuperTypeJSProject() throws CoreException { -// } -// -// public void testConvertModuleCoreProject() throws CoreException { -// } - - public void testConvertSimpleProject() throws CoreException { - IProject p = createSimpleProject(getName(), null, null); - assertConvertedIncludePath(p, "/testConvertSimpleProject[CPE_SOURCE][K_SOURCE][isExported:false][attributes:provider=org.eclipse.wst.jsdt.web.core.internal.project.ModuleSourcePathProvider]\norg.eclipse.wst.jsdt.launching.JRE_CONTAINER[CPE_CONTAINER][K_SOURCE][isExported:false]\norg.eclipse.wst.jsdt.launching.baseBrowserLibrary[CPE_CONTAINER][K_SOURCE][isExported:false]\n"); - // clean up if we got to the end - try { - p.delete(true, true, null); - } - catch (Exception e) { - // not a failure condition - } - } - - public void testConvertDefaultJSProject() throws CoreException { - IProject p = createSimpleProject(getName(), null, new String[]{JavaScriptCore.NATURE_ID}); - assertConvertedIncludePath(p, "org.eclipse.wst.jsdt.launching.JRE_CONTAINER[CPE_CONTAINER][K_SOURCE][isExported:false]\norg.eclipse.wst.jsdt.launching.baseBrowserLibrary[CPE_CONTAINER][K_SOURCE][isExported:false]\n/testConvertDefaultJSProject[CPE_SOURCE][K_SOURCE][isExported:false]\n"); - // clean up if we got to the end - try { - p.delete(true, true, null); - } - catch (Exception e) { - // not a failure condition - } - } - - public void testVerifyDefaultIncludePath() throws CoreException { - IProject p = createSimpleProject(getName(), null, new String[]{JavaScriptCore.NATURE_ID}); - assertIncludePath(p, "org.eclipse.wst.jsdt.launching.JRE_CONTAINER[CPE_CONTAINER][K_SOURCE][isExported:false]\norg.eclipse.wst.jsdt.launching.baseBrowserLibrary[CPE_CONTAINER][K_SOURCE][isExported:false]\n/testVerifyDefaultIncludePath[CPE_SOURCE][K_SOURCE][isExported:false]\n"); - // clean up if we got to the end - try { - p.delete(true, true, null); - } - catch (Exception e) { - // not a failure condition - } - } -}
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/format/FormattingTests.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/format/FormattingTests.java index d0f40e3..d976dc2 100644 --- a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/format/FormattingTests.java +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/format/FormattingTests.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2012 IBM Corporation and others. + * Copyright (c) 2010, 2013 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 @@ -183,6 +183,10 @@ formatAndAssertEquals("test19.html", "test19-fmt.html", new StructuredTextViewerConfigurationJSDT()); } + public void testBug377979() throws UnsupportedEncodingException, IOException, CoreException { + formatAndAssertEquals("test20.jsp", "test20-fmt.jsp", new StructuredTextViewerConfigurationJSDT()); + } + /** * @param beforePath - the path of the before file * @param afterPath - the path of the after file, <b>must not be the same as the before file</b> @@ -396,12 +400,18 @@ * @see junit.extensions.TestSetup#tearDown() */ public void tearDown() throws Exception { - //delete test projects - fProject.delete(true, new NullProgressMonitor()); - - //reset non-interactive - if (previousWTPAutoTestNonInteractivePropValue != null) { - System.setProperty(WTP_AUTOTEST_NONINTERACTIVE, previousWTPAutoTestNonInteractivePropValue); + try { + // delete test projects + fProject.delete(true, new NullProgressMonitor()); + } + catch (CoreException e) { + // problems deleting aren't a failure + } + finally { + // reset non-interactive + if (previousWTPAutoTestNonInteractivePropValue != null) { + System.setProperty(WTP_AUTOTEST_NONINTERACTIVE, previousWTPAutoTestNonInteractivePropValue); + } } } }
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/format/TestJSPContentFormatter.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/format/TestJSPContentFormatter.java new file mode 100644 index 0000000..4837186 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/format/TestJSPContentFormatter.java
@@ -0,0 +1,247 @@ +/******************************************************************************* + * Copyright (c) 2007, 2012 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.web.ui.tests.format; + +import java.io.ByteArrayOutputStream; +import java.io.CharArrayWriter; +import java.io.IOException; +import java.io.UnsupportedEncodingException; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Preferences; +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.Region; +import org.eclipse.jface.text.formatter.FormattingContext; +import org.eclipse.jface.text.formatter.FormattingContextProperties; +import org.eclipse.jface.text.formatter.IContentFormatterExtension; +import org.eclipse.jface.text.formatter.IFormattingContext; +import org.eclipse.jface.text.source.SourceViewerConfiguration; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.ide.IDE; +import org.eclipse.wst.html.core.internal.HTMLCorePlugin; +import org.eclipse.wst.html.core.internal.preferences.HTMLCorePreferenceNames; +import org.eclipse.wst.jsdt.core.JavaScriptCore; +import org.eclipse.wst.jsdt.web.ui.tests.internal.ProjectUtil; +import org.eclipse.wst.sse.core.StructuredModelManager; +import org.eclipse.wst.sse.core.internal.provisional.IModelManager; +import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; +import org.eclipse.wst.sse.core.utils.StringUtils; +import org.eclipse.wst.sse.ui.StructuredTextEditor; +import org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder; +import org.eclipse.wst.sse.ui.internal.StructuredTextViewer; + +/** + * Taken from org.eclipse.jst.jsp.ui.tests.format.TestContentFormatter + */ +public class TestJSPContentFormatter extends TestCase { + String wtp_autotest_noninteractive = null; + private static final String PROJECT_NAME = "jsdtjspformatting"; + private static final String UTF_8 = "UTF-8"; + + private IFormattingContext fContext; + public static Test suite() { + TestSuite ts = new TestSuite(TestJSPContentFormatter.class); + return ts; + } + + protected void setUp() throws Exception { + super.setUp(); + + String noninteractive = System.getProperty("wtp.autotest.noninteractive"); + if (noninteractive != null) + wtp_autotest_noninteractive = noninteractive; + System.setProperty("wtp.autotest.noninteractive", "true"); + + if (!ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME).exists()) { + ProjectUtil.createProject(PROJECT_NAME, null, new String[]{JavaScriptCore.NATURE_ID}); + ProjectUtil.copyBundleEntriesIntoWorkspace("/testFiles/" + PROJECT_NAME, "/" + PROJECT_NAME); + } + assertTrue("project could not be created", ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME).exists()); + + fContext = new FormattingContext(); + fContext.setProperty(FormattingContextProperties.CONTEXT_DOCUMENT, Boolean.valueOf(true)); + } + + private void formatAndAssertEquals(String beforePath, String afterPath, boolean resetPreferences) throws UnsupportedEncodingException, IOException, CoreException { + IStructuredModel beforeModel = null, afterModel = null; + try { + beforeModel = getModelForEdit(beforePath); + assertNotNull("could not retrieve structured model for : " + beforePath, beforeModel); + + afterModel = getModelForEdit(afterPath); + assertNotNull("could not retrieve structured model for : " + afterPath, afterModel); + + if (resetPreferences) { + resetPreferencesToDefault(); + } + + SourceViewerConfiguration configuration = (SourceViewerConfiguration) ExtendedConfigurationBuilder.getInstance().getConfiguration(ExtendedConfigurationBuilder.SOURCEVIEWERCONFIGURATION, "org.eclipse.jst.jsp.core.jspsource"); + IContentFormatterExtension formatter = (IContentFormatterExtension) configuration.getContentFormatter(null); + + IDocument document = beforeModel.getStructuredDocument(); + Region region = new Region(0, document.getLength()); + fContext.setProperty(FormattingContextProperties.CONTEXT_REGION, region); + formatter.format(document, fContext); + + ByteArrayOutputStream formattedBytes = new ByteArrayOutputStream(); + beforeModel.save(formattedBytes); // "beforeModel" should now be + // after the formatter + + ByteArrayOutputStream afterBytes = new ByteArrayOutputStream(); + afterModel.save(afterBytes); + + String expectedContents = new String(afterBytes.toByteArray(), UTF_8); + expectedContents = StringUtils.replace(expectedContents, "\r\n", "\r"); + expectedContents = StringUtils.replace(expectedContents, "\r", "\n"); + + String actualContents = new String(formattedBytes.toByteArray(), UTF_8); + actualContents = StringUtils.replace(actualContents, "\r\n", "\r"); + actualContents = StringUtils.replace(actualContents, "\r", "\n"); + + assertTrue(onlyWhiteSpaceDiffers(expectedContents, actualContents)); + assertEquals("Formatted document differs from the expected.", expectedContents, actualContents); + } + finally { + if (beforeModel != null) + beforeModel.releaseFromEdit(); + if (afterModel != null) + afterModel.releaseFromEdit(); + } + } + + private void formatAndAssertSignificantEquals(String beforePath, boolean resetPreferences) throws UnsupportedEncodingException, IOException, CoreException { + StructuredTextEditor editor = (StructuredTextEditor) IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(beforePath)), "org.eclipse.jst.jsp.core.jspsource.source", true); + try { + String before = editor.getDocumentProvider().getDocument(editor.getEditorInput()).get(); + editor.getTextViewer().doOperation(StructuredTextViewer.FORMAT_DOCUMENT); + + String after = editor.getDocumentProvider().getDocument(editor.getEditorInput()).get(); + assertTrue(onlyWhiteSpaceDiffers(before, after)); + } + finally { + editor.close(false); + } + } + + /** + * must release model (from edit) after + * + * @param filename + * relative to this class (TestFormatProcessorCSS) + */ + private IStructuredModel getModelForEdit(final String filename) { + IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(filename)); + assertTrue("unable to find file: " + filename, file.exists()); + + IStructuredModel model = null; + try { + IModelManager modelManager = StructuredModelManager.getModelManager(); + model = modelManager.getModelForEdit(file); + } + catch (CoreException ce) { + ce.printStackTrace(); + } + catch (IOException io) { + io.printStackTrace(); + } + return model; + } + + /** + * Useful for making sure all significant content was retained. + * + * @param expectedContents + * @param actualContents + * @return + */ + private boolean onlyWhiteSpaceDiffers(String expectedContents, String actualContents) { + CharArrayWriter writer1 = new CharArrayWriter(); + char[] expected = expectedContents.toCharArray(); + for (int i = 0; i < expected.length; i++) { + if (!Character.isWhitespace(expected[i])) + writer1.write(expected[i]); + } + + CharArrayWriter writer2 = new CharArrayWriter(); + char[] actual = actualContents.toCharArray(); + for (int i = 0; i < actual.length; i++) { + if (!Character.isWhitespace(actual[i])) + writer2.write(actual[i]); + } + writer1.close(); + writer2.close(); + + char[] expectedCompacted = writer1.toCharArray(); + char[] actualCompacted = writer2.toCharArray(); + assertEquals("significant character differs", new String(expectedCompacted), new String(actualCompacted)); + + return true; + } + private void resetPreferencesToDefault() { + Preferences preferences = HTMLCorePlugin.getDefault().getPluginPreferences(); + preferences.setToDefault(HTMLCorePreferenceNames.SPLIT_MULTI_ATTRS); + preferences.setToDefault(HTMLCorePreferenceNames.LINE_WIDTH); + preferences.setToDefault(HTMLCorePreferenceNames.INDENTATION_CHAR); + preferences.setToDefault(HTMLCorePreferenceNames.INDENTATION_SIZE); + preferences.setToDefault(HTMLCorePreferenceNames.CLEAR_ALL_BLANK_LINES); + } + + public void testFormatBug102495() throws UnsupportedEncodingException, IOException, CoreException { + String beforePath = "/" + PROJECT_NAME + "/WebContent/formatbug102495.jsp"; + String afterPath = "/" + PROJECT_NAME + "/WebContent/formatbug102495-fmt.jsp"; + formatAndAssertEquals(beforePath, afterPath, true); + } + + public void testFormatBug102495_1() throws UnsupportedEncodingException, IOException, CoreException { + String beforePath = "/" + PROJECT_NAME + "/WebContent/formatbug102495_1.jsp"; + String afterPath = "/" + PROJECT_NAME + "/WebContent/formatbug102495_1-fmt.jsp"; + formatAndAssertEquals(beforePath, afterPath, true); + } + + public void testFormatBug102495_2() throws UnsupportedEncodingException, IOException, CoreException { + String beforePath = "/" + PROJECT_NAME + "/WebContent/formatbug102495_2.jsp"; + String afterPath = "/" + PROJECT_NAME + "/WebContent/formatbug102495_2-fmt.jsp"; + formatAndAssertEquals(beforePath, afterPath, true); + } + + public void testFormatBug102495_3() throws UnsupportedEncodingException, IOException, CoreException { + String beforePath = "/" + PROJECT_NAME + "/WebContent/formatbug102495_3.jsp"; + String afterPath = "/" + PROJECT_NAME + "/WebContent/formatbug102495_3-fmt.jsp"; + formatAndAssertEquals(beforePath, afterPath, true); + } + + public void testFormatBug102495_4() throws UnsupportedEncodingException, IOException, CoreException { + String beforePath = "/" + PROJECT_NAME + "/WebContent/formatbug102495_4.jsp"; + String afterPath = "/" + PROJECT_NAME + "/WebContent/formatbug102495_4-fmt.jsp"; + formatAndAssertEquals(beforePath, afterPath, true); + } + + public void testFormatBug358545a() throws UnsupportedEncodingException, IOException, CoreException { + formatAndAssertSignificantEquals("/" + PROJECT_NAME + "/WebContent/formatbug358545.jsp", true); + } + + public void testFormatBug358545b() throws UnsupportedEncodingException, IOException, CoreException { + formatAndAssertSignificantEquals("/" + PROJECT_NAME + "/WebContent/formatbug358545b.jsp", true); + } + public void testFormatBug384126() throws UnsupportedEncodingException, IOException, CoreException { + formatAndAssertSignificantEquals("/" + PROJECT_NAME + "/WebContent/formatBug384126.jsp", true); + } + public void testFormatBug383387() throws UnsupportedEncodingException, IOException, CoreException { + formatAndAssertSignificantEquals("/" + PROJECT_NAME + "/WebContent/formatBug383387.jsp", true); + } +}
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/internal/TestProjectSetup.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/internal/TestProjectSetup.java new file mode 100644 index 0000000..c2e9fb6 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/internal/TestProjectSetup.java
@@ -0,0 +1,355 @@ +/******************************************************************************* + * Copyright (c) 2012 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.web.ui.tests.internal; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import junit.extensions.TestSetup; +import junit.framework.Assert; +import junit.framework.Test; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.jface.text.IDocument; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.ide.IDE; +import org.eclipse.ui.texteditor.AbstractTextEditor; +import org.eclipse.ui.texteditor.ITextEditor; +import org.eclipse.wst.jsdt.internal.core.JavaModelManager; +import org.eclipse.wst.jsdt.internal.core.search.indexing.IndexManager; + + +/** + * <p>Sets up a test project.</p> + * + * @see org.eclipse.wst.jsdt.ui.tests.utils + * @see org.eclipse.wst.jsdt.web.ui.tests.internal + */ +public class TestProjectSetup extends TestSetup { + /** preference for ignoring WTP UI */ + private static final String WTP_AUTOTEST_NONINTERACTIVE = "wtp.autotest.noninteractive"; + + /** The location of the testing files */ + private static final String TESTING_RESOURCES_DIR = "testFiles"; + + /** previous value for hiding WTP UI */ + private String fPreviousWTPAutoTestNonInteractivePropValue = null; + + /** Name of the project the tests use */ + private final String fProjectName; + + /** The project that the tests use */ + private IProject fProject; + + /** The root directory to start with when looking for files */ + private final String fRootDirictory; + + /** + * <p> + * <code>true</code> if should delete project on tear down, + * <code>false</code> to leave it for other tests to use. + * </p> + */ + private final boolean fDeleteOnTearDown; + + /** + * Used to keep track of the already open editors so that the tests don't go through + * the trouble of opening the same editors over and over again + */ + private Map fFileToEditorMap = new HashMap(); + + /** + * <p> + * <b>NOTE:</b> will not delete the project on tear down so other tests can use it. + * </p> + * + * @param test + * do setup for the given test + * @param projectName + * name of the project to set up + * @param rootDirectory + * path to the root directory to look for all files under, or <code>null</code> if + * look directly under project root + */ + public TestProjectSetup(Test test, String projectName, String rootDirectory) { + super(test); + + this.fProjectName = projectName; + this.fRootDirictory = rootDirectory; + this.fDeleteOnTearDown = false; + } + + /** + * @param test + * do setup for the given test + * @param projectName + * name of the project to set up + * @param rootDirectory + * path to the root directory to look for all files under, or <code>null</code> if + * look directly under project root + * @param deleteOnTearDown + * <code>true</code> if should delete project on tear down, <code>false</code> to + * leave it for other tests to use. + */ + public TestProjectSetup(Test test, String projectName, String rootDirectory, boolean deleteOnTearDown) { + super(test); + + this.fProjectName = projectName; + this.fRootDirictory = rootDirectory; + this.fDeleteOnTearDown = deleteOnTearDown; + } + + /** + * @return {@link IProject} that was setup + */ + public IProject getProject() { + return this.fProject; + } + + /** + * <p> + * Given a <code>file</code> get an editor for it. If an editor has already been retrieved for + * the given <code>file</code> then return the same already open editor. + * </p> + * + * <p> + * When opening the editor it will also standardized the line endings to <code>\n</code> + * </p> + * + * @param file + * open and return an editor for this + * @return <code>StructuredTextEditor</code> opened from the given <code>file</code> + */ + public AbstractTextEditor getEditor(IFile file) { + AbstractTextEditor editor = (AbstractTextEditor) fFileToEditorMap.get(file); + + if(editor == null) { + try { + IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + IWorkbenchPage page = workbenchWindow.getActivePage(); + IEditorPart editorPart = null; + if(file.getFileExtension().equals("js")) { + editorPart = IDE.openEditor(page, file, true, true); + } else if(file.getFileExtension().equals("html")) { + editorPart = IDE.openEditor(page, file, "org.eclipse.wst.html.core.htmlsource.source", true); + } + + if(editorPart instanceof AbstractTextEditor) { + editor = (AbstractTextEditor) editorPart; + } else { + Assert.fail("Unable to open structured text editor"); + } + + if(editor != null) { + standardizeLineEndings(editor); + fFileToEditorMap.put(file, editor); + } else { + Assert.fail("Could not open editor for " + file); + } + } catch(Exception e) { + Assert.fail("Could not open editor for " + file + " exception: " + e.getMessage()); + } + } + + return editor; + } + + /** + * <p> + * Given a file path in the test project attempts to get an <code>IFile</code> for it, if the + * file doesn't exist the test fails. + * </p> + * + * @param path + * the name of the file to get + * + * @return the {@link IFile} associated with the given file path + */ + public IFile getFile(String path) { + IFile file = null; + + if(this.fRootDirictory != null) { + file = this.fProject.getFile(this.fRootDirictory + IPath.SEPARATOR + path); + } else { + file = this.fProject.getFile(path); + } + + Assert.assertTrue("Test file " + file + " can not be found", file.exists()); + + return file; + } + + /** + * <p> + * Edits the file given by the fileName. The number of characters indicated by length are + * replaced by the given text beginning at the character located at the given line number and + * the line character offset. + * </p> + * + * @param fileName + * @param lineNum + * @param lineRelativeCharOffset + * @param length + * @param text + * @throws Exception + */ + public void editFile(String fileName, int lineNum, int lineRelativeCharOffset, int length, String text) + throws Exception { + + IFile file = this.getFile(fileName); + AbstractTextEditor editor = this.getEditor(file); + IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput()); + + int offset = doc.getLineOffset(lineNum) + lineRelativeCharOffset; + doc.replace(offset, length, text); + + waitForIndexManager(); + } + + /** + * <p> + * This is run Once while the test is being setUp for all the tests. + * </p> + * <p> + * Designed to be overridden by content assist test suite Implementers to do additional test + * setup. + * </p> + * + */ + public void additionalSetUp() throws Exception { + // default do nothing + } + + /** + * <p> + * This is run once before all of the tests + * </p> + * + * @see junit.extensions.TestSetup#setUp() + */ + public final void setUp() throws Exception { + // setup properties + String noninteractive = System.getProperty(WTP_AUTOTEST_NONINTERACTIVE); + if(noninteractive != null) { + fPreviousWTPAutoTestNonInteractivePropValue = noninteractive; + } else { + fPreviousWTPAutoTestNonInteractivePropValue = "false"; + } + System.setProperty(WTP_AUTOTEST_NONINTERACTIVE, "true"); + + // get project + IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + fProject = root.getProject(this.fProjectName); + + // setup project if it is not yet setup + if(fProject == null || !fProject.exists()) { + fProject = ProjectUtil.createProject(this.fProjectName, null, null); + ProjectUtil.copyBundleEntriesIntoWorkspace(TESTING_RESOURCES_DIR + IPath.SEPARATOR + this.fProjectName, + IPath.SEPARATOR + this.fProjectName); + } + + // run any additional test setup + this.additionalSetUp(); + + // give the workspace a second to settle before running tests + Thread.sleep(1000); + waitForIndexManager(); + } + + /** + * <p> + * This is run once after all of the tests have been run + * </p> + * + * @see junit.extensions.TestSetup#tearDown() + */ + public void tearDown() throws Exception { + // close out the editors + Iterator iter = fFileToEditorMap.values().iterator(); + while(iter.hasNext()) { + AbstractTextEditor editor = (AbstractTextEditor) iter.next(); + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeEditor(editor, false); + } + this.fFileToEditorMap.clear(); + + //delete the project + if(this.fDeleteOnTearDown) { + this.fProject.delete(true, new NullProgressMonitor()); + } + + // restore properties + if(fPreviousWTPAutoTestNonInteractivePropValue != null) { + System.setProperty(WTP_AUTOTEST_NONINTERACTIVE, fPreviousWTPAutoTestNonInteractivePropValue); + } + } + + /** + * <p> + * Line endings can be an issue when running tests on different OSs. This function standardizes + * the line endings to use <code>\n</code> + * </p> + * + * <p> + * It will get the text from the given editor, change the line endings, and then save the editor + * </p> + * + * @param editor + * standardize the line endings of the text presented in this + * editor. + */ + private static void standardizeLineEndings(ITextEditor editor) { + IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput()); + String contents = doc.get(); + contents = StringUtils.replace(contents, "\r\n", "\n"); + contents = StringUtils.replace(contents, "\r", "\n"); + doc.set(contents); + } + + /** + * <p> + * Wait for the index manager with a time out of 10 seconds. + * </p> + */ + private static void waitForIndexManager() { + waitForIndexManager(10000); + } + + /** + * <p> + * Wait for the index manager for the given max time. + * </p> + * + * @param max + * maximum amount of time to wait for the index manager + */ + private static void waitForIndexManager(long max) { + // Wait for the end of indexing + IndexManager indexManager = JavaModelManager.getJavaModelManager().getIndexManager(); + long maxWaits = max / 10; + while (indexManager.awaitingJobsCount() > 0 && maxWaits-- > 0) { + try { + Thread.sleep(10); + } + catch (InterruptedException e) { + return; + } + } + } +} \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/style/StyleTests.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/style/StyleTests.java index f4a8eb2..91fd25b 100644 --- a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/style/StyleTests.java +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/style/StyleTests.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2011 IBM Corporation and others. + * Copyright (c) 2009, 2012 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 @@ -27,6 +27,7 @@ import org.eclipse.swt.custom.StyledText; import org.eclipse.swt.widgets.Control; import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.ide.IDE; import org.eclipse.wst.jsdt.core.IJavaScriptProject; @@ -78,15 +79,21 @@ // create test file IFile file = iProject.getFile(fileName); file.create(new ByteArrayInputStream(contents.getBytes()), true, null); - IEditorPart editor = IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), file, "org.eclipse.wst.html.core.htmlsource.source"); - assertNotNull("editor failed to open", editor); - Control control = (Control) editor.getAdapter(Control.class); - assertNotNull("editor did not return a Control adapter", control); - assertTrue("editor Control adapter is not a StyledText widget", control instanceof StyledText); - int varIndex = contents.indexOf("var"); - StyleRange[] styleRanges = ((StyledText) control).getStyleRanges(varIndex, 3); - assertTrue("no style range for 'var' keyword (this test may fail due to unpredictable timing issues with the test workbench)", styleRanges.length > 0); - assertNotNull("no foreground color for 'var' keyword", styleRanges[0].foreground); - assertNotSame("foreground color has same RGB as black", PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_BLACK).getRGB(), styleRanges[0].foreground.getRGB()); + IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + IEditorPart editor = IDE.openEditor(activePage, file, "org.eclipse.wst.html.core.htmlsource.source"); + try { + assertNotNull("editor failed to open", editor); + Control control = (Control) editor.getAdapter(Control.class); + assertNotNull("editor did not return a Control adapter", control); + assertTrue("editor Control adapter is not a StyledText widget", control instanceof StyledText); + int varIndex = contents.indexOf("var"); + StyleRange[] styleRanges = ((StyledText) control).getStyleRanges(varIndex, 3); + assertTrue("no style range for 'var' keyword (this test may fail due to unpredictable timing issues with the test workbench)", styleRanges.length > 0); + assertNotNull("no foreground color for 'var' keyword", styleRanges[0].foreground); + assertNotSame("foreground color has same RGB as black", PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_BLACK).getRGB(), styleRanges[0].foreground.getRGB()); + } + finally { + activePage.closeEditor(editor, false); + } } }
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/translation/RunCodeHandler.java b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/translation/RunCodeHandler.java index bbb8177..dbd5604 100644 --- a/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/translation/RunCodeHandler.java +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/src/org/eclipse/wst/jsdt/web/ui/tests/translation/RunCodeHandler.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. + * Copyright (c) 2008, 2012 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 @@ -191,7 +191,7 @@ e.printStackTrace(); } return false; - }; + } } protected void doExecute(IFile jsFile) {
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/.project b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/.project new file mode 100644 index 0000000..40843e8 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/.project
@@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>JSDTWebContentAssist</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.wst.jsdt.core.javascriptValidator</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.wst.common.project.facet.core.builder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.wst.validation.validationbuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.wst.common.project.facet.core.nature</nature> + <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature> + <nature>org.eclipse.wst.jsdt.core.jsNature</nature> + </natures> +</projectDescription>
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/.settings/.jsdtscope b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/.settings/.jsdtscope new file mode 100644 index 0000000..3a28de0 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/.settings/.jsdtscope
@@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="WebContent"/> + <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject"> + <attributes> + <attribute name="hide" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/> + <classpathentry kind="output" path=""/> +</classpath>
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/.settings/org.eclipse.core.resources.prefs b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..30ddf73 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@ +#Wed Nov 16 13:07:13 EST 2011 +eclipse.preferences.version=1 +encoding//WebContent/GlobalFunctions.html=UTF-8
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/.settings/org.eclipse.wst.common.component b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/.settings/org.eclipse.wst.common.component new file mode 100644 index 0000000..1bd35b0 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/.settings/org.eclipse.wst.common.component
@@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project-modules id="moduleCoreId" project-version="1.5.0"> + <wb-module deploy-name="JSDTWebContentAssist"> + <wb-resource deploy-path="/" source-path="/WebContent"/> + <property name="context-root" value="JSDTWebContentAssist"/> + </wb-module> +</project-modules>
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/.settings/org.eclipse.wst.common.project.facet.core.xml b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..f48d661 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<faceted-project> + <runtime name="Web Preview Server Runtime"/> + <fixed facet="wst.jsdt.web"/> + <fixed facet="wst.web"/> + <installed facet="wst.web" version="1.0"/> + <installed facet="wst.jsdt.web" version="1.0"/> +</faceted-project>
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/.settings/org.eclipse.wst.jsdt.ui.superType.container b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/.settings/org.eclipse.wst.jsdt.ui.superType.container new file mode 100644 index 0000000..3bd5d0a --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/.settings/org.eclipse.wst.jsdt.ui.superType.container
@@ -0,0 +1 @@ +org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/.settings/org.eclipse.wst.jsdt.ui.superType.name b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/.settings/org.eclipse.wst.jsdt.ui.superType.name new file mode 100644 index 0000000..05bd71b --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/.settings/org.eclipse.wst.jsdt.ui.superType.name
@@ -0,0 +1 @@ +Window \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/BrowserLibrary.html b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/BrowserLibrary.html new file mode 100644 index 0000000..a55efc8 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/BrowserLibrary.html
@@ -0,0 +1,20 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> +<title>GlobalFunctions</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script type="text/javascript"> + +document.g + +al + +doc + +</script> + +</head> +<body> + +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/ClassTest1.js b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/ClassTest1.js new file mode 100644 index 0000000..f76e1ab --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/ClassTest1.js
@@ -0,0 +1,8 @@ +function MyClass1(a) { + this.a = a; +} + +var MyClass2 = function() {}; +MyClass2.prototype.meth = function() {}; + +new MyCl
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/ClassTest2.html b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/ClassTest2.html new file mode 100644 index 0000000..25b86b0 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/ClassTest2.html
@@ -0,0 +1,16 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> +<title>GlobalFunctions</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script type="text/javascript"> + +new MyCl + +</script> + +</head> +<body> + +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/ClassTest3.js b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/ClassTest3.js new file mode 100644 index 0000000..bc26399 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/ClassTest3.js
@@ -0,0 +1,14 @@ +function MyClass7(a) { + this.a = a; +} + +var o = { + a: new z, + b: 42 +}; + +var q = { + a: new MyC, + b: 42 +}; +
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/ConstructorCamelCase.html b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/ConstructorCamelCase.html new file mode 100644 index 0000000..3c2874e --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/ConstructorCamelCase.html
@@ -0,0 +1,21 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> +<title>GlobalFunctions</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script type="text/javascript"> + + +new iG + +new iGS + +new iGSF + +</script> + +</head> +<body> + +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/ConstructorCamelCase.js b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/ConstructorCamelCase.js new file mode 100644 index 0000000..b3d1059 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/ConstructorCamelCase.js
@@ -0,0 +1,27 @@ +var iGotMessage = function iGotMessage(param1) { + this.param1=param1; +}; + +var mail = { + inbox: { + IGotStared : {} + }, + spam : {} +}; + +mail.iGotSpam = function(a, b) {}; +mail.iGotSpam.prototype = new Object(); + +mail.inbox.iGotStarredFun = function(param1) {}; +mail.inbox.iGotStarredFun.prototype = new Object(); + +new iG + +new iGS + +new iGSF + + +iGSF + +m \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/Crazy.html b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/Crazy.html new file mode 100644 index 0000000..3c58310 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/Crazy.html
@@ -0,0 +1,19 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> +<title>GlobalFunctions</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script type="text/javascript"> + + +var obj = new Crazy(); + +obj. + +</script> + +</head> +<body> + +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/Crazy.js b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/Crazy.js new file mode 100644 index 0000000..a8e95dc --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/Crazy.js
@@ -0,0 +1,11 @@ +function Crazy() { + this.foo = "foo"; +} + +/** + * + * @param {Number} param1 + */ +Crazy.prototype.myFunc1 = function(param1) { + return param1; +}; \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/GLobalObjectLiterals.js b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/GLobalObjectLiterals.js new file mode 100644 index 0000000..b00b679 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/GLobalObjectLiterals.js
@@ -0,0 +1,13 @@ +org = {}; +org.eclipse = {}; +org.eclipse2 = {}; +org.eclipse.fun = function(){}; +org.eclipse.crazy = function() {}; + + + +o + +org.e + +org.eclipse.z \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/Global.html b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/Global.html new file mode 100644 index 0000000..22f32d5 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/Global.html
@@ -0,0 +1,23 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> +<title>GlobalFunctions</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script type="text/javascript"> + + +g + +globalV + +gVN + +gV + +</script> + +</head> +<body> + +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/Global.js b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/Global.js new file mode 100644 index 0000000..4dea074 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/Global.js
@@ -0,0 +1,18 @@ +var globalVar; +var globalVarNum = 42; +var globalVarString = "test"; +var globalVarObject = {}; + +global; +globalNum = 42; +globalString = "test"; + +g + +globalV + +g + +gVN + +gV
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/GlobalFunctions.html b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/GlobalFunctions.html new file mode 100644 index 0000000..52f163b --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/GlobalFunctions.html
@@ -0,0 +1,23 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> +<title>GlobalFunctions</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script type="text/javascript"> + + +f + +func + +funcT + +fT + +</script> + +</head> +<body> + +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/GlobalFunctions.js b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/GlobalFunctions.js new file mode 100644 index 0000000..db84e80 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/GlobalFunctions.js
@@ -0,0 +1,65 @@ +function funcOne() { + +} + +function funcTwo() { + return ""; +} + +function funcThree(paramOne) { + +} + +function funcFour(paramOne, paramTwo) { + return paramOne * paramTwo; +} + +/** + * + * @param {Number} paramOne + * @param {String} paramTwo + * @returns {String} + */ +function funcFive(paramOne, paramTwo) { + return "hello"; +} + +/** + * + * @param paramOne + * @param {String} paramTwo + * @returns {Number} + */ +function funcSix(paramOne, paramTwo) { + return 7; +} + +/** + * + * @param {String} paramOne + * @param paramTwo + * @returns {Number} + */ +function funcSeven(paramOne, paramTwo) { + return 7; +} + +var funcEight = function(paramOne) { + return ""; +}; + + +funcNine = function(paramOne) { + return 42; +}; + +fT + +f + +func + +funcT + + +
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/GlobalObjectLiterals.html b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/GlobalObjectLiterals.html new file mode 100644 index 0000000..7a54807 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/GlobalObjectLiterals.html
@@ -0,0 +1,21 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> +<title>GlobalFunctions</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script type="text/javascript"> + + +o + +org.e + +org.eclipse.z + +</script> + +</head> +<body> + +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/GlobalVarsDefinedInClosure.html b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/GlobalVarsDefinedInClosure.html new file mode 100644 index 0000000..e1c38d8 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/GlobalVarsDefinedInClosure.html
@@ -0,0 +1,23 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> +<title>GlobalFunctions</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script type="text/javascript"> + + + +clo + +closure.n + +closure2.b + + +</script> + +</head> +<body> + +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/GlobalVarsDefinedInClosure.js b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/GlobalVarsDefinedInClosure.js new file mode 100644 index 0000000..c37d199 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/GlobalVarsDefinedInClosure.js
@@ -0,0 +1,19 @@ +(function() { + closure = { + nifty : 42 + }; + + this.closure2 = { + burg : "foo" + }; + + +})(); + + + +clo + +closure.n + +closure2.b \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/InnerFunctions.html b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/InnerFunctions.html new file mode 100644 index 0000000..2a83758 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/InnerFunctions.html
@@ -0,0 +1,23 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> +<title>GlobalFunctions</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script type="text/javascript"> + + +funcT + +fT + +f + +fE + +</script> + +</head> +<body> + +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/InnerFunctions.js b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/InnerFunctions.js new file mode 100644 index 0000000..4b37106 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/InnerFunctions.js
@@ -0,0 +1,24 @@ +function funcTen( paramEleven , paramTwelve ) { + function funcTenInner(newParam111,newParam222){ + return ""; + }; + + var funcTenInner1 = function(param1) { + + }; + + funcTenInner2= function(param1,param2) { + + }; + funcT + fT + +}; + + + +funcT + +fT + +fE \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/InnerOuter.html b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/InnerOuter.html new file mode 100644 index 0000000..fdb9916 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/InnerOuter.html
@@ -0,0 +1,21 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> +<title>GlobalFunctions</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script type="text/javascript"> + + +oF + +i + +eF + +</script> + +</head> +<body> + +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/InnerOuter.js b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/InnerOuter.js new file mode 100644 index 0000000..79998f8 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/InnerOuter.js
@@ -0,0 +1,22 @@ +function outerFunc() +{ + // innerFunc and outerFunc + function innerFunc() + { + // all but localInnerFunc + + function insideInnerFunc() + { + var localInnerFunc = function(param1) { + + }; + //all the functions + + } + // all but localInnerFunc + + } + +} + + // only outerFunc \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/JSClasses.html b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/JSClasses.html new file mode 100644 index 0000000..8d582d8 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/JSClasses.html
@@ -0,0 +1,31 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> +<title>GlobalFunctions</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script type="text/javascript"> + + +new Aw + +new ba + +new bar.C + +new bar.fo + +new bar.foo.C + +new C + +new bar. + +z //needed because the bar. causes compile issues + +</script> + +</head> +<body> + +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/JSClasses.js b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/JSClasses.js new file mode 100644 index 0000000..575a2d6 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/JSClasses.js
@@ -0,0 +1,34 @@ +function Awesome(param1, param2) { + this.param1 = param1; + this.param2 = param2; +}; + +var bar = { + foo: {}, + foobla : {}, + neto : {} +}; +bar.Class1 = function(a, b) {}; +bar.Class1.prototype = new Object(); +bar.Class2 = function(c, d, e) {}; +bar.Class2.prototype = new Object(); +bar.foo.Class3 = function(param1, param2, param3, param4) {}; +bar.foo.Class3.prototype = new Object(); + +new + +new Aw + +new ba + +new bar.C + +new bar.fo + +new bar.foo.C + +new C + +new bar. + +z //needed because the bar. causes compile issues \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/JSClassesII.html b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/JSClassesII.html new file mode 100644 index 0000000..d1b4260 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/JSClassesII.html
@@ -0,0 +1,27 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> +<title>GlobalFunctions</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script type="text/javascript"> + + +ID + +CX + +IDC + +Comp + +Ins + +z //needed because the bar. causes compile issues + +</script> + +</head> +<body> + +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/JSClassesII.js b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/JSClassesII.js new file mode 100644 index 0000000..6b36fc1 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/JSClassesII.js
@@ -0,0 +1,38 @@ +var Computer = { + proc: { + + }, + memory : {} +}; + +var Installed = {}; + +Computer.proc.IntelDualCore1=function(param1,param2) { + this.foo1 = 42; +}; +Computer.proc.IntelDualCore2=function(param3,param4) { + this.foo2 = 42; +}; +Computer.proc.IntelQuadCore = function(param5) { + this.foo3 = 42; +}; +Computer.proc.CeleronXSeries = function() { + this.foo = 42; +}; + +Installed.CorelXSoftware = function() { + this.foo = 42; +}; + + +ID + +CX + +IDC + +Comp + +Ins + +z //needed because the bar. causes compile issues \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/JSObjectModel.html b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/JSObjectModel.html new file mode 100644 index 0000000..e97256a --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/JSObjectModel.html
@@ -0,0 +1,22 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> +<title>GlobalFunctions</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script type="text/javascript"> + + +historyObject. ; + +windowObject. ; + +nodeObject. ; + + +</script> + +</head> +<body> + +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/JSObjectModel.js b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/JSObjectModel.js new file mode 100644 index 0000000..6f75433 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/JSObjectModel.js
@@ -0,0 +1,13 @@ + + +var windowObject = new Window(); + +var nodeObject = new Node(); +nodeObject. +var historyObject = new History(); + +windowObject. ; + +// + +historyObject. ; \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/LocalVariableDefinedInFunctionInObjectLiteral.html b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/LocalVariableDefinedInFunctionInObjectLiteral.html new file mode 100644 index 0000000..500031a --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/LocalVariableDefinedInFunctionInObjectLiteral.html
@@ -0,0 +1,16 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> +<title>GlobalFunctions</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script type="text/javascript"> + +nin + +</script> + +</head> +<body> + +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/LocalVariableDefinedInFunctionInObjectLiteral.js b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/LocalVariableDefinedInFunctionInObjectLiteral.js new file mode 100644 index 0000000..4cd4466 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/LocalVariableDefinedInFunctionInObjectLiteral.js
@@ -0,0 +1,8 @@ +__objLiteral = { + foo : function() { + var ninjaLocal = 42; + nin + } +} + +nin \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/NamedFunctionAssignedToVariables.html b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/NamedFunctionAssignedToVariables.html new file mode 100644 index 0000000..0f64e4e --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/NamedFunctionAssignedToVariables.html
@@ -0,0 +1,17 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> +<title>GlobalFunctions</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script type="text/javascript"> + + +f + +</script> + +</head> +<body> + +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/NamedFunctionAssignedToVariables.js b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/NamedFunctionAssignedToVariables.js new file mode 100644 index 0000000..5270e81 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/NamedFunctionAssignedToVariables.js
@@ -0,0 +1,11 @@ +var foo1 = function foo1Ignored(param2) { + +}; + +foo2 = function foo2Ignored(param3, param4) { + +} + + + +f \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/ProposalInfo.html b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/ProposalInfo.html new file mode 100644 index 0000000..a377046 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/ProposalInfo.html
@@ -0,0 +1,20 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> +<title>GlobalFunctions</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script type="text/javascript"> + + + +Hel + +nod + +</script> + +</head> +<body> + +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/ProposalInfo.js b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/ProposalInfo.js new file mode 100644 index 0000000..454bafd --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/ProposalInfo.js
@@ -0,0 +1,25 @@ +/** + * Hello World + */ +function HelloWorld() { + +} + +/** + * @param State + * @param City + */ +function HelloAmerica(State, City) { + +} + +Hel + +/** + * nodeOne = test + */ +var nodeOne = "test"; + +nod + +
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/ReferenceInMemberAndStaticFunctions.html b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/ReferenceInMemberAndStaticFunctions.html new file mode 100644 index 0000000..26f9c97 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/ReferenceInMemberAndStaticFunctions.html
@@ -0,0 +1,18 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> +<title>GlobalFunctions</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script type="text/javascript"> + +new fu + +new Par + +</script> + +</head> +<body> + +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/ReferenceInMemberAndStaticFunctions.js b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/ReferenceInMemberAndStaticFunctions.js new file mode 100644 index 0000000..a5bf9e5 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/ReferenceInMemberAndStaticFunctions.js
@@ -0,0 +1,12 @@ +ParentType0 = function(a) {}; +ParentType0.prototype = new Object(); +ParentType0.prototype.func1 = function(a) { + this.a = a; +}; +ParentType0.func2 = function(b) { + this.b = b; +}; + +new fu + +new Par \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/SingleLineScriptTag.html b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/SingleLineScriptTag.html new file mode 100644 index 0000000..2d7d0a6 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/SingleLineScriptTag.html
@@ -0,0 +1,14 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> +<title>GlobalFunctions</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script type="text/javascript">var d = new D</script> +<script type="text/javascript">var d = new D </script> +<script type="text/javascript"></script> + +</head> +<body> + +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/StaticTests.html b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/StaticTests.html new file mode 100644 index 0000000..7d6bfc5 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/StaticTests.html
@@ -0,0 +1,27 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> +<title>GlobalFunctions</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script type="text/javascript"> + + +Server.gSIP; + +yDC ; + +yahooDotCom.cIP; + +yahooDotCom.g ; + +Server.s ; + +// End of Code + +</script> + +</head> +<body> + +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/StaticTests.js b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/StaticTests.js new file mode 100644 index 0000000..2a42a96 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/StaticTests.js
@@ -0,0 +1,59 @@ +function Server(param1) +{ + this.port=param1; +} + +// static variables + +Server.getServerIP = function() { + return Server.serverIP; +}; +Server.serverIP = '123.23.23.23'; + +// instance variables + +Server.prototype.getClientPort = function() { + return this.port; +}; +Server.prototype.clientIP = ''; +Server.prototype.getClientIP = function() { + return this.clientIP; +}; + +// instance of Server + +var yahooDotCom = new Server(); + +// Begin tests + +Server.gSIP ; + +yDC ; + +yahooDotCom.cIP; + +yahooDotCom.g ; + +Server.s ; + +// Peace + + + + + + + + + + + + + + + + + + + +
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/Template.html b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/Template.html new file mode 100644 index 0000000..472f7af --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/Template.html
@@ -0,0 +1,12 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> +<title>GlobalFunctions</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script type="text/javascript">func</script> + +</head> +<body> + +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/Test.html b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/Test.html new file mode 100644 index 0000000..c012bac --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/Test.html
@@ -0,0 +1,17 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> +<title>GlobalFunctions</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script type="text/javascript"> + + +new tes + +</script> + +</head> +<body> + +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/Test.js b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/Test.js new file mode 100644 index 0000000..1e7f03f --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/JSDTWebContentAssist/WebContent/Test.js
@@ -0,0 +1,8 @@ +var test = {}; +test['Foo'] = function(x, y, z) { + this.fX = x; + this.fY = y; + this.fZ = z; +}; + +new tes \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/formatting/test20-fmt.jsp b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/formatting/test20-fmt.jsp new file mode 100644 index 0000000..70248e0 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/formatting/test20-fmt.jsp
@@ -0,0 +1,20 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<%@ page import="com.google.appengine.api.users.User"%> +<%@ page import="com.google.appengine.api.users.UserService"%> +<%@ page import="com.google.appengine.api.users.UserServiceFactory"%> +<% + UserService userService = UserServiceFactory.getUserService(); + User user = userService.getCurrentUser(); +%> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<script type="text/javascript" + src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> +<script type="text/javascript"> + $(document).ready(function() { + openid.init('openid_identifier'); + }); +</script> +</head> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/formatting/test20.jsp b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/formatting/test20.jsp new file mode 100644 index 0000000..793fea1 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/formatting/test20.jsp
@@ -0,0 +1,18 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> +<%@ page import="com.google.appengine.api.users.User"%> +<%@ page import="com.google.appengine.api.users.UserService"%> +<%@ page import="com.google.appengine.api.users.UserServiceFactory"%> +<% + UserService userService = UserServiceFactory.getUserService(); + User user = userService.getCurrentUser(); +%> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> +<script type="text/javascript"> + $(document).ready(function() { + openid.init('openid_identifier'); + }); +</script> +</head>
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/.project b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/.project new file mode 100644 index 0000000..7b17698 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/.project
@@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>jsdtjspformatting</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.wst.validation.validationbuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription>
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/META-INF/MANIFEST.MF b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/META-INF/MANIFEST.MF new file mode 100644 index 0000000..5e94951 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: +
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/WEB-INF/lib/.keepme b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/WEB-INF/lib/.keepme new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/WEB-INF/lib/.keepme
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/WEB-INF/web.xml b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/WEB-INF/web.xml new file mode 100644 index 0000000..6497626 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/WEB-INF/web.xml
@@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> + <display-name>jsdtjspformatting</display-name> + <welcome-file-list> + <welcome-file>index.html</welcome-file> + <welcome-file>index.htm</welcome-file> + <welcome-file>index.jsp</welcome-file> + <welcome-file>default.html</welcome-file> + <welcome-file>default.htm</welcome-file> + <welcome-file>default.jsp</welcome-file> + </welcome-file-list> +</web-app>
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug102495-fmt.jsp b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug102495-fmt.jsp new file mode 100644 index 0000000..8bb8b72 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug102495-fmt.jsp
@@ -0,0 +1,37 @@ +<%-- jsp declaration for String pal should stay on same line. All others should move to new line --%> +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%><%!String pal = "friend";%> +<%!String message = "friend";%> +<%!String buddy = "friend";%> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> +<title>Insert title here</title> +</head> +<body> + <%-- jsp expression must be followed directly by ! because no whitespace exists between --%> + Welcome to WTP, + <%=message%>! + <p> + Welcome to WTP, + <%=pal%>! + </p> + <%-- jsp expression should be treated like any other attribute --%> + <table <%="align='left'"%>> + <tr> + <%-- no whitespace exists before/after jsp tag so keep it that way --%> + <th>Column<jsp:setProperty name="myname" property="myproperty" />Heading + </th> + <%-- whitespace exists before/after jsp tag so newlines are okay --%> + <th>Column <jsp:setProperty name="myname" property="myproperty" /> + Heading + </th> + </tr> + <tr> + <td>Row 1: Col 1</td> + <td>Row 1: Col 2</td> + </tr> + </table> +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug102495.jsp b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug102495.jsp new file mode 100644 index 0000000..74bf0a6 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug102495.jsp
@@ -0,0 +1,29 @@ +<%-- jsp declaration for String pal should stay on same line. All others should move to new line --%> +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%><%! String pal="friend"; %> +<%! String message="friend"; %> <%! String buddy="friend"; %> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> +<title>Insert title here</title> +</head> +<body> +<%-- jsp expression must be followed directly by ! because no whitespace exists between --%> +Welcome to WTP, <%=message%>! +<p>Welcome to WTP, <%=pal%>!</p> +<%-- jsp expression should be treated like any other attribute --%> +<table <%="align='left'"%>> + <tr> + <%-- no whitespace exists before/after jsp tag so keep it that way --%> + <th>Column<jsp:setProperty name="myname" property="myproperty"/>Heading</th> + <%-- whitespace exists before/after jsp tag so newlines are okay --%> + <th>Column <jsp:setProperty name="myname" property="myproperty"/> Heading</th> + </tr> + <tr> + <td>Row 1: Col 1</td> + <td>Row 1: Col 2</td> + </tr> +</table> +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug102495_1-fmt.jsp b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug102495_1-fmt.jsp new file mode 100644 index 0000000..3b57eeb --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug102495_1-fmt.jsp
@@ -0,0 +1,14 @@ +<%-- jsp declaration for String pal should stay on same line. All others should move to new line --%> +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%><%!String pal = "friend";%> +<%!String message = "friend";%> +<%!String buddy = "friend";%> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> +<title>Insert title here</title> +</head> +<body> +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug102495_1.jsp b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug102495_1.jsp new file mode 100644 index 0000000..2554390 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug102495_1.jsp
@@ -0,0 +1,13 @@ +<%-- jsp declaration for String pal should stay on same line. All others should move to new line --%> +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%><%! String pal="friend"; %> +<%! String message="friend"; %> <%! String buddy="friend"; %> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> +<title>Insert title here</title> +</head> +<body> +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug102495_2-fmt.jsp b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug102495_2-fmt.jsp new file mode 100644 index 0000000..1467120 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug102495_2-fmt.jsp
@@ -0,0 +1,20 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<%!String pal = "friend";%> +<%!String message = "friend";%> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> +<title>Insert title here</title> +</head> +<body> + <%-- jsp expression must be followed directly by ! because no whitespace exists between --%> + Welcome to WTP, + <%=message%>! + <p> + Welcome to WTP, + <%=pal%>! + </p> +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug102495_2.jsp b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug102495_2.jsp new file mode 100644 index 0000000..692e1e5 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug102495_2.jsp
@@ -0,0 +1,16 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<%! String pal="friend"; %> +<%! String message="friend"; %> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> +<title>Insert title here</title> +</head> +<body> +<%-- jsp expression must be followed directly by ! because no whitespace exists between --%> +Welcome to WTP, <%=message%>! +<p>Welcome to WTP, <%=pal%>!</p> +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug102495_3-fmt.jsp b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug102495_3-fmt.jsp new file mode 100644 index 0000000..79c70a6 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug102495_3-fmt.jsp
@@ -0,0 +1,14 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> +<title>Insert title here</title> +</head> +<body> + <%-- jsp expression should be treated like any other attribute --%> + <table <%="align='left'"%>> + </table> +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug102495_3.jsp b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug102495_3.jsp new file mode 100644 index 0000000..e185c3e --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug102495_3.jsp
@@ -0,0 +1,14 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> +<title>Insert title here</title> +</head> +<body> +<%-- jsp expression should be treated like any other attribute --%> +<table <%="align='left'"%>> +</table> +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug102495_4-fmt.jsp b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug102495_4-fmt.jsp new file mode 100644 index 0000000..4fd9c21 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug102495_4-fmt.jsp
@@ -0,0 +1,26 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> +<title>Insert title here</title> +</head> +<body> + <table> + <tr> + <%-- no whitespace exists before/after jsp tag so keep it that way --%> + <th>Column<jsp:setProperty name="myname" property="myproperty" />Heading + </th> + <%-- whitespace exists before/after jsp tag so newlines are okay --%> + <th>Column <jsp:setProperty name="myname" property="myproperty" /> + Heading + </th> + </tr> + <tr> + <td>Row 1: Col 1</td> + <td>Row 1: Col 2</td> + </tr> + </table> +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug102495_4.jsp b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug102495_4.jsp new file mode 100644 index 0000000..87859db --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug102495_4.jsp
@@ -0,0 +1,23 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> +<title>Insert title here</title> +</head> +<body> +<table> + <tr> + <%-- no whitespace exists before/after jsp tag so keep it that way --%> + <th>Column<jsp:setProperty name="myname" property="myproperty"/>Heading</th> + <%-- whitespace exists before/after jsp tag so newlines are okay --%> + <th>Column <jsp:setProperty name="myname" property="myproperty"/> Heading</th> + </tr> + <tr> + <td>Row 1: Col 1</td> + <td>Row 1: Col 2</td> + </tr> +</table> +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug358545.jsp b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug358545.jsp new file mode 100644 index 0000000..9c804b5 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug358545.jsp
@@ -0,0 +1,92 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" import="com.eprice.data.*, + com.eprice.data.PricingPlanAttribute.AttributeSourceEnum, + com.eprice.data.Currency, + com.epriceadmin.form.*, + java.util.Iterator, + com.epriceadmin.service.PriceBookService, + com.epriceadmin.data.*, + com.eprice.data.pricebook.*, + com.eprice.importsexports.data.AttributeValue, + java.util.*, + java.text.*" +%> +<html> +<head> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> +<%@ taglib prefix="eprice" uri="WEB-INF/tld/eprice.tld"%> +<jsp:useBean id="AdminSession" scope="session" type="com.epriceadmin.data.AdminSession" /> +<c:set var="activeForm" value="${AdminSession.activeForm}" scope="session" /> +<script type="text/javascript"> + var oldValue = ""; + + function copyPrices(prevValue) { + var pricetxts = document.forms[0].priceField; + if (isNaN(pricetxts[0].value)) { + alert('Cannot copy non-numeric prices'); + return; + } + for ( var i = 0; i < pricetxts.length; i++) { + if (!isNaN(pricetxts[0].value)) { + pricetxts[i].value = pricetxts[0].value + oldValue = prevValue + } + } + + } + + + function controlForm() { +<% if( priceBooksEditIndividualForm.getShowAttributes() != null ) { %> + document.getElementById("savePrices").className = "buttonDisabled"; + document.getElementById("savePrices").mouseover.className = "buttonDisabled"; +<% } %> + } + + function MM_findObj(n, d) { //v4.01 + var p, i, x; + if (!d) + d = document; + if ((p = n.indexOf("?")) > 0 && parent.frames.length) { + d = parent.frames[n.substring(p + 1)].document; + n = n.substring(0, p); + } + if (!(x = d[n]) && d.all) + x = d.all[n]; + for (i = 0; !x && i < d.forms.length; i++) + x = d.forms[i][n]; + for (i = 0; !x && d.layers && i < d.layers.length; i++) + x = MM_findObj(n, d.layers[i].document); + if (!x && d.getElementById) + x = d.getElementById(n); + return x; + } + + function MM_showHideLayers() { //v6.0 + var i, p, v, obj, args = MM_showHideLayers.arguments; + for (i = 0; i < (args.length - 2); i += 3) + if ((obj = MM_findObj(args[i])) != null) { + v = args[i + 2]; + if (obj.style) { + obj = obj.style; + v = (v == 'show') ? 'visible' : (v == 'hide') ? 'hidden' + : v; + } + obj.visibility = v; + } + } + function verifyLocalAcessPLI() { +<% if( request.getAttribute( "LOCAL_DIVERSE_ACESS_PLI" ) != null ) {%> + MM_showHideLayers('restrictLocalAccessPLIPopup', '', 'show'); +<% }%> + } +</script> +<title>ePrice Administration - Price Books - Edit Individual Prices</title> +</head> +<body onkeydown="selectSave()" onload="verifyLocalAcessPLI();"> + + + +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug358545b.jsp b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug358545b.jsp new file mode 100644 index 0000000..640c934 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/WebContent/formatbug358545b.jsp
@@ -0,0 +1,19 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<script type="text/javascript"> + + function verifyLocalAcessPLI() { +<% if( request.getAttribute( "LOCAL_DIVERSE_ACESS_PLI" ) != null ) {%> + MM_showHideLayers('restrictLocalAccessPLIPopup', '', 'show'); +<% }%> + } +</script> +<title>ePrice Administration - Price Books - Edit Individual Prices</title> +</head> +<body onkeydown="selectSave()" onload="verifyLocalAcessPLI();"> + + + +</body> +</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/src/.keepme b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/src/.keepme new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/jsdtjspformatting/src/.keepme
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/test16-fmt.html b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/test16-fmt.html deleted file mode 100644 index cb2fe9b..0000000 --- a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/test16-fmt.html +++ /dev/null
@@ -1,351 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -<html> -<head> -<title>index</title> -<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> -</head> -<body> - <script type="text/javascript"> - function boo() { - } - - boo(); - - - define("ibm/PaperSheet", [ "dojo", "dijit", "dojo/_base/array", "dijit/_WidgetBase", - "dojox/mobile/Container", "dojo/NodeList-traverse" ], function(dojo, dijit, array, _WidgetBase, - Container) { - return dojo.declare("ibm.PaperSheet", [ dijit._WidgetBase, - dojox.mobile.Container ], { - - _sideMargin: 15, - _topMargin: 20, - _bottomMargin: 40, - - _bottomLeft: null, - _bottomRight: null, - _bottomCenter: null, - _leftSide: null, - _rightSide: null, - - constructor : function() { - }, - - postMixInProperties: function(){ - }, - - postCreate : function() { - dojo.style(this.domNode, "marginLeft", "auto"); - dojo.style(this.domNode, "marginRight", "auto"); - dojo.style(this.domNode, "marginBottom", "50px"); - dojo.style(this.domNode, "position", "relative"); - dojo.style(this.domNode, "backgroundColor", "white"); - dojo.style(this.domNode, "backgroundImage", "-webkit-linear-gradient(bottom, #F0F0F0 40%, #FFFFFF 100%)"); - - this._createSides(); - this._createBottom(); - }, - - // react to the parent resizing - resize : function() { - array.forEach(this.getChildren(), function(child){ - if(child.resize) { - child.resize(); - } - }); - - var domNodeHeight = dojo.position(this.domNode).h; - var screenSize = dojox.mobile.getScreenSize(); - var containerWidth = screenSize.w - (2 * this._sideMargin); - - dojo.style(this.domNode, "width", containerWidth + "px"); - dojo.style(this.domNode, "top", this._topMargin + "px"); - - var bottomWidth = Math.min(300, (containerWidth / 2) + 10); - - // bottom left - dojo.style(this._bottomLeft, "width", bottomWidth + "px"); - dojo.style(this._bottomLeft, "height", "26px"); - dojo.style(this._bottomLeft, "left", "-10px"); - dojo.style(this._bottomLeft, "top", domNodeHeight + "px"); - - // bottom right - dojo.style(this._bottomRight, "height", "26px"); - dojo.style(this._bottomRight, "width", bottomWidth + "px"); - dojo.style(this._bottomRight, "position", "absolute"); - dojo.style(this._bottomRight, "left", ((containerWidth - bottomWidth) + 10) + "px"); - dojo.style(this._bottomRight, "top", domNodeHeight + "px"); - - // bottom center - dojo.style(this._bottomCenter, "height", "26px"); - dojo.style(this._bottomCenter, "top", domNodeHeight + "px"); - dojo.style(this._bottomCenter, "left", (bottomWidth - 10) + "px"); - dojo.style(this._bottomCenter, "width", (Math.max(0, containerWidth + 20 - (2 * bottomWidth))) + "px"); - - // left - dojo.style(this._leftSide, "width", "10px"); - dojo.style(this._leftSide, "height", domNodeHeight + "px"); - dojo.style(this._leftSide, "left", "-10px"); - - // right - dojo.style(this._rightSide, "width", "10px"); - dojo.style(this._rightSide, "height", domNodeHeight + "px"); - dojo.style(this._rightSide, "left", containerWidth + "px"); - }, - - _createBottom : function() { - this._bottomLeft = dojo.create("div", {}, this.domNode, "last"); - dojo.style(this._bottomLeft, "position", "absolute"); - - // set background - dojo.style(this._bottomLeft, "backgroundImage", "url('" + require.toUrl("ibm/images/left_bottom_shadow.png") + "')"); - dojo.style(this._bottomLeft, "backgroundPosition", "top left"); - dojo.style(this._bottomLeft, "backgroundRepeat", "no-repeat"); - - this._bottomCenter = dojo.create("div", {}, this.domNode, "last"); - dojo.style(this._bottomCenter, "position", "absolute"); - dojo.style(this._bottomCenter, "backgroundImage", "url('" + require.toUrl("ibm/images/middle_bottom_shadow.png") + "')"); - dojo.style(this._bottomCenter, "backgroundPosition", "top"); - dojo.style(this._bottomCenter, "backgroundRepeat", "repeat-x"); - - this._bottomRight = dojo.create("div", {}, this.domNode, "last"); - dojo.style(this._bottomRight, "position", "absolute"); - - // set the shadow background - dojo.style(this._bottomRight, "backgroundImage", "url('" + require.toUrl("ibm/images/right_bottom_shadow.png") + "')"); - dojo.style(this._bottomRight, "backgroundPosition", "top right"); - dojo.style(this._bottomRight, "backgroundRepeat", "no-repeat"); - }, - - _createSides : function() { - this._leftSide = dojo.create("div", {}, this.domNode, "first"); - dojo.style(this._leftSide, "position", "absolute"); - dojo.style(this._leftSide, "top", "0px"); - - // set background - dojo.style(this._leftSide, "backgroundImage", "url('" + require.toUrl("ibm/images/left_shadow.png") + "')"); - dojo.style(this._leftSide, "backgroundPosition", "top left"); - - this._rightSide = dojo.create("div", {}, this.domNode, "last"); - dojo.style(this._rightSide, "position", "absolute"); - dojo.style(this._rightSide, "top", "0px"); - - // set background - dojo.style(this._rightSide, "backgroundImage", "url('" + require.toUrl("ibm/images/right_shadow.png") + "')"); - dojo.style(this._rightSide, "backgroundPosition", "top right"); - } - }); -}); - <!-- - define("ibm/PaperSheet", [ "dojo", "dijit", "dojo/_base/array", "dijit/_WidgetBase", - "dojox/mobile/Container", "dojo/NodeList-traverse" ], function(dojo, dijit, array, _WidgetBase, - Container) { - return dojo.declare("ibm.PaperSheet", [ dijit._WidgetBase, - dojox.mobile.Container ], { - - _sideMargin: 15, - _topMargin: 20, - _bottomMargin: 40, - - _bottomLeft: null, - _bottomRight: null, - _bottomCenter: null, - _leftSide: null, - _rightSide: null, - - constructor : function() { - }, - - postMixInProperties: function(){ - }, - - postCreate : function() { - dojo.style(this.domNode, "marginLeft", "auto"); - dojo.style(this.domNode, "marginRight", "auto"); - dojo.style(this.domNode, "marginBottom", "50px"); - dojo.style(this.domNode, "position", "relative"); - dojo.style(this.domNode, "backgroundColor", "white"); - dojo.style(this.domNode, "backgroundImage", "-webkit-linear-gradient(bottom, #F0F0F0 40%, #FFFFFF 100%)"); - - this._createSides(); - this._createBottom(); - }, - - // react to the parent resizing - resize : function() { - array.forEach(this.getChildren(), function(child){ - if(child.resize) { - child.resize(); - } - }); - - var domNodeHeight = dojo.position(this.domNode).h; - var screenSize = dojox.mobile.getScreenSize(); - var containerWidth = screenSize.w - (2 * this._sideMargin); - - dojo.style(this.domNode, "width", containerWidth + "px"); - dojo.style(this.domNode, "top", this._topMargin + "px"); - - var bottomWidth = Math.min(300, (containerWidth / 2) + 10); - - // bottom left - dojo.style(this._bottomLeft, "width", bottomWidth + "px"); - dojo.style(this._bottomLeft, "height", "26px"); - dojo.style(this._bottomLeft, "left", "-10px"); - dojo.style(this._bottomLeft, "top", domNodeHeight + "px"); - - // bottom right - dojo.style(this._bottomRight, "height", "26px"); - dojo.style(this._bottomRight, "width", bottomWidth + "px"); - dojo.style(this._bottomRight, "position", "absolute"); - dojo.style(this._bottomRight, "left", ((containerWidth - bottomWidth) + 10) + "px"); - dojo.style(this._bottomRight, "top", domNodeHeight + "px"); - - // bottom center - dojo.style(this._bottomCenter, "height", "26px"); - dojo.style(this._bottomCenter, "top", domNodeHeight + "px"); - dojo.style(this._bottomCenter, "left", (bottomWidth - 10) + "px"); - dojo.style(this._bottomCenter, "width", (Math.max(0, containerWidth + 20 - (2 * bottomWidth))) + "px"); - - // left - dojo.style(this._leftSide, "width", "10px"); - dojo.style(this._leftSide, "height", domNodeHeight + "px"); - dojo.style(this._leftSide, "left", "-10px"); - - // right - dojo.style(this._rightSide, "width", "10px"); - dojo.style(this._rightSide, "height", domNodeHeight + "px"); - dojo.style(this._rightSide, "left", containerWidth + "px"); - }, - - _createBottom : function() { - this._bottomLeft = dojo.create("div", {}, this.domNode, "last"); - dojo.style(this._bottomLeft, "position", "absolute"); - - // set background - dojo.style(this._bottomLeft, "backgroundImage", "url('" + require.toUrl("ibm/images/left_bottom_shadow.png") + "')"); - dojo.style(this._bottomLeft, "backgroundPosition", "top left"); - dojo.style(this._bottomLeft, "backgroundRepeat", "no-repeat"); - - this._bottomCenter = dojo.create("div", {}, this.domNode, "last"); - dojo.style(this._bottomCenter, "position", "absolute"); - dojo.style(this._bottomCenter, "backgroundImage", "url('" + require.toUrl("ibm/images/middle_bottom_shadow.png") + "')"); - dojo.style(this._bottomCenter, "backgroundPosition", "top"); - dojo.style(this._bottomCenter, "backgroundRepeat", "repeat-x"); - - this._bottomRight = dojo.create("div", {}, this.domNode, "last"); - dojo.style(this._bottomRight, "position", "absolute"); - - // set the shadow background - dojo.style(this._bottomRight, "backgroundImage", "url('" + require.toUrl("ibm/images/right_bottom_shadow.png") + "')"); - dojo.style(this._bottomRight, "backgroundPosition", "top right"); - dojo.style(this._bottomRight, "backgroundRepeat", "no-repeat"); - }, - - _createSides : function() { - this._leftSide = dojo.create("div", {}, this.domNode, "first"); - dojo.style(this._leftSide, "position", "absolute"); - dojo.style(this._leftSide, "top", "0px"); - - // set background - dojo.style(this._leftSide, "backgroundImage", "url('" + require.toUrl("ibm/images/left_shadow.png") + "')"); - dojo.style(this._leftSide, "backgroundPosition", "top left"); - - this._rightSide = dojo.create("div", {}, this.domNode, "last"); - dojo.style(this._rightSide, "position", "absolute"); - dojo.style(this._rightSide, "top", "0px"); - - // set background - dojo.style(this._rightSide, "backgroundImage", "url('" + require.toUrl("ibm/images/right_shadow.png") + "')"); - dojo.style(this._rightSide, "backgroundPosition", "top right"); - } - }); -}); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //--> - </script> -</body> -</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/test17-fmt.html b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/test17-fmt.html deleted file mode 100644 index 9d9dc72..0000000 --- a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/test17-fmt.html +++ /dev/null
@@ -1,31 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" -"http://www.w3.org/TR/html4/loose.dtd"> -<html> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> -<title>Insert title here</title> -</head> -<body> - <input onchange="change();"> - <button onclick="dochange();">click</button> - <div></div> - <script type="text/javascript"> - function dochange() { - var input = document.getElementsByTagName("input")[0]; - var div = document.getElementsByTagName("div")[0]; - - var str = ""; - input.setAttribute("value", "bbb"); - for ( var i in window) { - str += i + "=" + window[i] + "<BR>"; - } - div.innerHTML = str; - } - - function change() { - alert(this); - } - </script> - -</body> -</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/test17.html b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/test17.html deleted file mode 100644 index 9d9dc72..0000000 --- a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/test17.html +++ /dev/null
@@ -1,31 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" -"http://www.w3.org/TR/html4/loose.dtd"> -<html> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> -<title>Insert title here</title> -</head> -<body> - <input onchange="change();"> - <button onclick="dochange();">click</button> - <div></div> - <script type="text/javascript"> - function dochange() { - var input = document.getElementsByTagName("input")[0]; - var div = document.getElementsByTagName("div")[0]; - - var str = ""; - input.setAttribute("value", "bbb"); - for ( var i in window) { - str += i + "=" + window[i] + "<BR>"; - } - div.innerHTML = str; - } - - function change() { - alert(this); - } - </script> - -</body> -</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/test18-fmt.html b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/test18-fmt.html deleted file mode 100644 index 2d9c7c1..0000000 --- a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/test18-fmt.html +++ /dev/null
@@ -1,17 +0,0 @@ -<script type="text/javascript"> - $(document).ready(function() { - // load up the meme data - $.getJSON('ajax/test.json', function(data) { - var items = []; - - $.each(data, function(key, val) { - items.push('<li id="' + key + '">' + val + '</li>'); - }); - - $('<ul/>', { - 'class' : 'my-new-list', - html : items.join('') - }).appendTo('body'); - }); - }); -</script>
diff --git a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/test18.html b/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/test18.html deleted file mode 100644 index 9fe269a..0000000 --- a/tests/org.eclipse.wst.jsdt.web.ui.tests/testFiles/test18.html +++ /dev/null
@@ -1,17 +0,0 @@ -<script type="text/javascript"> - $(document).ready(function() { - // load up the meme data - $.getJSON('ajax/test.json', function(data) { - var items = []; - - $.each(data, function(key, val) { - items.push('<li id="' + key + '">' + val + '</li>'); - }); - - $('<ul/>', { - 'class': 'my-new-list', - html: items.join('') - }).appendTo('body'); -}); - }); -</script>