diff --git a/src/fs/temp.rs b/src/fs/temp.rs index 3d550f4..3ab38d1 100644 --- a/src/fs/temp.rs +++ b/src/fs/temp.rs @@ -21,6 +21,11 @@ impl TempFileSystem { _temp_dir: temp_dir, }) } + + /// Create a clone of the wrapped [FileSystem]. + pub fn as_real(&self) -> FileSystem { + self.real.clone() + } } impl std::ops::Deref for TempFileSystem { type Target = FileSystem; diff --git a/tests/fs.rs b/tests/fs.rs index 2b04b16..6e64ab9 100644 --- a/tests/fs.rs +++ b/tests/fs.rs @@ -9,6 +9,13 @@ mod path { use super::*; + #[test] + fn temp_as_real() { + let fs = fs::temp().expect("temp fs"); + let read = fs.as_real(); + + assert_eq!(read.base(), fs.base()); + } mod is_link { use super::*;