summaryrefslogtreecommitdiffstats
path: root/tests/auto/other/compiler
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-11-15 11:36:18 +1000
committerQt by Nokia <qt-info@nokia.com>2011-11-18 01:51:57 +0100
commita8fd0c3654f8352773638633778cd8003680cbc7 (patch)
tree4815cca9daf879b96a92a3de95621b56ac5ba868 /tests/auto/other/compiler
parentd90d57bb8b995c7a66e7f9b7b2515447fbe11de0 (diff)
Don't depend on moc to disable test functions.
The moc tool is not aware of all defines (particularly those that are compiler builtins) and does not correctly evaluate others that depend on compiler builtins, such as Q_OS_FOO. This commit reverts parts of the following commits, but is not a complete fix as there were many instances of this problem in the tests prior to those commits: 924d810dbdcd5b5b0fa860922b2487ea9062d002 8aaff6751038b88d17e23be6fcee945771297c5b 338d3f11973412047c2c9cd41cbd0c961d738ef3 a55034062ba2bf73a9f1ed3d9cf31745b38149e3 253497b7446c7d723aa3bdd7152e25d6852f2604 7cfad460c56319ba89c4a3a0bbcb2e54ab1cdbc6 9d2ff58f3642828e494e7e9b2df7dbb8e2cd408f 0cf6baa2d61ebaad2a2a0530c37f27e719b68f4b Change-Id: I947d797fe3ec76139ba1b55561cea569895662c5 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/other/compiler')
-rw-r--r--tests/auto/other/compiler/tst_compiler.cpp46
1 files changed, 24 insertions, 22 deletions
diff --git a/tests/auto/other/compiler/tst_compiler.cpp b/tests/auto/other/compiler/tst_compiler.cpp
index 71c133a44e..b6fb391fb1 100644
--- a/tests/auto/other/compiler/tst_compiler.cpp
+++ b/tests/auto/other/compiler/tst_compiler.cpp
@@ -39,7 +39,6 @@
**
****************************************************************************/
-
#include <QtCore/QtCore>
#include <QtTest/QtTest>
@@ -49,43 +48,24 @@
#include "baseclass.h"
#include "derivedclass.h"
-#if defined(Q_CC_HPACC)
-# define DONT_TEST_TEMPLATE_CONSTRUCTORS
-# define DONT_TEST_CONSTRUCTOR_SPECIALIZATION
-# define DONT_TEST_DATASTREAM_DETECTION
-#endif
-
-#if defined(Q_CC_SUN)
-# define DONT_TEST_STL_SORTING
-#endif
-
QT_USE_NAMESPACE
class tst_Compiler : public QObject
{
Q_OBJECT
-
private slots:
void template_methods();
-#ifndef DONT_TEST_TEMPLATE_CONSTRUCTORS
void template_constructors();
-#endif
void template_subclasses();
void methodSpecialization();
-#ifndef DONT_TEST_CONSTRUCTOR_SPECIALIZATION
void constructorSpecialization();
-#endif
void staticTemplateMethods();
void staticTemplateMethodSpecialization();
-#ifndef DONT_TEST_DATASTREAM_DETECTION
void detectDataStream();
-#endif
void detectEnums();
void overrideCFunction();
-#ifndef DONT_TEST_STL_SORTING
void stdSortQList();
void stdSortQVector();
-#endif
void templateCallOrder();
void virtualFunctionNoLongerPureVirtual();
void charSignedness() const;
@@ -93,6 +73,16 @@ private slots:
void staticConstUnionWithInitializerList() const;
};
+#if defined(Q_CC_HPACC)
+# define DONT_TEST_TEMPLATE_CONSTRUCTORS
+# define DONT_TEST_CONSTRUCTOR_SPECIALIZATION
+# define DONT_TEST_DATASTREAM_DETECTION
+#endif
+
+#if defined(Q_CC_SUN)
+# define DONT_TEST_STL_SORTING
+#endif
+
class TemplateMethodClass
{
public:
@@ -129,6 +119,9 @@ void tst_Compiler::template_constructors()
QCOMPARE(t2.i, 42);
QCOMPARE(t3.i, 42);
}
+#else
+void tst_Compiler::template_constructors()
+{ QSKIP("Compiler doesn't do template constructors"); }
#endif
template <typename T>
@@ -193,6 +186,9 @@ void tst_Compiler::constructorSpecialization()
QCOMPARE(t2.i, 42);
QCOMPARE(t3.i, 42);
}
+#else
+void tst_Compiler::constructorSpecialization()
+{ QSKIP("Compiler doesn't do constructor specialization"); }
#endif
class StaticTemplateClass
@@ -313,6 +309,9 @@ void tst_Compiler::detectDataStream()
QVERIFY(QtTestInternal::getSaveOperator<MyString>() != 0);
QVERIFY(QtTestInternal::getSaveOperator<Qxxx>() == 0);
}
+#else
+void tst_Compiler::detectDataStream()
+{ QSKIP("Compiler doesn't evaluate templates correctly"); }
#endif
enum Enum1 { Foo = 0, Bar = 1 };
@@ -346,10 +345,8 @@ void tst_Compiler::detectEnums()
QVERIFY(QTestTypeInfo<Qt::MatchFlag>::IsEnum);
QVERIFY(!QTestTypeInfo<Qt::MatchFlags>::IsEnum);
}
-
static int indicator = 0;
-
// this is a silly C function
extern "C" {
void someCFunc(void *) { indicator = 42; }
@@ -395,6 +392,11 @@ void tst_Compiler::stdSortQVector()
QCOMPARE(strvec.value(0), QString("a"));
QCOMPARE(strvec.value(1), QString("b"));
}
+#else
+void tst_Compiler::stdSortQList()
+{ QSKIP("Compiler's STL broken"); }
+void tst_Compiler::stdSortQVector()
+{ QSKIP("Compiler's STL broken"); }
#endif
// the C func will set it to 1, the template to 2