From 82d7ca2e7a8857cfbd7f22f081377a4e61a42846 Mon Sep 17 00:00:00 2001 From: John Camelon Date: Fri, 29 Apr 2005 01:03:20 +0000 Subject: [PATCH] Move failed tests to passing lot. --- .../tests/ast2/AST2CPPSpecFailingTest.java | 75 +------------------ .../parser/tests/ast2/AST2CPPSpecTest.java | 72 ++++++++++++++++++ 2 files changed, 73 insertions(+), 74 deletions(-) diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecFailingTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecFailingTest.java index 0e29707de26..e27b4df96ab 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecFailingTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecFailingTest.java @@ -558,81 +558,8 @@ public class AST2CPPSpecFailingTest extends AST2SpecBaseTest { } } - /** - [--Start Example(CPP 12-1): - struct A { }; // implicitlydeclared A::operator= - struct B : A { - B& operator=(const B &); - }; - B& B::operator=(const B& s) { - this->A::operator=(s); // wellformed - return *this; - } - --End Example] - */ - public void test12s1() { // TODO raised bug 90653 - StringBuffer buffer = new StringBuffer(); - buffer.append("struct A { }; // implicitlydeclared A::operator=\n"); //$NON-NLS-1$ - buffer.append("struct B : A {\n"); //$NON-NLS-1$ - buffer.append("B& operator=(const B &);\n"); //$NON-NLS-1$ - buffer.append("};\n"); //$NON-NLS-1$ - buffer.append("B& B::operator=(const B& s) {\n"); //$NON-NLS-1$ - buffer.append("this->A::operator=(s); // wellformed\n"); //$NON-NLS-1$ - buffer.append("return *this;\n"); //$NON-NLS-1$ - buffer.append("}\n"); //$NON-NLS-1$ - try { - parse(buffer.toString(), ParserLanguage.CPP, true, 0); - assertTrue(false); - } catch (Exception e) { - } - } - /** - [--Start Example(CPP 12.7-2): - struct A { }; - struct B : virtual A { }; - struct C : B { }; - struct D : virtual A { D(A*); }; - struct X { X(A*); }; - struct E : C, D, X { - E() : D(this), // undefined: upcast from E* to A* - // might use path E* ® D* ® A* - // but D is not constructed - // D((C*)this), // defined: - // E* -> C* defined because E() has started - // and C* -> A* defined because - // C fully constructed - X(this) //defined: upon construction of X, - // C/B/D/A sublattice is fully constructed - { } - }; - --End Example] - */ - public void test12_7s2() { // TODO raised bug 90664 - StringBuffer buffer = new StringBuffer(); - buffer.append("struct A { };\n"); //$NON-NLS-1$ - buffer.append("struct B : virtual A { };\n"); //$NON-NLS-1$ - buffer.append("struct C : B { };\n"); //$NON-NLS-1$ - buffer.append("struct D : virtual A { D(A*); };\n"); //$NON-NLS-1$ - buffer.append("struct X { X(A*); };\n"); //$NON-NLS-1$ - buffer.append("struct E : C, D, X {\n"); //$NON-NLS-1$ - buffer.append("E() : D(this), // undefined: upcast from E* to A*\n"); //$NON-NLS-1$ - buffer.append("// might use path E* ® D* ® A*\n"); //$NON-NLS-1$ - buffer.append("// but D is not constructed\n"); //$NON-NLS-1$ - buffer.append("// D((C*)this), // defined:\n"); //$NON-NLS-1$ - buffer.append("// E* ® C* defined because E() has started\n"); //$NON-NLS-1$ - buffer.append("// and C* ® A* defined because\n"); //$NON-NLS-1$ - buffer.append("// C fully constructed\n"); //$NON-NLS-1$ - buffer.append("X(this) //defined: upon construction of X,\n"); //$NON-NLS-1$ - buffer.append("// C/B/D/A sublattice is fully constructed\n"); //$NON-NLS-1$ - buffer.append("{ }\n"); //$NON-NLS-1$ - buffer.append("};\n"); //$NON-NLS-1$ - try { - parse(buffer.toString(), ParserLanguage.CPP, true, 0); - assertTrue(false); - } catch (Exception e) { - } - } + /** [--Start Example(CPP 13.4-5a): diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecTest.java index c22f85e89d5..2ddfda7f92a 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecTest.java @@ -11,6 +11,7 @@ package org.eclipse.cdt.core.parser.tests.ast2; import org.eclipse.cdt.core.parser.ParserLanguage; +import org.eclipse.cdt.internal.core.parser.ParserException; /** * @author dsteffle @@ -11852,4 +11853,75 @@ public class AST2CPPSpecTest extends AST2SpecBaseTest { buffer.append("}\n"); //$NON-NLS-1$ parse(buffer.toString(), ParserLanguage.CPP, true, 0); } + + /** + [--Start Example(CPP 12-1): + struct A { }; // implicitlydeclared A::operator= + struct B : A { + B& operator=(const B &); + }; + B& B::operator=(const B& s) { + this->A::operator=(s); // wellformed + return *this; + } + --End Example] + * @throws ParserException + */ + public void test12s1() throws ParserException { + StringBuffer buffer = new StringBuffer(); + buffer.append("struct A { }; // implicitlydeclared A::operator=\n"); //$NON-NLS-1$ + buffer.append("struct B : A {\n"); //$NON-NLS-1$ + buffer.append("B& operator=(const B &);\n"); //$NON-NLS-1$ + buffer.append("};\n"); //$NON-NLS-1$ + buffer.append("B& B::operator=(const B& s) {\n"); //$NON-NLS-1$ + buffer.append("this->A::operator=(s); // wellformed\n"); //$NON-NLS-1$ + buffer.append("return *this;\n"); //$NON-NLS-1$ + buffer.append("}\n"); //$NON-NLS-1$ + parse(buffer.toString(), ParserLanguage.CPP, true, 0); + } + + /** + [--Start Example(CPP 12.7-2): + struct A { }; + struct B : virtual A { }; + struct C : B { }; + struct D : virtual A { D(A*); }; + struct X { X(A*); }; + struct E : C, D, X { + E() : D(this), // undefined: upcast from E* to A* + // might use path E* ® D* ® A* + // but D is not constructed + // D((C*)this), // defined: + // E* -> C* defined because E() has started + // and C* -> A* defined because + // C fully constructed + X(this) //defined: upon construction of X, + // C/B/D/A sublattice is fully constructed + { } + }; + --End Example] + * @throws ParserException + */ + public void test12_7s2() throws ParserException { + StringBuffer buffer = new StringBuffer(); + buffer.append("struct A { };\n"); //$NON-NLS-1$ + buffer.append("struct B : virtual A { };\n"); //$NON-NLS-1$ + buffer.append("struct C : B { };\n"); //$NON-NLS-1$ + buffer.append("struct D : virtual A { D(A*); };\n"); //$NON-NLS-1$ + buffer.append("struct X { X(A*); };\n"); //$NON-NLS-1$ + buffer.append("struct E : C, D, X {\n"); //$NON-NLS-1$ + buffer.append("E() : D(this), // undefined: upcast from E* to A*\n"); //$NON-NLS-1$ + buffer.append("// might use path E* ® D* ® A*\n"); //$NON-NLS-1$ + buffer.append("// but D is not constructed\n"); //$NON-NLS-1$ + buffer.append("// D((C*)this), // defined:\n"); //$NON-NLS-1$ + buffer.append("// E* ® C* defined because E() has started\n"); //$NON-NLS-1$ + buffer.append("// and C* ® A* defined because\n"); //$NON-NLS-1$ + buffer.append("// C fully constructed\n"); //$NON-NLS-1$ + buffer.append("X(this) //defined: upon construction of X,\n"); //$NON-NLS-1$ + buffer.append("// C/B/D/A sublattice is fully constructed\n"); //$NON-NLS-1$ + buffer.append("{ }\n"); //$NON-NLS-1$ + buffer.append("};\n"); //$NON-NLS-1$ + parse(buffer.toString(), ParserLanguage.CPP, true, 0); + } + }