summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qscopedvaluerollback
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2019-04-16 16:32:08 +0200
committerTobias Hunger <tobias.hunger@qt.io>2019-04-16 16:32:08 +0200
commit6630937e63ae5797487b86743a7733c8ae5cc42c (patch)
tree3d53dacf6430f9099e1fb20835881205de674961 /tests/auto/corelib/tools/qscopedvaluerollback
parent37ed6dae00640f9cc980ffda05347c12a7eb5d7e (diff)
parentc7af193d2e49e9f10b86262e63d8d13abf72b5cf (diff)
Merge commit 'dev' into 'wip/cmake-merge'
Diffstat (limited to 'tests/auto/corelib/tools/qscopedvaluerollback')
-rw-r--r--tests/auto/corelib/tools/qscopedvaluerollback/tst_qscopedvaluerollback.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qscopedvaluerollback/tst_qscopedvaluerollback.cpp b/tests/auto/corelib/tools/qscopedvaluerollback/tst_qscopedvaluerollback.cpp
index 656dd6a6e3..9b607db608 100644
--- a/tests/auto/corelib/tools/qscopedvaluerollback/tst_qscopedvaluerollback.cpp
+++ b/tests/auto/corelib/tools/qscopedvaluerollback/tst_qscopedvaluerollback.cpp
@@ -46,6 +46,7 @@ private Q_SLOTS:
void rollbackToPreviousCommit();
void exceptions();
void earlyExitScope();
+ void moveOnly();
private:
void earlyExitScope_helper(int exitpoint, int &member);
};
@@ -190,5 +191,17 @@ void tst_QScopedValueRollback::earlyExitScope_helper(int exitpoint, int& member)
r.commit();
}
+void tst_QScopedValueRollback::moveOnly()
+{
+ std::unique_ptr<int> uniquePtr;
+ std::unique_ptr<int> newVal(new int(5));
+ QVERIFY(!uniquePtr);
+ {
+ QScopedValueRollback<std::unique_ptr<int>> r(uniquePtr, std::move(newVal));
+ QVERIFY(uniquePtr);
+ }
+ QVERIFY(!uniquePtr);
+}
+
QTEST_MAIN(tst_QScopedValueRollback)
#include "tst_qscopedvaluerollback.moc"