|
|
|
@ -276,44 +276,6 @@ static void specialCasesTest(MarkdownFunction applyMarkdown,
@@ -276,44 +276,6 @@ static void specialCasesTest(MarkdownFunction applyMarkdown,
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Testing cases which are common for all types of formatting except multiline code |
|
|
|
|
* @param noSymbols True if it's not allowed to show formatting symbols |
|
|
|
|
* @param map Grouped cases |
|
|
|
|
* @param signs Combination of formatting symbols |
|
|
|
|
*/ |
|
|
|
|
static void commonTest(bool showSymbols, const StringToString map, const QString signs) |
|
|
|
|
{ |
|
|
|
|
for (QString key : map.keys()) { |
|
|
|
|
QString source = key.arg(signs); |
|
|
|
|
QString result = map[key].arg(showSymbols ? signs : "", signsToTags[signs]); |
|
|
|
|
QVERIFY(applyMarkdown(source, showSymbols) == result); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Testing exception cases |
|
|
|
|
* @param signs Combination of formatting symbols |
|
|
|
|
*/ |
|
|
|
|
static void commonExceptionsTest(const QString signs) |
|
|
|
|
{ |
|
|
|
|
for (QString source : commonExceptions) { |
|
|
|
|
QString message = source.arg(signs); |
|
|
|
|
QVERIFY(applyMarkdown(message, false) == message); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Testing some uncommon, special cases |
|
|
|
|
* @param map Grouped cases |
|
|
|
|
*/ |
|
|
|
|
static void specialTest(const StringToString map) |
|
|
|
|
{ |
|
|
|
|
for (QString key : map.keys()) { |
|
|
|
|
QVERIFY(applyMarkdown(key, false) == map[key]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class TestTextFormatter : public QObject |
|
|
|
|
{ |
|
|
|
|
Q_OBJECT |
|
|
|
@ -331,7 +293,6 @@ private slots:
@@ -331,7 +293,6 @@ private slots:
|
|
|
|
|
void singleAndDoubleMarkdownExceptionsShowSymbols(); |
|
|
|
|
void singleAndDoubleMarkdownExceptionsHideSymbols(); |
|
|
|
|
void mixedFormattingSpecialCases(); |
|
|
|
|
void urlTest(); |
|
|
|
|
private: |
|
|
|
|
MarkdownFunction markdownFunction; |
|
|
|
|
}; |
|
|
|
@ -482,11 +443,6 @@ void TestTextFormatter::mixedFormattingSpecialCases()
@@ -482,11 +443,6 @@ void TestTextFormatter::mixedFormattingSpecialCases()
|
|
|
|
|
specialCasesTest(markdownFunction, MIXED_FORMATTING_SPECIAL_CASES); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void TestTextFormatter::urlTest() |
|
|
|
|
{ |
|
|
|
|
specialTest(urlCases); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QTEST_GUILESS_MAIN(TestTextFormatter) |
|
|
|
|
#include "textformatter_test.moc" |
|
|
|
|
|
|
|
|
|