TestSpec_PublicAPI_ExtractMarkdownSection validates the documented behavior of ExtractMarkdownSection as described in the package README.md. Specification: Extracts a named ## section from markdown.
(t *testing.T)
| 55 | // |
| 56 | // Specification: Extracts a named ## section from markdown. |
| 57 | func TestSpec_PublicAPI_ExtractMarkdownSection(t *testing.T) { |
| 58 | t.Run("extracts the named section content", func(t *testing.T) { |
| 59 | content := "# Title\n\n## Tools\n\nSome tool config.\n\n## Other\n\nOther stuff." |
| 60 | section, err := ExtractMarkdownSection(content, "Tools") |
| 61 | require.NoError(t, err, |
| 62 | "ExtractMarkdownSection should not error when section exists") |
| 63 | assert.Contains(t, section, "Some tool config", |
| 64 | "extracted section should contain the body following the matched heading") |
| 65 | }) |
| 66 | |
| 67 | t.Run("returns error when section is not found", func(t *testing.T) { |
| 68 | content := "# Title\n\n## Tools\n\nSome tool config." |
| 69 | _, err := ExtractMarkdownSection(content, "Missing") |
| 70 | assert.Error(t, err, |
| 71 | "ExtractMarkdownSection should return error when the requested section is absent") |
| 72 | }) |
| 73 | |
| 74 | t.Run("stops at next same-or-higher level heading", func(t *testing.T) { |
| 75 | content := "## Tools\n\nTool A.\n\n## Engine\n\nEngine X." |
| 76 | section, err := ExtractMarkdownSection(content, "Tools") |
| 77 | require.NoError(t, err, |
| 78 | "ExtractMarkdownSection should not error when section exists") |
| 79 | assert.Contains(t, section, "Tool A", |
| 80 | "extracted section should contain text from inside the matched section") |
| 81 | assert.NotContains(t, section, "Engine X", |
| 82 | "extracted section should not bleed into the next ## section") |
| 83 | }) |
| 84 | } |
| 85 | |
| 86 | // TestSpec_PublicAPI_IsWorkflowSpec validates the documented behavior of |
| 87 | // IsWorkflowSpec as described in the package README.md. |
nothing calls this directly
no test coverage detected