assert-rs/dir-diff

Potential collaboration using checksumdir and diff-rs crates in Torchbear environment

Opened this issue · 5 comments

Hi!

This crate looks very similar to what we did in checksumdir, which is a straight port of python's checksumdir, and diff-rs in order to make those functions available to Torchbear's scripting environment - just announced in r/rust.

Perhaps someone here would like to try out this new Rust project that makes it possible to produce useful apps from powerful libraries in simple scripts.

epage commented

#11 is the type of direction I'd like to take this project.

One use case is to make testing as dead simple as possible while giving the user as much information as they need. I'd like get dir-diff to report what is different, integrate it into predicates, and then it'd have integration in assert_fs. I'm wanting both subset assertion (everything in my "expected" folder is in my "actual" folder) and exact assertion ("expected" and "actual" folders completely match).

You can find a hand-rolled version of this in cobalt's tests. The fun part is coming up with an API that is general enough but not so general it can't ever be implemented or used :)

Looking at checksumdir, it looks like it takes a checksum of a directory which would make quick checks over time, etc. Is this correct?

From these comparisons, any potential you see in collaboration?

hmm.. well what's your main goal? what are you ultimately building?

epage commented

I felt like I had said that but I guess I wasn't clear. Let me try another way.

I've been working on a crate, assert_fs, that tries to make it more trivial to write tests that deal with filesystems. With minimal boilerplate, you can write a test and on failure, it reports a lot of helpful information to make the debug process easier. A big use case not covered is making sure an output directory matches a "golden" or "snapshot" directory. cobalt-bins tests are one example of this need.

To help accomplish this, I need a directory diffing API that doesn't just return a pass / fail but will tell you why it failed, e.g. what file was missing or which file had unexpected content and what the content was. That is what #11 is about. #6 complicates it a little bit.

for Cobalt?

epage commented

Cobalt is one example of the need. I want to generalize what cobalt has so anyone can take advantage of it.