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

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java (-1 / +55 lines)
Lines 39-45 Link Here
39
	}
39
	}
40
40
41
	static {
41
	static {
42
//		TESTS_NUMBERS = new int[] { 192 };
42
//		TESTS_NUMBERS = new int[] { 194 };
43
//		TESTS_NAMES = new String[] {"test0189"};
43
//		TESTS_NAMES = new String[] {"test0189"};
44
	}
44
	}
45
	public static Test suite() {
45
	public static Test suite() {
Lines 5785-5788 Link Here
5785
	   	assertTrue("should yield a null, not a malformed binding", 
5785
	   	assertTrue("should yield a null, not a malformed binding", 
5786
	   			bindings[0] == null);
5786
	   			bindings[0] == null);
5787
	}
5787
	}
5788
	
5789
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=104492
5790
	public void test0193() throws JavaModelException {
5791
    	this.workingCopy = getWorkingCopy("/Converter15/src/X.java", true/*resolve*/);
5792
    	String contents =
5793
			"public class X {\n" +
5794
			"    public static void main(String[] args) {\n" +
5795
			"        byte[] b1 = new byte[0];\n" +
5796
			"        byte[] b2 = new byte[0];\n" +
5797
			"        for (byte[] bs : new byte[][] { b1, b2 }) {}\n" +
5798
			"    }\n" +
5799
			"}";
5800
    	ASTNode node = buildAST(
5801
    			contents,
5802
    			this.workingCopy);
5803
    	assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
5804
    	CompilationUnit unit = (CompilationUnit) node;
5805
    	node = getASTNode(unit, 0, 0, 2);
5806
    	assertEquals("Not an enhanced for statement", ASTNode.ENHANCED_FOR_STATEMENT, node.getNodeType());
5807
    	EnhancedForStatement forStatement = (EnhancedForStatement) node;
5808
    	SingleVariableDeclaration singleVariableDeclaration = forStatement.getParameter();
5809
    	assertEquals("Should be 0", 0, singleVariableDeclaration.getExtraDimensions());
5810
    	Type type = singleVariableDeclaration.getType();
5811
    	assertEquals("Not an array type", ASTNode.ARRAY_TYPE, type.getNodeType());
5812
    	ArrayType arrayType = (ArrayType) type;
5813
    	assertEquals("Should be 1", 1, arrayType.getDimensions());
5814
    }
5815
	
5816
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=104492
5817
	public void test0194() throws JavaModelException {
5818
    	this.workingCopy = getWorkingCopy("/Converter15/src/X.java", true/*resolve*/);
5819
    	String contents =
5820
			"public class X {\n" +
5821
			"    public static void main(String[] args) {\n" +
5822
			"        byte[] b1 = new byte[0];\n" +
5823
			"        byte[] b2 = new byte[0];\n" +
5824
			"        for (byte[] bs/*comment*/ [ /*comment*/ ]: new byte[][][] { new byte[][] { b1, b2 }}) {}\n" +
5825
			"    }\n" +
5826
			"}";
5827
    	ASTNode node = buildAST(
5828
    			contents,
5829
    			this.workingCopy);
5830
    	assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
5831
    	CompilationUnit unit = (CompilationUnit) node;
5832
    	node = getASTNode(unit, 0, 0, 2);
5833
    	assertEquals("Not an enhanced for statement", ASTNode.ENHANCED_FOR_STATEMENT, node.getNodeType());
5834
    	EnhancedForStatement forStatement = (EnhancedForStatement) node;
5835
    	SingleVariableDeclaration singleVariableDeclaration = forStatement.getParameter();
5836
    	assertEquals("Should be 1", 1, singleVariableDeclaration.getExtraDimensions());
5837
    	Type type = singleVariableDeclaration.getType();
5838
    	assertEquals("Not an array type", ASTNode.ARRAY_TYPE, type.getNodeType());
5839
    	ArrayType arrayType = (ArrayType) type;
5840
    	assertEquals("Should be 1", 1, arrayType.getDimensions());
5841
	}
5788
}
5842
}

Return to bug 104492