Commit 3ec7f9d3 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Added tests for the new regressions in the C++ parser.

parent ad092d11
...@@ -62,8 +62,10 @@ private slots: ...@@ -62,8 +62,10 @@ private slots:
void function_call_1(); void function_call_1();
void function_call_2(); void function_call_2();
void function_call_3(); void function_call_3();
void function_call_4();
void nested_deref_expression(); void nested_deref_expression();
void assignment_1(); void assignment_1();
void assignment_2();
// objc++ // objc++
void objc_attributes_followed_by_at_keyword(); void objc_attributes_followed_by_at_keyword();
...@@ -215,7 +217,15 @@ void tst_AST::function_call_2() ...@@ -215,7 +217,15 @@ void tst_AST::function_call_2()
void tst_AST::function_call_3() void tst_AST::function_call_3()
{ {
QSharedPointer<TranslationUnit> unit(parseStatement("(*blah) = 10;")); QSharedPointer<TranslationUnit> unit(parseStatement("advance();"));
AST *ast = unit->ast();
QVERIFY(ast != 0);
QVERIFY(ast->asExpressionStatement());
}
void tst_AST::function_call_4()
{
QSharedPointer<TranslationUnit> unit(parseStatement("checkPropertyAttribute(attrAst, propAttrs, ReadWrite);"));
AST *ast = unit->ast(); AST *ast = unit->ast();
QVERIFY(ast != 0); QVERIFY(ast != 0);
QVERIFY(ast->asExpressionStatement()); QVERIFY(ast->asExpressionStatement());
...@@ -237,6 +247,14 @@ void tst_AST::assignment_1() ...@@ -237,6 +247,14 @@ void tst_AST::assignment_1()
QVERIFY(ast->asExpressionStatement()); QVERIFY(ast->asExpressionStatement());
} }
void tst_AST::assignment_2()
{
QSharedPointer<TranslationUnit> unit(parseStatement("(*blah) = 10;"));
AST *ast = unit->ast();
QVERIFY(ast != 0);
QVERIFY(ast->asExpressionStatement());
}
void tst_AST::if_statement() void tst_AST::if_statement()
{ {
QSharedPointer<TranslationUnit> unit(parseStatement("if (a) b;")); QSharedPointer<TranslationUnit> unit(parseStatement("if (a) b;"));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment