summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp')
-rw-r--r--tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp b/tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp
index 24c3023183..e5393f694e 100644
--- a/tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp
+++ b/tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp
@@ -112,12 +112,19 @@ void tst_QScopeGuard::constructionFromLvalue()
{
#ifdef __cpp_deduction_guides
Callable::resetCounts();
- Callable callable;
{
+ Callable callable;
QScopeGuard guard(callable);
}
QCOMPARE(Callable::copied, 1);
QCOMPARE(Callable::moved, 0);
+ Callable::resetCounts();
+ {
+ Callable callable;
+ auto guard = qScopeGuard(callable);
+ }
+ QCOMPARE(Callable::copied, 1);
+ QCOMPARE(Callable::moved, 0);
#else
QSKIP("This test requires C++17 Class Template Argument Deduction support enabled in the compiler.");
#endif
@@ -133,6 +140,13 @@ void tst_QScopeGuard::constructionFromRvalue()
}
QCOMPARE(Callable::copied, 0);
QCOMPARE(Callable::moved, 1);
+ Callable::resetCounts();
+ {
+ Callable callable;
+ auto guard = qScopeGuard(std::move(callable));
+ }
+ QCOMPARE(Callable::copied, 0);
+ QCOMPARE(Callable::moved, 1);
#else
QSKIP("This test requires C++17 Class Template Argument Deduction support enabled in the compiler.");
#endif