blob: 57fe2932137111b38908f6a0555119956ea431b4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
/*******************************************************************************
* Copyright (c) 2002, 2005 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 Rational Software - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.parser.failedTests;
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
import org.eclipse.cdt.core.parser.tests.BaseASTTest;
/**
* @author jcamelon
*
*/
public class ASTFailedTests extends BaseASTTest
{
public ASTFailedTests(String name)
{
super(name);
}
public void testBug36730() throws Exception
{
assertCodeFailsParse("FUNCTION_MACRO( 1, a )\n int i;");
}
//Here C99-specific section ends
//Here GCC-specific section starts
public void testBug39676() throws Exception
{
assertCodeFailsParse("struct { int e1, e2; } v = { e2: 0 }");
}
public void testBug39679() throws Exception
{
assertCodeFailsParse("Foo blat() return f(4) {}");
}
public void testBug39682() throws Exception
{
IASTTypedefDeclaration typedef = (IASTTypedefDeclaration)parse("typedef name = (a+1);").getDeclarations().next();
assertFalse(
"The expected error did not occur.",
typedef.getName().equals( "name" ) );
}
public void testBug39687() throws Exception
{
assertCodeFailsParse("struct entry tester (int len; char data[len][len], int len) {}");
}
// public void testBug39688() throws Exception
// {
// Writer code = new StringWriter();
// try
// {
// code.write("#define decl(type, vars...) \\\n");
// code.write(" type vars ;\n");
// code.write("decl(int, x, y)\n");
// }
// catch (IOException ioe)
// {
// }
// assertCodeFailsParse(code.toString());
// }
public void testBug39695A() throws Exception
{
assertCodeFailsParse("int foo asm (\"myfoo\") = 2;");
}
public void testBug39695B() throws Exception
{
assertCodeFailsParse("extern func () asm (\"FUNC\");");
}
public void testBug39695C() throws Exception
{
assertCodeFailsParse("register int *foo asm (\"a5\");");
}
public void testBug39702() throws Exception
{
Writer code = new StringWriter();
try
{
code.write("signature T {\n");
code.write(" int f (int);\n");
code.write(" int f0 () { return f (0); };\n");
code.write("};\n");
}
catch (IOException ioe)
{
}
assertCodeFailsFullParse(code.toString());
}
public void testBug40422() throws Exception {
// Parse and get the translaton unit
parse("int A::* x = 0;").getDeclarations().next();
}
}
|