diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2022-09-06 10:27:03 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2022-09-16 08:37:50 -0700 |
commit | 0193b4d2193b989d44dd28deda6dce12ae11ca4e (patch) | |
tree | 448952fae89a9252644bcbc452c4651170c48550 /tests/auto/corelib/io | |
parent | 4b997d1851bc62b9a1eb761f08d3b22c85bb0b51 (diff) |
tst_QFile::setPermissions: add QScopeGuard to remove temporary file
Pick-to: 6.4
Change-Id: If5d5ef6220874ae8858efffd17125580b5943cc2
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'tests/auto/corelib/io')
-rw-r--r-- | tests/auto/corelib/io/qfile/tst_qfile.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index 3c738abae4..df3f13dc39 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -1426,8 +1426,9 @@ void tst_QFile::setPermissions() #ifdef Q_OS_QNX QSKIP("This test doesn't pass on QNX and no one has cared to investigate."); #endif - if ( QFile::exists( "createme.txt" ) ) - QFile::remove( "createme.txt" ); + auto remove = []() { QFile::remove("createme.txt"); }; + auto guard = qScopeGuard(remove); + remove(); QVERIFY( !QFile::exists( "createme.txt" ) ); QFile f("createme.txt"); |