aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cppeditor/cppdoxygen_test.cpp
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2013-11-19 19:53:48 +0200
committerOrgad Shaneh <orgads@gmail.com>2013-11-21 11:27:47 +0100
commit149242ee6f828b54524226852fc798a2ee5de9a9 (patch)
tree08f5039943dfe6405ef2ddfe3d8017174a4b7ffd /src/plugins/cppeditor/cppdoxygen_test.cpp
parent7a3ff86163dacff2fc0196bf6746b85c462d5993 (diff)
CppEditor: Make doxygen tests data-driven
Change-Id: I7b859a7304cb2a6e19eabf114345b31fe11d98b1 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Diffstat (limited to 'src/plugins/cppeditor/cppdoxygen_test.cpp')
-rw-r--r--src/plugins/cppeditor/cppdoxygen_test.cpp141
1 files changed, 44 insertions, 97 deletions
diff --git a/src/plugins/cppeditor/cppdoxygen_test.cpp b/src/plugins/cppeditor/cppdoxygen_test.cpp
index 8feffc6579..56a75178ff 100644
--- a/src/plugins/cppeditor/cppdoxygen_test.cpp
+++ b/src/plugins/cppeditor/cppdoxygen_test.cpp
@@ -51,6 +51,9 @@ using namespace CPlusPlus;
using namespace CppEditor::Internal;
namespace {
+
+typedef QByteArray _;
+
/**
* Encapsulates the whole process of setting up an editor,
* pressing ENTER and checking the result.
@@ -140,205 +143,149 @@ void TestCase::run(const QByteArray &expected, int undoCount)
}
} // anonymous namespace
-void CppEditorPlugin::test_doxygen_comments_qt_style()
+void CppEditorPlugin::test_doxygen_comments_data()
{
- const QByteArray given =
+ QTest::addColumn<QByteArray>("given");
+ QTest::addColumn<QByteArray>("expected");
+
+ QTest::newRow("qt_style") << _(
"bool preventFolding;\n"
"/*!|\n"
"int a;\n"
- ;
- const QByteArray expected =
+ ) << _(
"bool preventFolding;\n"
"/*!\n"
" * \\brief a\n"
" */\n"
"int a;\n"
- ;
-
- TestCase data(given);
- data.run(expected);
-}
+ );
-void CppEditorPlugin::test_doxygen_comments_qt_style_continuation()
-{
- const QByteArray given =
+ QTest::newRow("qt_style_continuation") << _(
"bool preventFolding;\n"
"/*!\n"
" * \\brief a|\n"
" */\n"
"int a;\n"
- ;
- const QByteArray expected =
+ ) << _(
"bool preventFolding;\n"
"/*!\n"
" * \\brief a\n"
" *\n"
" */\n"
"int a;\n"
- ;
-
- TestCase data(given);
- data.run(expected);
-}
+ );
-void CppEditorPlugin::test_doxygen_comments_java_style()
-{
- const QByteArray given =
+ QTest::newRow("java_style") << _(
"bool preventFolding;\n"
"/**|\n"
"int a;\n"
- ;
- const QByteArray expected =
+ ) << _(
"bool preventFolding;\n"
"/**\n"
" * @brief a\n"
" */\n"
"int a;\n"
- ;
-
- TestCase data(given);
- data.run(expected);
-}
+ );
-void CppEditorPlugin::test_doxygen_comments_java_style_continuation()
-{
- const QByteArray given =
+ QTest::newRow("java_style_continuation") << _(
"bool preventFolding;\n"
"/**\n"
" * @brief a|\n"
" */\n"
"int a;\n"
- ;
- const QByteArray expected =
+ ) << _(
"bool preventFolding;\n"
"/**\n"
" * @brief a\n"
" *\n"
" */\n"
"int a;\n"
- ;
-
- TestCase data(given);
- data.run(expected);
-}
+ );
-void CppEditorPlugin::test_doxygen_comments_cpp_styleA()
-{
- const QByteArray given =
+ QTest::newRow("cpp_styleA") << _(
"bool preventFolding;\n"
"///|\n"
"int a;\n"
- ;
-
- const QByteArray expected =
+ ) << _(
"bool preventFolding;\n"
"///\n"
"/// \\brief a\n"
"///\n"
"int a;\n"
- ;
- TestCase data(given);
- data.run(expected);
-}
+ );
-void CppEditorPlugin::test_doxygen_comments_cpp_styleB()
-{
- const QByteArray given =
+ QTest::newRow("cpp_styleB") << _(
"bool preventFolding;\n"
"//!|\n"
"int a;\n"
- ;
-
- const QByteArray expected =
+ ) << _(
"bool preventFolding;\n"
"//!\n"
"//! \\brief a\n"
"//!\n"
"int a;\n"
- ;
- TestCase data(given);
- data.run(expected);
-}
+ );
-void CppEditorPlugin::test_doxygen_comments_cpp_styleA_continuation()
-{
- const QByteArray given =
+ QTest::newRow("cpp_styleA_continuation") << _(
"bool preventFolding;\n"
"///\n"
"/// \\brief a|\n"
"///\n"
"int a;\n"
- ;
- const QByteArray expected =
+ ) << _(
"bool preventFolding;\n"
"///\n"
"/// \\brief a\n"
"///\n"
"///\n"
"int a;\n"
- ;
-
- TestCase data(given);
- data.run(expected);
-}
+ );
-/// test cpp style doxygen comment when inside a indented scope
-void CppEditorPlugin::test_doxygen_comments_cpp_styleA_indented()
-{
- const QByteArray given =
+ /// test cpp style doxygen comment when inside a indented scope
+ QTest::newRow("cpp_styleA_indented") << _(
" bool preventFolding;\n"
" ///|\n"
" int a;\n"
- ;
-
- const QByteArray expected =
+ ) << _(
" bool preventFolding;\n"
" ///\n"
" /// \\brief a\n"
" ///\n"
" int a;\n"
- ;
- TestCase data(given);
- data.run(expected);
-}
+ );
-/// test cpp style doxygen comment continuation when inside a indented scope
-void CppEditorPlugin::test_doxygen_comments_cpp_styleA_indented_continuation()
-{
- const QByteArray given =
+ /// test cpp style doxygen comment continuation when inside a indented scope
+ QTest::newRow("cpp_styleA_indented_continuation") << _(
" bool preventFolding;\n"
" ///\n"
" /// \\brief a|\n"
" ///\n"
" int a;\n"
- ;
- const QByteArray expected =
+ ) << _(
" bool preventFolding;\n"
" ///\n"
" /// \\brief a\n"
" ///\n"
" ///\n"
" int a;\n"
- ;
+ );
- TestCase data(given);
- data.run(expected);
-}
-
-void CppEditorPlugin::test_doxygen_comments_cpp_styleA_corner_case()
-{
- const QByteArray given =
+ QTest::newRow("cpp_styleA_corner_case") << _(
"bool preventFolding;\n"
"///\n"
"void d(); ///|\n"
- ;
- const QByteArray expected =
+ ) << _(
"bool preventFolding;\n"
"///\n"
"void d(); ///\n"
"\n"
- ;
+ );
+}
+void CppEditorPlugin::test_doxygen_comments()
+{
+ QFETCH(QByteArray, given);
+ QFETCH(QByteArray, expected);
TestCase data(given);
data.run(expected);
}