MCPcopy Create free account
hub / github.com/KDE/kdevelop / urlForFileKind

Method urlForFileKind

plugins/debuggercommon/tests/debuggertestbase.cpp:2545–2572  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2543
2544template<typename UrlProvider>
2545QUrl DebuggerTestBase::urlForFileKind(FileKind fileKind, UrlProvider validUrlCallback) const
2546{
2547 switch (fileKind) {
2548 case FileKind::Valid:
2549 return validUrlCallback();
2550 case FileKind::EmptyName:
2551 return QUrl{};
2552 case FileKind::Nonexistent:
2553 return QUrl::fromLocalFile("/this/path/should/not/exist");
2554 case FileKind::Directory:
2555 return debugeeUrl().adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash);
2556 case FileKind::NotReadable: {
2557 if (m_notReadableFile.fileName().isEmpty()) {
2558 QVERIFY_RETURN(m_notReadableFile.open(), QUrl{});
2559 m_notReadableFile.close();
2560 QCOMPARE_RETURN(m_notReadableFile.error(), QFileDevice::NoError, QUrl{});
2561 QVERIFY_RETURN(m_notReadableFile.setPermissions({}), QUrl{});
2562 }
2563 const auto fileName = m_notReadableFile.fileName();
2564 QVERIFY_RETURN(!fileName.isEmpty(), QUrl{});
2565 QVERIFY_RETURN(!QFileInfo{fileName}.isReadable(), QUrl{});
2566 return QUrl::fromLocalFile(fileName);
2567 }
2568 case FileKind::Invalid:
2569 return debugeeUrl(); // a C++ source file is neither an executable nor a core dump file
2570 }
2571 Q_UNREACHABLE_RETURN(QUrl{});
2572}
2573
2574#include "moc_debuggertestbase.cpp"

Callers

nothing calls this directly

Calls 6

isReadableMethod · 0.80
isEmptyMethod · 0.45
fileNameMethod · 0.45
openMethod · 0.45
closeMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected