Refactored handling of relative paths (#213)

This commit is contained in:
Bartek Kryza
2023-12-08 08:17:00 +01:00
parent f1d3695ccc
commit d7195d5a5d
130 changed files with 317 additions and 255 deletions

View File

@@ -269,7 +269,10 @@ std::unique_ptr<class_> template_builder::build(const clang::NamedDecl *cls,
template_instantiation.set_id(
common::to_id(template_instantiation_ptr->full_name(false)));
visitor_.set_source_location(*template_decl, *template_instantiation_ptr);
visitor_.set_source_location(*template_decl, template_instantiation);
LOG_DBG("**** {} -> {}", template_instantiation.full_name(false),
template_instantiation.file());
return template_instantiation_ptr;
}

View File

@@ -724,7 +724,10 @@ paths_filter::paths_filter(filter_t type, const std::filesystem::path &root,
resolved_absolute_path.make_preferred();
paths_.emplace_back(resolved_absolute_path);
LOG_DBG("Added path {} to paths_filter",
resolved_absolute_path.string());
paths_.emplace_back(std::move(resolved_absolute_path));
match_successful = true;
}
@@ -738,8 +741,8 @@ paths_filter::paths_filter(filter_t type, const std::filesystem::path &root,
if (!match_successful)
LOG_WARN("Paths filter pattern '{}' did not match "
"any files...",
path);
"any files relative to '{}'",
path, root_.string());
}
}
@@ -1059,8 +1062,7 @@ void diagram_filter::init_filters(const config::diagram &c)
if (auto p = path.get<std::string>(); p.has_value()) {
std::filesystem::path dep_path{*p};
if (dep_path.is_relative()) {
dep_path = c.base_directory() / *p;
dep_path = relative(dep_path, c.relative_to());
dep_path = relative(*p, c.root_directory());
}
dependants.emplace_back(
@@ -1072,8 +1074,7 @@ void diagram_filter::init_filters(const config::diagram &c)
if (auto p = path.get<std::string>(); p.has_value()) {
std::filesystem::path dep_path{*p};
if (dep_path.is_relative()) {
dep_path = c.base_directory() / *p;
dep_path = relative(dep_path, c.relative_to());
dep_path = relative(*p, c.root_directory());
}
dependencies.emplace_back(

View File

@@ -26,7 +26,7 @@ namespace clanguml::common::visitor {
translation_unit_visitor::translation_unit_visitor(
clang::SourceManager &sm, const clanguml::config::diagram &config)
: source_manager_{sm}
, relative_to_path_{config.relative_to()}
, relative_to_path_{config.root_directory()}
{
if (config.comment_parser() == config::comment_parser_t::plain) {
comment_visitor_ =
@@ -108,6 +108,8 @@ void translation_unit_visitor::set_source_location(
const clang::SourceLocation &location,
clanguml::common::model::source_location &element)
{
namespace fs = std::filesystem;
std::string file;
unsigned line{};
unsigned column{};
@@ -133,15 +135,25 @@ void translation_unit_visitor::set_source_location(
}
}
if (std::filesystem::path file_path{file}; !file_path.is_absolute()) {
file_path =
std::filesystem::canonical(std::filesystem::absolute(file_path));
file = file_path.string();
// ensure the path is absolute
fs::path file_path{file};
if (!file_path.is_absolute()) {
file_path = fs::absolute(file_path);
}
file_path = fs::canonical(file_path);
if (!util::is_relative_to(file_path, relative_to_path_)) {
return;
}
file = file_path.string();
element.set_file(file);
element.set_file_relative(util::path_to_url(
std::filesystem::relative(element.file(), relative_to_path_).string()));
if (util::is_relative_to(file_path, relative_to_path_)) {
element.set_file_relative(util::path_to_url(
fs::relative(element.file(), relative_to_path_).string()));
}
element.set_translation_unit(tu_path().string());
element.set_line(line);
element.set_column(column);

View File

@@ -233,8 +233,7 @@ std::vector<std::string> diagram::get_translation_units() const
{
std::vector<std::string> translation_units{};
LOG_DBG("Looking for translation units in {}",
std::filesystem::current_path().string());
LOG_DBG("Looking for translation units in {}", root_directory().string());
for (const auto &g : glob()) {
std::string glob_path =

View File

@@ -482,10 +482,6 @@ struct inheritable_diagram_options {
// This is the absolute filesystem path to the directory containing
// the current .clang-uml config file - it is set automatically
option<std::filesystem::path> base_directory{"__parent_path"};
// This is the relative path with respect to the `base_directory`,
// against which all matches are made, if not provided it defaults to
// the `base_directory`
option<std::filesystem::path> relative_to{"relative_to"};
option<bool> generate_system_headers{"generate_system_headers", false};
option<relationship_hints_t> relationship_hints{"relationship_hints"};
option<type_aliases_t> type_aliases{"type_aliases"};
@@ -502,6 +498,30 @@ struct inheritable_diagram_options {
"message_comment_width", clanguml::util::kDefaultMessageCommentWidth};
option<bool> debug_mode{"debug_mode", false};
option<bool> generate_metadata{"generate_metadata", true};
/**
* @brief Get reference to `relative_to` diagram config option
*
* This method is only to allow access to `relative_to` for loading
* and adjusting configuration file and for making test cases work.
*
* Instead use @see config::diagram::root_directory() method.
*
* @return Reference to `relative_to` config option.
*/
option<std::filesystem::path> &get_relative_to() { return relative_to; }
protected:
// This is the relative path with respect to the `base_directory`,
// against which all matches are made, if not provided it defaults to
// the `base_directory`
//
// This option should not be accessed directly in code - instead use
// @see config::diagram::root_directory()
option<std::filesystem::path> relative_to{"relative_to"};
friend YAML::Emitter &operator<<(
YAML::Emitter &out, const inheritable_diagram_options &c);
};
/**

View File

@@ -602,7 +602,7 @@ template <> struct convert<class_diagram> {
get_option(node, rhs.skip_redundant_dependencies);
get_option(node, rhs.relationship_hints);
get_option(node, rhs.type_aliases);
get_option(node, rhs.relative_to);
get_option(node, rhs.get_relative_to());
rhs.initialize_relationship_hints();
rhs.initialize_type_aliases();
@@ -626,15 +626,15 @@ template <> struct convert<sequence_diagram> {
get_option(node, rhs.combine_free_functions_into_file_participants);
get_option(node, rhs.generate_return_types);
get_option(node, rhs.generate_condition_statements);
get_option(node, rhs.relative_to);
get_option(node, rhs.get_relative_to());
get_option(node, rhs.participants_order);
get_option(node, rhs.generate_method_arguments);
get_option(node, rhs.generate_message_comments);
get_option(node, rhs.message_comment_width);
// Ensure relative_to has a value
if (!rhs.relative_to.has_value)
rhs.relative_to.set(
if (!rhs.get_relative_to().has_value)
rhs.get_relative_to().set(
std::filesystem::current_path().lexically_normal());
rhs.initialize_type_aliases();
@@ -653,12 +653,12 @@ template <> struct convert<package_diagram> {
return false;
get_option(node, rhs.layout);
get_option(node, rhs.relative_to);
get_option(node, rhs.get_relative_to());
get_option(node, rhs.package_type);
// Ensure relative_to has a value
if (!rhs.relative_to.has_value)
rhs.relative_to.set(
if (!rhs.get_relative_to().has_value)
rhs.get_relative_to().set(
std::filesystem::current_path().lexically_normal());
return true;
@@ -675,21 +675,12 @@ template <> struct convert<include_diagram> {
return false;
get_option(node, rhs.layout);
get_option(node, rhs.relative_to);
get_option(node, rhs.get_relative_to());
get_option(node, rhs.generate_system_headers);
if (!rhs.relative_to)
rhs.relative_to.set(std::filesystem::current_path());
// Convert the path in relative_to to an absolute path, with respect
// to the directory where the `.clang-uml` configuration file is
// located
if (rhs.relative_to) {
auto absolute_relative_to =
std::filesystem::path{node["__parent_path"].as<std::string>()} /
rhs.relative_to();
rhs.relative_to.set(absolute_relative_to.lexically_normal());
}
if (!rhs.get_relative_to().has_value)
rhs.get_relative_to().set(
std::filesystem::current_path().lexically_normal());
return true;
}
@@ -824,7 +815,7 @@ template <> struct convert<config> {
get_option(node, rhs.message_comment_width);
rhs.base_directory.set(node["__parent_path"].as<std::string>());
get_option(node, rhs.relative_to);
get_option(node, rhs.get_relative_to());
get_option(node, rhs.diagram_templates);

View File

@@ -95,12 +95,8 @@ void translation_unit_visitor::include_visitor::InclusionDirective(
LOG_DBG("Processing include directive {} in file {}", include_path.string(),
current_file.string());
auto relative_include_path = include_path;
if (config().relative_to) {
const std::filesystem::path relative_to{config().relative_to()};
relative_include_path =
std::filesystem::relative(include_path, relative_to);
}
auto relative_include_path =
std::filesystem::relative(include_path, config().root_directory());
if (diagram().should_include(source_file{include_path})) {
process_internal_header(include_path,
@@ -133,12 +129,8 @@ void translation_unit_visitor::include_visitor::process_internal_header(
const common::id_t current_file_id)
{
// Make the path relative with respect to relative_to config option
auto relative_include_path = include_path;
if (config().relative_to) {
const std::filesystem::path relative_to{config().relative_to()};
relative_include_path =
std::filesystem::relative(include_path, relative_to);
}
auto relative_include_path =
std::filesystem::relative(include_path, config().root_directory());
// Check if this source file is already registered in the diagram,
// if not add it
@@ -218,13 +210,9 @@ translation_unit_visitor::include_visitor::process_source_file(
if (diagram().should_include(source_file{file_path})) {
LOG_DBG("Processing source file {}", file.string());
// Relativize the path with respect to relative_to config option
auto relative_file_path = file_path;
if (config().relative_to) {
const std::filesystem::path relative_to{config().relative_to()};
relative_file_path =
std::filesystem::relative(file_path, relative_to);
}
// Relativize the path with respect to effective root directory
auto relative_file_path =
std::filesystem::relative(file_path, config().root_directory());
[[maybe_unused]] const auto relative_file_path_str =
relative_file_path.string();

View File

@@ -400,7 +400,7 @@ void generator::generate_participant(
if (is_participant_generated(file_id))
return;
auto participant_name = util::path_to_url(std::filesystem::relative(
auto participant_name = util::path_to_url(relative(
std::filesystem::path{file_path}, config().root_directory())
.string());

View File

@@ -2311,9 +2311,13 @@ std::string translation_unit_visitor::make_lambda_name(
const auto location = cls->getLocation();
const auto file_line = source_manager().getSpellingLineNumber(location);
const auto file_column = source_manager().getSpellingColumnNumber(location);
const std::string file_name = util::path_to_url(std::filesystem::relative(
source_manager().getFilename(location).str(), config().relative_to())
.string());
const std::string file_name = config().make_path_relative(
source_manager().getFilename(location).str());
//
// util::path_to_url(std::filesystem::relative(
// source_manager().getFilename(location).str(),
// config().relative_to())
// .string());
if (context().caller_id() != 0 &&
get_participant(context().caller_id()).has_value()) {

View File

@@ -404,6 +404,15 @@ std::filesystem::path ensure_path_is_absolute(
return result;
}
bool is_relative_to(
const std::filesystem::path &child, const std::filesystem::path &parent)
{
if (child.has_root_directory() != parent.has_root_directory())
return false;
return starts_with(child, parent);
}
std::string format_message_comment(const std::string &comment, unsigned width)
{
if (width == 0)

View File

@@ -435,6 +435,17 @@ std::string path_to_url(const std::filesystem::path &p);
std::filesystem::path ensure_path_is_absolute(const std::filesystem::path &p,
const std::filesystem::path &root = std::filesystem::current_path());
/**
* @brief Check if a given path is relative to another path.
*
* @param parent The path to be checked for relativity.
* @param right The base path against which the relativity is checked.
* @return True if the child path is relative to the parent path, false
* otherwise.
*/
bool is_relative_to(
const std::filesystem::path &parent, const std::filesystem::path &child);
std::string format_message_comment(
const std::string &c, unsigned width = kDefaultMessageCommentWidth);

View File

@@ -5,7 +5,7 @@ diagrams:
type: class
title: Basic class diagram example
glob:
- ../../tests/t00002/t00002.cc
- tests/t00002/t00002.cc
comment_parser: clang
using_namespace:
- clanguml::t00002

View File

@@ -4,7 +4,7 @@ diagrams:
t00003_class:
type: class
glob:
- ../../tests/t00003/t00003.cc
- tests/t00003/t00003.cc
using_namespace: clanguml::t00003
include:
namespaces:

View File

@@ -4,7 +4,7 @@ diagrams:
t00004_class:
type: class
glob:
- ../../tests/t00004/t00004.cc
- tests/t00004/t00004.cc
using_namespace:
- clanguml::t00004
- clanguml::t00004::A

View File

@@ -4,7 +4,7 @@ diagrams:
t00005_class:
type: class
glob:
- ../../tests/t00005/t00005.cc
- tests/t00005/t00005.cc
using_namespace:
- clanguml::t00005
include:

View File

@@ -4,7 +4,7 @@ diagrams:
t00006_class:
type: class
glob:
- ../../tests/t00006/t00006.cc
- tests/t00006/t00006.cc
using_namespace:
- clanguml::t00006
include:

View File

@@ -4,7 +4,7 @@ diagrams:
t00007_class:
type: class
glob:
- ../../tests/t00007/t00007.cc
- tests/t00007/t00007.cc
using_namespace:
- clanguml::t00007
include:

View File

@@ -4,7 +4,7 @@ diagrams:
t00008_class:
type: class
glob:
- ../../tests/t00008/t00008.cc
- tests/t00008/t00008.cc
using_namespace:
- clanguml::t00008
include:

View File

@@ -4,7 +4,7 @@ diagrams:
t00009_class:
type: class
glob:
- ../../tests/t00009/t00009.cc
- tests/t00009/t00009.cc
using_namespace:
- clanguml::t00009
include:

View File

@@ -4,7 +4,7 @@ diagrams:
t00010_class:
type: class
glob:
- ../../tests/t00010/t00010.cc
- tests/t00010/t00010.cc
using_namespace:
- clanguml::t00010
include:

View File

@@ -4,7 +4,7 @@ diagrams:
t00011_class:
type: class
glob:
- ../../tests/t00011/t00011.cc
- tests/t00011/t00011.cc
using_namespace:
- clanguml::t00011
include:

View File

@@ -4,7 +4,7 @@ diagrams:
t00012_class:
type: class
glob:
- ../../tests/t00012/t00012.cc
- tests/t00012/t00012.cc
using_namespace:
- clanguml::t00012
include:

View File

@@ -4,7 +4,7 @@ diagrams:
t00013_class:
type: class
glob:
- ../../tests/t00013/t00013.cc
- tests/t00013/t00013.cc
using_namespace:
- clanguml::t00013
include:

View File

@@ -4,7 +4,8 @@ diagrams:
t00014_class:
type: class
glob:
- ../../tests/t00014/t00014.cc
- tests/t00014/t00014.cc
# relative_to: ../../..
using_namespace:
- clanguml::t00014
include:

View File

@@ -4,7 +4,7 @@ diagrams:
t00015_class:
type: class
glob:
- ../../tests/t00015/t00015.cc
- tests/t00015/t00015.cc
using_namespace:
- clanguml::t00015
include:

View File

@@ -4,7 +4,7 @@ diagrams:
t00016_class:
type: class
glob:
- ../../tests/t00016/t00016.cc
- tests/t00016/t00016.cc
using_namespace:
- clanguml::t00016
include:

View File

@@ -5,7 +5,7 @@ diagrams:
type: class
include_relations_also_as_members: false
glob:
- ../../tests/t00017/t00017.cc
- tests/t00017/t00017.cc
using_namespace:
- clanguml::t00017
include:

View File

@@ -4,7 +4,7 @@ diagrams:
t00018_class:
type: class
glob:
- ../../tests/t00018/**.cc
- tests/t00018/**.cc
using_namespace:
- clanguml::t00018
include:

View File

@@ -4,7 +4,7 @@ diagrams:
t00019_class:
type: class
glob:
- ../../tests/t00019/**.cc
- tests/t00019/**.cc
generate_template_argument_dependencies: false
using_namespace:
- clanguml::t00019

View File

@@ -4,7 +4,7 @@ diagrams:
t00020_class:
type: class
glob:
- ../../tests/t00020/t00020.cc
- tests/t00020/t00020.cc
using_namespace:
- clanguml::t00020
include:

View File

@@ -4,7 +4,7 @@ diagrams:
t00021_class:
type: class
glob:
- ../../tests/t00021/t00021.cc
- tests/t00021/t00021.cc
using_namespace:
- clanguml::t00021
include:

View File

@@ -4,7 +4,7 @@ diagrams:
t00022_class:
type: class
glob:
- ../../tests/t00022/t00022.cc
- tests/t00022/t00022.cc
using_namespace:
- clanguml::t00022
include:

View File

@@ -4,7 +4,7 @@ diagrams:
t00023_class:
type: class
glob:
- ../../tests/t00023/t00023.cc
- tests/t00023/t00023.cc
using_namespace:
- clanguml::t00023
include:

View File

@@ -4,7 +4,7 @@ diagrams:
t00024_class:
type: class
glob:
- ../../tests/t00024/t00024.cc
- tests/t00024/t00024.cc
using_namespace:
- clanguml::t00024
include:

View File

@@ -4,7 +4,7 @@ diagrams:
t00025_class:
type: class
glob:
- ../../tests/t00025/t00025.cc
- tests/t00025/t00025.cc
using_namespace:
- clanguml::t00025
include:

View File

@@ -4,7 +4,7 @@ diagrams:
t00026_class:
type: class
glob:
- ../../tests/t00026/t00026.cc
- tests/t00026/t00026.cc
using_namespace:
- clanguml::t00026
include:

View File

@@ -4,7 +4,7 @@ diagrams:
t00027_class:
type: class
glob:
- ../../tests/t00027/t00027.cc
- tests/t00027/t00027.cc
using_namespace:
- clanguml::t00027
include:

View File

@@ -4,7 +4,7 @@ diagrams:
t00028_class:
type: class
glob:
- ../../tests/t00028/t00028.cc
- tests/t00028/t00028.cc
using_namespace:
- clanguml::t00028
include:

View File

@@ -4,7 +4,7 @@ diagrams:
t00029_class:
type: class
glob:
- ../../tests/t00029/t00029.cc
- tests/t00029/t00029.cc
using_namespace:
- clanguml::t00029
include:

View File

@@ -4,7 +4,7 @@ diagrams:
t00030_class:
type: class
glob:
- ../../tests/t00030/t00030.cc
- tests/t00030/t00030.cc
using_namespace:
- clanguml::t00030
include:

View File

@@ -4,7 +4,7 @@ diagrams:
t00031_class:
type: class
glob:
- ../../tests/t00031/t00031.cc
- tests/t00031/t00031.cc
skip_redundant_dependencies: false
using_namespace:
- clanguml::t00031

View File

@@ -4,7 +4,7 @@ diagrams:
t00032_class:
type: class
glob:
- ../../tests/t00032/t00032.cc
- tests/t00032/t00032.cc
using_namespace:
- clanguml::t00032
include:

View File

@@ -4,7 +4,7 @@ diagrams:
t00033_class:
type: class
glob:
- ../../tests/t00033/t00033.cc
- tests/t00033/t00033.cc
using_namespace:
- clanguml::t00033
include:

View File

@@ -4,7 +4,7 @@ diagrams:
t00034_class:
type: class
glob:
- ../../tests/t00034/t00034.cc
- tests/t00034/t00034.cc
using_namespace:
- clanguml::t00034
include:

View File

@@ -4,7 +4,7 @@ diagrams:
t00035_class:
type: class
glob:
- ../../tests/t00035/t00035.cc
- tests/t00035/t00035.cc
using_namespace:
- clanguml::t00035
include:

View File

@@ -5,7 +5,7 @@ diagrams:
type: class
generate_packages: true
glob:
- ../../tests/t00036/t00036.cc
- tests/t00036/t00036.cc
using_namespace:
- clanguml::t00036
include:

View File

@@ -5,7 +5,7 @@ diagrams:
type: class
generate_packages: true
glob:
- ../../tests/t00037/t00037.cc
- tests/t00037/t00037.cc
using_namespace:
- clanguml::t00037
include:

View File

@@ -5,7 +5,7 @@ diagrams:
type: class
generate_packages: false
glob:
- ../../tests/t00038/t00038.cc
- tests/t00038/t00038.cc
using_namespace:
- clanguml::t00038
include:

View File

@@ -5,7 +5,7 @@ diagrams:
type: class
generate_packages: false
glob:
- ../../tests/t00039/t00039.cc
- tests/t00039/t00039.cc
using_namespace:
- clanguml::t00039
include:

View File

@@ -5,7 +5,7 @@ diagrams:
type: class
generate_packages: false
glob:
- ../../tests/t00040/t00040.cc
- tests/t00040/t00040.cc
using_namespace:
- clanguml::t00040
include:

View File

@@ -5,7 +5,7 @@ diagrams:
type: class
generate_packages: false
glob:
- ../../tests/t00041/t00041.cc
- tests/t00041/t00041.cc
using_namespace:
- clanguml::t00041
include:

View File

@@ -5,7 +5,7 @@ diagrams:
type: class
generate_packages: false
glob:
- ../../tests/t00042/t00042.cc
- tests/t00042/t00042.cc
using_namespace:
- clanguml::t00042
include:

View File

@@ -5,7 +5,7 @@ diagrams:
type: class
generate_packages: true
glob:
- ../../tests/t00043/t00043.cc
- tests/t00043/t00043.cc
using_namespace:
- clanguml::t00043
include:

View File

@@ -5,7 +5,7 @@ diagrams:
type: class
generate_packages: true
glob:
- ../../tests/t00044/t00044.cc
- tests/t00044/t00044.cc
using_namespace:
- clanguml::t00044
include:

View File

@@ -4,7 +4,7 @@ diagrams:
t00045_class:
type: class
glob:
- ../../tests/t00045/t00045.cc
- tests/t00045/t00045.cc
exclude:
namespaces:
- std

View File

@@ -5,7 +5,7 @@ diagrams:
type: class
generate_packages: true
glob:
- ../../tests/t00046/t00046.cc
- tests/t00046/t00046.cc
exclude:
namespaces:
- std

View File

@@ -4,7 +4,7 @@ diagrams:
t00047_class:
type: class
glob:
- ../../tests/t00047/t00047.cc
- tests/t00047/t00047.cc
using_namespace: clanguml::t00047
include:
namespaces:

View File

@@ -4,9 +4,9 @@ diagrams:
t00048_class:
type: class
glob:
- ../../tests/t00048/b_t00048.cc
- ../../tests/t00048/a_t00048.cc
- ../../tests/t00048/t00048.cc
- tests/t00048/b_t00048.cc
- tests/t00048/a_t00048.cc
- tests/t00048/t00048.cc
using_namespace: clanguml::t00048
include:
namespaces:

View File

@@ -11,7 +11,7 @@ diagrams:
"std::vector<thestring>": string_vector
"std::map<int,int>": intmap
glob:
- ../../tests/t00049/t00049.cc
- tests/t00049/t00049.cc
include:
namespaces:
- clanguml::t00049

View File

@@ -4,7 +4,7 @@ diagrams:
t00050_class:
type: class
glob:
- ../../tests/t00050/t00050.cc
- tests/t00050/t00050.cc
comment_parser: clang
include:
namespaces:

View File

@@ -4,7 +4,7 @@ diagrams:
t00051_class:
type: class
glob:
- ../../tests/t00051/t00051.cc
- tests/t00051/t00051.cc
include:
namespaces:
- clanguml::t00051

View File

@@ -45,14 +45,14 @@ TEST_CASE("t00051", "[test-case][class]")
"Function && f, Args &&... args")));
REQUIRE_THAT(src,
(IsMethod<Public>("thread", "void",
"(lambda at ../../tests/t00051/t00051.cc:59:27) &&")));
"(lambda at tests/t00051/t00051.cc:59:27) &&")));
REQUIRE_THAT(src,
(IsMethod<Private>("start_thread3",
"B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at "
"../../tests/t00051/t00051.cc:43:27)>")));
"B<(lambda at tests/t00051/t00051.cc:43:18),(lambda at "
"tests/t00051/t00051.cc:43:27)>")));
REQUIRE_THAT(src,
(IsMethod<Private>("get_function",
"(lambda at ../../tests/t00051/t00051.cc:48:16)")));
(IsMethod<Private>(
"get_function", "(lambda at tests/t00051/t00051.cc:48:16)")));
REQUIRE_THAT(src, IsClassTemplate("B", "F,FF=F"));
REQUIRE_THAT(src, (IsMethod<Public>("f", "void")));
@@ -60,18 +60,18 @@ TEST_CASE("t00051", "[test-case][class]")
REQUIRE_THAT(src,
IsClassTemplate("B",
"(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at "
"../../tests/t00051/t00051.cc:43:27)"));
"(lambda at tests/t00051/t00051.cc:43:18),(lambda at "
"tests/t00051/t00051.cc:43:27)"));
REQUIRE_THAT(src,
IsInstantiation(_A("B<F,FF=F>"),
_A("B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda "
"at ../../tests/t00051/t00051.cc:43:27)>")));
_A("B<(lambda at tests/t00051/t00051.cc:43:18),(lambda "
"at tests/t00051/t00051.cc:43:27)>")));
REQUIRE_THAT(src,
IsDependency(_A("A"),
_A("B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda "
"at ../../tests/t00051/t00051.cc:43:27)>")));
_A("B<(lambda at tests/t00051/t00051.cc:43:18),(lambda "
"at tests/t00051/t00051.cc:43:27)>")));
save_puml(config.output_directory(), diagram->name + ".puml", src);
}
@@ -103,33 +103,32 @@ TEST_CASE("t00051", "[test-case][class]")
"Function && f, Args &&... args")));
REQUIRE_THAT(src,
(IsMethod<Public>("thread", "void",
"(lambda at ../../tests/t00051/t00051.cc:59:27) &&")));
"(lambda at tests/t00051/t00051.cc:59:27) &&")));
REQUIRE_THAT(src,
(IsMethod<Private>("start_thread3",
"B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at "
"../../tests/t00051/t00051.cc:43:27)>")));
"B<(lambda at tests/t00051/t00051.cc:43:18),(lambda at "
"tests/t00051/t00051.cc:43:27)>")));
REQUIRE_THAT(src,
(IsMethod<Private>("get_function",
"(lambda at ../../tests/t00051/t00051.cc:48:16)")));
(IsMethod<Private>(
"get_function", "(lambda at tests/t00051/t00051.cc:48:16)")));
REQUIRE_THAT(src, IsClass(_A("B<F,FF=F>")));
REQUIRE_THAT(src, (IsMethod<Public>("f", "void")));
REQUIRE_THAT(src, (IsMethod<Public>("ff", "void")));
REQUIRE_THAT(src,
IsClass(_A(
"B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at "
"../../tests/t00051/t00051.cc:43:27)>")));
IsClass(_A("B<(lambda at tests/t00051/t00051.cc:43:18),(lambda at "
"tests/t00051/t00051.cc:43:27)>")));
REQUIRE_THAT(src,
IsInstantiation(_A("B<F,FF=F>"),
_A("B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda "
"at ../../tests/t00051/t00051.cc:43:27)>")));
_A("B<(lambda at tests/t00051/t00051.cc:43:18),(lambda "
"at tests/t00051/t00051.cc:43:27)>")));
REQUIRE_THAT(src,
IsDependency(_A("A"),
_A("B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda "
"at ../../tests/t00051/t00051.cc:43:27)>")));
_A("B<(lambda at tests/t00051/t00051.cc:43:18),(lambda "
"at tests/t00051/t00051.cc:43:27)>")));
save_mermaid(config.output_directory(), diagram->name + ".mmd", src);
}

View File

@@ -4,7 +4,7 @@ diagrams:
t00052_class:
type: class
glob:
- ../../tests/t00052/t00052.cc
- tests/t00052/t00052.cc
include:
namespaces:
- clanguml::t00052

View File

@@ -4,7 +4,7 @@ diagrams:
t00053_class:
type: class
glob:
- ../../tests/t00053/t00053.cc
- tests/t00053/t00053.cc
include:
namespaces:
- clanguml::t00053

View File

@@ -4,7 +4,7 @@ diagrams:
t00054_class:
type: class
glob:
- ../../tests/t00054/t00054.cc
- tests/t00054/t00054.cc
include:
namespaces:
- clanguml::t00054

View File

@@ -4,7 +4,7 @@ diagrams:
t00055_class:
type: class
glob:
- ../../tests/t00055/t00055.cc
- tests/t00055/t00055.cc
include:
namespaces:
- clanguml::t00055

View File

@@ -4,7 +4,7 @@ diagrams:
t00056_class:
type: class
glob:
- ../../tests/t00056/t00056.cc
- tests/t00056/t00056.cc
include:
namespaces:
- clanguml::t00056

View File

@@ -4,5 +4,5 @@ diagrams:
t00057_class:
type: class
glob:
- ../../tests/t00057/t00057.c
- ../../tests/t00057/src/t00057_impl.c
- tests/t00057/t00057.c
- tests/t00057/src/t00057_impl.c

View File

@@ -4,7 +4,7 @@ diagrams:
t00058_class:
type: class
glob:
- ../../tests/t00058/t00058.cc
- tests/t00058/t00058.cc
include:
namespaces:
- clanguml::t00058

View File

@@ -4,7 +4,7 @@ diagrams:
t00059_class:
type: class
glob:
- ../../tests/t00059/t00059.cc
- tests/t00059/t00059.cc
include:
namespaces:
- clanguml::t00059

View File

@@ -4,7 +4,7 @@ diagrams:
t00060_class:
type: class
glob:
- ../../tests/t00060/t00060.cc
- tests/t00060/t00060.cc
include:
namespaces:
- clanguml::t00060

View File

@@ -4,7 +4,7 @@ diagrams:
t00062_class:
type: class
glob:
- ../../tests/t00062/t00062.cc
- tests/t00062/t00062.cc
include:
namespaces:
- clanguml::t00062

View File

@@ -4,7 +4,7 @@ diagrams:
t00063_class:
type: class
glob:
- ../../tests/t00063/t00063.cc
- tests/t00063/t00063.cc
include:
namespaces:
- clanguml::t00063

View File

@@ -4,7 +4,7 @@ diagrams:
t00064_class:
type: class
glob:
- ../../tests/t00064/t00064.cc
- tests/t00064/t00064.cc
include:
namespaces:
- clanguml::t00064

View File

@@ -4,7 +4,7 @@ diagrams:
t00066_class:
type: class
glob:
- ../../tests/t00066/t00066.cc
- tests/t00066/t00066.cc
include:
namespaces:
- clanguml::t00066

View File

@@ -4,7 +4,7 @@ diagrams:
t00067_class:
type: class
glob:
- ../../tests/t00067/t00067.cc
- tests/t00067/t00067.cc
include:
namespaces:
- clanguml::t00067

View File

@@ -5,7 +5,7 @@ diagrams:
type: class
title: AAA context of radius 0
glob:
- ../../tests/t00068/t00068.cc
- tests/t00068/t00068.cc
include:
namespaces:
- clanguml::t00068
@@ -19,7 +19,7 @@ diagrams:
type: class
title: AAA context of radius 1
glob:
- ../../tests/t00068/t00068.cc
- tests/t00068/t00068.cc
include:
namespaces:
- clanguml::t00068
@@ -33,7 +33,7 @@ diagrams:
type: class
title: AAA context of radius 2
glob:
- ../../tests/t00068/t00068.cc
- tests/t00068/t00068.cc
include:
namespaces:
- clanguml::t00068

View File

@@ -7,7 +7,7 @@ diagrams:
type: sequence
title: Basic sequence diagram example
glob:
- ../../tests/t20001/t20001.cc
- tests/t20001/t20001.cc
include:
namespaces:
- clanguml::t20001

View File

@@ -4,7 +4,7 @@ diagrams:
t20002_sequence:
type: sequence
glob:
- ../../tests/t20002/t20002.cc
- tests/t20002/t20002.cc
include:
namespaces:
- clanguml::t20002

View File

@@ -4,7 +4,7 @@ diagrams:
t20003_sequence:
type: sequence
glob:
- ../../tests/t20003/t20003.cc
- tests/t20003/t20003.cc
include:
namespaces:
- clanguml::t20003

View File

@@ -4,7 +4,7 @@ diagrams:
t20004_sequence:
type: sequence
glob:
- ../../tests/t20004/t20004.cc
- tests/t20004/t20004.cc
include:
namespaces:
- clanguml::t20004

View File

@@ -4,7 +4,7 @@ diagrams:
t20005_sequence:
type: sequence
glob:
- ../../tests/t20005/t20005.cc
- tests/t20005/t20005.cc
include:
namespaces:
- clanguml::t20005

View File

@@ -4,7 +4,7 @@ diagrams:
t20006_sequence:
type: sequence
glob:
- ../../tests/t20006/t20006.cc
- tests/t20006/t20006.cc
include:
namespaces:
- clanguml::t20006

View File

@@ -4,7 +4,7 @@ diagrams:
t20007_sequence:
type: sequence
glob:
- ../../tests/t20007/t20007.cc
- tests/t20007/t20007.cc
include:
namespaces:
- clanguml::t20007

View File

@@ -4,7 +4,7 @@ diagrams:
t20008_sequence:
type: sequence
glob:
- ../../tests/t20008/t20008.cc
- tests/t20008/t20008.cc
include:
namespaces:
- clanguml::t20008

View File

@@ -4,7 +4,7 @@ diagrams:
t20009_sequence:
type: sequence
glob:
- ../../tests/t20009/t20009.cc
- tests/t20009/t20009.cc
include:
namespaces:
- clanguml::t20009

View File

@@ -4,7 +4,7 @@ diagrams:
t20010_sequence:
type: sequence
glob:
- ../../tests/t20010/t20010.cc
- tests/t20010/t20010.cc
include:
namespaces:
- clanguml::t20010

View File

@@ -4,7 +4,7 @@ diagrams:
t20011_sequence:
type: sequence
glob:
- ../../tests/t20011/t20011.cc
- tests/t20011/t20011.cc
include:
namespaces:
- clanguml::t20011

View File

@@ -4,7 +4,7 @@ diagrams:
t20012_sequence:
type: sequence
glob:
- ../../tests/t20012/t20012.cc
- tests/t20012/t20012.cc
include:
namespaces:
- clanguml::t20012

View File

@@ -37,41 +37,41 @@ TEST_CASE("t20012", "[test-case][sequence]")
// Check if all calls exist
REQUIRE_THAT(src,
HasCall(_A("tmain()"),
_A("tmain()::(lambda ../../tests/t20012/t20012.cc:67:20)"),
_A("tmain()::(lambda tests/t20012/t20012.cc:67:20)"),
"operator()()"));
REQUIRE_THAT(src,
HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:67:20)"),
HasCall(_A("tmain()::(lambda tests/t20012/t20012.cc:67:20)"),
_A("A"), "a()"));
REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "aa()"));
REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "aaa()"));
REQUIRE_THAT(src,
HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:67:20)"),
HasCall(_A("tmain()::(lambda tests/t20012/t20012.cc:67:20)"),
_A("B"), "b()"));
REQUIRE_THAT(src, HasCall(_A("B"), _A("B"), "bb()"));
REQUIRE_THAT(src, HasCall(_A("B"), _A("B"), "bbb()"));
REQUIRE_THAT(src,
HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:80:20)"),
HasCall(_A("tmain()::(lambda tests/t20012/t20012.cc:80:20)"),
_A("C"), "c()"));
REQUIRE_THAT(src, HasCall(_A("C"), _A("C"), "cc()"));
REQUIRE_THAT(src, HasCall(_A("C"), _A("C"), "ccc()"));
REQUIRE_THAT(src,
HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:80:20)"),
_A("tmain()::(lambda ../../tests/t20012/t20012.cc:67:20)"),
HasCall(_A("tmain()::(lambda tests/t20012/t20012.cc:80:20)"),
_A("tmain()::(lambda tests/t20012/t20012.cc:67:20)"),
"operator()()"));
REQUIRE_THAT(src, HasCall(_A("C"), _A("C"), "ccc()"));
REQUIRE_THAT(src,
HasCall(_A("tmain()"),
_A("R<R::(lambda ../../tests/t20012/t20012.cc:86:9)>"), "r()"));
_A("R<R::(lambda tests/t20012/t20012.cc:86:9)>"), "r()"));
REQUIRE_THAT(src,
HasCall(_A("R<R::(lambda ../../tests/t20012/t20012.cc:86:9)>"),
_A("tmain()::(lambda ../../tests/t20012/t20012.cc:86:9)"),
HasCall(_A("R<R::(lambda tests/t20012/t20012.cc:86:9)>"),
_A("tmain()::(lambda tests/t20012/t20012.cc:86:9)"),
"operator()()"));
REQUIRE_THAT(src,
HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:86:9)"),
HasCall(_A("tmain()::(lambda tests/t20012/t20012.cc:86:9)"),
_A("C"), "c()"));
// @todo #168
@@ -87,32 +87,27 @@ TEST_CASE("t20012", "[test-case][sequence]")
std::vector<int> messages = {
FindMessage(j, "tmain()",
"tmain()::(lambda ../../tests/t20012/t20012.cc:67:20)",
"tmain()::(lambda tests/t20012/t20012.cc:67:20)",
"operator()()"),
FindMessage(j,
"tmain()::(lambda ../../tests/t20012/t20012.cc:67:20)", "A",
"a()"),
FindMessage(j, "tmain()::(lambda tests/t20012/t20012.cc:67:20)",
"A", "a()"),
FindMessage(j, "A", "A", "aa()"), FindMessage(j, "A", "A", "aaa()"),
FindMessage(j,
"tmain()::(lambda ../../tests/t20012/t20012.cc:67:20)", "B",
"b()"),
FindMessage(j, "tmain()::(lambda tests/t20012/t20012.cc:67:20)",
"B", "b()"),
FindMessage(j, "B", "B", "bb()"), FindMessage(j, "B", "B", "bbb()"),
FindMessage(j,
"tmain()::(lambda ../../tests/t20012/t20012.cc:80:20)", "C",
"c()"),
FindMessage(j, "tmain()::(lambda tests/t20012/t20012.cc:80:20)",
"C", "c()"),
FindMessage(j, "C", "C", "cc()"), FindMessage(j, "C", "C", "ccc()"),
FindMessage(j,
"tmain()::(lambda ../../tests/t20012/t20012.cc:80:20)",
"tmain()::(lambda ../../tests/t20012/t20012.cc:67:20)",
FindMessage(j, "tmain()::(lambda tests/t20012/t20012.cc:80:20)",
"tmain()::(lambda tests/t20012/t20012.cc:67:20)",
"operator()()"),
FindMessage(j, "tmain()",
"R<R::(lambda ../../tests/t20012/t20012.cc:86:9)>", "r()"),
FindMessage(j, "R<R::(lambda ../../tests/t20012/t20012.cc:86:9)>",
"tmain()::(lambda ../../tests/t20012/t20012.cc:86:9)",
"R<R::(lambda tests/t20012/t20012.cc:86:9)>", "r()"),
FindMessage(j, "R<R::(lambda tests/t20012/t20012.cc:86:9)>",
"tmain()::(lambda tests/t20012/t20012.cc:86:9)",
"operator()()"),
FindMessage(j,
"tmain()::(lambda ../../tests/t20012/t20012.cc:86:9)", "C",
"c()"),
FindMessage(
j, "tmain()::(lambda tests/t20012/t20012.cc:86:9)", "C", "c()"),
// @todo #168
// FindMessage(j, "tmain()", "D", "add5(int)")
};
@@ -130,41 +125,41 @@ TEST_CASE("t20012", "[test-case][sequence]")
REQUIRE_THAT(src,
HasCall(_A("tmain()"),
_A("tmain()::(lambda ../../tests/t20012/t20012.cc:67:20)"),
_A("tmain()::(lambda tests/t20012/t20012.cc:67:20)"),
"operator()()"));
REQUIRE_THAT(src,
HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:67:20)"),
HasCall(_A("tmain()::(lambda tests/t20012/t20012.cc:67:20)"),
_A("A"), "a()"));
REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "aa()"));
REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "aaa()"));
REQUIRE_THAT(src,
HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:67:20)"),
HasCall(_A("tmain()::(lambda tests/t20012/t20012.cc:67:20)"),
_A("B"), "b()"));
REQUIRE_THAT(src, HasCall(_A("B"), _A("B"), "bb()"));
REQUIRE_THAT(src, HasCall(_A("B"), _A("B"), "bbb()"));
REQUIRE_THAT(src,
HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:80:20)"),
HasCall(_A("tmain()::(lambda tests/t20012/t20012.cc:80:20)"),
_A("C"), "c()"));
REQUIRE_THAT(src, HasCall(_A("C"), _A("C"), "cc()"));
REQUIRE_THAT(src, HasCall(_A("C"), _A("C"), "ccc()"));
REQUIRE_THAT(src,
HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:80:20)"),
_A("tmain()::(lambda ../../tests/t20012/t20012.cc:67:20)"),
HasCall(_A("tmain()::(lambda tests/t20012/t20012.cc:80:20)"),
_A("tmain()::(lambda tests/t20012/t20012.cc:67:20)"),
"operator()()"));
REQUIRE_THAT(src, HasCall(_A("C"), _A("C"), "ccc()"));
REQUIRE_THAT(src,
HasCall(_A("tmain()"),
_A("R<R::(lambda ../../tests/t20012/t20012.cc:86:9)>"), "r()"));
_A("R<R::(lambda tests/t20012/t20012.cc:86:9)>"), "r()"));
REQUIRE_THAT(src,
HasCall(_A("R<R::(lambda ../../tests/t20012/t20012.cc:86:9)>"),
_A("tmain()::(lambda ../../tests/t20012/t20012.cc:86:9)"),
HasCall(_A("R<R::(lambda tests/t20012/t20012.cc:86:9)>"),
_A("tmain()::(lambda tests/t20012/t20012.cc:86:9)"),
"operator()()"));
REQUIRE_THAT(src,
HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:86:9)"),
HasCall(_A("tmain()::(lambda tests/t20012/t20012.cc:86:9)"),
_A("C"), "c()"));
save_mermaid(config.output_directory(), diagram->name + ".mmd", src);

View File

@@ -4,7 +4,7 @@ diagrams:
t20013_sequence:
type: sequence
glob:
- ../../tests/t20013/t20013.cc
- tests/t20013/t20013.cc
include:
namespaces:
- clanguml::t20013

View File

@@ -4,10 +4,10 @@ diagrams:
t20014_sequence:
type: sequence
glob:
- ../../tests/t20014/t20014.cc
- ../../tests/t20014/t20014_c.cc
- ../../tests/t20014/t20014_b.cc
- ../../tests/t20014/t20014_a.cc
- tests/t20014/t20014.cc
- tests/t20014/t20014_c.cc
- tests/t20014/t20014_b.cc
- tests/t20014/t20014_a.cc
include:
namespaces:
- clanguml::t20014

View File

@@ -4,7 +4,7 @@ diagrams:
t20015_sequence:
type: sequence
glob:
- ../../tests/t20015/t20015.cc
- tests/t20015/t20015.cc
include:
namespaces:
- clanguml::t20015

View File

@@ -4,7 +4,7 @@ diagrams:
t20016_sequence:
type: sequence
glob:
- ../../tests/t20016/t20016.cc
- tests/t20016/t20016.cc
include:
namespaces:
- clanguml::t20016

View File

@@ -4,7 +4,7 @@ diagrams:
t20018_sequence:
type: sequence
glob:
- ../../tests/t20018/t20018.cc
- tests/t20018/t20018.cc
include:
namespaces:
- clanguml::t20018

View File

@@ -4,7 +4,7 @@ diagrams:
t20019_sequence:
type: sequence
glob:
- ../../tests/t20019/t20019.cc
- tests/t20019/t20019.cc
include:
namespaces:
- clanguml::t20019

View File

@@ -4,7 +4,7 @@ diagrams:
t20020_sequence:
type: sequence
glob:
- ../../tests/t20020/t20020.cc
- tests/t20020/t20020.cc
include:
namespaces:
- clanguml::t20020

View File

@@ -4,7 +4,7 @@ diagrams:
t20021_sequence:
type: sequence
glob:
- ../../tests/t20021/t20021.cc
- tests/t20021/t20021.cc
include:
namespaces:
- clanguml::t20021

View File

@@ -4,7 +4,7 @@ diagrams:
t20022_sequence:
type: sequence
glob:
- ../../tests/t20022/t20022.cc
- tests/t20022/t20022.cc
include:
namespaces:
- clanguml::t20022

View File

@@ -4,7 +4,7 @@ diagrams:
t20023_sequence:
type: sequence
glob:
- ../../tests/t20023/t20023.cc
- tests/t20023/t20023.cc
include:
namespaces:
- clanguml::t20023

Some files were not shown because too many files have changed in this diff Show More