Skip to content

Commit 99333ba

Browse files
committed
test: support multipage golden tests
1 parent 97a9acf commit 99333ba

File tree

29 files changed

+1457
-282
lines changed

29 files changed

+1457
-282
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,5 @@
2727
/util/danger/node_modules/
2828
/.roadmap
2929
/AGENTS.md
30+
# Ignore hidden OS files under golden fixtures
31+
test-files/golden-tests/**/.*

docs/modules/ROOT/pages/contribute.adoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,13 @@ The fixtures for golden testing are defined in `test-files/golden-tests`, where
263263
* `<filename>.bad.xml`: The test output file generated when the test fails.
264264
* `<filename>.yml`: Extra configuration options for this specific file.
265265

266+
Multipage golden tests follow a snapshot-based layout:
267+
268+
* The suite defaults to `multipage: false` in `test-files/golden-tests/mrdocs.yml`; a multipage test must provide a `<stem>.yml` that sets `multipage: true`.
269+
* Expected output lives under `<stem>.multipage/<format>/...` (one directory per generator); single-page siblings like `<stem>.html`/`.xml` must be absent.
270+
* The harness skips `.multipage/` directories during discovery and compares generated temp output trees to the snapshot (strict tree + content).
271+
* Add a short comment in the `.cpp` explaining why multipage is required—use it only when single-page output cannot validate the behavior (e.g., relative asset/link handling).
272+
266273
== Style Guide
267274

268275
This project follows informal formatting conventions established by previous Boost projects.

mrdocs.rnc

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,47 @@ namespace xsi= "http://www.w3.org/2001/XMLSchema-instance"
2020

2121
grammar
2222
{
23-
start = element mrdocs
24-
{
25-
attribute xsi:noNamespaceSchemaLocation {text}?,
26-
Namespace
27-
}
23+
start = Mrdocs | Tagfile
24+
25+
Mrdocs =
26+
element mrdocs
27+
{
28+
attribute xsi:noNamespaceSchemaLocation {text}?,
29+
Namespace
30+
}
31+
32+
Tagfile =
33+
element tagfile
34+
{
35+
TagCompound+
36+
}
37+
38+
TagCompound =
39+
element compound
40+
{
41+
attribute kind { "namespace" | "class" },
42+
element name { text },
43+
element filename { text },
44+
(TagClass | TagMember)*
45+
}
46+
47+
TagClass =
48+
element class
49+
{
50+
attribute kind { "class" },
51+
text
52+
}
53+
54+
TagMember =
55+
element member
56+
{
57+
attribute kind { "function" },
58+
element type { text },
59+
element name { text },
60+
element anchorfile { text },
61+
element anchor { text },
62+
element arglist { text }
63+
}
2864

2965
#---------------------------------------------
3066

src/lib/Gen/hbs/HandlebarsGenerator.hpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,28 @@ namespace hbs {
2727
class HandlebarsGenerator
2828
: public Generator
2929
{
30+
public:
31+
struct StylesheetRef
32+
{
33+
/** Absolute path to the source stylesheet on disk (empty for remote). */
34+
std::string sourcePath;
35+
/** Href or output-relative path written to the HTML. */
36+
std::string outputRelative;
37+
/** True when the stylesheet is remote and should not be copied. */
38+
bool external = false;
39+
};
40+
41+
struct StylesData
42+
{
43+
std::vector<StylesheetRef> stylesheets;
44+
std::vector<std::string> inlineStyles;
45+
std::vector<std::string> inlineScripts;
46+
bool hasDefaultStyles = false;
47+
};
48+
49+
private:
50+
Expected<StylesData> prepareStylesheets(Config const& config) const;
51+
3052
public:
3153
Expected<void>
3254
build(

0 commit comments

Comments
 (0)