diff --git a/src/lib.rs b/src/lib.rs index f8895e3..46bc4aa 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -48,6 +48,7 @@ pub fn is_different, B: AsRef>(a_base: A, b_base: B) -> Res if a.depth() != b.depth() || a.file_type() != b.file_type() || a.file_name() != b.file_name() + || a.metadata()?.permissions() != b.metadata()?.permissions() || (a.file_type().is_file() && read_to_vec(a.path())? != read_to_vec(b.path())?) { return Ok(true); diff --git a/tests/permissions/bad/dir1/file b/tests/permissions/bad/dir1/file new file mode 100644 index 0000000..e69de29 diff --git a/tests/permissions/bad/dir2/file b/tests/permissions/bad/dir2/file new file mode 100644 index 0000000..e69de29 diff --git a/tests/permissions/good/dir1/file b/tests/permissions/good/dir1/file new file mode 100644 index 0000000..e69de29 diff --git a/tests/permissions/good/dir2/file b/tests/permissions/good/dir2/file new file mode 100644 index 0000000..e69de29 diff --git a/tests/smoke.rs b/tests/smoke.rs index 53072cd..07306fb 100644 --- a/tests/smoke.rs +++ b/tests/smoke.rs @@ -57,6 +57,12 @@ fn reflexive() { assert!(dir_diff::is_different("tests/reflexive/dir1", "tests/reflexive/dir2").unwrap()); } +#[test] +fn binary_permissions() { + assert!(!dir_diff::is_different("tests/permissions/good/dir1", "tests/permissions/good/dir2").unwrap()); + assert!(dir_diff::is_different("tests/permissions/bad/dir1", "tests/permissions/bad/dir2").unwrap()); +} + #[test] fn dirs_differ() { assert!(dir_diff::is_different("tests/dirs_differ/dir1", "tests/dirs_differ/dir2").unwrap());