Fixed path filtering
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
#include <algorithm>
|
||||
#include <numeric>
|
||||
#include <vector>
|
||||
|
||||
namespace clanguml {
|
||||
|
||||
@@ -10,6 +10,9 @@ diagrams:
|
||||
include:
|
||||
namespaces:
|
||||
- clanguml::t20017
|
||||
# This only affects free function participants
|
||||
paths:
|
||||
- t20017.cc
|
||||
using_namespace:
|
||||
- clanguml::t20017
|
||||
start_from:
|
||||
|
||||
@@ -15,7 +15,7 @@ diagrams:
|
||||
include:
|
||||
# Include only headers belonging to these paths
|
||||
paths:
|
||||
- ../../../tests/t40001
|
||||
- .
|
||||
plantuml:
|
||||
before:
|
||||
- "' t40001 test include diagram"
|
||||
|
||||
@@ -11,13 +11,13 @@ diagrams:
|
||||
# Render the paths relative to this directory
|
||||
relative_to: ../../../tests/t40002
|
||||
include:
|
||||
# Include only files belonging to these paths
|
||||
# Include only files belonging to these paths relative to relative_to
|
||||
paths:
|
||||
- ../../../tests/t40002
|
||||
- .
|
||||
exclude:
|
||||
paths:
|
||||
# Exclude single header
|
||||
- ../../../tests/t40002/include/lib2/lib2_detail.h
|
||||
# Exclude single header relative to relative_to
|
||||
- include/lib2/lib2_detail.h
|
||||
plantuml:
|
||||
before:
|
||||
- "' t40002 test include diagram"
|
||||
@@ -13,10 +13,10 @@ diagrams:
|
||||
include:
|
||||
# Include only files which depend on t1.h
|
||||
dependants:
|
||||
- ../../../tests/t40003/include/dependants/t1.h
|
||||
- include/dependants/t1.h
|
||||
# and dependencies of t2.cc
|
||||
dependencies:
|
||||
- ../../../tests/t40003/src/dependencies/t2.cc
|
||||
- src/dependencies/t2.cc
|
||||
plantuml:
|
||||
before:
|
||||
- "' t40003 test include diagram"
|
||||
@@ -3,18 +3,18 @@ output_directory: output
|
||||
|
||||
diagrams:
|
||||
include_test:
|
||||
type: class
|
||||
type: include
|
||||
relative_to: ../../../src
|
||||
glob:
|
||||
- src/**/*.cc
|
||||
- src/**/*.h
|
||||
include:
|
||||
paths:
|
||||
- dir1
|
||||
- dir2/dir1
|
||||
- file1.h
|
||||
- class_diagram/
|
||||
- common
|
||||
- util
|
||||
- main.cc
|
||||
exclude:
|
||||
paths:
|
||||
- dir1/file9.h
|
||||
- dir2/dir1/file9.h
|
||||
- dir1/dir3
|
||||
- file9.h
|
||||
- sequence_diagram
|
||||
- util/error.h
|
||||
@@ -32,11 +32,6 @@ TEST_CASE("Test diagram paths filter", "[unit-test]")
|
||||
using clanguml::common::model::diagram_filter;
|
||||
using clanguml::common::model::source_file;
|
||||
|
||||
auto make_path = [](std::string_view p) {
|
||||
return source_file{
|
||||
std::filesystem::current_path() / "test_config_data" / p};
|
||||
};
|
||||
|
||||
auto cfg = clanguml::config::load("./test_config_data/filters.yml");
|
||||
|
||||
CHECK(cfg.diagrams.size() == 1);
|
||||
@@ -45,10 +40,15 @@ TEST_CASE("Test diagram paths filter", "[unit-test]")
|
||||
|
||||
diagram_filter filter(diagram, config);
|
||||
|
||||
CHECK(filter.should_include(make_path("dir1/file1.h")));
|
||||
CHECK(filter.should_include(make_path("dir1/dir2/file1.h")));
|
||||
CHECK(filter.should_include(make_path("dir1/dir2/dir3/dir4/file1.h")));
|
||||
CHECK_FALSE(filter.should_include(make_path("dir1/file9.h")));
|
||||
CHECK_FALSE(filter.should_include(make_path("dir1/dir3/file1.h")));
|
||||
CHECK_FALSE(filter.should_include(make_path("dir2/dir1/file9.h")));
|
||||
auto make_path = [&](std::string_view p) {
|
||||
return source_file{config.relative_to() / p};
|
||||
};
|
||||
|
||||
CHECK(filter.should_include(
|
||||
make_path("class_diagram/visitor/translation_unit_visitor.h")));
|
||||
CHECK(filter.should_include(make_path("main.cc")));
|
||||
CHECK(filter.should_include(make_path("util/util.cc")));
|
||||
CHECK_FALSE(filter.should_include(make_path("util/error.h")));
|
||||
CHECK_FALSE(filter.should_include(
|
||||
make_path("sequence_diagram/visitor/translation_unit_visitor.h")));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user