forked from qt-creator/qt-creator
LSP: Fix auto tests for Linux and macOS
Some URI/URL functionality (especially file protocol) is based on the underlying file system and operating system respectively. Change-Id: I6a0956bbef292ff964aec581c2555c54d6d0dbe3 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -598,7 +598,9 @@ void tst_LanguageServerProtocol::documentUri_data()
|
|||||||
QTest::addColumn<Utils::FileName>("fileName");
|
QTest::addColumn<Utils::FileName>("fileName");
|
||||||
QTest::addColumn<QString>("string");
|
QTest::addColumn<QString>("string");
|
||||||
|
|
||||||
const QString filePrefix("file:///");
|
// '/' (fs root) is part of the file path
|
||||||
|
const QString filePrefix = Utils::HostOsInfo::isWindowsHost() ? QString("file:///")
|
||||||
|
: QString("file://");
|
||||||
|
|
||||||
QTest::newRow("empty uri")
|
QTest::newRow("empty uri")
|
||||||
<< DocumentUri()
|
<< DocumentUri()
|
||||||
@@ -613,7 +615,7 @@ void tst_LanguageServerProtocol::documentUri_data()
|
|||||||
<< Utils::FileName::fromUserInput(QDir::homePath())
|
<< Utils::FileName::fromUserInput(QDir::homePath())
|
||||||
<< QString(filePrefix + QDir::homePath());
|
<< QString(filePrefix + QDir::homePath());
|
||||||
|
|
||||||
const QString argv0 = qApp->arguments().first();
|
const QString argv0 = QFileInfo(qApp->arguments().first()).absoluteFilePath();
|
||||||
const auto argv0FileName = Utils::FileName::fromUserInput(argv0);
|
const auto argv0FileName = Utils::FileName::fromUserInput(argv0);
|
||||||
QTest::newRow("argv0 file name")
|
QTest::newRow("argv0 file name")
|
||||||
<< DocumentUri::fromFileName(argv0FileName)
|
<< DocumentUri::fromFileName(argv0FileName)
|
||||||
@@ -627,8 +629,10 @@ void tst_LanguageServerProtocol::documentUri_data()
|
|||||||
<< Utils::FileName()
|
<< Utils::FileName()
|
||||||
<< "https://www.qt.io/";
|
<< "https://www.qt.io/";
|
||||||
|
|
||||||
|
// depending on the OS the resulting path is different (made suitable for the file system)
|
||||||
const QString winUserPercent("file:///C%3A/Users/");
|
const QString winUserPercent("file:///C%3A/Users/");
|
||||||
const QString winUser("C:\\Users\\");
|
const QString winUser = Utils::HostOsInfo::isWindowsHost() ? QString("C:\\Users\\")
|
||||||
|
: QString("/C:/Users/");
|
||||||
QTest::newRow("percent encoding")
|
QTest::newRow("percent encoding")
|
||||||
<< DocumentUri::fromProtocol(winUserPercent)
|
<< DocumentUri::fromProtocol(winUserPercent)
|
||||||
<< true
|
<< true
|
||||||
|
Reference in New Issue
Block a user