testmark-rs

lib.rs

//! Parser and patcher for the testmark format: named data hunks embedded in markdown.
//!
//! Testmark lets a markdown document double as documentation and test fixture data.
//! A data hunk is a fenced code block immediately preceded by a comment line
//! of the form `[testmark]:# (hunk-name)`:
//!
//! ````markdown
//! Some prose explaining the scenario.
//!
//! [testmark]:# (scenario/input)
//! ```text
//! data goes here
//! ```
//! ````
//!
//! Everything else in the document is plain markdown and is ignored
//! (and preserved byte-for-byte by the patcher).
//! The format is specified upstream at <https://github.com/warpfork/go-testmark>.
//!
//! This implementation fails closed where the input looks like testmark but isn't quite:
//! malformed annotations, annotations without a following fence, unclosed fences,
//! and duplicate hunk names are all errors rather than silently skipped hunks.
//! (A silently skipped hunk would mean a silently unexercised test.)

mod document;

pub use document::{Document, Hunk, HunkContent, NewContent, ParseError, ParsedTable};

crates/testmark/src/lib.rs · 1.1 KiB · 9ec06e8229