summaryrefslogtreecommitdiffstats
path: root/tests/auto/qlist
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-04-19 22:45:06 +0200
committerOlivier Goffart <olivier.goffart@nokia.com>2010-09-03 12:57:24 +0200
commitc22d43237363463e3409286470392a3227f49961 (patch)
tree9c1929a796ae8175242a7d6baf359592b52b3339 /tests/auto/qlist
parentda0e1a682362144b9f13b4c564f86e09efb681bb (diff)
C++0x: being able to create a list with the {,,,} notation
Reviewed-by: Joao
Diffstat (limited to 'tests/auto/qlist')
-rw-r--r--tests/auto/qlist/tst_qlist.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/qlist/tst_qlist.cpp b/tests/auto/qlist/tst_qlist.cpp
index ba8aefa8c0..9f6b4a59ff 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"