Skip to content

Commit

Permalink
Include path in test filename
Browse files Browse the repository at this point in the history
  • Loading branch information
aumetra committed May 3, 2024
1 parent b5c7ccb commit 9445cec
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions docs-test-gen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,18 @@ fn process_file(path: &Path) -> Result<()> {
}

for (idx, block) in blocks.iter().enumerate() {
let mdx_filename = path.file_name().unwrap().to_str().ok_or_else(|| {
let mdx_path = path.to_str().ok_or_else(|| {
anyhow!(
"filename of path \"{}\" isn't valid utf-8. (really?! in the 21st century?)",
path.display()
)
})?;
})?
.replace("../", "")
.replace('/', "_");

let filename = format!(
"{}_{}_{}.{}",
mdx_filename.replace('.', "_"),
block.template,
"{}_{}.{}",
mdx_path.replace('.', "_"),
idx,
block.language.file_ext(),
);
Expand Down

0 comments on commit 9445cec

Please sign in to comment.