forked from qt-creator/qt-creator
Sqlite: Make the statement conversion operator id aware
Before you had to use an constructor which is has an integer as
parameter. Like
struct Foo
{
Foo{long long id} : id{id} {}
Foo{TypeId id} : id{id} {}
TypeId id;
}
Now you can write:
struct Foo
{
TypeId id;
}
With C++ 20 we can even remove more contructors.
Change-Id: I374505a037a71339b672f5f3a57b06dcf443b4bf
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -112,16 +112,16 @@ protected:
|
||||
Utils::PathString filePath5{"/file/pathFife"};
|
||||
Utils::PathStringVector filePaths{filePath1, filePath2, filePath3, filePath4, filePath5};
|
||||
Utils::PathStringVector reverseFilePaths{filePath1, filePath2, filePath3, filePath4, filePath5};
|
||||
SourceContextId id1{0};
|
||||
SourceContextId id2{1};
|
||||
SourceContextId id3{2};
|
||||
SourceContextId id4{3};
|
||||
SourceContextId id5{4};
|
||||
SourceContextId id41{41};
|
||||
SourceContextId id42{42};
|
||||
SourceContextId id43{43};
|
||||
SourceContextId id44{44};
|
||||
SourceContextId id45{45};
|
||||
SourceContextId id1{SourceContextId::create(0)};
|
||||
SourceContextId id2{SourceContextId::create(1)};
|
||||
SourceContextId id3{SourceContextId::create(2)};
|
||||
SourceContextId id4{SourceContextId::create(3)};
|
||||
SourceContextId id5{SourceContextId::create(4)};
|
||||
SourceContextId id41{SourceContextId::create(41)};
|
||||
SourceContextId id42{SourceContextId::create(42)};
|
||||
SourceContextId id43{SourceContextId::create(43)};
|
||||
SourceContextId id44{SourceContextId::create(44)};
|
||||
SourceContextId id45{SourceContextId::create(45)};
|
||||
};
|
||||
|
||||
using CacheTypes = ::testing::Types<CacheWithMockLocking, CacheWithoutLocking>;
|
||||
@@ -240,7 +240,7 @@ TYPED_TEST(StorageCache, IsNotEmptyAfterPopulateWithSomeEntries)
|
||||
typename TypeParam::CacheEntries entries{{this->filePath1.clone(), this->id1},
|
||||
{this->filePath2.clone(), this->id4},
|
||||
{this->filePath3.clone(), this->id3},
|
||||
{this->filePath4.clone(), SourceContextId{5}}};
|
||||
{this->filePath4.clone(), SourceContextId::create(5)}};
|
||||
ON_CALL(this->mockStorage, fetchAllSourceContexts()).WillByDefault(Return(entries));
|
||||
|
||||
this->cache.uncheckedPopulate();
|
||||
@@ -252,12 +252,12 @@ TYPED_TEST(StorageCache, GetEntryAfterPopulateWithSomeEntries)
|
||||
{
|
||||
typename TypeParam::CacheEntries entries{{this->filePath1.clone(), this->id1},
|
||||
{this->filePath2.clone(), this->id2},
|
||||
{this->filePath3.clone(), SourceContextId{7}},
|
||||
{this->filePath3.clone(), SourceContextId::create(7)},
|
||||
{this->filePath4.clone(), this->id4}};
|
||||
ON_CALL(this->mockStorage, fetchAllSourceContexts()).WillByDefault(Return(entries));
|
||||
this->cache.uncheckedPopulate();
|
||||
|
||||
auto value = this->cache.value(SourceContextId{7});
|
||||
auto value = this->cache.value(SourceContextId::create(7));
|
||||
|
||||
ASSERT_THAT(value, this->filePath3);
|
||||
}
|
||||
@@ -442,7 +442,7 @@ TYPED_TEST(StorageCache, GetEntryByIndexAfterInsertingByCustomIndex)
|
||||
TYPED_TEST(StorageCache, CallFetchSourceContextPathForLowerIndex)
|
||||
{
|
||||
auto index = this->cache.id("foo");
|
||||
SourceContextId lowerIndex{&index - 1};
|
||||
SourceContextId lowerIndex{SourceContextId::create(&index - 1)};
|
||||
|
||||
EXPECT_CALL(this->mockStorage, fetchSourceContextPath(Eq(lowerIndex)));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user