forked from qt-creator/qt-creator
Unittest: Fix crash in Linux
Change-Id: I1e8dc10bd9f0f9d11b0f18716e284ffadef7c6c5 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -65,6 +65,12 @@ class StringCache : public testing::Test
|
|||||||
protected:
|
protected:
|
||||||
void SetUp()
|
void SetUp()
|
||||||
{
|
{
|
||||||
|
mockStorageFetchDirectyId = [&](Utils::SmallStringView string) {
|
||||||
|
return mockStorage.fetchDirectoryId(string);
|
||||||
|
};
|
||||||
|
mockStorageFetchDirectyPath = [&](int id) {
|
||||||
|
return mockStorage.fetchDirectoryPath(id);
|
||||||
|
};
|
||||||
std::sort(filePaths.begin(), filePaths.end(), [](auto &f, auto &l) {
|
std::sort(filePaths.begin(), filePaths.end(), [](auto &f, auto &l) {
|
||||||
return compare(f, l) < 0;
|
return compare(f, l) < 0;
|
||||||
});
|
});
|
||||||
@@ -82,12 +88,8 @@ protected:
|
|||||||
protected:
|
protected:
|
||||||
NiceMock<MockSqliteDatabase> mockDatabase;
|
NiceMock<MockSqliteDatabase> mockDatabase;
|
||||||
NiceMock<MockFilePathStorage> mockStorage{mockDatabase};
|
NiceMock<MockFilePathStorage> mockStorage{mockDatabase};
|
||||||
StorageIdFunction mockStorageFetchDirectyId = [&](Utils::SmallStringView string) {
|
StorageIdFunction mockStorageFetchDirectyId;
|
||||||
return mockStorage.fetchDirectoryId(string);
|
StorageStringFunction mockStorageFetchDirectyPath;
|
||||||
};
|
|
||||||
StorageStringFunction mockStorageFetchDirectyPath = [&](int id) {
|
|
||||||
return mockStorage.fetchDirectoryPath(id);
|
|
||||||
};
|
|
||||||
Cache cache;
|
Cache cache;
|
||||||
typename Cache::MutexType &mockMutex = cache.mutex();
|
typename Cache::MutexType &mockMutex = cache.mutex();
|
||||||
Utils::PathString filePath1{"/file/pathOne"};
|
Utils::PathString filePath1{"/file/pathOne"};
|
||||||
|
Reference in New Issue
Block a user