Struct tendermint_testgen::tester::TestEnv
source · [−]pub struct TestEnv { /* private fields */ }
Expand description
A test environment, which is essentially a wrapper around some directory, with some utility functions operating relative to that directory.
Implementations
sourceimpl TestEnv
impl TestEnv
pub fn new(current_dir: &str) -> Option<Self>
pub fn push(&self, child: &str) -> Option<Self>
pub fn current_dir(&self) -> &str
pub fn clear_log(&self) -> Option<()>
pub fn logln(&self, msg: &str) -> Option<()>
pub fn logln_to(&self, msg: &str, rel_path: impl AsRef<Path>) -> Option<()>
sourcepub fn read_file(&self, rel_path: impl AsRef<Path>) -> Option<String>
pub fn read_file(&self, rel_path: impl AsRef<Path>) -> Option<String>
Read a file from a path relative to the environment current dir into a string
sourcepub fn write_file(
&self,
rel_path: impl AsRef<Path>,
contents: &str
) -> Option<()>
pub fn write_file(
&self,
rel_path: impl AsRef<Path>,
contents: &str
) -> Option<()>
Write a file to a path relative to the environment current dir
sourcepub fn parse_file<T: DeserializeOwned>(
&self,
rel_path: impl AsRef<Path>
) -> Option<T>
pub fn parse_file<T: DeserializeOwned>(
&self,
rel_path: impl AsRef<Path>
) -> Option<T>
Parse a file from a path relative to the environment current dir as the given type
sourcepub fn copy_file_from(&self, path: impl AsRef<Path>) -> Option<()>
pub fn copy_file_from(&self, path: impl AsRef<Path>) -> Option<()>
Copy a file from the path outside environment into the environment current dir Returns None if copying was not successful
sourcepub fn copy_file_from_as(
&self,
path: impl AsRef<Path>,
new_name: &str
) -> Option<()>
pub fn copy_file_from_as(
&self,
path: impl AsRef<Path>,
new_name: &str
) -> Option<()>
Copy a file from the path outside environment into the environment current dir Assigns the file a new_name in the current environment Returns None if copying was not successful
sourcepub fn copy_file_from_env(
&self,
other: &TestEnv,
path: impl AsRef<Path>
) -> Option<()>
pub fn copy_file_from_env(
&self,
other: &TestEnv,
path: impl AsRef<Path>
) -> Option<()>
Copy a file from the path relative to the other environment into the environment current dir Returns None if copying was not successful
sourcepub fn copy_file_from_env_as(
&self,
other: &TestEnv,
path: impl AsRef<Path>,
new_name: &str
) -> Option<()>
pub fn copy_file_from_env_as(
&self,
other: &TestEnv,
path: impl AsRef<Path>,
new_name: &str
) -> Option<()>
Copy a file from the path relative to the other environment into the environment current dir Assigns the file a new_name in the current environment Returns None if copying was not successful
sourcepub fn remove_file(&self, rel_path: impl AsRef<Path>) -> Option<()>
pub fn remove_file(&self, rel_path: impl AsRef<Path>) -> Option<()>
Remove a file from a path relative to the environment current dir
sourcepub fn full_path(&self, rel_path: impl AsRef<Path>) -> PathBuf
pub fn full_path(&self, rel_path: impl AsRef<Path>) -> PathBuf
Convert a relative path to the full path from the test root Return None if the full path can’t be formed
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for TestEnv
impl Send for TestEnv
impl Sync for TestEnv
impl Unpin for TestEnv
impl UnwindSafe for TestEnv
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more