diff options
author | Christian Stenger <christian.stenger@qt.io> | 2020-09-02 15:30:13 +0200 |
---|---|---|
committer | Christian Stenger <christian.stenger@qt.io> | 2020-09-03 04:21:00 +0000 |
commit | 5355aa7a3706790079f4681dd0f34bc77802f3b6 (patch) | |
tree | 604987fabd6e17e82b52c66c1774a246958be3d7 /tests | |
parent | a408bcfd3d05a071fb546c5986643ea2f0332ea2 (diff) |
Unittest: Fix crash in Linux
Change-Id: I1e8dc10bd9f0f9d11b0f18716e284ffadef7c6c5
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/unittest/stringcache-test.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/unit/unittest/stringcache-test.cpp b/tests/unit/unittest/stringcache-test.cpp index 8eecd92c44..5a2b1d404d 100644 --- a/tests/unit/unittest/stringcache-test.cpp +++ b/tests/unit/unittest/stringcache-test.cpp @@ -65,6 +65,12 @@ class StringCache : public testing::Test protected: 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) { return compare(f, l) < 0; }); @@ -82,12 +88,8 @@ protected: protected: NiceMock<MockSqliteDatabase> mockDatabase; NiceMock<MockFilePathStorage> mockStorage{mockDatabase}; - StorageIdFunction mockStorageFetchDirectyId = [&](Utils::SmallStringView string) { - return mockStorage.fetchDirectoryId(string); - }; - StorageStringFunction mockStorageFetchDirectyPath = [&](int id) { - return mockStorage.fetchDirectoryPath(id); - }; + StorageIdFunction mockStorageFetchDirectyId; + StorageStringFunction mockStorageFetchDirectyPath; Cache cache; typename Cache::MutexType &mockMutex = cache.mutex(); Utils::PathString filePath1{"/file/pathOne"}; |