forked from qt-creator/qt-creator
Clang: Handle native file in the file cache
Different types are introduced for normalized and native file path. So the compiler is warning you if you try the wrong format. Change-Id: I1da0686b142cbf9bb7578468c2b50f90a94cebf9 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io> Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -37,6 +37,31 @@ TEST(FilePath, CreateFromPathString)
|
||||
ASSERT_THAT(filePath.name(), "pathOne");
|
||||
}
|
||||
|
||||
TEST(FilePath, CreateFromDirectoryAndFileName)
|
||||
{
|
||||
ClangBackEnd::FilePath filePath{Utils::PathString{"/file"}, Utils::PathString{"pathOne"}};
|
||||
|
||||
ASSERT_THAT(filePath.directory(), "/file");
|
||||
ASSERT_THAT(filePath.name(), "pathOne");
|
||||
ASSERT_THAT(filePath.path(), "/file/pathOne");
|
||||
}
|
||||
|
||||
TEST(FilePath, CreateFromCString)
|
||||
{
|
||||
ClangBackEnd::FilePath filePath{"/file/pathOne"};
|
||||
|
||||
ASSERT_THAT(filePath.directory(), "/file");
|
||||
ASSERT_THAT(filePath.name(), "pathOne");
|
||||
}
|
||||
|
||||
TEST(FilePath, CreateFromFilePathView)
|
||||
{
|
||||
ClangBackEnd::FilePath filePath{ClangBackEnd::FilePathView{"/file/pathOne"}};
|
||||
|
||||
ASSERT_THAT(filePath.directory(), "/file");
|
||||
ASSERT_THAT(filePath.name(), "pathOne");
|
||||
}
|
||||
|
||||
TEST(FilePath, CreateFromQString)
|
||||
{
|
||||
ClangBackEnd::FilePath filePath{QString{"/file/pathOne"}};
|
||||
@@ -45,7 +70,7 @@ TEST(FilePath, CreateFromQString)
|
||||
ASSERT_THAT(filePath.name(), "pathOne");
|
||||
}
|
||||
|
||||
TEST(FilePath, EmptyFilePath)
|
||||
TEST(FilePath, DefaultFilePath)
|
||||
{
|
||||
ClangBackEnd::FilePath filePath;
|
||||
|
||||
@@ -53,4 +78,12 @@ TEST(FilePath, EmptyFilePath)
|
||||
ASSERT_THAT(filePath.name(), "");
|
||||
}
|
||||
|
||||
TEST(FilePath, EmptyFilePath)
|
||||
{
|
||||
ClangBackEnd::FilePath filePath("");
|
||||
|
||||
ASSERT_THAT(filePath.directory(), "");
|
||||
ASSERT_THAT(filePath.name(), "");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user