#fixtures #assert #filesystem

dev assert_fs

Filesystem fixtures and assertions for testing

34 releases (19 stable)

Uses new Rust 2024

1.1.4 May 26, 2026
1.1.3 May 2, 2025
1.1.2 Jul 25, 2024
1.1.1 Jan 12, 2024
0.3.0 Jun 27, 2018

#27 in Testing

Download history 199201/week @ 2026-03-26 186537/week @ 2026-04-02 206730/week @ 2026-04-09 215684/week @ 2026-04-16 227978/week @ 2026-04-23 172694/week @ 2026-04-30 197676/week @ 2026-05-07 208424/week @ 2026-05-14 185718/week @ 2026-05-21 208580/week @ 2026-05-28 256099/week @ 2026-06-04 230748/week @ 2026-06-11 202258/week @ 2026-06-18 222669/week @ 2026-06-25 201140/week @ 2026-07-02 204628/week @ 2026-07-09

867,711 downloads per month
Used in 753 crates (732 directly)

MIT/Apache

60KB
868 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

~5–11MB
~215K SLoC