use std::fs;
use mini_docs::Builder;
#[test]
fn child_template_alphabetically_before_parent_still_loads() {
let input = tempfile::tempdir().expect("create input tempdir");
let templates = tempfile::tempdir().expect("create templates tempdir");
let output = tempfile::tempdir().expect("create output tempdir");
fs::write(input.path().join("page.md"), "# Page\n").expect("write page.md");
fs::write(
templates.path().join("article.html"),
"{% extends \"base.html\" %}{% block content %}{{ page.content | safe }}{% endblock %}",
)
.expect("write article.html");
fs::write(
templates.path().join("base.html"),
"<body>{% block content %}{% endblock %}</body>",
)
.expect("write base.html");
let result = Builder::new(input.path())
.templates(templates.path())
.output(output.path())
.default_template("article.html")
.build();
assert!(
result.is_ok(),
"build should succeed regardless of template file order: {result:?}"
);
assert!(output.path().join("page.html").is_file());
}