-
Notifications
You must be signed in to change notification settings - Fork 11
Closed
Labels
enhancementImprove the expectedImprove the expected
Description
I've extended the ChildPath in my project in order to do that — see glehmann/hld@00bc932#diff-475a9530a9c1e888d097445199b74c2fR402
pub trait TestPathChild {
fn child<P>(&self, path: P) -> assert_fs::fixture::ChildPath
where
P: AsRef<std::path::Path>;
fn mkdir_all(&self) -> std::io::Result<()>;
}
impl TestPathChild for assert_fs::fixture::ChildPath {
fn child<P>(&self, path: P) -> assert_fs::fixture::ChildPath
where
P: AsRef<std::path::Path>,
{
assert_fs::fixture::ChildPath::new(self.path().join(path))
}
fn mkdir_all(&self) -> std::io::Result<()> {
std::fs::create_dir_all(self.path())
}
}used this way:
let tmp = assert_fs::TempDir::new().unwrap();
let subdir = tmp.child("hop").child("hop").child("hop");
let foo = subdir.child("foo.txt");
subdir.mkdir_all().unwrap();
foo.write_str(&lorem_ipsum).unwrap();It might be good to support this feature natively :)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementImprove the expectedImprove the expected