#folders #test #assert

dircmp

Compare folders and return a diff for assertion

2 unstable releases

0.2.0 Nov 29, 2022
0.1.0 Nov 29, 2022

#1195 in Filesystem

Download history 55/week @ 2023-05-23 39/week @ 2023-05-30 114/week @ 2023-06-06 96/week @ 2023-06-13 44/week @ 2023-06-20 40/week @ 2023-06-27 86/week @ 2023-07-04 55/week @ 2023-07-11 58/week @ 2023-07-18 14/week @ 2023-07-25 82/week @ 2023-08-01 43/week @ 2023-08-08 343/week @ 2023-08-15 430/week @ 2023-08-22 162/week @ 2023-08-29 153/week @ 2023-09-05

1,119 downloads per month
Used in 2 crates

Apache-2.0

8KB
122 lines

dircmp

github crates.io docs.rs build status

Compare two folders for the similarities and differences.

  • Two way comparison
  • File types (dir, symlink, etc.)
  • Content difference is based on hashing the files, so binaries are also good for comparison
  • Good for asserting in tests and for taking snapshot of difference or similarity

Dependency

[dependencies]
dircmp = "0.1.0"

Usage

Default usage:

let cmp = dircmp::Comparison::default();

let result = cmp
    .compare(
        Path::new("/tmp/a"),
        Path::new("/tmp/b"),
    )

Ignore components:

use regex::RegexSet;

let ignores = let set = RegexSet::new(&[
    r"foo",
    r"bar",
]).expect("should compile");

let cmp = dircmp::Comparison::new(ignores);

let result = cmp
    .compare(
        Path::new("/tmp/a"),
        Path::new("/tmp/b"),
    )

Copyright

Copyright (c) 2022 @jondot. See LICENSE for further details.

Dependencies

~2.9–4.5MB
~84K SLoC