Skip to content

Commit

Permalink
string_pair
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyagr committed Mar 21, 2024
1 parent 985016f commit 5267cda
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ fn scan_several(roots: [&PathBuf; 3]) -> Result<EntriesToCompare, DataReadError>

#[cfg(test)]
mod tests {
use indexmap::indexmap;
use indexmap::IndexMap;
use indoc::indoc;
use itertools::Itertools;
use tempdir::TempDir;
Expand All @@ -160,6 +160,10 @@ mod tests {
}
}

fn string_pair(first: &str, second: &str) -> (String, String) {
(first.to_string(), second.to_string())
}

#[test]
fn it_works() {
let tmp_dir = TempDir::new("de3test").unwrap();
Expand Down Expand Up @@ -196,9 +200,7 @@ mod tests {
- type: Missing
- type: Missing
"###);
let result = input.save(indexmap! {
"subdir/txt".to_string() => "".to_string()
});
let result = input.save(IndexMap::from([string_pair("subdir/txt", "")]));
insta::assert_debug_snapshot!(result, @r###"
Err(
IOError(
Expand All @@ -211,10 +213,10 @@ mod tests {
),
)
"###);
let result = input.save(indexmap! {
"another_txt".to_string() => "".to_string(),
"subdir/txt".to_string() => "".to_string()
});
let result = input.save(IndexMap::from([
string_pair("subdir/txt", ""),
string_pair("another_txt", ""),
]));
insta::assert_debug_snapshot!(result, @r###"
Err(
ValidationFailError(
Expand Down

0 comments on commit 5267cda

Please sign in to comment.