From f1db96445839575e769d0382adac67450d3f84ea Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Thu, 8 Nov 2012 16:13:47 -0800 Subject: [PATCH] Moved typedef preservation tests to AST2TemplateTests. --- .../core/parser/tests/ast2/AST2CPPTests.java | 91 ------------------- .../parser/tests/ast2/AST2TemplateTests.java | 91 +++++++++++++++++++ 2 files changed, 91 insertions(+), 91 deletions(-) diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java index 98f85fb0796..a8c41262af4 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java @@ -4763,97 +4763,6 @@ public class AST2CPPTests extends AST2BaseTest { assertSame(i, col.getName(7).resolveBinding()); } - // template - // struct basic_string { - // basic_string& operator+=(const T* s); - // basic_string& append(const T* s); - // }; - // - // template - // basic_string operator+(const T* cs, const basic_string& s); - // - // template - // basic_string operator+(const basic_string& s, const T* cs); - // - // typedef basic_string string; - // - // void test(const string& s) { - // auto s1 = "" + s + ""; - // auto s2 = s1 += ""; - // auto s3 = s2.append("foo"); - // } - public void testTypedefPreservation_380498_1() throws Exception { - BindingAssertionHelper ba= getAssertionHelper(); - ICPPVariable s1 = ba.assertNonProblem("s1", ICPPVariable.class); - assertTrue(s1.getType() instanceof ITypedef); - assertEquals("string", ((ITypedef) s1.getType()).getName()); - ICPPVariable s2 = ba.assertNonProblem("s2", ICPPVariable.class); - assertTrue(s2.getType() instanceof ITypedef); - assertEquals("string", ((ITypedef) s2.getType()).getName()); - ICPPVariable s3 = ba.assertNonProblem("s3", ICPPVariable.class); - assertTrue(s3.getType() instanceof ITypedef); - assertEquals("string", ((ITypedef) s3.getType()).getName()); - } - - // template - // struct vector { - // typedef T* const_iterator; - // const_iterator begin() const; - // }; - // - // typedef int Element; - // - // void test(const vector& v) { - // auto it = v.begin(); - // } - public void testTypedefPreservation_380498_2() throws Exception { - BindingAssertionHelper ba= getAssertionHelper(); - ICPPVariable it = ba.assertNonProblem("it =", "it", ICPPVariable.class); - assertTrue(it.getType() instanceof ITypedef); - assertEquals("vector::const_iterator", ASTTypeUtil.getType(it.getType(), false)); - } - - // template class char_traits {}; - // template > class basic_string {}; - // - // template - // struct iterator_traits { - // typedef typename _Iterator::reference reference; - // }; - // - // template - // struct iterator_traits<_Tp*> { - // typedef _Tp& reference; - // }; - // - // template - // struct normal_iterator { - // typedef iterator_traits<_Iterator> traits_type; - // typedef typename traits_type::reference reference; - // reference operator*() const; - // }; - // - // template struct vector { - // typedef T* pointer; - // typedef normal_iterator iterator; - // iterator begin(); - // iterator end(); - // }; - // - // typedef basic_string string; - // - // void test() { - // vector v; - // for (auto s : v) { - // } - // } - public void testTypedefPreservation_380498_3() throws Exception { - BindingAssertionHelper ba= getAssertionHelper(); - ICPPVariable s = ba.assertNonProblem("s :", "s", ICPPVariable.class); - assertTrue(s.getType() instanceof ITypedef); - assertEquals("string", ASTTypeUtil.getType(s.getType(), false)); - } - // int f() { // return 5; // } diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java index 3c8ba19e5b0..9ff2bcef0c5 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java @@ -3704,6 +3704,97 @@ public class AST2TemplateTests extends AST2BaseTest { bh.assertNonProblem("func(p)", 4, ICPPFunction.class); } + // template + // struct basic_string { + // basic_string& operator+=(const T* s); + // basic_string& append(const T* s); + // }; + // + // template + // basic_string operator+(const T* cs, const basic_string& s); + // + // template + // basic_string operator+(const basic_string& s, const T* cs); + // + // typedef basic_string string; + // + // void test(const string& s) { + // auto s1 = "" + s + ""; + // auto s2 = s1 += ""; + // auto s3 = s2.append("foo"); + // } + public void testTypedefPreservation_380498_1() throws Exception { + BindingAssertionHelper ba= getAssertionHelper(); + ICPPVariable s1 = ba.assertNonProblem("s1", ICPPVariable.class); + assertTrue(s1.getType() instanceof ITypedef); + assertEquals("string", ((ITypedef) s1.getType()).getName()); + ICPPVariable s2 = ba.assertNonProblem("s2", ICPPVariable.class); + assertTrue(s2.getType() instanceof ITypedef); + assertEquals("string", ((ITypedef) s2.getType()).getName()); + ICPPVariable s3 = ba.assertNonProblem("s3", ICPPVariable.class); + assertTrue(s3.getType() instanceof ITypedef); + assertEquals("string", ((ITypedef) s3.getType()).getName()); + } + + // template + // struct vector { + // typedef T* const_iterator; + // const_iterator begin() const; + // }; + // + // typedef int Element; + // + // void test(const vector& v) { + // auto it = v.begin(); + // } + public void testTypedefPreservation_380498_2() throws Exception { + BindingAssertionHelper ba= getAssertionHelper(); + ICPPVariable it = ba.assertNonProblem("it =", "it", ICPPVariable.class); + assertTrue(it.getType() instanceof ITypedef); + assertEquals("vector::const_iterator", ASTTypeUtil.getType(it.getType(), false)); + } + + // template class char_traits {}; + // template > class basic_string {}; + // + // template + // struct iterator_traits { + // typedef typename _Iterator::reference reference; + // }; + // + // template + // struct iterator_traits<_Tp*> { + // typedef _Tp& reference; + // }; + // + // template + // struct normal_iterator { + // typedef iterator_traits<_Iterator> traits_type; + // typedef typename traits_type::reference reference; + // reference operator*() const; + // }; + // + // template struct vector { + // typedef T* pointer; + // typedef normal_iterator iterator; + // iterator begin(); + // iterator end(); + // }; + // + // typedef basic_string string; + // + // void test() { + // vector v; + // for (auto s : v) { + // } + // } + public void testTypedefPreservation_380498_3() throws Exception { + BindingAssertionHelper ba= getAssertionHelper(); + ICPPVariable s = ba.assertNonProblem("s :", "s", ICPPVariable.class); + assertTrue(s.getType() instanceof ITypedef); + assertEquals("string", ASTTypeUtil.getType(s.getType(), false)); + } + // template // struct A { // template struct C {