#filesystem #assert #fixtures #fixture #test #setting-up

dev assert_fs

Filesystem fixtures and assertions for testing

32 releases (17 stable)

1.1.2 Jul 25, 2024
1.1.1 Jan 12, 2024
1.1.0 Dec 27, 2023
1.0.13 Apr 13, 2023
0.3.0 Jun 27, 2018

#10 in Testing

Download history 45522/week @ 2024-07-26 48983/week @ 2024-08-02 49710/week @ 2024-08-09 66554/week @ 2024-08-16 48578/week @ 2024-08-23 42719/week @ 2024-08-30 44048/week @ 2024-09-06 38712/week @ 2024-09-13 44881/week @ 2024-09-20 41950/week @ 2024-09-27 44430/week @ 2024-10-04 43619/week @ 2024-10-11 47846/week @ 2024-10-18 46710/week @ 2024-10-25 48888/week @ 2024-11-01 51307/week @ 2024-11-08

203,700 downloads per month
Used in 416 crates (402 directly)

MIT/Apache

56KB
846 lines

assert_fs

Assert Filesystems - Filesystem fixtures and assertions for testing.

Documentation License Crates Status

assert_fs aims to simplify

  • Setting up files for your tests to consume
  • Asserting on files produced by your tests

Example

Here is a trivial example:

use assert_fs::prelude::*;
use predicates::prelude::*;

let temp = assert_fs::TempDir::new().unwrap();
let input_file = temp.child("foo.txt");
input_file.touch().unwrap();
// ... do something with input_file ...
input_file.assert("");
temp.child("bar.txt").assert(predicate::path::missing());
temp.close().unwrap();

See the documentation for more information.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~6–15MB
~212K SLoC