Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

test(diagram): keep the unclosed class declaration in its own diagram

Martin Vogeld514868ee470
diff --git a/tests/test_diagrams.c b/tests/test_diagrams.c
index cf1cc6e7b..05d1f8323 100644
--- a/tests/test_diagrams.c
+++ b/tests/test_diagrams.c
@@ -331,7 +331,9 @@ TEST(diagrams_plantuml) {
/* #2818: a sequence message to or from the diagram edge (`A ->: x`, `A <-: x`,
* `[-> A: x`) and a declaration with an unclosed bracket have no operand id;
- * they used to read an uninitialized one and crash the index worker. */
+ * they used to read an uninitialized one and crash the index worker. The
+ * declaration sits in its own diagram: a `class` line makes a diagram a class
+ * diagram, where `->` is an arrow rather than a sequence message. */
TEST(diagrams_plantuml_edge_messages) {
CBMFileResult *r = dg_file("@startuml\n"
"participant Alice\n"
@@ -339,10 +341,14 @@ TEST(diagrams_plantuml_edge_messages) {
"Alice <-: in\n"
"[-> Alice: from the edge\n"
"Alice -> Bob : hello\n"
+ "@enduml\n"
+ "@startuml\n"
"class [Unclosed\n"
"@enduml\n",
"docs/edge.puml");
ASSERT_NOT_NULL(r);
+ ASSERT_STR_EQ(dg_prop(dg_def(r, "edge#diagram-1"), "diagram_kind"), "sequence");
+ ASSERT_STR_EQ(dg_prop(dg_def(r, "edge#diagram-2"), "diagram_kind"), "class");
ASSERT_NOT_NULL(dg_def(r, "edge#diagram-1.Alice"));
ASSERT_NOT_NULL(dg_def(r, "edge#diagram-1.Bob"));
ASSERT_EQ(r->diagram_arrows.count, 1);