diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-04-19 20:45:06 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-09-03 10:57:24 (GMT) |
commit | c22d43237363463e3409286470392a3227f49961 (patch) | |
tree | 9c1929a796ae8175242a7d6baf359592b52b3339 /tests/auto/qlist/tst_qlist.cpp | |
parent | da0e1a682362144b9f13b4c564f86e09efb681bb (diff) | |
download | Qt-c22d43237363463e3409286470392a3227f49961.zip Qt-c22d43237363463e3409286470392a3227f49961.tar.gz Qt-c22d43237363463e3409286470392a3227f49961.tar.bz2 |
C++0x: being able to create a list with the {,,,} notation
Reviewed-by: Joao
Diffstat (limited to 'tests/auto/qlist/tst_qlist.cpp')
-rw-r--r-- | tests/auto/qlist/tst_qlist.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/qlist/tst_qlist.cpp b/tests/auto/qlist/tst_qlist.cpp index ba8aefa..9f6b4a5 100644 --- a/tests/auto/qlist/tst_qlist.cpp +++ b/tests/auto/qlist/tst_qlist.cpp @@ -89,6 +89,8 @@ private slots: void testSTLIterators() const; void testOperators() const; + + void initializeList() const; }; void tst_QList::length() const @@ -662,5 +664,19 @@ void tst_QList::testSTLIterators() const QCOMPARE(*it, QLatin1String("foo")); } +void tst_QList::initializeList() const +{ +#ifdef QT_CXX0X_INITIALIZERLIST + QList<int> v1{2,3,4}; + QCOMPARE(v1, QList<int>() << 2 << 3 << 4); + QCOMPARE(v1, (QList<int>{2,3,4})); + + QList<QList<int>> v2{ v1, {1}, QList<int>(), {2,3,4} }; + QList<QList<int>> v3; + v3 << v1 << (QList<int>() << 1) << QList<int>() << v1; + QCOMPARE(v3, v2); +#endif +} + QTEST_APPLESS_MAIN(tst_QList) #include "tst_qlist.moc" |