summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2022-03-18 12:53:51 +0100
committerSona Kurazyan <sona.kurazyan@qt.io>2022-04-07 19:30:17 +0200
commita885f28933896998cd363999b7825b95c365b3f5 (patch)
tree98770f255ac2ef5d367e0eebe4a1d33d6464d2a0 /tests/auto/corelib/io
parentf5174abec3720b7deec3157e482ca62c0d90fb19 (diff)
Replace uses of _qs with _s in tests
Task-number: QTBUG-101408 Change-Id: If092a68828a1e8056259cf90d035d9a87989244b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/auto/corelib/io')
-rw-r--r--tests/auto/corelib/io/qdir/tst_qdir.cpp42
-rw-r--r--tests/auto/corelib/io/qfile/tst_qfile.cpp4
-rw-r--r--tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp6
-rw-r--r--tests/auto/corelib/io/qfilesystementry/tst_qfilesystementry.cpp6
-rw-r--r--tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp12
-rw-r--r--tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp12
-rw-r--r--tests/auto/corelib/io/qurl/tst_qurl.cpp4
-rw-r--r--tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp6
8 files changed, 54 insertions, 38 deletions
diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp
index d0d6588446..8f93f74193 100644
--- a/tests/auto/corelib/io/qdir/tst_qdir.cpp
+++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp
@@ -75,6 +75,8 @@ extern Q_CORE_EXPORT int qt_ntfs_permission_lookup;
#include "private/qdir_p.h"
#endif
+using namespace Qt::StringLiterals;
+
static QByteArray msgDoesNotExist(const QString &name)
{
return (QLatin1Char('"') + QDir::toNativeSeparators(name)
@@ -490,7 +492,7 @@ void tst_QDir::mkdirWithPermissions()
QFile::ReadOwner, QFile::WriteOwner, QFile::ExeOwner
};
- const QString path = u"tmpdir"_qs;
+ const QString path = u"tmpdir"_s;
QDir dir;
auto deleteDirectory = qScopeGuard([&dir, &path] { dir.rmdir(path); });
@@ -1332,19 +1334,19 @@ tst_QDir::cleanPath_data()
QTest::newRow("unc-server-up") << "//server/path/.." << "//server";
QTest::newRow("unc-server-above-root") << "//server/.." << "//server/..";
- QTest::newRow("longpath") << uR"(\\?\d:\)"_qs << u"d:/"_qs;
- QTest::newRow("longpath-slash") << u"//?/d:/"_qs << u"d:/"_qs;
- QTest::newRow("longpath-mixed-slashes") << uR"(//?/d:\)"_qs << u"d:/"_qs;
- QTest::newRow("longpath-mixed-slashes-2") << uR"(\\?\d:/)"_qs << u"d:/"_qs;
-
- QTest::newRow("unc-network-share") << uR"(\\?\UNC\localhost\c$\tmp.txt)"_qs
- << u"//localhost/c$/tmp.txt"_qs;
- QTest::newRow("unc-network-share-slash") << u"//?/UNC/localhost/c$/tmp.txt"_qs
- << u"//localhost/c$/tmp.txt"_qs;
- QTest::newRow("unc-network-share-mixed-slashes") << uR"(//?/UNC/localhost\c$\tmp.txt)"_qs
- << u"//localhost/c$/tmp.txt"_qs;
- QTest::newRow("unc-network-share-mixed-slashes-2") << uR"(\\?\UNC\localhost/c$/tmp.txt)"_qs
- << u"//localhost/c$/tmp.txt"_qs;
+ QTest::newRow("longpath") << uR"(\\?\d:\)"_s << u"d:/"_s;
+ QTest::newRow("longpath-slash") << u"//?/d:/"_s << u"d:/"_s;
+ QTest::newRow("longpath-mixed-slashes") << uR"(//?/d:\)"_s << u"d:/"_s;
+ QTest::newRow("longpath-mixed-slashes-2") << uR"(\\?\d:/)"_s << u"d:/"_s;
+
+ QTest::newRow("unc-network-share") << uR"(\\?\UNC\localhost\c$\tmp.txt)"_s
+ << u"//localhost/c$/tmp.txt"_s;
+ QTest::newRow("unc-network-share-slash") << u"//?/UNC/localhost/c$/tmp.txt"_s
+ << u"//localhost/c$/tmp.txt"_s;
+ QTest::newRow("unc-network-share-mixed-slashes") << uR"(//?/UNC/localhost\c$\tmp.txt)"_s
+ << u"//localhost/c$/tmp.txt"_s;
+ QTest::newRow("unc-network-share-mixed-slashes-2") << uR"(\\?\UNC\localhost/c$/tmp.txt)"_s
+ << u"//localhost/c$/tmp.txt"_s;
#else
QTest::newRow("data15") << "//c:/foo" << "/c:/foo";
#endif // non-windows
@@ -1743,9 +1745,9 @@ void tst_QDir::dotAndDotDot()
{
QDir dir(QString((m_dataPath + "/testdir/")));
QStringList entryList = dir.entryList(QDir::Dirs);
- QCOMPARE(entryList, QStringList({ u"."_qs, u".."_qs, u"dir"_qs, u"dir.lnk"_qs, u"spaces"_qs }));
+ QCOMPARE(entryList, QStringList({ u"."_s, u".."_s, u"dir"_s, u"dir.lnk"_s, u"spaces"_s }));
entryList = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
- QCOMPARE(entryList, QStringList({ u"dir"_qs, u"dir.lnk"_qs, u"spaces"_qs }));
+ QCOMPARE(entryList, QStringList({ u"dir"_s, u"dir.lnk"_s, u"spaces"_s }));
}
void tst_QDir::homePath()
@@ -1820,10 +1822,10 @@ void tst_QDir::nativeSeparators()
QCOMPARE(QDir::fromNativeSeparators(QLatin1String("/")), QString("/"));
QCOMPARE(QDir::fromNativeSeparators(QLatin1String("\\")), QString("/"));
QCOMPARE(QDir::fromNativeSeparators(QLatin1String("\\\\?\\C:\\")), QString("C:/"));
- QCOMPARE(QDir::fromNativeSeparators(uR"(\\?\UNC\localhost\c$\tmp.txt)"_qs),
- u"//localhost/c$/tmp.txt"_qs);
- QCOMPARE(QDir::fromNativeSeparators(uR"(//?/UNC/localhost\c$\tmp.txt)"_qs),
- u"//localhost/c$/tmp.txt"_qs);
+ QCOMPARE(QDir::fromNativeSeparators(uR"(\\?\UNC\localhost\c$\tmp.txt)"_s),
+ u"//localhost/c$/tmp.txt"_s);
+ QCOMPARE(QDir::fromNativeSeparators(uR"(//?/UNC/localhost\c$\tmp.txt)"_s),
+ u"//localhost/c$/tmp.txt"_s);
#else
QCOMPARE(QDir::toNativeSeparators(QLatin1String("/")), QString("/"));
QCOMPARE(QDir::toNativeSeparators(QLatin1String("\\")), QString("\\"));
diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp
index 8ea01b4680..fa8cee0172 100644
--- a/tests/auto/corelib/io/qfile/tst_qfile.cpp
+++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp
@@ -119,6 +119,8 @@ QT_END_NAMESPACE
#define QT_OPEN_BINARY 0
#endif
+using namespace Qt::StringLiterals;
+
Q_DECLARE_METATYPE(QFile::FileError)
@@ -1302,7 +1304,7 @@ void tst_QFile::createFilePermissions()
QFile::ReadOwner, QFile::WriteOwner, QFile::ExeOwner
};
- const QString fileName = u"createme.txt"_qs;
+ const QString fileName = u"createme.txt"_s;
QFile::remove(fileName);
QVERIFY(!QFile::exists(fileName));
diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
index a46fac04a4..673378c6aa 100644
--- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
@@ -77,6 +77,8 @@ QT_END_NAMESPACE
bool IsUserAdmin();
#endif
+using namespace Qt::StringLiterals;
+
inline bool qIsLikelyToBeFat(const QString &path)
{
QByteArray name = QStorageInfo(path).fileSystemType().toLower();
@@ -1853,14 +1855,14 @@ void tst_QFileInfo::ntfsJunctionPointsAndSymlinks()
creationResult.target = creationResult.target.sliced(4);
// resolve volume to drive letter
- static const QRegularExpression matchVolumeRe(uR"(^Volume\{([a-z]|[0-9]|-)+\}\\)"_qs,
+ static const QRegularExpression matchVolumeRe(uR"(^Volume\{([a-z]|[0-9]|-)+\}\\)"_s,
QRegularExpression::CaseInsensitiveOption);
auto matchVolume = matchVolumeRe.match(creationResult.target);
if (matchVolume.hasMatch()) {
Q_ASSERT(matchVolume.capturedStart() == 0);
DWORD len;
wchar_t buffer[MAX_PATH];
- const QString volumeName = uR"(\\?\)"_qs + matchVolume.captured();
+ const QString volumeName = uR"(\\?\)"_s + matchVolume.captured();
if (GetVolumePathNamesForVolumeName(reinterpret_cast<LPCWSTR>(volumeName.utf16()),
buffer, MAX_PATH, &len) != 0) {
creationResult.target.replace(0, matchVolume.capturedLength(),
diff --git a/tests/auto/corelib/io/qfilesystementry/tst_qfilesystementry.cpp b/tests/auto/corelib/io/qfilesystementry/tst_qfilesystementry.cpp
index a9ae848251..4fe42cf74c 100644
--- a/tests/auto/corelib/io/qfilesystementry/tst_qfilesystementry.cpp
+++ b/tests/auto/corelib/io/qfilesystementry/tst_qfilesystementry.cpp
@@ -30,6 +30,8 @@
#include <QtCore/private/qfilesystementry_p.h>
+using namespace Qt::StringLiterals;
+
class tst_QFileSystemEntry : public QObject
{
Q_OBJECT
@@ -106,12 +108,12 @@ void tst_QFileSystemEntry::getSetCheck_data()
<< "A:dir/without/leading/backslash.bat" << "backslash.bat" << "backslash" << "backslash" << "bat" << "bat" << false << false;
QTest::newRow("longpath")
- << uR"(\\?\D:\)"_qs
+ << uR"(\\?\D:\)"_s
<< absPrefix + QLatin1String(R"(D:\)")
<< "D:/" << "" << "" << "" << "" << "" << true << false;
QTest::newRow("uncprefix")
- << uR"(\\?\UNC\localhost\C$\tmp.txt)"_qs
+ << uR"(\\?\UNC\localhost\C$\tmp.txt)"_s
<< absPrefix + QLatin1String(R"(UNC\localhost\C$\tmp.txt)")
<< "//localhost/C$/tmp.txt" << "tmp.txt" << "tmp" << "tmp" << "txt" << "txt" << true
<< false;
diff --git a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
index 65835ab91a..3900d76b57 100644
--- a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
+++ b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
@@ -51,6 +51,8 @@
#include <optional>
+using namespace Qt::StringLiterals;
+
class tst_QTemporaryDir : public QObject
{
Q_OBJECT
@@ -224,19 +226,19 @@ void tst_QTemporaryDir::fileTemplate_data()
return; // skip if we have no drive letter
tmp.data()[1] = u'$';
- const auto tmpPath = tmp + uR"(\UNC.XXXXXX.tmpDir)"_qs;
+ const auto tmpPath = tmp + uR"(\UNC.XXXXXX.tmpDir)"_s;
QTest::newRow("UNC-backslash")
- << uR"(\\localhost\)"_qs + tmpPath << "UNC."
+ << uR"(\\localhost\)"_s + tmpPath << "UNC."
<< ".tmpDir";
QTest::newRow("UNC-prefix")
- << uR"(\\?\UNC\localhost\)"_qs + tmpPath << "UNC."
+ << uR"(\\?\UNC\localhost\)"_s + tmpPath << "UNC."
<< ".tmpDir";
QTest::newRow("UNC-slash")
- << u"//localhost/"_qs + QDir::fromNativeSeparators(tmpPath) << "UNC."
+ << u"//localhost/"_s + QDir::fromNativeSeparators(tmpPath) << "UNC."
<< ".tmpDir";
QTest::newRow("UNC-prefix-slash")
- << uR"(//?/UNC/localhost/)"_qs + QDir::fromNativeSeparators(tmpPath) << "UNC."
+ << uR"(//?/UNC/localhost/)"_s + QDir::fromNativeSeparators(tmpPath) << "UNC."
<< ".tmpDir";
#endif
}
diff --git a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
index 732b2fa4a8..7d0729bdc1 100644
--- a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
+++ b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
@@ -60,6 +60,8 @@
#include "qplatformdefs.h"
#endif
+using namespace Qt::StringLiterals;
+
class tst_QTemporaryFile : public QObject
{
Q_OBJECT
@@ -218,22 +220,22 @@ void tst_QTemporaryFile::fileTemplate_data()
return; // skip if we have no drive letter
tmp.data()[1] = u'$';
- const auto tmpPath = tmp + uR"(\QTBUG-74291.XXXXXX.tmpFile)"_qs;
+ const auto tmpPath = tmp + uR"(\QTBUG-74291.XXXXXX.tmpFile)"_s;
QTest::newRow("UNC-backslash")
- << uR"(\\localhost\)"_qs + tmpPath << "QTBUG-74291."
+ << uR"(\\localhost\)"_s + tmpPath << "QTBUG-74291."
<< ".tmpFile"
<< "";
QTest::newRow("UNC-prefix")
- << uR"(\\?\UNC\localhost\)"_qs + tmpPath << "QTBUG-74291."
+ << uR"(\\?\UNC\localhost\)"_s + tmpPath << "QTBUG-74291."
<< ".tmpFile"
<< "";
QTest::newRow("UNC-slash")
- << u"//localhost/"_qs + QDir::fromNativeSeparators(tmpPath) << "QTBUG-74291."
+ << u"//localhost/"_s + QDir::fromNativeSeparators(tmpPath) << "QTBUG-74291."
<< ".tmpFile"
<< "";
QTest::newRow("UNC-prefix-slash")
- << uR"(//?/UNC/localhost/)"_qs + QDir::fromNativeSeparators(tmpPath) << "QTBUG-74291."
+ << uR"(//?/UNC/localhost/)"_s + QDir::fromNativeSeparators(tmpPath) << "QTBUG-74291."
<< ".tmpFile"
<< "";
#endif
diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp
index 205a99ef1b..5f5efa62a1 100644
--- a/tests/auto/corelib/io/qurl/tst_qurl.cpp
+++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp
@@ -40,6 +40,8 @@
#include <QtTest/private/qemulationdetector_p.h>
+using namespace Qt::StringLiterals;
+
Q_DECLARE_METATYPE(QUrl::FormattingOptions)
class tst_QUrl : public QObject
@@ -2085,7 +2087,7 @@ void tst_QUrl::hasQuery()
void tst_QUrl::nameprep()
{
// U+FB01 LATIN SMALL LIGATURE FI
- QUrl url(u"http://www.\uFB01le.de/"_qs);
+ QUrl url(u"http://www.\uFB01le.de/"_s);
QCOMPARE(url.toString(), QStringLiteral(u"http://www.file.de/"));
}
diff --git a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
index 6c556f1f25..5ada515676 100644
--- a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
+++ b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
@@ -41,6 +41,8 @@
#define STRINGPREP_BIDI_BOTH_L_AND_RAL 4
#define STRINGPREP_BIDI_LEADTRAIL_NOT_RAL 5
+using namespace Qt::StringLiterals;
+
struct char16array {
char16array() {}
template <size_t N>
@@ -259,8 +261,8 @@ void tst_QUrlInternal::ace_testsuite_data()
QTest::newRow("ascii-upper") << "FLUKE" << "fluke" << "fluke" << "fluke";
// U+FB01 LATIN SMALL LIGATURE FI
- QTest::newRow("asciifolded") << u"\uFB01le"_qs << "file" << "." << "file";
- QTest::newRow("asciifolded-dotcom") << u"\uFB01le.example.com"_qs << "file.example.com" << "." << "file.example.com";
+ QTest::newRow("asciifolded") << u"\uFB01le"_s << "file" << "." << "file";
+ QTest::newRow("asciifolded-dotcom") << u"\uFB01le.example.com"_s << "file.example.com" << "." << "file.example.com";
QTest::newRow("greek-mu") << QString::fromLatin1("\265V")
<<"xn--v-lmb"
<< "."