Commit d679dc4d authored by Erik Verbruggen's avatar Erik Verbruggen

C++: Added tests for C++11 features.

Change-Id: Ifa0bc37916d3ac3a523580bec15a6685709e7810
Reviewed-by: default avatarRoberto Raggi <roberto.raggi@nokia.com>
parent f06a5f12
include(../../qttest.pri)
include(../shared/shared.pri)
SOURCES += tst_cxx11.cpp
OTHER_FILES += \
data/inlineNamespace.1.cpp \
data/inlineNamespace.1.errors.txt \
data/staticAssert.1.cpp \
data/staticAssert.1.errors.txt \
data/noExcept.1.cpp \
data/noExcept.1.errors.txt
void f() noexcept {
}
void g() noexcept(1) {
}
struct S {
static_assert(sizeof(char) == 1, "Some message");
void f() {
static_assert(sizeof(int) == 4, "Another message");
}
};
......@@ -118,6 +118,10 @@ private Q_SLOTS:
//
void inlineNamespace_data();
void inlineNamespace();
void staticAssert();
void staticAssert_data();
void noExcept();
void noExcept_data();
//
// checks for the semantic
......@@ -164,5 +168,49 @@ void tst_cxx11::inlineNamespaceLookup()
QCOMPARE(results.size(), 1); // the symbol is visible from the global scope
}
void tst_cxx11::staticAssert_data()
{
QTest::addColumn<QString>("file");
QTest::addColumn<QString>("errorFile");
QTest::newRow("staticAssert.1") << "staticAssert.1.cpp" << "staticAssert.1.errors.txt";
}
void tst_cxx11::staticAssert()
{
QFETCH(QString, file);
QFETCH(QString, errorFile);
QByteArray errors;
Document::Ptr doc = document(file, &errors);
if (! qgetenv("DEBUG").isNull())
printf("%s\n", errors.constData());
VERIFY_ERRORS();
}
void tst_cxx11::noExcept_data()
{
QTest::addColumn<QString>("file");
QTest::addColumn<QString>("errorFile");
QTest::newRow("noExcept.1") << "noExcept.1.cpp" << "noExcept.1.errors.txt";
}
void tst_cxx11::noExcept()
{
QFETCH(QString, file);
QFETCH(QString, errorFile);
QByteArray errors;
Document::Ptr doc = document(file, &errors);
if (! qgetenv("DEBUG").isNull())
printf("%s\n", errors.constData());
VERIFY_ERRORS();
}
QTEST_APPLESS_MAIN(tst_cxx11)
#include "tst_cxx11.moc"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment