Skip to content

Commit

Permalink
fix a formatting bug with test scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
kaikalii committed Jun 28, 2024
1 parent 6fea2f7 commit d80a15e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -589,12 +589,18 @@ impl<'a> Formatter<'a> {
Item::Module(m) => {
self.prev_import_function = None;
self.output.push_str("---");
if let ModuleKind::Named(name) = &m.value.kind {
self.push(&name.span, &name.value);
match &m.value.kind {
ModuleKind::Named(name) => self.push(&name.span, &name.value),
ModuleKind::Test => self.output.push_str("test"),
}
let subdepth = match m.value.kind {
ModuleKind::Named(_) => depth + 1,
ModuleKind::Test => depth,
ModuleKind::Test => {
if depth == 0 {
self.newline(depth);
}
depth
}
};
self.format_items(&m.value.items, subdepth);
if self.output.ends_with('\n') {
Expand Down

0 comments on commit d80a15e

Please sign in to comment.