Lines 114-120
Link Here
|
114 |
// Run test cases subset |
114 |
// Run test cases subset |
115 |
COPY_DIR = false; |
115 |
COPY_DIR = false; |
116 |
System.err.println("WARNING: only subset of tests will be executed!!!"); |
116 |
System.err.println("WARNING: only subset of tests will be executed!!!"); |
117 |
suite.addTest(new ASTConverterJavadocTest("testBug70892_JLS3")); |
117 |
suite.addTest(new ASTConverterJavadocTest("testBug165525")); |
118 |
return suite; |
118 |
return suite; |
119 |
} |
119 |
} |
120 |
|
120 |
|
Lines 3415-3418
Link Here
|
3415 |
assertEquals("Comment should be javadoc", comment.getNodeType(), ASTNode.JAVADOC); |
3415 |
assertEquals("Comment should be javadoc", comment.getNodeType(), ASTNode.JAVADOC); |
3416 |
} |
3416 |
} |
3417 |
} |
3417 |
} |
|
|
3418 |
|
3419 |
/** |
3420 |
* @bug 165525: [comments] ASTParser excludes trailing line comments from extended range of fields in enums |
3421 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=165525" |
3422 |
*/ |
3423 |
public void testBug165525() throws JavaModelException { |
3424 |
workingCopies = new ICompilationUnit[1]; |
3425 |
workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b165525/Test.java", |
3426 |
"package javadoc.b165525;\n" + |
3427 |
"public enum Test {\n" + |
3428 |
" ENUM_CONST_1(\"String constant 1\") //$NON-NLS-1$\n" + |
3429 |
" , ENUM_CONST_2(\"String constant 2\") //$NON-NLS-1$\n" + |
3430 |
" ;\n" + |
3431 |
" Test(String x) {\n" + |
3432 |
" }\n" + |
3433 |
" String a = \"a\"; //$NON-NLS-1$\n" + |
3434 |
" String b = \"b\"; //$NON-NLS-1$\n" + |
3435 |
"}\n" |
3436 |
); |
3437 |
System.out.println(workingCopies[0].getSource()); |
3438 |
CompilationUnit compilUnit = (CompilationUnit) runConversion(AST.JLS3, workingCopies[0], true); |
3439 |
verifyWorkingCopiesComments(); |
3440 |
if (docCommentSupport.equals(JavaCore.ENABLED)) { |
3441 |
// Verify comment type |
3442 |
List unitComments = compilUnit.getCommentList(); |
3443 |
assertEquals("Wrong number of comments", 4, unitComments.size()); |
3444 |
|
3445 |
// Verify extension of first enum declaration constant |
3446 |
Comment comment = (Comment) unitComments.get(0); |
3447 |
EnumDeclaration enumDeclaration = (EnumDeclaration) compilUnit.types().get(0); |
3448 |
EnumConstantDeclaration constantDeclaration = (EnumConstantDeclaration) enumDeclaration.enumConstants().get(0); |
3449 |
int declarationEnd = constantDeclaration.getStartPosition() + compilUnit.getExtendedLength(constantDeclaration) - 1; |
3450 |
int commentEnd = comment.getStartPosition() + comment.getLength() - 1; |
3451 |
assumeEquals("Enum constant declaration "+constantDeclaration+" does not have the correct length", commentEnd, declarationEnd); |
3452 |
|
3453 |
// Verify extension of second enum declaration constant |
3454 |
comment = (Comment) unitComments.get(1); |
3455 |
constantDeclaration = (EnumConstantDeclaration) enumDeclaration.enumConstants().get(1); |
3456 |
declarationEnd = constantDeclaration.getStartPosition() + compilUnit.getExtendedLength(constantDeclaration) - 1; |
3457 |
commentEnd = comment.getStartPosition() + comment.getLength() - 1; |
3458 |
assumeEquals("Enum constant declaration "+constantDeclaration+" does not have the correct length", commentEnd, declarationEnd); |
3459 |
|
3460 |
// Verify extension of first field declaration |
3461 |
comment = (Comment) unitComments.get(2); |
3462 |
FieldDeclaration fieldDeclaration = (FieldDeclaration) enumDeclaration.bodyDeclarations().get(1); |
3463 |
declarationEnd = fieldDeclaration.getStartPosition() + compilUnit.getExtendedLength(fieldDeclaration) - 1; |
3464 |
commentEnd = comment.getStartPosition() + comment.getLength() - 1; |
3465 |
assumeEquals("Enum constant declaration "+constantDeclaration+" does not have the correct length", commentEnd, declarationEnd); |
3466 |
|
3467 |
// Verify extension of second field declaration |
3468 |
comment = (Comment) unitComments.get(3); |
3469 |
fieldDeclaration = (FieldDeclaration) enumDeclaration.bodyDeclarations().get(2); |
3470 |
declarationEnd = fieldDeclaration.getStartPosition() + compilUnit.getExtendedLength(fieldDeclaration) - 1; |
3471 |
commentEnd = comment.getStartPosition() + comment.getLength() - 1; |
3472 |
assumeEquals("Enum constant declaration "+constantDeclaration+" does not have the correct length", commentEnd, declarationEnd); |
3473 |
} |
3474 |
} |
3418 |
} |
3475 |
} |