mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Added a test case for bug 229917.
This commit is contained in:
parent
756df1f7d5
commit
72f98fc936
2 changed files with 30 additions and 5 deletions
|
@ -445,21 +445,24 @@ public class AST2BaseTest extends BaseTestCase {
|
|||
|
||||
public IBinding assertProblem(String section, int len) {
|
||||
IBinding binding= binding(section, len);
|
||||
assertTrue("Non-ProblemBinding for name: "+section, binding instanceof IProblemBinding);
|
||||
assertTrue("Non-ProblemBinding for name: " + section.substring(0, len),
|
||||
binding instanceof IProblemBinding);
|
||||
return binding;
|
||||
}
|
||||
|
||||
public IBinding assertNonProblem(String section, int len) {
|
||||
IBinding binding= binding(section, len);
|
||||
assertTrue("ProblemBinding for name: "+section, !(binding instanceof IProblemBinding));
|
||||
assertTrue("ProblemBinding for name: " + section.substring(0, len),
|
||||
!(binding instanceof IProblemBinding));
|
||||
return binding;
|
||||
}
|
||||
|
||||
public <T extends IBinding> T assertNonProblem(String section, int len, Class<T> type, Class... cs) {
|
||||
IBinding binding= binding(section, len);
|
||||
assertTrue("ProblemBinding for name: "+section, !(binding instanceof IProblemBinding));
|
||||
assertTrue("ProblemBinding for name: " + section.substring(0, len),
|
||||
!(binding instanceof IProblemBinding));
|
||||
assertInstance(binding, type);
|
||||
for(Class c : cs) {
|
||||
for (Class c : cs) {
|
||||
assertInstance(binding, c);
|
||||
}
|
||||
return type.cast(binding);
|
||||
|
|
|
@ -2021,7 +2021,29 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
ICPPFunction fn= bh.assertNonProblem("makeClosure(this", 11, ICPPFunction.class);
|
||||
}
|
||||
|
||||
// class A {};
|
||||
// template<class _T1, class _T2>
|
||||
// struct pair {
|
||||
// typedef _T1 first_type;
|
||||
// };
|
||||
//
|
||||
// template <typename _Key, typename _Tp>
|
||||
// struct map {
|
||||
// typedef pair<_Key, _Tp> value_type;
|
||||
// };
|
||||
//
|
||||
// template <class _C>
|
||||
// typename _C::value_type GetPair(_C& collection, typename _C::value_type::first_type key);
|
||||
//
|
||||
// int main(map<int, int> x) {
|
||||
// GetPair(x, 1);
|
||||
// }
|
||||
public void _testBug229917() throws Exception {
|
||||
BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), true);
|
||||
IBinding b0 = bh.assertNonProblem("_C::value_type GetPair", 2, IBinding.class);
|
||||
ICPPFunction fn = bh.assertNonProblem("GetPair(x", 7, ICPPFunction.class);
|
||||
}
|
||||
|
||||
// class A {};
|
||||
//
|
||||
// template <class T> class C {
|
||||
// public:
|
||||
|
|
Loading…
Add table
Reference in a new issue