Fixed link generation in include diagrams for source files

This commit is contained in:
Bartek Kryza
2022-04-13 00:00:25 +02:00
parent 1915bd85b1
commit 9a0a64efd3
2 changed files with 18 additions and 0 deletions

View File

@@ -160,6 +160,10 @@ void translation_unit_visitor::process_source_file(const cppast::cpp_file &file)
else
source_file.set_type(source_file_t::kHeader);
source_file.set_file(
std::filesystem::absolute(file.name()).lexically_normal().string());
source_file.set_line(0);
ctx.set_current_file(type_safe::opt_ref(source_file));
}
else {

View File

@@ -48,6 +48,20 @@ TEST_CASE("t40002", "[test-case][package]")
REQUIRE_THAT(puml, IsAssociation(_A("lib1.cc"), _A("lib1.h")));
REQUIRE_THAT(puml, IsAssociation(_A("lib2.cc"), _A("lib2.h")));
REQUIRE_THAT(puml,
HasLink(_A("t40002.cc"),
fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/"
"t40002/src/t40002.cc#L0",
clanguml::util::get_git_commit()),
"t40002.cc"));
REQUIRE_THAT(puml,
HasLink(_A("lib1.cc"),
fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/"
"t40002/src/lib1/lib1.cc#L0",
clanguml::util::get_git_commit()),
"lib1.cc"));
REQUIRE_THAT(puml,
HasLink(_A("lib1.h"),
fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/"