safehtml 0.2.0

A high-performance, no_std Rust library for Type-Driven Security (XSS and injection prevention).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Compile-fail (trybuild) suite for the `safe_html_format!` const
//! checkers — the compile-time boundary that keeps unescaped
//! interpolation out. Each `tests/ui/*.rs` case must fail to compile with
//! the diagnostic pinned in its `.stderr` snapshot; a refactor that
//! weakens a checker breaks this test.
//!
//! To regenerate snapshots after an intentional diagnostic change:
//! `TRYBUILD=overwrite cargo test --test compile_fail`.
#![cfg(feature = "alloc")]

#[test]
fn safe_html_format_rejects_invalid_templates() {
    let t = trybuild::TestCases::new();
    t.compile_fail("tests/ui/*.rs");
}