Module term_transcript::test [−][src]
This is supported on crate feature
test
only.Expand description
Snapshot testing tools for Transcript
s.
Examples
Simple scenario in which the tested transcript calls to one or more Cargo binaries / examples by their original names.
use term_transcript::{ ShellOptions, Transcript, test::{MatchKind, TestConfig, TestOutputConfig}, }; use std::io; // Test configuration that can be shared across tests. fn config() -> TestConfig { let shell_options = ShellOptions::default().with_cargo_path(); let mut config = TestConfig::new(shell_options); config .with_match_kind(MatchKind::Precise) .with_output(TestOutputConfig::Verbose); config } fn read_svg_snapshot() -> io::Result<impl io::BufRead> { // reads the snapshot, e.g. from a file } // Usage in tests: fn test_basics() -> anyhow::Result<()> { let transcript = Transcript::from_svg(read_svg_snapshot()?)?; config().test_transcript(&transcript); Ok(()) }
Structs
Parsed | Parsed terminal output. |
TestConfig | Testing configuration. |
TestStats | Stats of a single snapshot test output by |
Enums
MatchKind | Kind of terminal output matching. |
ParseError | Errors that can occur during parsing SVG transcripts. |
TestOutputConfig | Configuration of output produced during testing. |