forked from qt-creator/qt-creator
CppTools: Support ObjC in member access operator tests
Actual test is added in a follow-up commit. Change-Id: I645d1e50d4ac9d281e31a0375f64fea849bf5e25 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
b6e52b0c37
commit
5b12c8d63a
@@ -63,7 +63,8 @@ typedef QByteArray _;
|
||||
class CompletionTestCase : public Tests::TestCase
|
||||
{
|
||||
public:
|
||||
CompletionTestCase(const QByteArray &sourceText, const QByteArray &textToInsert = QByteArray())
|
||||
CompletionTestCase(const QByteArray &sourceText, const QByteArray &textToInsert = QByteArray(),
|
||||
bool isObjC = false)
|
||||
: m_position(-1), m_editorWidget(0), m_textDocument(0), m_editor(0)
|
||||
{
|
||||
QVERIFY(succeededSoFar());
|
||||
@@ -77,7 +78,8 @@ public:
|
||||
// Write source to file
|
||||
m_temporaryDir.reset(new Tests::TemporaryDir());
|
||||
QVERIFY(m_temporaryDir->isValid());
|
||||
const QString fileName = m_temporaryDir->createFile("file.h", m_source);
|
||||
const QByteArray fileExt = isObjC ? ".mm" : ".h";
|
||||
const QString fileName = m_temporaryDir->createFile("file." + fileExt, m_source);
|
||||
QVERIFY(!fileName.isEmpty());
|
||||
|
||||
// Open in editor
|
||||
@@ -3361,9 +3363,10 @@ void CppToolsPlugin::test_completion_member_access_operator()
|
||||
QFETCH(QByteArray, code);
|
||||
QFETCH(QByteArray, prefix);
|
||||
QFETCH(QStringList, expectedCompletions);
|
||||
QFETCH(bool, isObjC);
|
||||
QFETCH(bool, expectedReplaceAccessOperator);
|
||||
|
||||
CompletionTestCase test(code, prefix);
|
||||
CompletionTestCase test(code, prefix, isObjC);
|
||||
QVERIFY(test.succeededSoFar());
|
||||
|
||||
bool replaceAccessOperator = false;
|
||||
@@ -3381,6 +3384,7 @@ void CppToolsPlugin::test_completion_member_access_operator_data()
|
||||
QTest::addColumn<QByteArray>("code");
|
||||
QTest::addColumn<QByteArray>("prefix");
|
||||
QTest::addColumn<QStringList>("expectedCompletions");
|
||||
QTest::addColumn<bool>("isObjC");
|
||||
QTest::addColumn<bool>("expectedReplaceAccessOperator");
|
||||
|
||||
QTest::newRow("member_access_operator") << _(
|
||||
@@ -3391,6 +3395,7 @@ void CppToolsPlugin::test_completion_member_access_operator_data()
|
||||
) << _("s.") << (QStringList()
|
||||
<< QLatin1String("S")
|
||||
<< QLatin1String("t"))
|
||||
<< false
|
||||
<< true;
|
||||
|
||||
QTest::newRow("typedef_of_type_and_decl_of_type_no_replace_access_operator") << _(
|
||||
@@ -3401,6 +3406,7 @@ void CppToolsPlugin::test_completion_member_access_operator_data()
|
||||
) << _("p.") << (QStringList()
|
||||
<< QLatin1String("S")
|
||||
<< QLatin1String("m"))
|
||||
<< false
|
||||
<< false;
|
||||
|
||||
QTest::newRow("typedef_of_pointer_and_decl_of_pointer_no_replace_access_operator") << _(
|
||||
@@ -3409,6 +3415,7 @@ void CppToolsPlugin::test_completion_member_access_operator_data()
|
||||
"SType *p;\n"
|
||||
"@\n"
|
||||
) << _("p.") << (QStringList())
|
||||
<< false
|
||||
<< false;
|
||||
|
||||
QTest::newRow("typedef_of_type_and_decl_of_pointer_replace_access_operator") << _(
|
||||
@@ -3419,6 +3426,7 @@ void CppToolsPlugin::test_completion_member_access_operator_data()
|
||||
) << _("p.") << (QStringList()
|
||||
<< QLatin1String("S")
|
||||
<< QLatin1String("m"))
|
||||
<< false
|
||||
<< true;
|
||||
|
||||
QTest::newRow("typedef_of_pointer_and_decl_of_type_replace_access_operator") << _(
|
||||
@@ -3429,6 +3437,7 @@ void CppToolsPlugin::test_completion_member_access_operator_data()
|
||||
) << _("p.") << (QStringList()
|
||||
<< QLatin1String("S")
|
||||
<< QLatin1String("m"))
|
||||
<< false
|
||||
<< true;
|
||||
|
||||
QTest::newRow("predecl_typedef_of_type_and_decl_of_pointer_replace_access_operator") << _(
|
||||
@@ -3439,6 +3448,7 @@ void CppToolsPlugin::test_completion_member_access_operator_data()
|
||||
) << _("p.") << (QStringList()
|
||||
<< QLatin1String("S")
|
||||
<< QLatin1String("m"))
|
||||
<< false
|
||||
<< true;
|
||||
|
||||
QTest::newRow("predecl_typedef_of_type_and_decl_type_no_replace_access_operator") << _(
|
||||
@@ -3449,6 +3459,7 @@ void CppToolsPlugin::test_completion_member_access_operator_data()
|
||||
) << _("p.") << (QStringList()
|
||||
<< QLatin1String("S")
|
||||
<< QLatin1String("m"))
|
||||
<< false
|
||||
<< false;
|
||||
|
||||
QTest::newRow("predecl_typedef_of_pointer_and_decl_of_pointer_no_replace_access_operator") << _(
|
||||
@@ -3457,6 +3468,7 @@ void CppToolsPlugin::test_completion_member_access_operator_data()
|
||||
"SType *p;\n"
|
||||
"@\n"
|
||||
) << _("p.") << (QStringList())
|
||||
<< false
|
||||
<< false;
|
||||
|
||||
QTest::newRow("predecl_typedef_of_pointer_and_decl_of_type_replace_access_operator") << _(
|
||||
@@ -3467,6 +3479,7 @@ void CppToolsPlugin::test_completion_member_access_operator_data()
|
||||
) << _("p.") << (QStringList()
|
||||
<< QLatin1String("S")
|
||||
<< QLatin1String("m"))
|
||||
<< false
|
||||
<< true;
|
||||
|
||||
QTest::newRow("typedef_of_pointer_of_type_replace_access_operator") << _(
|
||||
@@ -3478,6 +3491,7 @@ void CppToolsPlugin::test_completion_member_access_operator_data()
|
||||
) << _("p.") << (QStringList()
|
||||
<< QLatin1String("S")
|
||||
<< QLatin1String("m"))
|
||||
<< false
|
||||
<< true;
|
||||
|
||||
QTest::newRow("typedef_of_pointer_of_type_no_replace_access_operator") << _(
|
||||
@@ -3489,5 +3503,6 @@ void CppToolsPlugin::test_completion_member_access_operator_data()
|
||||
) << _("p->") << (QStringList()
|
||||
<< QLatin1String("S")
|
||||
<< QLatin1String("m"))
|
||||
<< false
|
||||
<< false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user