View | Details | Raw Unified | Return to bug 203579 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java (-1 / +59 lines)
Lines 120-126 Link Here
120
	static {
120
	static {
121
//		TESTS_NAMES = new String[] {"test0602"};
121
//		TESTS_NAMES = new String[] {"test0602"};
122
//		TESTS_RANGE = new int[] { 670, -1 };
122
//		TESTS_RANGE = new int[] { 670, -1 };
123
//		TESTS_NUMBERS =  new int[] { 684, 685 };
123
//		TESTS_NUMBERS =  new int[] { 631 };
124
	}
124
	}
125
	public static Test suite() {
125
	public static Test suite() {
126
		return buildModelTestSuite(ASTConverterTestAST3_2.class);
126
		return buildModelTestSuite(ASTConverterTestAST3_2.class);
Lines 9452-9455 Link Here
9452
		final String qualifiedName = typeBinding.getQualifiedName();
9452
		final String qualifiedName = typeBinding.getQualifiedName();
9453
		assertEquals("wrong qualified name", "", qualifiedName);
9453
		assertEquals("wrong qualified name", "", qualifiedName);
9454
	}
9454
	}
9455
9456
	/*
9457
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=203579
9458
	 */
9459
	public void test0686() throws JavaModelException {
9460
		ICompilationUnit workingCopy = null;
9461
		try {
9462
			String contents =
9463
				"public class X {\n" + 
9464
				"	void foo() {\n" + 
9465
				"		int   a  ,   b  ;\n" + 
9466
				"		for (int  i  ,  j  ;;) {}\n" + 
9467
				"	}\n" + 
9468
				"	int   n  ,   m  ;\n" + 
9469
				"}";
9470
			workingCopy = getWorkingCopy("/Converter/src/X.java", true/*resolve*/);
9471
			ASTNode node = buildAST(
9472
				contents,
9473
				workingCopy);
9474
			assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
9475
			CompilationUnit unit = (CompilationUnit) node;
9476
			assertProblemsSize(unit, 0);
9477
			node = getASTNode(unit, 0, 0, 0);
9478
			assertEquals("Not a variable statement declaration", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
9479
			VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
9480
			List fragments = statement.fragments();
9481
			assertEquals("Wrong size", 2, fragments.size());
9482
			VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
9483
			checkSourceRange(fragment, "a", contents);
9484
			fragment = (VariableDeclarationFragment) fragments.get(1);
9485
			checkSourceRange(fragment, "b", contents);
9486
			node = getASTNode(unit, 0, 0, 1);
9487
			assertEquals("Not a for statement", ASTNode.FOR_STATEMENT, node.getNodeType());
9488
			ForStatement forStatement = (ForStatement) node;
9489
			final List initializers = forStatement.initializers();
9490
			assertEquals("Wrong size", 1, initializers.size());
9491
			VariableDeclarationExpression expression = (VariableDeclarationExpression) initializers.get(0);
9492
			fragments = expression.fragments();
9493
			assertEquals("Wrong size", 2, fragments.size());
9494
			fragment = (VariableDeclarationFragment) fragments.get(0);
9495
			checkSourceRange(fragment, "i", contents);
9496
			fragment = (VariableDeclarationFragment) fragments.get(1);
9497
			checkSourceRange(fragment, "j", contents);
9498
9499
			node = getASTNode(unit, 0, 1);
9500
			assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
9501
			FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
9502
			fragments = fieldDeclaration.fragments();
9503
			assertEquals("Wrong size", 2, fragments.size());
9504
			fragment = (VariableDeclarationFragment) fragments.get(0);
9505
			checkSourceRange(fragment, "n", contents);
9506
			fragment = (VariableDeclarationFragment) fragments.get(1);
9507
			checkSourceRange(fragment, "m", contents);
9508
		} finally {
9509
			if (workingCopy != null)
9510
				workingCopy.discardWorkingCopy();
9511
		}
9512
	}
9455
}
9513
}

Return to bug 203579