summaryrefslogtreecommitdiffstats
path: root/tests/auto/tools/moc/tst_moc.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2011-11-10 14:56:55 +0100
committerQt by Nokia <qt-info@nokia.com>2011-11-11 02:45:05 +0100
commit96611a677fc0feeb374c191e248842167f39770d (patch)
tree1611e16ad658117e0e3e53c470f69eca9a4b57a2 /tests/auto/tools/moc/tst_moc.cpp
parentc888e20f22ebd295ac8aa31eb21e19c8377e4805 (diff)
Fix parsing of #if defined expression
We only need to match the closing parentheses if there was an opening one This has caused mis-parsing of tst_qbytearray.cpp Change-Id: I9d52916e3ed8549c5ddd968092451fef7389a952 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Diffstat (limited to 'tests/auto/tools/moc/tst_moc.cpp')
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index aad095d490..6a84eb244a 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -346,11 +346,28 @@ private slots:
void invalidSlot() {}
#endif
-
friend class Receiver; // task #85783
signals:
friend class Sender; // task #85783
+#define MACRO_DEFINED
+
+#if !(defined MACRO_UNDEF || defined MACRO_DEFINED) || 1
+ void signalInIf1();
+#else
+ void doNotExist();
+#endif
+#if !(!defined MACRO_UNDEF || !defined MACRO_DEFINED) && 1
+ void doNotExist();
+#else
+ void signalInIf2();
+#endif
+#if !(!defined (MACRO_DEFINED) || !defined (MACRO_UNDEF)) && 1
+ void doNotExist();
+#else
+ void signalInIf3();
+#endif
+
public slots:
void const slotWithSillyConst() {}
@@ -756,6 +773,10 @@ void tst_Moc::preprocessorConditionals()
QVERIFY(mobj->indexOfSlot("slotInIf()") != -1);
QVERIFY(mobj->indexOfSlot("slotInLastElse()") != -1);
QVERIFY(mobj->indexOfSlot("slotInElif()") != -1);
+ QVERIFY(mobj->indexOfSignal("signalInIf1()") != -1);
+ QVERIFY(mobj->indexOfSignal("signalInIf2()") != -1);
+ QVERIFY(mobj->indexOfSignal("signalInIf3()") != -1);
+ QVERIFY(mobj->indexOfSignal("doNotExist()") == -1);
}
void tst_Moc::blackslashNewlines()