pub struct InMemoryFileSystem { /* private fields */ }
Expand description
In-memory filesystem for use in unit tests.
This type mocks out the file system operations in the VM. It provides an in-memory system to which “files” can be added before the test runs. It is designed to help test primitives that interact with the filesystem.
Given a VM, the file system can be set as follows:
let mut vm = vm::VM::<State>::new(
Default::default(), // initial commands
);
let mock_file_system: InMemoryFileSystem = Default::default();
vm.file_system = Box::new(mock_file_system);
When using the test runners in this module or the test_suite macro, assign the file system ops using the TestOption::CustomVMInitializationDyn option:
let options = TestOption::CustomVMInitializationDyn(Box::new(|vm: &mut vm::VM<State>|{
let mock_file_system: InMemoryFileSystem = Default::default();
vm.file_system = Box::new(mock_file_system);
}));
Implementations§
Trait Implementations§
Source§impl Default for InMemoryFileSystem
impl Default for InMemoryFileSystem
Source§fn default() -> InMemoryFileSystem
fn default() -> InMemoryFileSystem
Returns the “default value” for a type. Read more
Source§impl FileSystem for InMemoryFileSystem
impl FileSystem for InMemoryFileSystem
Auto Trait Implementations§
impl Freeze for InMemoryFileSystem
impl RefUnwindSafe for InMemoryFileSystem
impl Send for InMemoryFileSystem
impl Sync for InMemoryFileSystem
impl Unpin for InMemoryFileSystem
impl UnwindSafe for InMemoryFileSystem
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