Available on crate feature
fixture only.Expand description
Files for integration tests, written through one call instead of
fs::create_dir_all, fs::write, and an expect per file.
A Suite owns a temporary directory named after the test file, and each
Suite::scenario owns its own directory inside it. Both are removed when
the value drops, so a test cleans up by going out of scope. A write that
fails panics with the path it could not write. A broken fixture is a broken
test, and the message names the file.
use ctl_core::fixture::Suite;
let suite = Suite::new("example");
let root = suite.scenario("one");
let path = root.file("notes/a.md", "hello");
assert!(path.starts_with(root.path()));
assert_eq!(root.read("notes/a.md"), "hello");