forked from qt-creator/qt-creator
C++: Added tests for C++11 features.
Change-Id: Ifa0bc37916d3ac3a523580bec15a6685709e7810 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
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
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
void f() noexcept {
|
||||
}
|
||||
|
||||
void g() noexcept(1) {
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
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"
|
||||
|
||||
Reference in New Issue
Block a user