This commit is contained in:
David Kellermann 2025-07-07 09:48:52 +02:00 committed by GitHub
commit 54a2b678df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 34 additions and 0 deletions

View file

@ -45,11 +45,21 @@ impl Display for Item<'_> {
write!(f, " {relative}")
}
Self::Module {
doc,
groups,
name,
relative,
optional,
..
} => {
if let Some(docstr) = doc {
writeln!(f, "# {docstr}")?;
}
for group in groups.iter() {
writeln!(f, "[group('{}')]", group)?;
}
write!(f, "mod")?;
if *optional {

View file

@ -998,3 +998,27 @@ fn empty_doc_attribute_on_module() {
.stdout("Available recipes:\n foo ...\n")
.run();
}
#[test]
fn modules_with_attributes_are_dumped_correctly() {
Test::new()
.write("foo.just", "foo:\n @echo FOO")
.justfile(
"
# doc
[group('bar')]
[group('baz')]
mod foo
",
)
.arg("--dump")
.stdout(
"
# doc
[group('bar')]
[group('baz')]
mod foo
",
)
.run();
}