Extended t00044 with JSON checks
This commit is contained in:
@@ -74,7 +74,7 @@ std::string class_::full_name_no_ns() const
|
||||
|
||||
ostr << name();
|
||||
|
||||
render_template_params(ostr, using_namespace(), false);
|
||||
render_template_params(ostr, using_namespace(), true);
|
||||
|
||||
return ostr.str();
|
||||
}
|
||||
@@ -115,9 +115,7 @@ int class_::calculate_template_specialization_match(const class_ &other) const
|
||||
{
|
||||
int res{0};
|
||||
|
||||
const std::string left = name_and_ns();
|
||||
// TODO: handle variadic templates
|
||||
if (left != other.name_and_ns()) {
|
||||
if (name_and_ns() != other.name_and_ns()) {
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -1763,6 +1763,7 @@ translation_unit_visitor::process_template_specialization(
|
||||
{
|
||||
auto c_ptr{std::make_unique<class_>(config_.using_namespace())};
|
||||
auto &template_instantiation = *c_ptr;
|
||||
template_instantiation.is_template(true);
|
||||
|
||||
// TODO: refactor to method get_qualified_name()
|
||||
auto qualified_name = cls->getQualifiedNameAsString();
|
||||
@@ -2192,6 +2193,7 @@ std::unique_ptr<class_> translation_unit_visitor::build_template_instantiation(
|
||||
std::make_unique<class_>(config_.using_namespace());
|
||||
|
||||
auto &template_instantiation = *template_instantiation_ptr;
|
||||
template_instantiation.is_template(true);
|
||||
|
||||
std::string full_template_specialization_name = common::to_string(
|
||||
template_type.desugar(),
|
||||
|
||||
@@ -41,18 +41,16 @@ TEST_CASE("t00044", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, IsClassTemplate("signal_handler", "Ret(Args...),A"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("signal_handler", "void(int),bool"));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsClassTemplate(
|
||||
"sink", "clanguml::t00044::signal_handler<Ret(Args...),A>"));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(_A("sink<T>"),
|
||||
_A("sink<clanguml::t00044::signal_handler<Ret(Args...),A>>")));
|
||||
REQUIRE_THAT(
|
||||
puml, IsClassTemplate("sink", "signal_handler<Ret(Args...),A>"));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(
|
||||
_A("sink<clanguml::t00044::signal_handler<Ret(Args...),A>>"),
|
||||
_A("sink<clanguml::t00044::signal_handler<void(int),bool>>")));
|
||||
_A("sink<T>"), _A("sink<signal_handler<Ret(Args...),A>>")));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(_A("sink<signal_handler<Ret(Args...),A>>"),
|
||||
_A("sink<signal_handler<void(int),bool>>")));
|
||||
|
||||
REQUIRE_THAT(puml, IsClassTemplate("signal_handler", "T,A"));
|
||||
REQUIRE_THAT(puml,
|
||||
@@ -71,6 +69,14 @@ TEST_CASE("t00044", "[test-case][class]")
|
||||
|
||||
using namespace json;
|
||||
|
||||
REQUIRE(IsClassTemplate(j, "sink<T>"));
|
||||
REQUIRE(IsClassTemplate(j, "signal_handler<T,A>"));
|
||||
REQUIRE(IsClassTemplate(j, "signal_handler<Ret(Args...),A>"));
|
||||
REQUIRE(IsClassTemplate(j, "signal_handler<void(int),bool>"));
|
||||
REQUIRE(IsClassTemplate(
|
||||
j, "sink<clanguml::t00044::signal_handler<Ret(Args...),A>>"));
|
||||
REQUIRE(IsClass(j, "R"));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user