Skip to content

Commit

Permalink
Abstract from filesystem differences
Browse files Browse the repository at this point in the history
  • Loading branch information
Frantisek Kropac authored and sylvestre committed Jun 4, 2023
1 parent 2a7f833 commit 1e8c5e9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/uu/df/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ clap = { workspace=true }
uucore = { workspace=true, features=["libc", "fsext"] }
unicode-width = { workspace=true }

[dev-dependencies]
tempfile = "3"

[[bin]]
name = "df"
path = "src/main.rs"
7 changes: 5 additions & 2 deletions src/uu/df/src/filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,13 @@ mod tests {

#[test]
fn test_dev_name_match() {
let tmp = tempfile::TempDir::new().expect("Failed to create temp dir");
let dev_name = tmp.path().to_string_lossy().to_string();

let mut mount_info = mount_info("/foo");
mount_info.dev_name = "/dev".to_string();
mount_info.dev_name = dev_name.clone();
let mounts = [mount_info];
let actual = mount_info_from_path(&mounts, "/dev", false).unwrap();
let actual = mount_info_from_path(&mounts, dev_name, false).unwrap();
assert!(mount_info_eq(actual, &mounts[0]));
}
}
Expand Down

0 comments on commit 1e8c5e9

Please sign in to comment.