1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-05 00:36:16 +02:00

Moved typedef preservation tests to AST2TemplateTests.

This commit is contained in:
Sergey Prigogin 2012-11-08 16:13:47 -08:00
parent 1eaf5662fe
commit f1db964458
2 changed files with 91 additions and 91 deletions

View file

@ -4763,97 +4763,6 @@ public class AST2CPPTests extends AST2BaseTest {
assertSame(i, col.getName(7).resolveBinding());
}
// template<typename T>
// struct basic_string {
// basic_string& operator+=(const T* s);
// basic_string& append(const T* s);
// };
//
// template<typename T>
// basic_string<T> operator+(const T* cs, const basic_string<T>& s);
//
// template<typename T>
// basic_string<T> operator+(const basic_string<T>& s, const T* cs);
//
// typedef basic_string<char> 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 <typename T>
// struct vector {
// typedef T* const_iterator;
// const_iterator begin() const;
// };
//
// typedef int Element;
//
// void test(const vector<Element>& 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<Element>::const_iterator", ASTTypeUtil.getType(it.getType(), false));
}
// template <typename T> class char_traits {};
// template <typename C, typename T = char_traits<C>> class basic_string {};
//
// template<typename _Iterator>
// struct iterator_traits {
// typedef typename _Iterator::reference reference;
// };
//
// template<typename _Tp>
// struct iterator_traits<_Tp*> {
// typedef _Tp& reference;
// };
//
// template<typename _Iterator, typename _Container>
// struct normal_iterator {
// typedef iterator_traits<_Iterator> traits_type;
// typedef typename traits_type::reference reference;
// reference operator*() const;
// };
//
// template <typename T> struct vector {
// typedef T* pointer;
// typedef normal_iterator<pointer, vector> iterator;
// iterator begin();
// iterator end();
// };
//
// typedef basic_string<char> string;
//
// void test() {
// vector<string> 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;
// }

View file

@ -3704,6 +3704,97 @@ public class AST2TemplateTests extends AST2BaseTest {
bh.assertNonProblem("func(p)", 4, ICPPFunction.class);
}
// template<typename T>
// struct basic_string {
// basic_string& operator+=(const T* s);
// basic_string& append(const T* s);
// };
//
// template<typename T>
// basic_string<T> operator+(const T* cs, const basic_string<T>& s);
//
// template<typename T>
// basic_string<T> operator+(const basic_string<T>& s, const T* cs);
//
// typedef basic_string<char> 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 <typename T>
// struct vector {
// typedef T* const_iterator;
// const_iterator begin() const;
// };
//
// typedef int Element;
//
// void test(const vector<Element>& 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<Element>::const_iterator", ASTTypeUtil.getType(it.getType(), false));
}
// template <typename T> class char_traits {};
// template <typename C, typename T = char_traits<C>> class basic_string {};
//
// template<typename _Iterator>
// struct iterator_traits {
// typedef typename _Iterator::reference reference;
// };
//
// template<typename _Tp>
// struct iterator_traits<_Tp*> {
// typedef _Tp& reference;
// };
//
// template<typename _Iterator, typename _Container>
// struct normal_iterator {
// typedef iterator_traits<_Iterator> traits_type;
// typedef typename traits_type::reference reference;
// reference operator*() const;
// };
//
// template <typename T> struct vector {
// typedef T* pointer;
// typedef normal_iterator<pointer, vector> iterator;
// iterator begin();
// iterator end();
// };
//
// typedef basic_string<char> string;
//
// void test() {
// vector<string> 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 <typename CL, typename T>
// struct A {
// template<typename U> struct C {