Enum term_transcript::test::UpdateMode
source · #[non_exhaustive]
pub enum UpdateMode {
Never,
Always,
}
Available on crate features
test
and svg
only.Expand description
Strategy for saving a new snapshot on a test failure within TestConfig::test()
and
related methods.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Never
Never create a new snapshot on test failure.
Always
Always create a new snapshot on test failure.
Implementations§
source§impl UpdateMode
impl UpdateMode
sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Reads the update mode from the TERM_TRANSCRIPT_UPDATE
env variable.
If the TERM_TRANSCRIPT_UPDATE
variable is not set, the output depends on whether
the executable is running in CI (which is detected by the presence of
the CI
env variable):
- In CI, the method returns
Self::Never
. - Otherwise, the method returns
Self::Always
.
Panics
If the TERM_TRANSCRIPT_UPDATE
env variable is set to an unrecognized value
(something other than never
or always
), this method will panic.
Trait Implementations§
source§impl Clone for UpdateMode
impl Clone for UpdateMode
source§fn clone(&self) -> UpdateMode
fn clone(&self) -> UpdateMode
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for UpdateMode
impl Debug for UpdateMode
source§impl Hash for UpdateMode
impl Hash for UpdateMode
source§impl PartialEq<UpdateMode> for UpdateMode
impl PartialEq<UpdateMode> for UpdateMode
source§fn eq(&self, other: &UpdateMode) -> bool
fn eq(&self, other: &UpdateMode) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.