Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
max-sixty committed May 3, 2024
1 parent 66aff45 commit 3dfb396
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions insta/src/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,6 @@ fn normalize_inline_snapshot(snapshot: &str) -> String {
fn names_of_path(path: &Path) -> (String, String) {
// The final part of the snapshot file name is the test name; the
// initial parts are the module name

let parts: Vec<&str> = path
.file_stem()
.unwrap()
Expand All @@ -623,9 +622,10 @@ fn names_of_path(path: &Path) -> (String, String) {
.rsplitn(2, "__")
.collect();

match parts.split_first() {
Some((&snapshot_name, modules)) => (snapshot_name.to_string(), modules.join("__")),
None => ("".to_string(), "<unknown>".to_string()),
match parts.as_slice() {
[snapshot_name, module_name] => (snapshot_name.to_string(), module_name.to_string()),
[snapshot_name] => (snapshot_name.to_string(), String::new()),
_ => (String::new(), "<unknown>".to_string()),
}
}

Expand Down

0 comments on commit 3dfb396

Please sign in to comment.