summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qtemporaryfile
diff options
context:
space:
mode:
authorAhmad Samir <a.samirh78@gmail.com>2023-08-11 03:09:40 +0300
committerAhmad Samir <a.samirh78@gmail.com>2023-08-19 16:29:09 +0300
commite7b07b64c7b0536eccba6ff25e23badb88226813 (patch)
treed70ab6c7451f2e6b62887684fe3ab528d345a577 /tests/auto/corelib/io/qtemporaryfile
parentc7a8e1e9928fc2b84e6179adc69c858b17b25d48 (diff)
tests/auto/*: port Q_FOREACH to ranged-for
The loop was iterating over a temporary container, so it couldn't have changed it. Store the container in a const auto variable and use ranged-for. In files where Q_FOREACH isn't used any more, remove "#undef QT_NO_FOREACH". Task-number: QTBUG-115839 Change-Id: I402df5fa48f4287f3cc989ddae1524da43999049 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests/auto/corelib/io/qtemporaryfile')
-rw-r--r--tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
index 6f4c99cf21..876931c239 100644
--- a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
+++ b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
@@ -524,7 +524,8 @@ void tst_QTemporaryFile::openOnRootDrives()
#endif
// If it's possible to create a file in the root directory, it
// must be possible to create a temp file there too.
- foreach (QFileInfo driveInfo, QDir::drives()) {
+ const auto drives = QDir::drives();
+ for (const QFileInfo &driveInfo : drives) {
QFile testFile(driveInfo.filePath() + "XXXXXX.txt");
if (testFile.open(QIODevice::ReadWrite)) {
testFile.remove();