Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Camelon2003-06-16 21:41:54 +0000
committerJohn Camelon2003-06-16 21:41:54 +0000
commit15f0d2108567cdf1ab8d8a0f0d85fa0d42dcae62 (patch)
treef32be970af09d036daf74cb0bd2cbea93b7de1c3 /core/org.eclipse.cdt.ui.tests
parent138588dd26864c4470f292c47a913390ae61aa46 (diff)
downloadorg.eclipse.cdt-15f0d2108567cdf1ab8d8a0f0d85fa0d42dcae62.tar.gz
org.eclipse.cdt-15f0d2108567cdf1ab8d8a0f0d85fa0d42dcae62.tar.xz
org.eclipse.cdt-15f0d2108567cdf1ab8d8a0f0d85fa0d42dcae62.zip
Patch for Victor Mozgin.
implemented support for pointers to class members; added handling of declarations for nested scopes (like A::B::C); fixed handling of parameter lists for typedefs for functions; some errorhandling in CModelBuilder;
Diffstat (limited to 'core/org.eclipse.cdt.ui.tests')
-rw-r--r--core/org.eclipse.cdt.ui.tests/ChangeLog5
-rw-r--r--core/org.eclipse.cdt.ui.tests/failures/org/eclipse/cdt/core/parser/failedTests/LokiFailures.java4
-rw-r--r--core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/DOMTests.java77
3 files changed, 82 insertions, 4 deletions
diff --git a/core/org.eclipse.cdt.ui.tests/ChangeLog b/core/org.eclipse.cdt.ui.tests/ChangeLog
index 04787b9363..e4ef4a4761 100644
--- a/core/org.eclipse.cdt.ui.tests/ChangeLog
+++ b/core/org.eclipse.cdt.ui.tests/ChangeLog
@@ -1,3 +1,8 @@
+2003-06-14 Victor Mozgin
+ Moved testBugSingleton192() from LokiFailures to DOMTests.
+ Added testPointersToMembers() and testPointersToMemberFunctions() to DOMTests.
+ Added testBug36290() and testBug36931() to DOMTests.
+
2003-06-13 John Camelon
Added Class/Base infrastructure to public interfaces & requestor callback.
Moved many internal interfaces to external packages.
diff --git a/core/org.eclipse.cdt.ui.tests/failures/org/eclipse/cdt/core/parser/failedTests/LokiFailures.java b/core/org.eclipse.cdt.ui.tests/failures/org/eclipse/cdt/core/parser/failedTests/LokiFailures.java
index 994c7378a7..22a0e21718 100644
--- a/core/org.eclipse.cdt.ui.tests/failures/org/eclipse/cdt/core/parser/failedTests/LokiFailures.java
+++ b/core/org.eclipse.cdt.ui.tests/failures/org/eclipse/cdt/core/parser/failedTests/LokiFailures.java
@@ -25,10 +25,6 @@ public class LokiFailures extends BaseDOMTest {
super(name);
}
- public void testBugSingleton192() {
- failTest("int Test::* pMember_;" );
- }
-
public void testBugTypeManip151()
{
Writer code = new StringWriter();
diff --git a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/DOMTests.java b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/DOMTests.java
index 8077467077..a7a0b77fd7 100644
--- a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/DOMTests.java
+++ b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/DOMTests.java
@@ -2082,4 +2082,81 @@ public class DOMTests extends BaseDOMTest {
parse("template <class A,B> X<A,C>::operator A*() { } \n");
parse("template <class A,B> X<A,C>::operator A&() { } \n");
}
+
+ public void testBugSingleton192() throws Exception {
+ parse("int Test::* pMember_;" );
+ }
+
+ public void testPointersToMembers() throws Exception {
+ // Parse and get the translaton unit
+ TranslationUnit translationUnit = parse("int A::* x = 0;");
+
+ List tudeclarations = translationUnit.getDeclarations();
+ assertEquals(1, tudeclarations.size());
+ SimpleDeclaration decl1 = (SimpleDeclaration) tudeclarations.get(0);
+ assertEquals(decl1.getDeclSpecifier().getType(), DeclSpecifier.t_int);
+
+ assertEquals(1, decl1.getDeclarators().size());
+
+ Declarator declarator1 = (Declarator) decl1.getDeclarators().get(0);
+ assertEquals(declarator1.getName().toString(), "x");
+ Expression initValue1 = declarator1.getExpression();
+ assertEquals(initValue1.elements().size(), 1);
+ List ptrOps1 = declarator1.getPointerOperators();
+ assertNotNull(ptrOps1);
+ assertEquals(1, ptrOps1.size());
+ PointerOperator po1 = (PointerOperator) ptrOps1.get(0);
+ assertNotNull(po1);
+ assertFalse(po1.isConst());
+ assertFalse(po1.isVolatile());
+ assertEquals(po1.getType(), PointerOperator.t_pointer_to_member);
+ assertEquals(po1.getNameSpecifier().toString(), "A::");
+ }
+
+ public void testPointersToMemberFunctions() throws Exception
+ {
+ TranslationUnit tu = parse("void (A::*name)(void);");
+ assertEquals( tu.getDeclarations().size(), 1 );
+ SimpleDeclaration declaration = (SimpleDeclaration)tu.getDeclarations().get(0);
+ assertEquals( declaration.getDeclSpecifier().getType(), DeclSpecifier.t_void );
+ assertEquals( declaration.getDeclarators().size(), 1);
+ assertNull( ((Declarator)declaration.getDeclarators().get(0)).getName() );
+ assertNotNull( ((Declarator)declaration.getDeclarators().get(0)).getDeclarator() );
+ assertEquals( ((Declarator)declaration.getDeclarators().get(0)).getDeclarator().getName().toString(), "name" );
+ ParameterDeclarationClause clause = ((Declarator)declaration.getDeclarators().get(0)).getParms();
+ assertEquals( clause.getDeclarations().size(), 1 );
+ assertEquals( ((ParameterDeclaration)clause.getDeclarations().get(0)).getDeclarators().size(), 1 );
+ assertNull( ((Declarator)((ParameterDeclaration)clause.getDeclarations().get(0)).getDeclarators().get(0)).getName() );
+ assertEquals( ((ParameterDeclaration)clause.getDeclarations().get(0)).getDeclSpecifier().getType(), DeclSpecifier.t_void );
+
+ List ptrOps1 = ((Declarator)declaration.getDeclarators().get(0)).getDeclarator().getPointerOperators();
+ assertNotNull(ptrOps1);
+ assertEquals(1, ptrOps1.size());
+ PointerOperator po1 = (PointerOperator) ptrOps1.get(0);
+ assertNotNull(po1);
+ assertFalse(po1.isConst());
+ assertFalse(po1.isVolatile());
+ assertEquals(po1.getType(), PointerOperator.t_pointer_to_member);
+ assertEquals(po1.getNameSpecifier().toString(), "A::");
+ }
+
+ public void testBug36290() throws Exception {
+ parse("typedef void ( A:: * pFunction ) ( void ); ");
+ parse("typedef void (boo) ( void ); ");
+ parse("typedef void boo (void); ");
+ }
+
+ public void testBug36931() throws Exception {
+ parse("A::nested::nested(){}; ");
+ parse("int A::nested::foo() {} ");
+ parse("int A::nested::operator+() {} ");
+ parse("A::nested::operator int() {} ");
+ parse("static const int A::nested::i = 1; ");
+
+ parse("template <class B,C> A<B>::nested::nested(){}; ");
+ parse("template <class B,C> int A::nested<B,D>::foo() {} ");
+ parse("template <class B,C> int A<B,C>::nested<C,B>::operator+() {} ");
+ parse("template <class B,C> A::nested::operator int() {} ");
+ }
+
}

Back to the top