Added test case for inline diagram in config without code
This commit is contained in:
@@ -214,6 +214,9 @@ public:
|
|||||||
{
|
{
|
||||||
ostr << "@startuml" << std::endl;
|
ostr << "@startuml" << std::endl;
|
||||||
|
|
||||||
|
for (const auto &b : m_config.puml.before)
|
||||||
|
ostr << b << std::endl;
|
||||||
|
|
||||||
for (const auto &c : m_model.classes) {
|
for (const auto &c : m_model.classes) {
|
||||||
generate_aliases(c, ostr);
|
generate_aliases(c, ostr);
|
||||||
ostr << std::endl;
|
ostr << std::endl;
|
||||||
@@ -229,6 +232,9 @@ public:
|
|||||||
ostr << std::endl;
|
ostr << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (const auto &b : m_config.puml.after)
|
||||||
|
ostr << b << std::endl;
|
||||||
|
|
||||||
ostr << "@enduml" << std::endl;
|
ostr << "@enduml" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
20
tests/t00000/.clanguml
Normal file
20
tests/t00000/.clanguml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
compilation_database_dir: ..
|
||||||
|
output_directory: puml
|
||||||
|
diagrams:
|
||||||
|
t00000_class:
|
||||||
|
type: class
|
||||||
|
plantuml:
|
||||||
|
before:
|
||||||
|
- 'class "Foo" as C_001'
|
||||||
|
- 'class C_001 {'
|
||||||
|
- ' +int value'
|
||||||
|
- '}'
|
||||||
|
- 'C_001 <|-- ArrayList'
|
||||||
|
- 'note top of C_001: This is a very important class.'
|
||||||
|
- 'note "This is a\nfloating note" as N1'
|
||||||
|
- 'note "This note is connected\nto several objects." as N2'
|
||||||
|
- 'C_001 .. N2'
|
||||||
|
- 'N2 .. ArrayList'
|
||||||
|
- 'class "Boo" as C_002'
|
||||||
|
- 'class C_002 {'
|
||||||
|
- '}'
|
||||||
0
tests/t00000/t00000.cc
Normal file
0
tests/t00000/t00000.cc
Normal file
42
tests/t00000/test_case.h
Normal file
42
tests/t00000/test_case.h
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
/**
|
||||||
|
* tests/t00000/test_case.cc
|
||||||
|
*
|
||||||
|
* Copyright (c) 2021 Bartek Kryza <bkryza@gmail.com>
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
TEST_CASE("Test t00000", "[unit-test]")
|
||||||
|
{
|
||||||
|
spdlog::set_level(spdlog::level::debug);
|
||||||
|
|
||||||
|
auto [config, db] = load_config("t00000");
|
||||||
|
|
||||||
|
auto diagram = config.diagrams["t00000_class"];
|
||||||
|
|
||||||
|
auto model = generate_class_diagram(db, diagram);
|
||||||
|
|
||||||
|
REQUIRE(model.name == "t00000_class");
|
||||||
|
|
||||||
|
auto puml = generate_class_puml(diagram, model);
|
||||||
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
|
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||||
|
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||||
|
|
||||||
|
REQUIRE_THAT(puml, IsClass(_A("Foo")));
|
||||||
|
REQUIRE_THAT(puml, IsClass(_A("Boo")));
|
||||||
|
|
||||||
|
save_puml(
|
||||||
|
"./" + config.output_directory + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
@@ -10,8 +10,3 @@ diagrams:
|
|||||||
include:
|
include:
|
||||||
namespaces:
|
namespaces:
|
||||||
- clanguml::t00002
|
- clanguml::t00002
|
||||||
plantuml:
|
|
||||||
before:
|
|
||||||
- "' t00002 test class diagram"
|
|
||||||
after:
|
|
||||||
- 'note over "A": A class'
|
|
||||||
|
|||||||
@@ -10,8 +10,3 @@ diagrams:
|
|||||||
include:
|
include:
|
||||||
namespaces:
|
namespaces:
|
||||||
- clanguml::t00003
|
- clanguml::t00003
|
||||||
plantuml:
|
|
||||||
before:
|
|
||||||
- "' t00003 test class members"
|
|
||||||
after:
|
|
||||||
- 'note over "A": A class'
|
|
||||||
|
|||||||
@@ -12,8 +12,3 @@ diagrams:
|
|||||||
include:
|
include:
|
||||||
namespaces:
|
namespaces:
|
||||||
- clanguml::t00004
|
- clanguml::t00004
|
||||||
plantuml:
|
|
||||||
before:
|
|
||||||
- "' t00004 test class members"
|
|
||||||
after:
|
|
||||||
- 'note over "A": A class'
|
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ using clanguml::test::matchers::Protected;
|
|||||||
using clanguml::test::matchers::Public;
|
using clanguml::test::matchers::Public;
|
||||||
using clanguml::test::matchers::Static;
|
using clanguml::test::matchers::Static;
|
||||||
|
|
||||||
|
#include "t00000/test_case.h"
|
||||||
#include "t00001/test_case.h"
|
#include "t00001/test_case.h"
|
||||||
#include "t00002/test_case.h"
|
#include "t00002/test_case.h"
|
||||||
#include "t00003/test_case.h"
|
#include "t00003/test_case.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user