Skip to content
Snippets Groups Projects
Commit fbecf2f3 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

CppTools: Add tests for nested enums


Discarded during merge from 3.0

Task-number: QTCREATORBUG-5456
Change-Id: I0bb4756e3cdf3c87a4c2b0fbfe6953faaa5e1c52
Reviewed-by: default avatarPrzemyslaw Gorszkowski <pgorszkowski@gmail.com>
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent 94266398
No related branches found
No related tags found
No related merge requests found
...@@ -303,6 +303,7 @@ void CppToolsPlugin::test_completion() ...@@ -303,6 +303,7 @@ void CppToolsPlugin::test_completion()
actualCompletions.sort(); actualCompletions.sort();
expectedCompletions.sort(); expectedCompletions.sort();
QEXPECT_FAIL("enum_in_function_in_struct_in_function", "doesn't work", Abort);
QCOMPARE(actualCompletions, expectedCompletions); QCOMPARE(actualCompletions, expectedCompletions);
} }
...@@ -1678,6 +1679,44 @@ void CppToolsPlugin::test_completion_data() ...@@ -1678,6 +1679,44 @@ void CppToolsPlugin::test_completion_data()
<< QLatin1String("e2") << QLatin1String("e2")
<< QLatin1String("e3")); << QLatin1String("e3"));
QTest::newRow("enum_inside_function") << _(
"void foo()\n"
"{\n"
" enum E { val1, val2, val3 };\n"
" @\n"
"}\n"
) << _("val") << (QStringList()
<< QLatin1String("val1")
<< QLatin1String("val2")
<< QLatin1String("val3"));
QTest::newRow("anon_enum_inside_function") << _(
"void foo()\n"
"{\n"
" enum { val1, val2, val3 };\n"
" @\n"
"}\n"
) << _("val") << (QStringList()
<< QLatin1String("val1")
<< QLatin1String("val2")
<< QLatin1String("val3"));
QTest::newRow("enum_in_function_in_struct_in_function") << _(
"void foo()\n"
"{\n"
" struct S {\n"
" void fun()\n"
" {\n"
" enum E { val1, val2, val3 };\n"
" @\n"
" }\n"
" };\n"
"}\n"
) << _("val") << (QStringList()
<< QLatin1String("val1")
<< QLatin1String("val2")
<< QLatin1String("val3"));
QTest::newRow("enum_inside_function_cxx11_QTCREATORBUG5456") << _( QTest::newRow("enum_inside_function_cxx11_QTCREATORBUG5456") << _(
"void foo()\n" "void foo()\n"
"{\n" "{\n"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment