summaryrefslogtreecommitdiffstats
path: root/tests/auto/qbytearray
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2010-11-02 15:20:37 +0100
committerOlivier Goffart <olivier.goffart@nokia.com>2010-11-03 11:50:48 +0100
commitd12681a4cf1227d0e92fc7cf12aa3977e6ffe3fe (patch)
tree32306cd47731503f85a3d88881a5e28901506432 /tests/auto/qbytearray
parent9ff533aa0ddf944b73b0c29193fc9936c644142e (diff)
Containers: add member-swap
Member-swap is required by the STL Sequence concept, but is also needed to write exception-safe code. Merge-request: 871 Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com>
Diffstat (limited to 'tests/auto/qbytearray')
-rw-r--r--tests/auto/qbytearray/tst_qbytearray.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/auto/qbytearray/tst_qbytearray.cpp b/tests/auto/qbytearray/tst_qbytearray.cpp
index 0dc2282fcd..c291c6afb7 100644
--- a/tests/auto/qbytearray/tst_qbytearray.cpp
+++ b/tests/auto/qbytearray/tst_qbytearray.cpp
@@ -71,6 +71,7 @@ public slots:
void init();
void cleanup();
private slots:
+ void swap();
void qCompress_data();
#ifndef QT_NO_COMPRESS
void qCompress();
@@ -453,6 +454,14 @@ void tst_QByteArray::split()
QCOMPARE(list.count(), size);
}
+void tst_QByteArray::swap()
+{
+ QByteArray b1 = "b1", b2 = "b2";
+ b1.swap(b2);
+ QCOMPARE(b1, QByteArray("b2"));
+ QCOMPARE(b2, QByteArray("b1"));
+}
+
void tst_QByteArray::base64_data()
{
QTest::addColumn<QByteArray>("rawdata");