diff options
author | Edward Welbourne <edward.welbourne@theqtcompany.com> | 2015-10-12 10:41:21 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@theqtcompany.com> | 2015-10-16 13:59:59 +0000 |
commit | 1901adbab796e27e7ed862e850a2171ffc4dde90 (patch) | |
tree | 65d3be617df8157936a8e553716c86bd63b45f01 /tests/auto/tools | |
parent | dde8d5e3a006c87b7a3f18733ba255d6354fcd37 (diff) |
Split two error cases so they get reported distinctly.
If a macro is used with too few parameters, complaining about its
definition using '#' followed by something other than a macro
parameter name is apt to be confusing - reading the definition will
reveal that the name in fact is a macro parameter after all. The
reader needs attention directed to the invocation, not the definition.
Split the test in two: one to test the prior error message does in
fact get produced for an invalid macro definition, the other to test
the invalid invocation case.
Task-number: QTBUG-46210
Change-Id: Ie177a56d346e553bf9d67e2008a4352633afa1ae
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'tests/auto/tools')
-rw-r--r-- | tests/auto/tools/moc/tst_moc.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index fa1b68b4f9..4fa98b6ecb 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -1883,12 +1883,19 @@ void tst_Moc::warnings_data() << QString() << QString("standard input:5: Error: Class declaration lacks Q_OBJECT macro."); - QTest::newRow("QTBUG-46210: crash on invalid macro") - << QByteArray("#define Foo(a, b, c) a b c #a #b #c a##b##c #d\n Foo(45);") + QTest::newRow("Invalid macro definition") + << QByteArray("#define Foo(a, b, c) a b c #a #b #c a##b##c #d\n Foo(45, 42, 39);") << QStringList() << 1 << QString("IGNORE_ALL_STDOUT") << QString(":2: Error: '#' is not followed by a macro parameter"); + + QTest::newRow("QTBUG-46210: crash on invalid macro invocation") + << QByteArray("#define Foo(a, b, c) a b c #a #b #c a##b##c\n Foo(45);") + << QStringList() + << 1 + << QString("IGNORE_ALL_STDOUT") + << QString(":2: Error: Macro invoked with too few parameters for a use of '#'"); } void tst_Moc::warnings() |