1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! Filesystem fixtures and assertions for testing.
//!
//! Fixtures:
//! - A sandbox to work within (see [`TempDir`]).
//! - Setup the sandbox (see [`FileTouch`], [`FileWriteBin`], [`FileWriteStr`], [`PathCopy`]).
//!
//! For assertions, see [`PathAssert`].
//!
//! ```toml
//! [dependencies]
//! assert_fs = "0.9"
//! ```
//!
//! ## Example
//!
//! Here is a trivial example:
//!
//! ```rust,ignore
//! 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();
//! ```
//!
//! [`TempDir`]: struct.TempDir.html
//! [`FileTouch`]: trait.FileTouch.html
//! [`FileWriteBin`]: trait.FileWriteBin.html
//! [`FileWriteStr`]: trait.FileWriteStr.html
//! [`PathCopy`]: trait.PathCopy.html
//! [`PathAssert`]: assert/trait.PathAssert.html

#![warn(missing_docs)]

extern crate globwalk;
extern crate predicates;
extern crate predicates_core;
extern crate predicates_tree;
extern crate tempfile;

pub mod assert;
pub use assert::PathAssert;

mod fs;
pub use fs::*;

pub mod errors;

/// Extension traits that are useful to have available.
pub mod prelude {
    pub use assert::PathAssert;
    pub use fs::FileTouch;
    pub use fs::FileWriteBin;
    pub use fs::FileWriteStr;
    pub use fs::PathChild;
    pub use fs::PathCopy;
}