pub struct TestWorkspace { /* private fields */ }Expand description
Managed temporary workspace for unit and integration tests.
The workspace is deleted when dropped.
Fixture operations are rooted at an explicit fixture directory and reject absolute
or parent-traversing relative paths through rskit-fs safe path handling.
Implementations§
Source§impl TestWorkspace
impl TestWorkspace
Sourcepub fn with_fixture_dir(self, fixture_dir: impl Into<PathBuf>) -> Self
pub fn with_fixture_dir(self, fixture_dir: impl Into<PathBuf>) -> Self
Set the directory used as the root for fixture lookups.
Sourcepub fn child(&self, rel_path: impl AsRef<Path>) -> AppResult<PathBuf>
pub fn child(&self, rel_path: impl AsRef<Path>) -> AppResult<PathBuf>
Resolve a safe relative path inside the workspace.
Sourcepub fn write_file(
&self,
rel_path: impl AsRef<Path>,
content: &[u8],
) -> AppResult<PathBuf>
pub fn write_file( &self, rel_path: impl AsRef<Path>, content: &[u8], ) -> AppResult<PathBuf>
Write a file inside the workspace, creating parent directories.
Sourcepub fn fixture_path(&self, rel_path: impl AsRef<Path>) -> AppResult<PathBuf>
pub fn fixture_path(&self, rel_path: impl AsRef<Path>) -> AppResult<PathBuf>
Resolve a fixture path under the configured fixture root.
Sourcepub fn read_fixture(&self, rel_path: impl AsRef<Path>) -> AppResult<Vec<u8>>
pub fn read_fixture(&self, rel_path: impl AsRef<Path>) -> AppResult<Vec<u8>>
Read fixture bytes from the configured fixture root.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TestWorkspace
impl RefUnwindSafe for TestWorkspace
impl Send for TestWorkspace
impl Sync for TestWorkspace
impl Unpin for TestWorkspace
impl UnsafeUnpin for TestWorkspace
impl UnwindSafe for TestWorkspace
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more