Skip to main content

assert_faithful

Macro assert_faithful 

Source
macro_rules! assert_faithful {
    ($output:expr, $context:expr, $template_literals:expr, $language:expr $(,)?) => { ... };
}
Expand description

Assert that a rendered output is faithful to its context and template.

Panics with a detailed diagnostic if the output has unentailed content tokens or a polarity mismatch. Use this in vocab-module tests to ensure templates only produce words entailed by their inputs.

ยงExample

use prosaic_core::{assert_faithful, ctx};
use prosaic_grammar_en::English;

let ctx = ctx! { name: "UserService", action: "renamed" };
let lits: &[&str] = &["The class ", " was ", "."];
assert_faithful!("The class UserService was renamed.", ctx, lits, &English::new());