From 33551932499a00de580b87c3b22708cf4cfd7489 Mon Sep 17 00:00:00 2001 From: redcatbaer Date: Fri, 9 Oct 2026 13:15:11 +0200 Subject: [PATCH] #401: Added regression test. --- doc/changes/changes_4.11.0.md | 3 +- .../TestRestructuredTextImporter.java | 66 +++++++++++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/doc/changes/changes_4.11.0.md b/doc/changes/changes_4.11.0.md index b332a9cd..7765f1ae 100644 --- a/doc/changes/changes_4.11.0.md +++ b/doc/changes/changes_4.11.0.md @@ -19,7 +19,8 @@ The user guide documentation now has automatic lateral navigation. ## Bugfixes -- #574: Fixed invalid HTML when inline code contains underscores +* #401: Added regression test for RST parser corner case (issue was fixed already) +* #574: Fixed invalid HTML when inline code contains underscores ## Documentation diff --git a/importer/restructuredtext/src/test/java/org/itsallcode/openfasttrace/importer/restructuredtext/TestRestructuredTextImporter.java b/importer/restructuredtext/src/test/java/org/itsallcode/openfasttrace/importer/restructuredtext/TestRestructuredTextImporter.java index f861a534..aecf22ce 100644 --- a/importer/restructuredtext/src/test/java/org/itsallcode/openfasttrace/importer/restructuredtext/TestRestructuredTextImporter.java +++ b/importer/restructuredtext/src/test/java/org/itsallcode/openfasttrace/importer/restructuredtext/TestRestructuredTextImporter.java @@ -250,4 +250,70 @@ void testDisablingRstParsingForATextBlock() .location("disable_parsing.rst", 1) .build())); } + + // Regression test for GitHub Issue #401 + // [utest->dsn~md.specification-item-title~1] + @ParameterizedTest + @ValueSource(strings = { "--------------", "##############" }) + void testImportsMultipleItemsWithRstUnderlineHeadings(final String underline) + { + assertImport("tmp.rst", """ + This is the main heading + ======================== + + The following are the requirements related to domain creation. + + Item 1 heading + %s + + `XenSSR~item1~1` + + Description: + Item 1 descrip. + + Rationale: + Item 1 rationale. + + Item 2 heading + %s + + `XenSSR~item2~1` + + Description: + Item 2 descrip. + + Rationale: + Item 2 rationale. + + Item 3 heading + %s + + `XenSSR~item3~1` + + Description: + Item 3 descrip. + + Rationale: + Item 3 rationale. + """.formatted(underline, underline, underline), + contains( + item().id(createId("XenSSR", "item1", 1)) + .title("Item 1 heading") + .description("Item 1 descrip.") + .rationale("Item 1 rationale.") + .location("tmp.rst", 9) + .build(), + item().id(createId("XenSSR", "item2", 1)) + .title("Item 2 heading") + .description("Item 2 descrip.") + .rationale("Item 2 rationale.") + .location("tmp.rst", 20) + .build(), + item().id(createId("XenSSR", "item3", 1)) + .title("Item 3 heading") + .description("Item 3 descrip.") + .rationale("Item 3 rationale.") + .location("tmp.rst", 31) + .build())); + } }