Struct term_transcript::test::TestConfig [−][src]
pub struct TestConfig<Cmd = Command> { /* fields omitted */ }test only.Expand description
Implementations
Creates a new config.
Panics
- Panics if the
svgcrate feature is enabled and theTERM_TRANSCRIPT_UPDATEvariable is set to an incorrect value. SeeUpdateMode::from_env()for more details.
Sets the matching kind applied.
Sets coloring of the output.
On Windows, color_choice has slightly different semantics than its usage
in the termcolor crate. Namely, if colors can be used (stdout is a tty with
color support), ANSI escape sequences will always be used.
Configures test output.
This is supported on crate feature svg only.
svg only.Sets the template for rendering new snapshots.
This is supported on crate feature svg only.
svg only.Overrides the strategy for saving new snapshots for failed tests.
By default, the strategy is determined from the execution environment
using UpdateMode::from_env().
Tests a snapshot at the specified path with the provided inputs.
If the path is relative, it is resolved relative to the current working dir,
which in the case of tests is the root directory of the including crate (i.e., the dir
where the crate manifest is located). You may specify an absolute path
using env vars that Cargo sets during build, such as env!("CARGO_MANIFEST_DIR").
Similar to other kinds of snapshot testing, a new snapshot will be generated if
there is no existing snapshot or there are mismatches between inputs or outputs
in the original and reproduced transcripts. This new snapshot will have the same path
as the original snapshot, but with the .new.svg extension. As an example,
if the snapshot at snapshots/help.svg is tested, the new snapshot will be saved at
snapshots/help.new.svg.
Generation of new snapshots will only happen if the svg crate feature is enabled
(which it is by default), and if the update mode
is not UpdateMode::Never, either because it was set explicitly or
inferred from the execution environment.
The snapshot template can be customized via Self::with_template().
Panics
- Panics if there is no snapshot at the specified path, or if the path points to a directory.
- Panics if an error occurs during reproducing the transcript or processing its output.
- Panics if there are mismatches between inputs or outputs in the original and reproduced transcripts.
Tests the transcript. This is a lower-level alternative to Self::test().
Panics
- Panics if an error occurs during reproducing the transcript or processing its output.
- Panics if there are mismatches between outputs in the original and reproduced transcripts.
pub fn test_transcript_for_stats(
&mut self,
transcript: &Transcript<Parsed>
) -> Result<(TestStats, Transcript)>
pub fn test_transcript_for_stats(
&mut self,
transcript: &Transcript<Parsed>
) -> Result<(TestStats, Transcript)>
Tests the transcript and returns testing stats together with
the reproduced Transcript. This is a lower-level alternative to Self::test().
Errors
- Returns an error if an error occurs during reproducing the transcript or processing its output.
