forked from qt-creator/qt-creator
UnitTests: Improve error messages
Adding the a property and field matcher string makes it easier to read the error messages. Change-Id: I0b9a4bf39d227eabd1342b3269ec70eca4e06d25 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -109,8 +109,8 @@ TEST_F(Storage, return_all_entries_with_the_name_which_starts_with_foo)
|
||||
|
||||
auto entries = storage.entries("foo*");
|
||||
|
||||
ASSERT_THAT(entries, UnorderedElementsAre(IsEntry("foo", Field(&Entry::values), Contains(5)),
|
||||
IsEntry("fooBar", Field(&Entry::values), IsSubset(42, 77))));
|
||||
ASSERT_THAT(entries, UnorderedElementsAre(IsEntry("foo", Field("Entry::values)", &Entry::values, Contains(5)),
|
||||
IsEntry("fooBar", Field("Entry::values", &Entry::values, IsSubset(42, 77))));
|
||||
}
|
||||
```
|
||||
|
||||
@@ -120,7 +120,7 @@ You can even make the matcher easier to read.
|
||||
template<typename Matcher>
|
||||
auto FieldValues(const Matcher &matcher)
|
||||
{
|
||||
return Field(&Entry::values, matcher);
|
||||
return Field("Entry::values", &Entry::values, matcher);
|
||||
}
|
||||
|
||||
TEST_F(Storage, return_all_entries_with_the_name_which_starts_with_foo)
|
||||
|
@@ -16,9 +16,9 @@ auto IsImport(const ModuleIdMatcher &moduleIdMatcher,
|
||||
const MajorVersionMatcher &majorVersionMatcher,
|
||||
const MinorVersionMatcher &minorVersionMatcher)
|
||||
{
|
||||
return AllOf(Field(&QmlDesigner::Storage::Import::moduleId, moduleIdMatcher),
|
||||
Field(&QmlDesigner::Storage::Import::sourceId, sourceIdMatcher),
|
||||
Field(&QmlDesigner::Storage::Import::version,
|
||||
return AllOf(Field("QmlDesigner::Storage::Import::moduleId", &QmlDesigner::Storage::Import::moduleId, moduleIdMatcher),
|
||||
Field("QmlDesigner::Storage::Import::sourceId", &QmlDesigner::Storage::Import::sourceId, sourceIdMatcher),
|
||||
Field("QmlDesigner::Storage::Import::version", &QmlDesigner::Storage::Import::version,
|
||||
IsVersion(majorVersionMatcher, minorVersionMatcher)));
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ auto IsImport(const ModuleIdMatcher &moduleIdMatcher,
|
||||
const SourceIdMatcher &sourceIdMatcher,
|
||||
const VersionMatcher &versionMatcher)
|
||||
{
|
||||
return AllOf(Field(&QmlDesigner::Storage::Import::moduleId, moduleIdMatcher),
|
||||
Field(&QmlDesigner::Storage::Import::sourceId, sourceIdMatcher),
|
||||
Field(&QmlDesigner::Storage::Import::version, versionMatcher));
|
||||
return AllOf(Field("QmlDesigner::Storage::Import::moduleId", &QmlDesigner::Storage::Import::moduleId, moduleIdMatcher),
|
||||
Field("QmlDesigner::Storage::Import::sourceId", &QmlDesigner::Storage::Import::sourceId, sourceIdMatcher),
|
||||
Field("QmlDesigner::Storage::Import::version", &QmlDesigner::Storage::Import::version, versionMatcher));
|
||||
}
|
||||
|
@@ -16,9 +16,9 @@ auto IsInfoExportTypeNames(const ModuleIdMatcher &moduleIdMatcher,
|
||||
const MajorVersionMatcher &majorVersionMatcher,
|
||||
const MinorVersionMatcher &minorVersionMatcher)
|
||||
{
|
||||
return AllOf(Field(&QmlDesigner::Storage::Info::ExportedTypeName::moduleId, moduleIdMatcher),
|
||||
Field(&QmlDesigner::Storage::Info::ExportedTypeName::name, nameMatcher),
|
||||
Field(&QmlDesigner::Storage::Info::ExportedTypeName::version,
|
||||
return AllOf(Field("QmlDesigner::Storage::Info::ExportedTypeName::moduleId", &QmlDesigner::Storage::Info::ExportedTypeName::moduleId, moduleIdMatcher),
|
||||
Field("QmlDesigner::Storage::Info::ExportedTypeName::name", &QmlDesigner::Storage::Info::ExportedTypeName::name, nameMatcher),
|
||||
Field("QmlDesigner::Storage::Info::ExportedTypeName::version", &QmlDesigner::Storage::Info::ExportedTypeName::version,
|
||||
IsVersion(majorVersionMatcher, minorVersionMatcher)));
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ auto IsInfoExportTypeNames(const ModuleIdMatcher &moduleIdMatcher,
|
||||
const NameMatcher &nameMatcher,
|
||||
const VersionMatcher &versionMatcher)
|
||||
{
|
||||
return AllOf(Field(&QmlDesigner::Storage::Info::ExportedTypeName::moduleId, moduleIdMatcher),
|
||||
Field(&QmlDesigner::Storage::Info::ExportedTypeName::name, nameMatcher),
|
||||
Field(&QmlDesigner::Storage::Info::ExportedTypeName::version, versionMatcher));
|
||||
return AllOf(Field("QmlDesigner::Storage::Info::ExportedTypeName::moduleId", &QmlDesigner::Storage::Info::ExportedTypeName::moduleId, moduleIdMatcher),
|
||||
Field("QmlDesigner::Storage::Info::ExportedTypeName::name", &QmlDesigner::Storage::Info::ExportedTypeName::name, nameMatcher),
|
||||
Field("QmlDesigner::Storage::Info::ExportedTypeName::version", &QmlDesigner::Storage::Info::ExportedTypeName::version, versionMatcher));
|
||||
}
|
||||
|
@@ -34,11 +34,12 @@ testing::Matcher<QVariant> IsQVariantType()
|
||||
template<typename Type, typename Matcher>
|
||||
auto IsQVariant(const Matcher &matcher)
|
||||
{
|
||||
return AllOf(IsQVariantType<Type>(), Property(&QVariant::value<Type>, matcher));
|
||||
return AllOf(IsQVariantType<Type>(),
|
||||
Property("QVariant::value<Type>", &QVariant::value<Type>, matcher));
|
||||
}
|
||||
|
||||
template<typename Matcher>
|
||||
auto QVariantIsValid(const Matcher &matcher)
|
||||
{
|
||||
return Property(&QVariant::isValid, matcher);
|
||||
return Property("QVariant::isValid", &QVariant::isValid, matcher);
|
||||
}
|
||||
|
@@ -11,19 +11,19 @@
|
||||
template<typename Matcher>
|
||||
auto IsVersionNumber(const Matcher &matcher)
|
||||
{
|
||||
return Field(&QmlDesigner::Storage::VersionNumber::value, matcher);
|
||||
return Field("QmlDesigner::Storage::VersionNumber::value", &QmlDesigner::Storage::VersionNumber::value, matcher);
|
||||
}
|
||||
|
||||
template<typename Matcher>
|
||||
auto IsMinorVersion(const Matcher &matcher)
|
||||
{
|
||||
return Field(&QmlDesigner::Storage::Version::minor, matcher);
|
||||
return Field("QmlDesigner::Storage::Version::minor", &QmlDesigner::Storage::Version::minor, matcher);
|
||||
}
|
||||
|
||||
template<typename Matcher>
|
||||
auto IsMajorVersion(const Matcher &matcher)
|
||||
{
|
||||
return Field(&QmlDesigner::Storage::Version::major, matcher);
|
||||
return Field("QmlDesigner::Storage::Version::major", &QmlDesigner::Storage::Version::major, matcher);
|
||||
}
|
||||
|
||||
template<typename MajorMatcher, typename MinorMatcher>
|
||||
|
@@ -36,13 +36,15 @@ using ComplexProperty = QmlDesigner::PropertyComponentGenerator::ComplexProperty
|
||||
template<typename Matcher>
|
||||
auto IsBasicProperty(const Matcher &matcher)
|
||||
{
|
||||
return VariantWith<BasicProperty>(Field(&BasicProperty::component, matcher));
|
||||
return VariantWith<BasicProperty>(
|
||||
Field("BasicProperty::component", &BasicProperty::component, matcher));
|
||||
}
|
||||
|
||||
template<typename Matcher>
|
||||
auto IsComplexProperty(const Matcher &matcher)
|
||||
{
|
||||
return VariantWith<ComplexProperty>(Field(&ComplexProperty::component, matcher));
|
||||
return VariantWith<ComplexProperty>(
|
||||
Field("ComplexProperty::component", &ComplexProperty::component, matcher));
|
||||
}
|
||||
|
||||
constexpr Utils::SmallStringView sourcesPath = UNITTEST_DIR
|
||||
|
@@ -97,7 +97,7 @@ TEST(DesignSystemManagerTest, remove_theme)
|
||||
mgr.removeTheme(*themeId);
|
||||
|
||||
// assert
|
||||
ASSERT_THAT(mgr, Property(&DSThemeManager::themeCount, 0));
|
||||
ASSERT_THAT(mgr, Property("DSThemeManager::themeCount", &DSThemeManager::themeCount, 0));
|
||||
}
|
||||
|
||||
TEST(DesignSystemManagerTest, remove_theme_with_properties)
|
||||
@@ -113,7 +113,7 @@ TEST(DesignSystemManagerTest, remove_theme_with_properties)
|
||||
|
||||
// assert
|
||||
ASSERT_THAT(mgr,
|
||||
AllOf(Property(&DSThemeManager::themeCount, 0),
|
||||
AllOf(Property("DSThemeManager::themeCount", &DSThemeManager::themeCount, 0),
|
||||
Not(HasProperty(*themeId, GroupType::Colors, testProp))));
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ TEST_P(DesignSystemManagerTest, add_property_without_theme)
|
||||
mgr.addProperty(groupType, testProp);
|
||||
|
||||
//assert
|
||||
ASSERT_THAT(mgr, Property(&DSThemeManager::themeCount, 0));
|
||||
ASSERT_THAT(mgr, Property("DSThemeManager::themeCount", &DSThemeManager::themeCount, 0));
|
||||
}
|
||||
|
||||
TEST_P(DesignSystemManagerTest, add_property)
|
||||
@@ -140,7 +140,7 @@ TEST_P(DesignSystemManagerTest, add_property)
|
||||
|
||||
// assert
|
||||
ASSERT_THAT(mgr,
|
||||
AllOf(Property(&DSThemeManager::themeCount, 1),
|
||||
AllOf(Property("DSThemeManager::themeCount", &DSThemeManager::themeCount, 1),
|
||||
HasProperty(*themeId, groupType, testProp)));
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ TEST_P(DesignSystemManagerTest, adding_invalid_property_fails)
|
||||
// assert
|
||||
ASSERT_FALSE(result);
|
||||
ASSERT_THAT(mgr,
|
||||
AllOf(Property(&DSThemeManager::themeCount, 1),
|
||||
AllOf(Property("DSThemeManager::themeCount", &DSThemeManager::themeCount, 1),
|
||||
Not(HasProperty(*themeId, groupType, testProp))));
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ TEST_P(DesignSystemManagerTest, adding_property_adds_property_to_all_themes)
|
||||
|
||||
// assert
|
||||
ASSERT_THAT(mgr,
|
||||
AllOf(Property(&DSThemeManager::themeCount, 2),
|
||||
AllOf(Property("DSThemeManager::themeCount", &DSThemeManager::themeCount, 2),
|
||||
HasProperty(*themeIdDark, groupType, testProp),
|
||||
HasProperty(*themeIdLight, groupType, testProp)));
|
||||
}
|
||||
@@ -190,7 +190,7 @@ TEST_P(DesignSystemManagerTest, update_property_value)
|
||||
|
||||
// assert
|
||||
ASSERT_THAT(mgr,
|
||||
AllOf(Property(&DSThemeManager::themeCount, 1),
|
||||
AllOf(Property("DSThemeManager::themeCount", &DSThemeManager::themeCount, 1),
|
||||
HasProperty(*themeId, groupType, testPropUpdated)));
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ TEST_P(DesignSystemManagerTest, update_property_name)
|
||||
|
||||
// assert
|
||||
ASSERT_THAT(mgr,
|
||||
AllOf(Property(&DSThemeManager::themeCount, 1),
|
||||
AllOf(Property("DSThemeManager::themeCount", &DSThemeManager::themeCount, 1),
|
||||
HasProperty(*themeId, groupType, testPropUpdated)));
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ TEST_P(DesignSystemManagerTest, updating_invalid_property_fails)
|
||||
|
||||
// assert
|
||||
ASSERT_THAT(mgr,
|
||||
AllOf(Property(&DSThemeManager::themeCount, 1),
|
||||
AllOf(Property("DSThemeManager::themeCount", &DSThemeManager::themeCount, 1),
|
||||
HasProperty(*themeId, groupType, testProp)));
|
||||
}
|
||||
|
||||
@@ -240,7 +240,7 @@ TEST_P(DesignSystemManagerTest, remove_property)
|
||||
|
||||
// assert
|
||||
ASSERT_THAT(mgr,
|
||||
AllOf(Property(&DSThemeManager::themeCount, 1),
|
||||
AllOf(Property("DSThemeManager::themeCount", &DSThemeManager::themeCount, 1),
|
||||
Not(HasProperty(*themeId, groupType, testProp))));
|
||||
}
|
||||
|
||||
@@ -256,7 +256,7 @@ TEST_P(DesignSystemManagerTest, remove_absent_property_fails)
|
||||
|
||||
// assert
|
||||
ASSERT_THAT(mgr,
|
||||
AllOf(Property(&DSThemeManager::themeCount, 1),
|
||||
AllOf(Property("DSThemeManager::themeCount", &DSThemeManager::themeCount, 1),
|
||||
HasProperty(*themeId, groupType, testProp)));
|
||||
}
|
||||
} // namespace
|
||||
|
@@ -134,7 +134,7 @@ TEST_P(DesignSystemQmlTest, group_aliase_properties_are_generated)
|
||||
|
||||
// assert
|
||||
ASSERT_THAT(rootNode,
|
||||
AllOf(Property(&ModelNode::type, Eq("QtObject")),
|
||||
AllOf(Property("ModelNode::type", &ModelNode::type, Eq("QtObject")),
|
||||
HasBindingProperty(groupName, binding),
|
||||
HasBindingProperty("currentTheme", darkThemeName),
|
||||
HasNodeProperty(darkThemeName, "QtObject")));
|
||||
@@ -152,7 +152,7 @@ TEST_P(DesignSystemQmlTest, empty_groups_generate_no_group_aliase_properties)
|
||||
|
||||
// assert
|
||||
ASSERT_THAT(rootNode,
|
||||
AllOf(Property(&ModelNode::type, Eq("QtObject")),
|
||||
AllOf(Property("ModelNode::type", &ModelNode::type, Eq("QtObject")),
|
||||
Not(HasBindingProperty(groupName, binding)),
|
||||
Not(HasBindingProperty("currentTheme", darkThemeName)),
|
||||
Not(HasNodeProperty(darkThemeName, "QtObject"))));
|
||||
|
@@ -519,9 +519,9 @@ TEST_F(AsynchronousImageCache, request_image_with_auxiliary_data_request_image_f
|
||||
_,
|
||||
_,
|
||||
VariantWith<FontCollectorSizesAuxiliaryData>(
|
||||
AllOf(Field(&FontCollectorSizesAuxiliaryData::sizes,
|
||||
AllOf(Field("FontCollectorSizesAuxiliaryData::sizes", &FontCollectorSizesAuxiliaryData::sizes,
|
||||
ElementsAre(QSize{20, 11})),
|
||||
Field(&FontCollectorSizesAuxiliaryData::colorName,
|
||||
Field("FontCollectorSizesAuxiliaryData::colorName", &FontCollectorSizesAuxiliaryData::colorName,
|
||||
Eq(u"color")))),
|
||||
_))
|
||||
.WillRepeatedly([&](auto, auto, auto, auto &&, auto, auto, auto) { notification.notify(); });
|
||||
@@ -548,9 +548,9 @@ TEST_F(AsynchronousImageCache, request_mid_size_image_with_auxiliary_data_reques
|
||||
_,
|
||||
_,
|
||||
VariantWith<FontCollectorSizesAuxiliaryData>(
|
||||
AllOf(Field(&FontCollectorSizesAuxiliaryData::sizes,
|
||||
AllOf(Field("FontCollectorSizesAuxiliaryData::sizes", &FontCollectorSizesAuxiliaryData::sizes,
|
||||
ElementsAre(QSize{20, 11})),
|
||||
Field(&FontCollectorSizesAuxiliaryData::colorName,
|
||||
Field("FontCollectorSizesAuxiliaryData::colorName", &FontCollectorSizesAuxiliaryData::colorName,
|
||||
Eq(u"color")))),
|
||||
_))
|
||||
.WillRepeatedly([&](auto, auto, auto, auto &&, auto, auto, auto) { notification.notify(); });
|
||||
@@ -577,9 +577,9 @@ TEST_F(AsynchronousImageCache, request_small_image_with_auxiliary_data_request_i
|
||||
_,
|
||||
_,
|
||||
VariantWith<FontCollectorSizesAuxiliaryData>(
|
||||
AllOf(Field(&FontCollectorSizesAuxiliaryData::sizes,
|
||||
AllOf(Field("FontCollectorSizesAuxiliaryData::sizes", &FontCollectorSizesAuxiliaryData::sizes,
|
||||
ElementsAre(QSize{20, 11})),
|
||||
Field(&FontCollectorSizesAuxiliaryData::colorName,
|
||||
Field("FontCollectorSizesAuxiliaryData::colorName", &FontCollectorSizesAuxiliaryData::colorName,
|
||||
Eq(u"color")))),
|
||||
_))
|
||||
.WillRepeatedly([&](auto, auto, auto, auto &&, auto, auto, auto) { notification.notify(); });
|
||||
|
@@ -74,10 +74,10 @@ TEST_F(AsynchronousImageFactory, request_image_with_auxiliary_data_request_image
|
||||
start(Eq("/path/to/Component.qml"),
|
||||
Eq("foo"),
|
||||
VariantWith<FontCollectorSizesAuxiliaryData>(
|
||||
AllOf(Field(&FontCollectorSizesAuxiliaryData::sizes,
|
||||
AllOf(Field("FontCollectorSizesAuxiliaryData::sizes", &FontCollectorSizesAuxiliaryData::sizes,
|
||||
ElementsAre(QSize{20, 11})),
|
||||
Field(&FontCollectorSizesAuxiliaryData::colorName, Eq(u"color")),
|
||||
Field(&FontCollectorSizesAuxiliaryData::text, Eq(u"some text")))),
|
||||
Field("FontCollectorSizesAuxiliaryData::colorName", &FontCollectorSizesAuxiliaryData::colorName, Eq(u"color")),
|
||||
Field("FontCollectorSizesAuxiliaryData::text", &FontCollectorSizesAuxiliaryData::text, Eq(u"some text")))),
|
||||
_,
|
||||
_,
|
||||
_))
|
||||
|
@@ -90,9 +90,9 @@ TEST_F(ImageCacheDispatchCollector, call_qml_collector_start)
|
||||
start(Eq("foo.qml"),
|
||||
Eq("state"),
|
||||
VariantWith<FontCollectorSizesAuxiliaryData>(
|
||||
AllOf(Field(&FontCollectorSizesAuxiliaryData::sizes,
|
||||
AllOf(Field("FontCollectorSizesAuxiliaryData::sizes", &FontCollectorSizesAuxiliaryData::sizes,
|
||||
ElementsAre(QSize{20, 11})),
|
||||
Field(&FontCollectorSizesAuxiliaryData::colorName, Eq(u"color")))),
|
||||
Field("FontCollectorSizesAuxiliaryData::colorName", &FontCollectorSizesAuxiliaryData::colorName, Eq(u"color")))),
|
||||
_,
|
||||
_,
|
||||
_))
|
||||
@@ -128,9 +128,9 @@ TEST_F(ImageCacheDispatchCollector, call_ui_file_collector_start)
|
||||
start(Eq("foo.ui.qml"),
|
||||
Eq("state"),
|
||||
VariantWith<FontCollectorSizesAuxiliaryData>(
|
||||
AllOf(Field(&FontCollectorSizesAuxiliaryData::sizes,
|
||||
AllOf(Field("FontCollectorSizesAuxiliaryData::sizes", &FontCollectorSizesAuxiliaryData::sizes,
|
||||
ElementsAre(QSize{20, 11})),
|
||||
Field(&FontCollectorSizesAuxiliaryData::colorName, Eq(u"color")))),
|
||||
Field("FontCollectorSizesAuxiliaryData::colorName", &FontCollectorSizesAuxiliaryData::colorName, Eq(u"color")))),
|
||||
_,
|
||||
_,
|
||||
_))
|
||||
@@ -206,9 +206,9 @@ TEST_F(ImageCacheDispatchCollector, first_collector_create_icon_calls)
|
||||
createIcon(Eq("foo.ui.qml"),
|
||||
Eq("state"),
|
||||
VariantWith<FontCollectorSizesAuxiliaryData>(
|
||||
AllOf(Field(&FontCollectorSizesAuxiliaryData::sizes,
|
||||
AllOf(Field("FontCollectorSizesAuxiliaryData::sizes", &FontCollectorSizesAuxiliaryData::sizes,
|
||||
ElementsAre(QSize{20, 11})),
|
||||
Field(&FontCollectorSizesAuxiliaryData::colorName,
|
||||
Field("FontCollectorSizesAuxiliaryData::colorName", &FontCollectorSizesAuxiliaryData::colorName,
|
||||
Eq(u"color"))))));
|
||||
EXPECT_CALL(collectorMock2, createIcon(_, _, _)).Times(0);
|
||||
|
||||
@@ -252,9 +252,9 @@ TEST_F(ImageCacheDispatchCollector, second_collector_create_icon_calls)
|
||||
createIcon(Eq("foo.qml"),
|
||||
Eq("state"),
|
||||
VariantWith<FontCollectorSizesAuxiliaryData>(
|
||||
AllOf(Field(&FontCollectorSizesAuxiliaryData::sizes,
|
||||
AllOf(Field("FontCollectorSizesAuxiliaryData::sizes", &FontCollectorSizesAuxiliaryData::sizes,
|
||||
ElementsAre(QSize{20, 11})),
|
||||
Field(&FontCollectorSizesAuxiliaryData::colorName,
|
||||
Field("FontCollectorSizesAuxiliaryData::colorName", &FontCollectorSizesAuxiliaryData::colorName,
|
||||
Eq(u"color"))))));
|
||||
EXPECT_CALL(collectorMock1, createIcon(_, _, _)).Times(0);
|
||||
|
||||
@@ -317,9 +317,9 @@ TEST_F(ImageCacheDispatchCollector, first_collector_create_image_calls)
|
||||
createImage(Eq("foo.ui.qml"),
|
||||
Eq("state"),
|
||||
VariantWith<FontCollectorSizesAuxiliaryData>(
|
||||
AllOf(Field(&FontCollectorSizesAuxiliaryData::sizes,
|
||||
AllOf(Field("FontCollectorSizesAuxiliaryData::sizes", &FontCollectorSizesAuxiliaryData::sizes,
|
||||
ElementsAre(QSize{20, 11})),
|
||||
Field(&FontCollectorSizesAuxiliaryData::colorName,
|
||||
Field("FontCollectorSizesAuxiliaryData::colorName", &FontCollectorSizesAuxiliaryData::colorName,
|
||||
Eq(u"color"))))));
|
||||
EXPECT_CALL(collectorMock2, createImage(_, _, _)).Times(0);
|
||||
|
||||
@@ -363,9 +363,9 @@ TEST_F(ImageCacheDispatchCollector, second_collector_create_image_calls)
|
||||
createImage(Eq("foo.qml"),
|
||||
Eq("state"),
|
||||
VariantWith<FontCollectorSizesAuxiliaryData>(
|
||||
AllOf(Field(&FontCollectorSizesAuxiliaryData::sizes,
|
||||
AllOf(Field("FontCollectorSizesAuxiliaryData::sizes", &FontCollectorSizesAuxiliaryData::sizes,
|
||||
ElementsAre(QSize{20, 11})),
|
||||
Field(&FontCollectorSizesAuxiliaryData::colorName,
|
||||
Field("FontCollectorSizesAuxiliaryData::colorName", &FontCollectorSizesAuxiliaryData::colorName,
|
||||
Eq(u"color"))))));
|
||||
EXPECT_CALL(collectorMock1, createImage(_, _, _)).Times(0);
|
||||
|
||||
|
@@ -421,9 +421,9 @@ TEST_F(ImageCacheGenerator, calls_collector_with_auxiliary_data)
|
||||
start(Eq("name"),
|
||||
_,
|
||||
VariantWith<FontCollectorSizesAuxiliaryData>(
|
||||
AllOf(Field(&FontCollectorSizesAuxiliaryData::sizes,
|
||||
AllOf(Field("FontCollectorSizesAuxiliaryData::sizes", &FontCollectorSizesAuxiliaryData::sizes,
|
||||
ElementsAre(QSize{20, 11})),
|
||||
Field(&FontCollectorSizesAuxiliaryData::colorName, Eq(u"color")))),
|
||||
Field("FontCollectorSizesAuxiliaryData::colorName", &FontCollectorSizesAuxiliaryData::colorName, Eq(u"color")))),
|
||||
_,
|
||||
_,
|
||||
_))
|
||||
|
@@ -240,9 +240,9 @@ TEST_F(SynchronousImageCache, icon_calls_collector_with_auxiliary_data)
|
||||
createIcon(Eq("/path/to/Component.qml"),
|
||||
Eq("extraId1"),
|
||||
VariantWith<FontCollectorSizesAuxiliaryData>(
|
||||
AllOf(Field(&FontCollectorSizesAuxiliaryData::sizes,
|
||||
AllOf(Field("FontCollectorSizesAuxiliaryData::sizes", &FontCollectorSizesAuxiliaryData::sizes,
|
||||
ElementsAre(QSize{20, 11})),
|
||||
Field(&FontCollectorSizesAuxiliaryData::colorName,
|
||||
Field("FontCollectorSizesAuxiliaryData::colorName", &FontCollectorSizesAuxiliaryData::colorName,
|
||||
Eq(u"color"))))));
|
||||
|
||||
auto icon = cache.icon("/path/to/Component.qml",
|
||||
@@ -261,9 +261,9 @@ TEST_F(SynchronousImageCache, image_calls_collector_with_auxiliary_data)
|
||||
createImage(Eq("/path/to/Component.qml"),
|
||||
Eq("extraId1"),
|
||||
VariantWith<FontCollectorSizesAuxiliaryData>(
|
||||
AllOf(Field(&FontCollectorSizesAuxiliaryData::sizes,
|
||||
AllOf(Field("FontCollectorSizesAuxiliaryData::sizes", &FontCollectorSizesAuxiliaryData::sizes,
|
||||
ElementsAre(QSize{20, 11})),
|
||||
Field(&FontCollectorSizesAuxiliaryData::colorName,
|
||||
Field("FontCollectorSizesAuxiliaryData::colorName", &FontCollectorSizesAuxiliaryData::colorName,
|
||||
Eq(u"color"))))));
|
||||
|
||||
auto icon = cache.image("/path/to/Component.qml",
|
||||
@@ -282,9 +282,9 @@ TEST_F(SynchronousImageCache, small_image_calls_collector_with_auxiliary_data)
|
||||
createImage(Eq("/path/to/Component.qml"),
|
||||
Eq("extraId1"),
|
||||
VariantWith<FontCollectorSizesAuxiliaryData>(
|
||||
AllOf(Field(&FontCollectorSizesAuxiliaryData::sizes,
|
||||
AllOf(Field("FontCollectorSizesAuxiliaryData::sizes", &FontCollectorSizesAuxiliaryData::sizes,
|
||||
ElementsAre(QSize{20, 11})),
|
||||
Field(&FontCollectorSizesAuxiliaryData::colorName,
|
||||
Field("FontCollectorSizesAuxiliaryData::colorName", &FontCollectorSizesAuxiliaryData::colorName,
|
||||
Eq(u"color"))))));
|
||||
|
||||
auto icon = cache.smallImage("/path/to/Component.qml",
|
||||
|
@@ -21,7 +21,7 @@ struct Task
|
||||
template<typename Matcher>
|
||||
auto IsTask(Matcher matcher)
|
||||
{
|
||||
return Field(&Task::i, matcher);
|
||||
return Field("Task::i", &Task::i, matcher);
|
||||
}
|
||||
|
||||
class TaskQueue : public testing::Test
|
||||
|
@@ -303,10 +303,10 @@ TEST_F(ListModelEditor, add_row_creates_new_model_node_and_reparents)
|
||||
{
|
||||
model.setListModel(listModelNode);
|
||||
|
||||
EXPECT_CALL(mockView, nodeCreated(Property(&ModelNode::type, Eq("ListElement"))));
|
||||
EXPECT_CALL(mockView, nodeCreated(Property("ModelNode::type", &ModelNode::type, Eq("ListElement"))));
|
||||
EXPECT_CALL(mockView,
|
||||
nodeReparented(Property(&ModelNode::type, Eq("ListElement")),
|
||||
Property(&AbstractProperty::parentModelNode, Eq(listModelNode)),
|
||||
nodeReparented(Property("ModelNode::type", &ModelNode::type, Eq("ListElement")),
|
||||
Property("AbstractProperty::parentModelNode", &AbstractProperty::parentModelNode, Eq(listModelNode)),
|
||||
_,
|
||||
_));
|
||||
|
||||
|
@@ -24,7 +24,7 @@ using QmlDesigner::Storage::TypeTraitsKind;
|
||||
template<typename Matcher>
|
||||
auto PropertyId(const Matcher &matcher)
|
||||
{
|
||||
return Property(&QmlDesigner::PropertyMetaInfo::id, matcher);
|
||||
return Property("QmlDesigner::PropertyMetaInfo::id", &QmlDesigner::PropertyMetaInfo::id, matcher);
|
||||
}
|
||||
|
||||
template<typename PropertyMatcher, typename ParentPropertyMatcher, typename NameMatcher>
|
||||
@@ -32,9 +32,15 @@ auto CompoundProperty(const PropertyMatcher &propertyMatcher,
|
||||
const ParentPropertyMatcher &parentPropertyMatcher,
|
||||
const NameMatcher &nameMatcher)
|
||||
{
|
||||
return AllOf(Field(&QmlDesigner::CompoundPropertyMetaInfo::property, propertyMatcher),
|
||||
Field(&QmlDesigner::CompoundPropertyMetaInfo::parent, parentPropertyMatcher),
|
||||
Property(&QmlDesigner::CompoundPropertyMetaInfo::name, nameMatcher));
|
||||
return AllOf(Field("QmlDesigner::CompoundPropertyMetaInfo::property",
|
||||
&QmlDesigner::CompoundPropertyMetaInfo::property,
|
||||
propertyMatcher),
|
||||
Field("QmlDesigner::CompoundPropertyMetaInfo::parent",
|
||||
&QmlDesigner::CompoundPropertyMetaInfo::parent,
|
||||
parentPropertyMatcher),
|
||||
Property("QmlDesigner::CompoundPropertyMetaInfo::name",
|
||||
&QmlDesigner::CompoundPropertyMetaInfo::name,
|
||||
nameMatcher));
|
||||
}
|
||||
|
||||
template<typename PropertyIdMatcher, typename ParentPropertyIdMatcher, typename NameMatcher>
|
||||
|
@@ -19,8 +19,8 @@ using QmlDesigner::ModelNode;
|
||||
template<typename NameMatcher>
|
||||
auto AuxiliaryProperty(AuxiliaryDataType type, const NameMatcher &nameMatcher, const QVariant &value)
|
||||
{
|
||||
return Pair(AllOf(Field(&AuxiliaryDataKey::type, type),
|
||||
Field(&AuxiliaryDataKey::name, nameMatcher)),
|
||||
return Pair(AllOf(Field("AuxiliaryDataKey::type", &AuxiliaryDataKey::type, type),
|
||||
Field("AuxiliaryDataKey::name", &AuxiliaryDataKey::name, nameMatcher)),
|
||||
value);
|
||||
}
|
||||
|
||||
|
@@ -15,13 +15,13 @@ QLatin1String qmlModulesPath(UNITTEST_DIR "/projectstorage/data/qml");
|
||||
template<typename Matcher>
|
||||
auto UrlProperty(const Matcher &matcher)
|
||||
{
|
||||
return Property(&QmlDesigner::Import::url, matcher);
|
||||
return Property("QmlDesigner::Import::url", &QmlDesigner::Import::url, matcher);
|
||||
}
|
||||
|
||||
template<typename Matcher>
|
||||
auto VersionProperty(const Matcher &matcher)
|
||||
{
|
||||
return Property(&QmlDesigner::Import::version, matcher);
|
||||
return Property("QmlDesigner::Import::version", &QmlDesigner::Import::version, matcher);
|
||||
}
|
||||
|
||||
template<typename Matcher>
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -313,9 +313,9 @@ TEST_F(QmlDocumentParser, functions)
|
||||
ASSERT_THAT(type.functionDeclarations,
|
||||
UnorderedElementsAre(
|
||||
AllOf(IsFunctionDeclaration("otherFunction", ""),
|
||||
Field(&Synchronization::FunctionDeclaration::parameters, IsEmpty())),
|
||||
Field("Synchronization::FunctionDeclaration::parameters", &Synchronization::FunctionDeclaration::parameters, IsEmpty())),
|
||||
AllOf(IsFunctionDeclaration("someScript", ""),
|
||||
Field(&Synchronization::FunctionDeclaration::parameters,
|
||||
Field("Synchronization::FunctionDeclaration::parameters", &Synchronization::FunctionDeclaration::parameters,
|
||||
ElementsAre(IsParameter("x", ""), IsParameter("y", ""))))));
|
||||
}
|
||||
|
||||
@@ -331,10 +331,10 @@ TEST_F(QmlDocumentParser, signals)
|
||||
ASSERT_THAT(type.signalDeclarations,
|
||||
UnorderedElementsAre(
|
||||
AllOf(IsSignalDeclaration("someSignal"),
|
||||
Field(&Synchronization::SignalDeclaration::parameters,
|
||||
Field("Synchronization::SignalDeclaration::parameters", &Synchronization::SignalDeclaration::parameters,
|
||||
ElementsAre(IsParameter("x", "int"), IsParameter("y", "real")))),
|
||||
AllOf(IsSignalDeclaration("signal2"),
|
||||
Field(&Synchronization::SignalDeclaration::parameters, IsEmpty()))));
|
||||
Field("Synchronization::SignalDeclaration::parameters", &Synchronization::SignalDeclaration::parameters, IsEmpty()))));
|
||||
}
|
||||
|
||||
TEST_F(QmlDocumentParser, enumeration)
|
||||
@@ -348,13 +348,13 @@ TEST_F(QmlDocumentParser, enumeration)
|
||||
ASSERT_THAT(type.enumerationDeclarations,
|
||||
UnorderedElementsAre(
|
||||
AllOf(IsEnumeration("Color"),
|
||||
Field(&Synchronization::EnumerationDeclaration::enumeratorDeclarations,
|
||||
Field("Synchronization::EnumerationDeclaration::enumeratorDeclarations", &Synchronization::EnumerationDeclaration::enumeratorDeclarations,
|
||||
ElementsAre(IsEnumerator("red", 0),
|
||||
IsEnumerator("green", 1),
|
||||
IsEnumerator("blue", 10),
|
||||
IsEnumerator("white", 11)))),
|
||||
AllOf(IsEnumeration("State"),
|
||||
Field(&Synchronization::EnumerationDeclaration::enumeratorDeclarations,
|
||||
Field("Synchronization::EnumerationDeclaration::enumeratorDeclarations", &Synchronization::EnumerationDeclaration::enumeratorDeclarations,
|
||||
ElementsAre(IsEnumerator("On", 0), IsEnumerator("Off", 1))))));
|
||||
}
|
||||
|
||||
|
@@ -80,7 +80,7 @@ MATCHER_P(IsSingleton, value, std::string(negation ? "isn't singleton " : "is si
|
||||
template<typename Matcher>
|
||||
auto IsTypeTrait(const Matcher &matcher)
|
||||
{
|
||||
return Field(&Synchronization::Type::traits, matcher);
|
||||
return Field("Synchronization::Type::traits", &Synchronization::Type::traits, matcher);
|
||||
}
|
||||
|
||||
MATCHER_P3(IsPropertyDeclaration,
|
||||
@@ -382,7 +382,7 @@ TEST_F(QmlTypesParser, properties_with_qualified_types)
|
||||
|
||||
ASSERT_THAT(types,
|
||||
Contains(
|
||||
Field(&Synchronization::Type::propertyDeclarations,
|
||||
Field("Synchronization::Type::propertyDeclarations", &Synchronization::Type::propertyDeclarations,
|
||||
UnorderedElementsAre(
|
||||
IsPropertyDeclaration("values",
|
||||
Synchronization::ImportedType{"Qt::Vector"},
|
||||
@@ -408,7 +408,7 @@ TEST_F(QmlTypesParser, properties_without_type)
|
||||
|
||||
ASSERT_THAT(types,
|
||||
ElementsAre(
|
||||
Field(&Synchronization::Type::propertyDeclarations,
|
||||
Field("Synchronization::Type::propertyDeclarations", &Synchronization::Type::propertyDeclarations,
|
||||
UnorderedElementsAre(
|
||||
IsPropertyDeclaration("target",
|
||||
Synchronization::ImportedType{"QObject"},
|
||||
@@ -444,17 +444,17 @@ TEST_F(QmlTypesParser, functions)
|
||||
&Synchronization::Type::functionDeclarations,
|
||||
UnorderedElementsAre(
|
||||
AllOf(IsFunctionDeclaration("advance", ""),
|
||||
Field(&Synchronization::FunctionDeclaration::parameters,
|
||||
Field("Synchronization::FunctionDeclaration::parameters", &Synchronization::FunctionDeclaration::parameters,
|
||||
UnorderedElementsAre(IsParameter("frames", "int"),
|
||||
IsParameter("fps", "double")))),
|
||||
AllOf(IsFunctionDeclaration("isImageLoading", "bool"),
|
||||
Field(&Synchronization::FunctionDeclaration::parameters,
|
||||
Field("Synchronization::FunctionDeclaration::parameters", &Synchronization::FunctionDeclaration::parameters,
|
||||
UnorderedElementsAre(IsParameter("url", "QUrl")))),
|
||||
AllOf(IsFunctionDeclaration("getContext", ""),
|
||||
Field(&Synchronization::FunctionDeclaration::parameters,
|
||||
Field("Synchronization::FunctionDeclaration::parameters", &Synchronization::FunctionDeclaration::parameters,
|
||||
UnorderedElementsAre(IsParameter("args", "QQmlV4Function")))),
|
||||
AllOf(IsFunctionDeclaration("movieUpdate", ""),
|
||||
Field(&Synchronization::FunctionDeclaration::parameters, IsEmpty()))))));
|
||||
Field("Synchronization::FunctionDeclaration::parameters", &Synchronization::FunctionDeclaration::parameters, IsEmpty()))))));
|
||||
}
|
||||
|
||||
TEST_F(QmlTypesParser, skip_java_script_functions)
|
||||
@@ -470,7 +470,7 @@ TEST_F(QmlTypesParser, skip_java_script_functions)
|
||||
|
||||
parser.parse(source, imports, types, directoryInfo);
|
||||
|
||||
ASSERT_THAT(types, ElementsAre(Field(&Synchronization::Type::functionDeclarations, IsEmpty())));
|
||||
ASSERT_THAT(types, ElementsAre(Field("Synchronization::Type::functionDeclarations", &Synchronization::Type::functionDeclarations, IsEmpty())));
|
||||
}
|
||||
|
||||
TEST_F(QmlTypesParser, functions_with_qualified_types)
|
||||
@@ -492,10 +492,10 @@ TEST_F(QmlTypesParser, functions_with_qualified_types)
|
||||
|
||||
ASSERT_THAT(types,
|
||||
Contains(
|
||||
Field(&Synchronization::Type::functionDeclarations,
|
||||
Field("Synchronization::Type::functionDeclarations", &Synchronization::Type::functionDeclarations,
|
||||
UnorderedElementsAre(AllOf(
|
||||
IsFunctionDeclaration("values", ""),
|
||||
Field(&Synchronization::FunctionDeclaration::parameters,
|
||||
Field("Synchronization::FunctionDeclaration::parameters", &Synchronization::FunctionDeclaration::parameters,
|
||||
UnorderedElementsAre(IsParameter("values", "Qt::Vector"),
|
||||
IsParameter("items", "Qt::List"),
|
||||
IsParameter("values2", "Qt::Vector"))))))));
|
||||
@@ -526,17 +526,17 @@ TEST_F(QmlTypesParser, signals)
|
||||
parser.parse(source, imports, types, directoryInfo);
|
||||
|
||||
ASSERT_THAT(types,
|
||||
ElementsAre(Field(&Synchronization::Type::signalDeclarations,
|
||||
ElementsAre(Field("Synchronization::Type::signalDeclarations", &Synchronization::Type::signalDeclarations,
|
||||
UnorderedElementsAre(
|
||||
AllOf(IsSignalDeclaration("advance"),
|
||||
Field(&Synchronization::SignalDeclaration::parameters,
|
||||
Field("Synchronization::SignalDeclaration::parameters", &Synchronization::SignalDeclaration::parameters,
|
||||
UnorderedElementsAre(IsParameter("frames", "int"),
|
||||
IsParameter("fps", "double")))),
|
||||
AllOf(IsSignalDeclaration("isImageLoading"),
|
||||
Field(&Synchronization::SignalDeclaration::parameters,
|
||||
Field("Synchronization::SignalDeclaration::parameters", &Synchronization::SignalDeclaration::parameters,
|
||||
UnorderedElementsAre(IsParameter("url", "QUrl")))),
|
||||
AllOf(IsSignalDeclaration("getContext"),
|
||||
Field(&Synchronization::SignalDeclaration::parameters,
|
||||
Field("Synchronization::SignalDeclaration::parameters", &Synchronization::SignalDeclaration::parameters,
|
||||
UnorderedElementsAre(
|
||||
IsParameter("args", "QQmlV4Function"))))))));
|
||||
}
|
||||
@@ -560,10 +560,10 @@ TEST_F(QmlTypesParser, signals_with_qualified_types)
|
||||
|
||||
ASSERT_THAT(types,
|
||||
Contains(
|
||||
Field(&Synchronization::Type::signalDeclarations,
|
||||
Field("Synchronization::Type::signalDeclarations", &Synchronization::Type::signalDeclarations,
|
||||
UnorderedElementsAre(AllOf(
|
||||
IsSignalDeclaration("values"),
|
||||
Field(&Synchronization::SignalDeclaration::parameters,
|
||||
Field("Synchronization::SignalDeclaration::parameters", &Synchronization::SignalDeclaration::parameters,
|
||||
UnorderedElementsAre(IsParameter("values", "Qt::Vector"),
|
||||
IsParameter("items", "Qt::List"),
|
||||
IsParameter("values2", "Qt::Vector"))))))));
|
||||
@@ -596,13 +596,13 @@ TEST_F(QmlTypesParser, enumerations)
|
||||
&Synchronization::Type::enumerationDeclarations,
|
||||
UnorderedElementsAre(
|
||||
AllOf(IsEnumeration("NamedColorSpace"),
|
||||
Field(&Synchronization::EnumerationDeclaration::enumeratorDeclarations,
|
||||
Field("Synchronization::EnumerationDeclaration::enumeratorDeclarations", &Synchronization::EnumerationDeclaration::enumeratorDeclarations,
|
||||
UnorderedElementsAre(IsEnumerator("Unknown"),
|
||||
IsEnumerator("SRgb"),
|
||||
IsEnumerator("AdobeRgb"),
|
||||
IsEnumerator("DisplayP3")))),
|
||||
AllOf(IsEnumeration("VerticalLayoutDirection"),
|
||||
Field(&Synchronization::EnumerationDeclaration::enumeratorDeclarations,
|
||||
Field("Synchronization::EnumerationDeclaration::enumeratorDeclarations", &Synchronization::EnumerationDeclaration::enumeratorDeclarations,
|
||||
UnorderedElementsAre(IsEnumerator("TopToBottom"),
|
||||
IsEnumerator("BottomToTop"))))))));
|
||||
}
|
||||
@@ -640,7 +640,7 @@ TEST_F(QmlTypesParser, enumeration_is_exported_as_type)
|
||||
Synchronization::ImportedType{},
|
||||
traits,
|
||||
qmltypesFileSourceId),
|
||||
Field(&Synchronization::Type::exportedTypes,
|
||||
Field("Synchronization::Type::exportedTypes", &Synchronization::Type::exportedTypes,
|
||||
UnorderedElementsAre(IsExportedType(qtQmlNativeModuleId,
|
||||
"QObject::NamedColorSpace",
|
||||
QmlDesigner::Storage::Version{})))),
|
||||
@@ -649,7 +649,7 @@ TEST_F(QmlTypesParser, enumeration_is_exported_as_type)
|
||||
Synchronization::ImportedType{},
|
||||
traits,
|
||||
qmltypesFileSourceId),
|
||||
Field(&Synchronization::Type::exportedTypes,
|
||||
Field("Synchronization::Type::exportedTypes", &Synchronization::Type::exportedTypes,
|
||||
UnorderedElementsAre(IsExportedType(qtQmlNativeModuleId,
|
||||
"QObject::VerticalLayoutDirection",
|
||||
QmlDesigner::Storage::Version{})))),
|
||||
@@ -685,7 +685,7 @@ TEST_F(QmlTypesParser, enumeration_is_exported_as_type_with_alias)
|
||||
Synchronization::ImportedType{},
|
||||
traits,
|
||||
qmltypesFileSourceId),
|
||||
Field(&Synchronization::Type::exportedTypes,
|
||||
Field("Synchronization::Type::exportedTypes", &Synchronization::Type::exportedTypes,
|
||||
UnorderedElementsAre(IsExportedType(qtQmlNativeModuleId,
|
||||
"QObject::NamedColorSpace",
|
||||
QmlDesigner::Storage::Version{}),
|
||||
@@ -733,7 +733,7 @@ TEST_F(QmlTypesParser, enumeration_is_exported_as_type_with_alias_too)
|
||||
Synchronization::ImportedType{},
|
||||
traits,
|
||||
qmltypesFileSourceId),
|
||||
Field(&Synchronization::Type::exportedTypes,
|
||||
Field("Synchronization::Type::exportedTypes", &Synchronization::Type::exportedTypes,
|
||||
UnorderedElementsAre(IsExportedType(qtQmlNativeModuleId,
|
||||
"QObject::NamedColorSpace",
|
||||
QmlDesigner::Storage::Version{}),
|
||||
@@ -763,7 +763,7 @@ TEST_F(QmlTypesParser, enumeration_is_referenced_by_qualified_name)
|
||||
parser.parse(source, imports, types, directoryInfo);
|
||||
|
||||
ASSERT_THAT(types,
|
||||
Contains(Field(&Synchronization::Type::propertyDeclarations,
|
||||
Contains(Field("Synchronization::Type::propertyDeclarations", &Synchronization::Type::propertyDeclarations,
|
||||
ElementsAre(IsPropertyDeclaration(
|
||||
"colorSpace",
|
||||
Synchronization::ImportedType{"QObject::NamedColorSpace"},
|
||||
@@ -791,7 +791,7 @@ TEST_F(QmlTypesParser, alias_enumeration_is_referenced_by_qualified_name)
|
||||
parser.parse(source, imports, types, directoryInfo);
|
||||
|
||||
ASSERT_THAT(types,
|
||||
Contains(Field(&Synchronization::Type::propertyDeclarations,
|
||||
Contains(Field("Synchronization::Type::propertyDeclarations", &Synchronization::Type::propertyDeclarations,
|
||||
ElementsAre(IsPropertyDeclaration(
|
||||
"colorSpace",
|
||||
Synchronization::ImportedType{"QObject::NamedColorSpaces"},
|
||||
@@ -880,7 +880,7 @@ TEST_F(QmlTypesParser, default_property)
|
||||
parser.parse(source, imports, types, directoryInfo);
|
||||
|
||||
ASSERT_THAT(types,
|
||||
ElementsAre(Field(&Synchronization::Type::defaultPropertyName, Eq("children"))));
|
||||
ElementsAre(Field("Synchronization::Type::defaultPropertyName", &Synchronization::Type::defaultPropertyName, Eq("children"))));
|
||||
}
|
||||
|
||||
TEST_F(QmlTypesParser, skip_template_item)
|
||||
|
@@ -27,10 +27,10 @@ protected:
|
||||
TEST_F(SqliteColumn, default_construct)
|
||||
{
|
||||
ASSERT_THAT(column,
|
||||
AllOf(Field(&Column::name, IsEmpty()),
|
||||
Field(&Column::tableName, IsEmpty()),
|
||||
Field(&Column::type, ColumnType::None),
|
||||
Field(&Column::constraints, IsEmpty())));
|
||||
AllOf(Field("Column::name", &Column::name, IsEmpty()),
|
||||
Field("Column::tableName", &Column::tableName, IsEmpty()),
|
||||
Field("Column::type", &Column::type, ColumnType::None),
|
||||
Field("Column::constraints", &Column::constraints, IsEmpty())));
|
||||
}
|
||||
|
||||
TEST_F(SqliteColumn, clear)
|
||||
@@ -43,10 +43,10 @@ TEST_F(SqliteColumn, clear)
|
||||
column.clear();
|
||||
|
||||
ASSERT_THAT(column,
|
||||
AllOf(Field(&Column::name, IsEmpty()),
|
||||
Field(&Column::tableName, IsEmpty()),
|
||||
Field(&Column::type, ColumnType::None),
|
||||
Field(&Column::constraints, IsEmpty())));
|
||||
AllOf(Field("Column::name", &Column::name, IsEmpty()),
|
||||
Field("Column::tableName", &Column::tableName, IsEmpty()),
|
||||
Field("Column::type", &Column::type, ColumnType::None),
|
||||
Field("Column::constraints", &Column::constraints, IsEmpty())));
|
||||
}
|
||||
|
||||
TEST_F(SqliteColumn, constructor)
|
||||
@@ -61,16 +61,16 @@ TEST_F(SqliteColumn, constructor)
|
||||
Enforment::Deferred}}};
|
||||
|
||||
ASSERT_THAT(column,
|
||||
AllOf(Field(&Column::name, Eq("column")),
|
||||
Field(&Column::tableName, Eq("table")),
|
||||
Field(&Column::type, ColumnType::Text),
|
||||
Field(&Column::constraints,
|
||||
AllOf(Field("Column::name", &Column::name, Eq("column")),
|
||||
Field("Column::tableName", &Column::tableName, Eq("table")),
|
||||
Field("Column::type", &Column::type, ColumnType::Text),
|
||||
Field("Column::constraints", &Column::constraints,
|
||||
ElementsAre(VariantWith<ForeignKey>(
|
||||
AllOf(Field(&ForeignKey::table, Eq("referencedTable")),
|
||||
Field(&ForeignKey::column, Eq("referencedColumn")),
|
||||
Field(&ForeignKey::updateAction, ForeignKeyAction::SetNull),
|
||||
Field(&ForeignKey::deleteAction, ForeignKeyAction::Cascade),
|
||||
Field(&ForeignKey::enforcement, Enforment::Deferred)))))));
|
||||
AllOf(Field("ForeignKey::table", &ForeignKey::table, Eq("referencedTable")),
|
||||
Field("ForeignKey::column", &ForeignKey::column, Eq("referencedColumn")),
|
||||
Field("ForeignKey::updateAction", &ForeignKey::updateAction, ForeignKeyAction::SetNull),
|
||||
Field("ForeignKey::deleteAction", &ForeignKey::deleteAction, ForeignKeyAction::Cascade),
|
||||
Field("ForeignKey::enforcement", &ForeignKey::enforcement, Enforment::Deferred)))))));
|
||||
}
|
||||
|
||||
TEST_F(SqliteColumn, flat_constructor)
|
||||
@@ -85,16 +85,16 @@ TEST_F(SqliteColumn, flat_constructor)
|
||||
Enforment::Deferred}}};
|
||||
|
||||
ASSERT_THAT(column,
|
||||
AllOf(Field(&Column::name, Eq("column")),
|
||||
Field(&Column::tableName, Eq("table")),
|
||||
Field(&Column::type, ColumnType::Text),
|
||||
Field(&Column::constraints,
|
||||
AllOf(Field("Column::name", &Column::name, Eq("column")),
|
||||
Field("Column::tableName", &Column::tableName, Eq("table")),
|
||||
Field("Column::type", &Column::type, ColumnType::Text),
|
||||
Field("Column::constraints", &Column::constraints,
|
||||
ElementsAre(VariantWith<ForeignKey>(
|
||||
AllOf(Field(&ForeignKey::table, Eq("referencedTable")),
|
||||
Field(&ForeignKey::column, Eq("referencedColumn")),
|
||||
Field(&ForeignKey::updateAction, ForeignKeyAction::SetNull),
|
||||
Field(&ForeignKey::deleteAction, ForeignKeyAction::Cascade),
|
||||
Field(&ForeignKey::enforcement, Enforment::Deferred)))))));
|
||||
AllOf(Field("ForeignKey::table", &ForeignKey::table, Eq("referencedTable")),
|
||||
Field("ForeignKey::column", &ForeignKey::column, Eq("referencedColumn")),
|
||||
Field("ForeignKey::updateAction", &ForeignKey::updateAction, ForeignKeyAction::SetNull),
|
||||
Field("ForeignKey::deleteAction", &ForeignKey::deleteAction, ForeignKeyAction::Cascade),
|
||||
Field("ForeignKey::enforcement", &ForeignKey::enforcement, Enforment::Deferred)))))));
|
||||
}
|
||||
|
||||
class SqliteStrictColumn : public ::testing::Test
|
||||
@@ -108,10 +108,10 @@ protected:
|
||||
TEST_F(SqliteStrictColumn, default_construct)
|
||||
{
|
||||
ASSERT_THAT(column,
|
||||
AllOf(Field(&Column::name, IsEmpty()),
|
||||
Field(&Column::tableName, IsEmpty()),
|
||||
Field(&Column::type, StrictColumnType::Any),
|
||||
Field(&Column::constraints, IsEmpty())));
|
||||
AllOf(Field("Column::name", &Column::name, IsEmpty()),
|
||||
Field("Column::tableName", &Column::tableName, IsEmpty()),
|
||||
Field("Column::type", &Column::type, StrictColumnType::Any),
|
||||
Field("Column::constraints", &Column::constraints, IsEmpty())));
|
||||
}
|
||||
|
||||
TEST_F(SqliteStrictColumn, clear)
|
||||
@@ -124,10 +124,10 @@ TEST_F(SqliteStrictColumn, clear)
|
||||
column.clear();
|
||||
|
||||
ASSERT_THAT(column,
|
||||
AllOf(Field(&Column::name, IsEmpty()),
|
||||
Field(&Column::tableName, IsEmpty()),
|
||||
Field(&Column::type, StrictColumnType::Any),
|
||||
Field(&Column::constraints, IsEmpty())));
|
||||
AllOf(Field("Column::name", &Column::name, IsEmpty()),
|
||||
Field("Column::tableName", &Column::tableName, IsEmpty()),
|
||||
Field("Column::type", &Column::type, StrictColumnType::Any),
|
||||
Field("Column::constraints", &Column::constraints, IsEmpty())));
|
||||
}
|
||||
|
||||
TEST_F(SqliteStrictColumn, constructor)
|
||||
@@ -142,16 +142,16 @@ TEST_F(SqliteStrictColumn, constructor)
|
||||
Enforment::Deferred}}};
|
||||
|
||||
ASSERT_THAT(column,
|
||||
AllOf(Field(&Column::name, Eq("column")),
|
||||
Field(&Column::tableName, Eq("table")),
|
||||
Field(&Column::type, StrictColumnType::Text),
|
||||
Field(&Column::constraints,
|
||||
AllOf(Field("Column::name", &Column::name, Eq("column")),
|
||||
Field("Column::tableName", &Column::tableName, Eq("table")),
|
||||
Field("Column::type", &Column::type, StrictColumnType::Text),
|
||||
Field("Column::constraints", &Column::constraints,
|
||||
ElementsAre(VariantWith<ForeignKey>(
|
||||
AllOf(Field(&ForeignKey::table, Eq("referencedTable")),
|
||||
Field(&ForeignKey::column, Eq("referencedColumn")),
|
||||
Field(&ForeignKey::updateAction, ForeignKeyAction::SetNull),
|
||||
Field(&ForeignKey::deleteAction, ForeignKeyAction::Cascade),
|
||||
Field(&ForeignKey::enforcement, Enforment::Deferred)))))));
|
||||
AllOf(Field("ForeignKey::table", &ForeignKey::table, Eq("referencedTable")),
|
||||
Field("ForeignKey::column", &ForeignKey::column, Eq("referencedColumn")),
|
||||
Field("ForeignKey::updateAction", &ForeignKey::updateAction, ForeignKeyAction::SetNull),
|
||||
Field("ForeignKey::deleteAction", &ForeignKey::deleteAction, ForeignKeyAction::Cascade),
|
||||
Field("ForeignKey::enforcement", &ForeignKey::enforcement, Enforment::Deferred)))))));
|
||||
}
|
||||
|
||||
TEST_F(SqliteStrictColumn, flat_constructor)
|
||||
@@ -166,16 +166,16 @@ TEST_F(SqliteStrictColumn, flat_constructor)
|
||||
Enforment::Deferred}}};
|
||||
|
||||
ASSERT_THAT(column,
|
||||
AllOf(Field(&Column::name, Eq("column")),
|
||||
Field(&Column::tableName, Eq("table")),
|
||||
Field(&Column::type, StrictColumnType::Text),
|
||||
Field(&Column::constraints,
|
||||
AllOf(Field("Column::name", &Column::name, Eq("column")),
|
||||
Field("Column::tableName", &Column::tableName, Eq("table")),
|
||||
Field("Column::type", &Column::type, StrictColumnType::Text),
|
||||
Field("Column::constraints", &Column::constraints,
|
||||
ElementsAre(VariantWith<ForeignKey>(
|
||||
AllOf(Field(&ForeignKey::table, Eq("referencedTable")),
|
||||
Field(&ForeignKey::column, Eq("referencedColumn")),
|
||||
Field(&ForeignKey::updateAction, ForeignKeyAction::SetNull),
|
||||
Field(&ForeignKey::deleteAction, ForeignKeyAction::Cascade),
|
||||
Field(&ForeignKey::enforcement, Enforment::Deferred)))))));
|
||||
AllOf(Field("ForeignKey::table", &ForeignKey::table, Eq("referencedTable")),
|
||||
Field("ForeignKey::column", &ForeignKey::column, Eq("referencedColumn")),
|
||||
Field("ForeignKey::updateAction", &ForeignKey::updateAction, ForeignKeyAction::SetNull),
|
||||
Field("ForeignKey::deleteAction", &ForeignKey::deleteAction, ForeignKeyAction::Cascade),
|
||||
Field("ForeignKey::enforcement", &ForeignKey::enforcement, Enforment::Deferred)))))));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@@ -665,7 +665,7 @@ TEST_F(SqliteStatement, write_sqlite_blob_value)
|
||||
statement.write(Sqlite::Value{bytes});
|
||||
|
||||
ASSERT_THAT(readStatement.template optionalValue<Sqlite::Blob>(),
|
||||
Optional(Field(&Sqlite::Blob::bytes, Eq(bytes))));
|
||||
Optional(Field("Sqlite::Blob::bytes", &Sqlite::Blob::bytes, Eq(bytes))));
|
||||
}
|
||||
|
||||
TEST_F(SqliteStatement, write_null_value_view)
|
||||
@@ -717,7 +717,7 @@ TEST_F(SqliteStatement, write_sqlite_blob_value_view)
|
||||
statement.write(Sqlite::ValueView::create(bytes));
|
||||
|
||||
ASSERT_THAT(readStatement.template optionalValue<Sqlite::Blob>(),
|
||||
Optional(Field(&Sqlite::Blob::bytes, Eq(bytes))));
|
||||
Optional(Field("Sqlite::Blob::bytes", &Sqlite::Blob::bytes, Eq(bytes))));
|
||||
}
|
||||
|
||||
TEST_F(SqliteStatement, write_empty_blobs)
|
||||
@@ -754,7 +754,7 @@ TEST_F(SqliteStatement, write_blobs)
|
||||
statement.write(bytes);
|
||||
|
||||
ASSERT_THAT(readStatement.template optionalValue<Sqlite::Blob>(),
|
||||
Optional(Field(&Sqlite::Blob::bytes, Eq(bytes))));
|
||||
Optional(Field("Sqlite::Blob::bytes", &Sqlite::Blob::bytes, Eq(bytes))));
|
||||
}
|
||||
|
||||
TEST_F(SqliteStatement, cannot_write_to_closed_database)
|
||||
@@ -1145,7 +1145,7 @@ TEST_F(SqliteStatement, get_blob_values)
|
||||
|
||||
auto values = statement.values<Sqlite::Blob>();
|
||||
|
||||
ASSERT_THAT(values, ElementsAre(Field(&Sqlite::Blob::bytes, Eq(bytes))));
|
||||
ASSERT_THAT(values, ElementsAre(Field("Sqlite::Blob::bytes", &Sqlite::Blob::bytes, Eq(bytes))));
|
||||
}
|
||||
|
||||
TEST_F(SqliteStatement, get_empty_optional_blob_value_for_integer)
|
||||
@@ -1154,7 +1154,7 @@ TEST_F(SqliteStatement, get_empty_optional_blob_value_for_integer)
|
||||
|
||||
auto value = statement.optionalValue<Sqlite::Blob>();
|
||||
|
||||
ASSERT_THAT(value, Optional(Field(&Sqlite::Blob::bytes, IsEmpty())));
|
||||
ASSERT_THAT(value, Optional(Field("Sqlite::Blob::bytes", &Sqlite::Blob::bytes, IsEmpty())));
|
||||
}
|
||||
|
||||
TEST_F(SqliteStatement, get_empty_optional_blob_value_for_float)
|
||||
@@ -1163,7 +1163,7 @@ TEST_F(SqliteStatement, get_empty_optional_blob_value_for_float)
|
||||
|
||||
auto value = statement.optionalValue<Sqlite::Blob>();
|
||||
|
||||
ASSERT_THAT(value, Optional(Field(&Sqlite::Blob::bytes, IsEmpty())));
|
||||
ASSERT_THAT(value, Optional(Field("Sqlite::Blob::bytes", &Sqlite::Blob::bytes, IsEmpty())));
|
||||
}
|
||||
|
||||
TEST_F(SqliteStatement, get_empty_optional_blob_value_for_text)
|
||||
@@ -1172,7 +1172,7 @@ TEST_F(SqliteStatement, get_empty_optional_blob_value_for_text)
|
||||
|
||||
auto value = statement.optionalValue<Sqlite::Blob>();
|
||||
|
||||
ASSERT_THAT(value, Optional(Field(&Sqlite::Blob::bytes, IsEmpty())));
|
||||
ASSERT_THAT(value, Optional(Field("Sqlite::Blob::bytes", &Sqlite::Blob::bytes, IsEmpty())));
|
||||
}
|
||||
|
||||
TEST_F(SqliteStatement, get_optional_single_value_and_multiple_query_value)
|
||||
|
@@ -172,10 +172,10 @@ TEST_F(SqliteTable, add_column)
|
||||
auto &column = table.addColumn("name", ColumnType::Text, {Sqlite::Unique{}});
|
||||
|
||||
ASSERT_THAT(column,
|
||||
AllOf(Field(&Column::name, Eq("name")),
|
||||
Field(&Column::tableName, Eq(tableName)),
|
||||
Field(&Column::type, ColumnType::Text),
|
||||
Field(&Column::constraints,
|
||||
AllOf(Field("Column::name", &Column::name, Eq("name")),
|
||||
Field("Column::tableName", &Column::tableName, Eq(tableName)),
|
||||
Field("Column::type", &Column::type, ColumnType::Text),
|
||||
Field("Column::constraints", &Column::constraints,
|
||||
ElementsAre(VariantWith<Sqlite::Unique>(Eq(Sqlite::Unique{}))))));
|
||||
}
|
||||
|
||||
@@ -193,16 +193,16 @@ TEST_F(SqliteTable, add_foreign_key_column_with_table)
|
||||
Enforment::Deferred);
|
||||
|
||||
ASSERT_THAT(column,
|
||||
AllOf(Field(&Column::name, Eq("name")),
|
||||
Field(&Column::tableName, Eq(tableName)),
|
||||
Field(&Column::type, ColumnType::Integer),
|
||||
Field(&Column::constraints,
|
||||
AllOf(Field("Column::name", &Column::name, Eq("name")),
|
||||
Field("Column::tableName", &Column::tableName, Eq(tableName)),
|
||||
Field("Column::type", &Column::type, ColumnType::Integer),
|
||||
Field("Column::constraints", &Column::constraints,
|
||||
ElementsAre(VariantWith<ForeignKey>(
|
||||
AllOf(Field(&ForeignKey::table, Eq("foreignTable")),
|
||||
Field(&ForeignKey::column, IsEmpty()),
|
||||
Field(&ForeignKey::updateAction, ForeignKeyAction::SetNull),
|
||||
Field(&ForeignKey::deleteAction, ForeignKeyAction::Cascade),
|
||||
Field(&ForeignKey::enforcement, Enforment::Deferred)))))));
|
||||
AllOf(Field("ForeignKey::table", &ForeignKey::table, Eq("foreignTable")),
|
||||
Field("ForeignKey::column", &ForeignKey::column, IsEmpty()),
|
||||
Field("ForeignKey::updateAction", &ForeignKey::updateAction, ForeignKeyAction::SetNull),
|
||||
Field("ForeignKey::deleteAction", &ForeignKey::deleteAction, ForeignKeyAction::Cascade),
|
||||
Field("ForeignKey::enforcement", &ForeignKey::enforcement, Enforment::Deferred)))))));
|
||||
}
|
||||
|
||||
TEST_F(SqliteTable, add_foreign_key_column_with_column)
|
||||
@@ -219,16 +219,16 @@ TEST_F(SqliteTable, add_foreign_key_column_with_column)
|
||||
Enforment::Deferred);
|
||||
|
||||
ASSERT_THAT(column,
|
||||
AllOf(Field(&Column::name, Eq("name")),
|
||||
Field(&Column::tableName, Eq(tableName)),
|
||||
Field(&Column::type, ColumnType::Text),
|
||||
Field(&Column::constraints,
|
||||
AllOf(Field("Column::name", &Column::name, Eq("name")),
|
||||
Field("Column::tableName", &Column::tableName, Eq(tableName)),
|
||||
Field("Column::type", &Column::type, ColumnType::Text),
|
||||
Field("Column::constraints", &Column::constraints,
|
||||
ElementsAre(VariantWith<ForeignKey>(
|
||||
AllOf(Field(&ForeignKey::table, Eq("foreignTable")),
|
||||
Field(&ForeignKey::column, Eq("foreignColumn")),
|
||||
Field(&ForeignKey::updateAction, ForeignKeyAction::SetNull),
|
||||
Field(&ForeignKey::deleteAction, ForeignKeyAction::Cascade),
|
||||
Field(&ForeignKey::enforcement, Enforment::Deferred)))))));
|
||||
AllOf(Field("ForeignKey::table", &ForeignKey::table, Eq("foreignTable")),
|
||||
Field("ForeignKey::column", &ForeignKey::column, Eq("foreignColumn")),
|
||||
Field("ForeignKey::updateAction", &ForeignKey::updateAction, ForeignKeyAction::SetNull),
|
||||
Field("ForeignKey::deleteAction", &ForeignKey::deleteAction, ForeignKeyAction::Cascade),
|
||||
Field("ForeignKey::enforcement", &ForeignKey::enforcement, Enforment::Deferred)))))));
|
||||
}
|
||||
|
||||
TEST_F(SqliteTable, add_foreign_key_which_is_not_unique_throws_an_exceptions)
|
||||
@@ -261,17 +261,17 @@ TEST_F(SqliteTable, add_foreign_key_column_with_table_and_not_null)
|
||||
{Sqlite::NotNull{}});
|
||||
|
||||
ASSERT_THAT(column,
|
||||
AllOf(Field(&Column::name, Eq("name")),
|
||||
Field(&Column::tableName, Eq(tableName)),
|
||||
Field(&Column::type, ColumnType::Integer),
|
||||
Field(&Column::constraints,
|
||||
AllOf(Field("Column::name", &Column::name, Eq("name")),
|
||||
Field("Column::tableName", &Column::tableName, Eq(tableName)),
|
||||
Field("Column::type", &Column::type, ColumnType::Integer),
|
||||
Field("Column::constraints", &Column::constraints,
|
||||
UnorderedElementsAre(
|
||||
VariantWith<ForeignKey>(
|
||||
AllOf(Field(&ForeignKey::table, Eq("foreignTable")),
|
||||
Field(&ForeignKey::column, IsEmpty()),
|
||||
Field(&ForeignKey::updateAction, ForeignKeyAction::SetNull),
|
||||
Field(&ForeignKey::deleteAction, ForeignKeyAction::Cascade),
|
||||
Field(&ForeignKey::enforcement, Enforment::Deferred))),
|
||||
AllOf(Field("ForeignKey::table", &ForeignKey::table, Eq("foreignTable")),
|
||||
Field("ForeignKey::column", &ForeignKey::column, IsEmpty()),
|
||||
Field("ForeignKey::updateAction", &ForeignKey::updateAction, ForeignKeyAction::SetNull),
|
||||
Field("ForeignKey::deleteAction", &ForeignKey::deleteAction, ForeignKeyAction::Cascade),
|
||||
Field("ForeignKey::enforcement", &ForeignKey::enforcement, Enforment::Deferred))),
|
||||
VariantWith<Sqlite::NotNull>(Eq(Sqlite::NotNull{}))))));
|
||||
}
|
||||
|
||||
@@ -290,17 +290,17 @@ TEST_F(SqliteTable, add_foreign_key_column_with_column_and_not_null)
|
||||
{Sqlite::NotNull{}});
|
||||
|
||||
ASSERT_THAT(column,
|
||||
AllOf(Field(&Column::name, Eq("name")),
|
||||
Field(&Column::tableName, Eq(tableName)),
|
||||
Field(&Column::type, ColumnType::Text),
|
||||
Field(&Column::constraints,
|
||||
AllOf(Field("Column::name", &Column::name, Eq("name")),
|
||||
Field("Column::tableName", &Column::tableName, Eq(tableName)),
|
||||
Field("Column::type", &Column::type, ColumnType::Text),
|
||||
Field("Column::constraints", &Column::constraints,
|
||||
UnorderedElementsAre(
|
||||
VariantWith<ForeignKey>(
|
||||
AllOf(Field(&ForeignKey::table, Eq("foreignTable")),
|
||||
Field(&ForeignKey::column, Eq("foreignColumn")),
|
||||
Field(&ForeignKey::updateAction, ForeignKeyAction::SetNull),
|
||||
Field(&ForeignKey::deleteAction, ForeignKeyAction::Cascade),
|
||||
Field(&ForeignKey::enforcement, Enforment::Deferred))),
|
||||
AllOf(Field("ForeignKey::table", &ForeignKey::table, Eq("foreignTable")),
|
||||
Field("ForeignKey::column", &ForeignKey::column, Eq("foreignColumn")),
|
||||
Field("ForeignKey::updateAction", &ForeignKey::updateAction, ForeignKeyAction::SetNull),
|
||||
Field("ForeignKey::deleteAction", &ForeignKey::deleteAction, ForeignKeyAction::Cascade),
|
||||
Field("ForeignKey::enforcement", &ForeignKey::enforcement, Enforment::Deferred))),
|
||||
VariantWith<Sqlite::NotNull>(Eq(Sqlite::NotNull{}))))));
|
||||
}
|
||||
|
||||
@@ -471,10 +471,10 @@ TEST_F(StrictSqliteTable, add_column)
|
||||
auto &column = table.addColumn("name", StrictColumnType::Text, {Sqlite::Unique{}});
|
||||
|
||||
ASSERT_THAT(column,
|
||||
AllOf(Field(&Column::name, Eq("name")),
|
||||
Field(&Column::tableName, Eq(tableName)),
|
||||
Field(&Column::type, StrictColumnType::Text),
|
||||
Field(&Column::constraints,
|
||||
AllOf(Field("Column::name", &Column::name, Eq("name")),
|
||||
Field("Column::tableName", &Column::tableName, Eq(tableName)),
|
||||
Field("Column::type", &Column::type, StrictColumnType::Text),
|
||||
Field("Column::constraints", &Column::constraints,
|
||||
ElementsAre(VariantWith<Sqlite::Unique>(Eq(Sqlite::Unique{}))))));
|
||||
}
|
||||
|
||||
@@ -492,16 +492,16 @@ TEST_F(StrictSqliteTable, add_foreign_key_column_with_table)
|
||||
Enforment::Deferred);
|
||||
|
||||
ASSERT_THAT(column,
|
||||
AllOf(Field(&Column::name, Eq("name")),
|
||||
Field(&Column::tableName, Eq(tableName)),
|
||||
Field(&Column::type, StrictColumnType::Integer),
|
||||
Field(&Column::constraints,
|
||||
AllOf(Field("Column::name", &Column::name, Eq("name")),
|
||||
Field("Column::tableName", &Column::tableName, Eq(tableName)),
|
||||
Field("Column::type", &Column::type, StrictColumnType::Integer),
|
||||
Field("Column::constraints", &Column::constraints,
|
||||
ElementsAre(VariantWith<ForeignKey>(
|
||||
AllOf(Field(&ForeignKey::table, Eq("foreignTable")),
|
||||
Field(&ForeignKey::column, IsEmpty()),
|
||||
Field(&ForeignKey::updateAction, ForeignKeyAction::SetNull),
|
||||
Field(&ForeignKey::deleteAction, ForeignKeyAction::Cascade),
|
||||
Field(&ForeignKey::enforcement, Enforment::Deferred)))))));
|
||||
AllOf(Field("ForeignKey::table", &ForeignKey::table, Eq("foreignTable")),
|
||||
Field("ForeignKey::column", &ForeignKey::column, IsEmpty()),
|
||||
Field("ForeignKey::updateAction", &ForeignKey::updateAction, ForeignKeyAction::SetNull),
|
||||
Field("ForeignKey::deleteAction", &ForeignKey::deleteAction, ForeignKeyAction::Cascade),
|
||||
Field("ForeignKey::enforcement", &ForeignKey::enforcement, Enforment::Deferred)))))));
|
||||
}
|
||||
|
||||
TEST_F(StrictSqliteTable, add_foreign_key_column_with_column)
|
||||
@@ -520,16 +520,16 @@ TEST_F(StrictSqliteTable, add_foreign_key_column_with_column)
|
||||
Enforment::Deferred);
|
||||
|
||||
ASSERT_THAT(column,
|
||||
AllOf(Field(&Column::name, Eq("name")),
|
||||
Field(&Column::tableName, Eq(tableName)),
|
||||
Field(&Column::type, StrictColumnType::Text),
|
||||
Field(&Column::constraints,
|
||||
AllOf(Field("Column::name", &Column::name, Eq("name")),
|
||||
Field("Column::tableName", &Column::tableName, Eq(tableName)),
|
||||
Field("Column::type", &Column::type, StrictColumnType::Text),
|
||||
Field("Column::constraints", &Column::constraints,
|
||||
ElementsAre(VariantWith<ForeignKey>(
|
||||
AllOf(Field(&ForeignKey::table, Eq("foreignTable")),
|
||||
Field(&ForeignKey::column, Eq("foreignColumn")),
|
||||
Field(&ForeignKey::updateAction, ForeignKeyAction::SetNull),
|
||||
Field(&ForeignKey::deleteAction, ForeignKeyAction::Cascade),
|
||||
Field(&ForeignKey::enforcement, Enforment::Deferred)))))));
|
||||
AllOf(Field("ForeignKey::table", &ForeignKey::table, Eq("foreignTable")),
|
||||
Field("ForeignKey::column", &ForeignKey::column, Eq("foreignColumn")),
|
||||
Field("ForeignKey::updateAction", &ForeignKey::updateAction, ForeignKeyAction::SetNull),
|
||||
Field("ForeignKey::deleteAction", &ForeignKey::deleteAction, ForeignKeyAction::Cascade),
|
||||
Field("ForeignKey::enforcement", &ForeignKey::enforcement, Enforment::Deferred)))))));
|
||||
}
|
||||
|
||||
TEST_F(StrictSqliteTable, add_foreign_key_which_is_not_unique_throws_an_exceptions)
|
||||
@@ -562,17 +562,17 @@ TEST_F(StrictSqliteTable, add_foreign_key_column_with_table_and_not_null)
|
||||
{Sqlite::NotNull{}});
|
||||
|
||||
ASSERT_THAT(column,
|
||||
AllOf(Field(&Column::name, Eq("name")),
|
||||
Field(&Column::tableName, Eq(tableName)),
|
||||
Field(&Column::type, StrictColumnType::Integer),
|
||||
Field(&Column::constraints,
|
||||
AllOf(Field("Column::name", &Column::name, Eq("name")),
|
||||
Field("Column::tableName", &Column::tableName, Eq(tableName)),
|
||||
Field("Column::type", &Column::type, StrictColumnType::Integer),
|
||||
Field("Column::constraints", &Column::constraints,
|
||||
UnorderedElementsAre(
|
||||
VariantWith<ForeignKey>(
|
||||
AllOf(Field(&ForeignKey::table, Eq("foreignTable")),
|
||||
Field(&ForeignKey::column, IsEmpty()),
|
||||
Field(&ForeignKey::updateAction, ForeignKeyAction::SetNull),
|
||||
Field(&ForeignKey::deleteAction, ForeignKeyAction::Cascade),
|
||||
Field(&ForeignKey::enforcement, Enforment::Deferred))),
|
||||
AllOf(Field("ForeignKey::table", &ForeignKey::table, Eq("foreignTable")),
|
||||
Field("ForeignKey::column", &ForeignKey::column, IsEmpty()),
|
||||
Field("ForeignKey::updateAction", &ForeignKey::updateAction, ForeignKeyAction::SetNull),
|
||||
Field("ForeignKey::deleteAction", &ForeignKey::deleteAction, ForeignKeyAction::Cascade),
|
||||
Field("ForeignKey::enforcement", &ForeignKey::enforcement, Enforment::Deferred))),
|
||||
VariantWith<Sqlite::NotNull>(Eq(Sqlite::NotNull{}))))));
|
||||
}
|
||||
|
||||
@@ -593,17 +593,17 @@ TEST_F(StrictSqliteTable, add_foreign_key_column_with_column_and_not_null)
|
||||
{Sqlite::NotNull{}});
|
||||
|
||||
ASSERT_THAT(column,
|
||||
AllOf(Field(&Column::name, Eq("name")),
|
||||
Field(&Column::tableName, Eq(tableName)),
|
||||
Field(&Column::type, StrictColumnType::Text),
|
||||
Field(&Column::constraints,
|
||||
AllOf(Field("Column::name", &Column::name, Eq("name")),
|
||||
Field("Column::tableName", &Column::tableName, Eq(tableName)),
|
||||
Field("Column::type", &Column::type, StrictColumnType::Text),
|
||||
Field("Column::constraints", &Column::constraints,
|
||||
UnorderedElementsAre(
|
||||
VariantWith<ForeignKey>(
|
||||
AllOf(Field(&ForeignKey::table, Eq("foreignTable")),
|
||||
Field(&ForeignKey::column, Eq("foreignColumn")),
|
||||
Field(&ForeignKey::updateAction, ForeignKeyAction::SetNull),
|
||||
Field(&ForeignKey::deleteAction, ForeignKeyAction::Cascade),
|
||||
Field(&ForeignKey::enforcement, Enforment::Deferred))),
|
||||
AllOf(Field("ForeignKey::table", &ForeignKey::table, Eq("foreignTable")),
|
||||
Field("ForeignKey::column", &ForeignKey::column, Eq("foreignColumn")),
|
||||
Field("ForeignKey::updateAction", &ForeignKey::updateAction, ForeignKeyAction::SetNull),
|
||||
Field("ForeignKey::deleteAction", &ForeignKey::deleteAction, ForeignKeyAction::Cascade),
|
||||
Field("ForeignKey::enforcement", &ForeignKey::enforcement, Enforment::Deferred))),
|
||||
VariantWith<Sqlite::NotNull>(Eq(Sqlite::NotNull{}))))));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user