forked from qt-creator/qt-creator
C++: Take multiline strings into account when preprocessing
It was creating extra line(s)... Change-Id: If28a9ccf16195c71747479db838a5589ea6683a0 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
This commit is contained in:
@@ -336,6 +336,8 @@ private slots:
|
||||
void comments_within2_data();
|
||||
void multitokens_argument();
|
||||
void multitokens_argument_data();
|
||||
void multiline_strings();
|
||||
void multiline_strings_data();
|
||||
};
|
||||
|
||||
// Remove all #... lines, and 'simplify' string, to allow easily comparing the result
|
||||
@@ -1298,6 +1300,27 @@ void tst_Preprocessor::comments_within2_data()
|
||||
QTest::newRow("case 4") << original << expected;
|
||||
}
|
||||
|
||||
void tst_Preprocessor::multiline_strings()
|
||||
{
|
||||
compare_input_output();
|
||||
}
|
||||
|
||||
void tst_Preprocessor::multiline_strings_data()
|
||||
{
|
||||
QTest::addColumn<QByteArray>("input");
|
||||
QTest::addColumn<QByteArray>("output");
|
||||
|
||||
QByteArray original;
|
||||
QByteArray expected;
|
||||
|
||||
original = "const char *s = \"abc\\\n"
|
||||
"xyz\";\n";
|
||||
expected = "# 1 \"<stdin>\"\n"
|
||||
"const char *s = \"abc\\\n"
|
||||
"xyz\";\n";
|
||||
QTest::newRow("case 1") << original << expected;
|
||||
}
|
||||
|
||||
void tst_Preprocessor::compare_input_output(bool keepComments)
|
||||
{
|
||||
QFETCH(QByteArray, input);
|
||||
|
||||
Reference in New Issue
Block a user