#folders #assert #testing

dev dircmp

Compare folders and return a diff for assertion

2 unstable releases

0.2.0 Nov 29, 2022
0.1.0 Nov 29, 2022

#962 in Filesystem

Download history 186/week @ 2023-12-04 282/week @ 2023-12-11 149/week @ 2023-12-18 258/week @ 2023-12-25 460/week @ 2024-01-01 182/week @ 2024-01-08 777/week @ 2024-01-15 192/week @ 2024-01-22 395/week @ 2024-01-29 144/week @ 2024-02-05 137/week @ 2024-02-12 232/week @ 2024-02-19 185/week @ 2024-02-26 214/week @ 2024-03-04 174/week @ 2024-03-11 156/week @ 2024-03-18

748 downloads per month
Used in 4 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

~3–4.5MB
~85K SLoC