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

Collapse All | Expand All

(-)ASTConverterTestAST3_2.java (-2 / +74 lines)
Lines 106-112 Link Here
106
106
107
	static {
107
	static {
108
//		TESTS_NAMES = new String[] {"test0602"};
108
//		TESTS_NAMES = new String[] {"test0602"};
109
//		TESTS_NUMBERS =  new int[] { 615 };
109
//		TESTS_NUMBERS =  new int[] { 616, 617 };
110
	}
110
	}
111
	public static Test suite() {
111
	public static Test suite() {
112
		return buildTestSuite(ASTConverterTestAST3_2.class);
112
		return buildTestSuite(ASTConverterTestAST3_2.class);
Lines 6666-6670 Link Here
6666
			if (workingCopy != null)
6666
			if (workingCopy != null)
6667
				workingCopy.discardWorkingCopy();
6667
				workingCopy.discardWorkingCopy();
6668
		}
6668
		}
6669
	}	
6669
	}
6670
	/*
6671
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=109333
6672
	 */
6673
	public void test0616() throws JavaModelException {
6674
		ICompilationUnit workingCopy = null;
6675
		try {
6676
			String contents =
6677
				"class X {\n" +
6678
				"	boolean val = true && false && true && false && true;\n" +
6679
				"}";
6680
			workingCopy = getWorkingCopy("/Converter/src/X.java", true/*resolve*/);
6681
			ASTNode node = buildAST(
6682
				contents,
6683
				workingCopy);
6684
			assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
6685
			CompilationUnit unit = (CompilationUnit) node;
6686
			assertProblemsSize(unit, 0);
6687
			node = getASTNode(unit, 0, 0);
6688
			assertNotNull("No node", node);
6689
			assertEquals("Not a field declaration ", ASTNode.FIELD_DECLARATION, node.getNodeType());
6690
			final FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
6691
			final List fragments = fieldDeclaration.fragments();
6692
			assertEquals("Wrong size", 1, fragments.size());
6693
			VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
6694
			final Expression initializer = fragment.getInitializer();
6695
			assertNotNull("No initializer", initializer);
6696
			assertEquals("Not an infix expression", ASTNode.INFIX_EXPRESSION, initializer.getNodeType());
6697
			InfixExpression infixExpression = (InfixExpression) initializer;
6698
			final List extendedOperands = infixExpression.extendedOperands();
6699
			assertEquals("Wrong size", 3, extendedOperands.size());
6700
			assertEquals("Wrong operator", InfixExpression.Operator.CONDITIONAL_AND, infixExpression.getOperator());
6701
		} finally {
6702
			if (workingCopy != null)
6703
				workingCopy.discardWorkingCopy();
6704
		}
6705
	}
6706
	/*
6707
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=109333
6708
	 */
6709
	public void test0617() throws JavaModelException {
6710
		ICompilationUnit workingCopy = null;
6711
		try {
6712
			String contents =
6713
				"class X {\n" +
6714
				"	boolean val = true || false || true || false || true;\n" +
6715
				"}";
6716
			workingCopy = getWorkingCopy("/Converter/src/X.java", true/*resolve*/);
6717
			ASTNode node = buildAST(
6718
				contents,
6719
				workingCopy);
6720
			assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
6721
			CompilationUnit unit = (CompilationUnit) node;
6722
			assertProblemsSize(unit, 0);
6723
			node = getASTNode(unit, 0, 0);
6724
			assertNotNull("No node", node);
6725
			assertEquals("Not a field declaration ", ASTNode.FIELD_DECLARATION, node.getNodeType());
6726
			final FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
6727
			final List fragments = fieldDeclaration.fragments();
6728
			assertEquals("Wrong size", 1, fragments.size());
6729
			VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
6730
			final Expression initializer = fragment.getInitializer();
6731
			assertNotNull("No initializer", initializer);
6732
			assertEquals("Not an infix expression", ASTNode.INFIX_EXPRESSION, initializer.getNodeType());
6733
			InfixExpression infixExpression = (InfixExpression) initializer;
6734
			final List extendedOperands = infixExpression.extendedOperands();
6735
			assertEquals("Wrong size", 3, extendedOperands.size());
6736
			assertEquals("Wrong operator", InfixExpression.Operator.CONDITIONAL_OR, infixExpression.getOperator());
6737
		} finally {
6738
			if (workingCopy != null)
6739
				workingCopy.discardWorkingCopy();
6740
		}
6741
	}
6670
}
6742
}

Return to bug 109333