Improved test coverage (#287)
This commit is contained in:
@@ -166,6 +166,8 @@ void generate_diagram_impl(const std::string &name,
|
||||
runtime_config.output_directory, name, diagram, model);
|
||||
}
|
||||
|
||||
// Convert plantuml or mermaid to an image using command provided
|
||||
// in the command line arguments
|
||||
if (runtime_config.render_diagrams) {
|
||||
render_diagram(generator_type, diagram);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,12 @@
|
||||
namespace clanguml::common::generators {
|
||||
|
||||
progress_indicator::progress_indicator()
|
||||
: progress_indicator(std::cout)
|
||||
{
|
||||
}
|
||||
|
||||
progress_indicator::progress_indicator(std::ostream &ostream)
|
||||
: ostream_(ostream)
|
||||
{
|
||||
progress_bars_.set_option(indicators::option::HideBarWhenComplete{false});
|
||||
}
|
||||
@@ -36,6 +42,7 @@ void progress_indicator::add_progress_bar(
|
||||
const auto kPrefixTextWidth = 25U;
|
||||
|
||||
auto bar = std::make_shared<indicators::ProgressBar>(
|
||||
indicators::option::Stream{ostream_},
|
||||
indicators::option::BarWidth{kBarWidth},
|
||||
indicators::option::ForegroundColor{color},
|
||||
indicators::option::ShowElapsedTime{true},
|
||||
@@ -78,6 +85,7 @@ void progress_indicator::increment(const std::string &name)
|
||||
bar.set_progress((p.progress * kASTTraverseProgressPercent) / p.max);
|
||||
bar.set_option(indicators::option::PostfixText{
|
||||
fmt::format("{}/{}", p.progress, p.max)});
|
||||
|
||||
progress_bars_mutex_.unlock();
|
||||
}
|
||||
|
||||
@@ -106,6 +114,8 @@ void progress_indicator::complete(const std::string &name)
|
||||
auto &p = progress_bar_index_.at(name);
|
||||
auto &bar = progress_bars_[p.index];
|
||||
|
||||
p.progress = p.max;
|
||||
|
||||
bar.set_progress(kCompleteProgressPercent);
|
||||
|
||||
#if _MSC_VER
|
||||
@@ -124,6 +134,12 @@ void progress_indicator::complete(const std::string &name)
|
||||
void progress_indicator::fail(const std::string &name)
|
||||
{
|
||||
progress_bars_mutex_.lock();
|
||||
|
||||
if (progress_bar_index_.count(name) == 0) {
|
||||
progress_bars_mutex_.unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
auto &p = progress_bar_index_.at(name);
|
||||
auto &bar = progress_bars_[p.index];
|
||||
|
||||
|
||||
@@ -45,6 +45,8 @@ public:
|
||||
|
||||
progress_indicator();
|
||||
|
||||
progress_indicator(std::ostream &ostream);
|
||||
|
||||
/**
|
||||
* Add a new progress bar to the indicator set
|
||||
*
|
||||
@@ -86,5 +88,6 @@ private:
|
||||
std::vector<std::shared_ptr<indicators::ProgressBar>> bars_;
|
||||
std::map<std::string, progress_state> progress_bar_index_;
|
||||
std::mutex progress_bars_mutex_;
|
||||
std::ostream &ostream_;
|
||||
};
|
||||
} // namespace clanguml::common::generators
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "clang_visitor.h"
|
||||
#include "util/util.h"
|
||||
|
||||
#if LLVM_VERSION_MAJOR > 17
|
||||
#define CLANG_UML_LLVM_COMMENT_KIND(COMMENT_KIND) \
|
||||
@@ -191,7 +192,7 @@ void clang_visitor::visit_param_command(
|
||||
|
||||
inja::json param = inja::json::object();
|
||||
param["name"] = name;
|
||||
param["description"] = description;
|
||||
param["description"] = util::trim(description);
|
||||
cmt["param"].push_back(std::move(param));
|
||||
}
|
||||
}
|
||||
@@ -226,7 +227,7 @@ void clang_visitor::visit_tparam_command(
|
||||
|
||||
inja::json param = inja::json::object();
|
||||
param["name"] = name;
|
||||
param["description"] = description;
|
||||
param["description"] = util::trim(description);
|
||||
cmt["tparam"].push_back(std::move(param));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user