mirror of
https://github.com/imjasonh/testscript-rs
synced 2026-07-12 02:49:35 +00:00
Implement TestWork functionality for preserving working directories on failure
Co-authored-by: imjasonh <210737+imjasonh@users.noreply.github.com>
This commit is contained in:
parent
6cb1109c05
commit
fe5da3cebe
7 changed files with 282 additions and 5 deletions
|
|
@ -301,6 +301,15 @@ impl TestEnvironment {
|
|||
|
||||
result
|
||||
}
|
||||
|
||||
/// Preserve the work directory by preventing TempDir cleanup
|
||||
/// Returns the path to the preserved directory
|
||||
pub fn preserve_work_dir(self) -> std::path::PathBuf {
|
||||
let work_dir = self.work_dir.clone();
|
||||
// Leak the TempDir to prevent cleanup
|
||||
std::mem::forget(self._temp_dir);
|
||||
work_dir
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue