token-align 0.1.0

Maps overlapping tokens and character positions between tokenized texts
Documentation
use std::path::PathBuf;

#[test]
fn unicode_version_digest_and_static_budget_are_consistent() {
    let root = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
    let tables =
        std::fs::read_to_string(root.join("src/unicode_tables.rs")).expect("read Unicode tables");
    assert!(tables.contains("Unicode 17.0.0 comparison data"));
    assert!(tables.contains("UNICODE_VERSION: (u8, u8, u8) = (17, 0, 0)"));
    let comment_digest = tables
        .lines()
        .find_map(|line| line.strip_prefix("// UnicodeData.txt sha256: "))
        .expect("table digest comment");
    let constant_digest = tables
        .lines()
        .find_map(|line| line.trim().strip_prefix('"'))
        .and_then(|line| line.strip_suffix("\";"))
        .expect("table digest constant");
    assert_eq!(comment_digest, constant_digest);
    assert_eq!(constant_digest.len(), 64);
    assert!(constant_digest.bytes().all(|byte| byte.is_ascii_hexdigit()));
    let bytes = tables
        .lines()
        .find_map(|line| line.strip_prefix("pub(crate) const STATIC_DATA_BYTES: usize = "))
        .and_then(|value| value.strip_suffix(';'))
        .and_then(|value| value.parse::<usize>().ok())
        .expect("static byte count");
    assert!(bytes <= 96 * 1024, "{bytes} bytes exceeds 96 KiB");
}

#[test]
fn unicode_license_covers_generated_tables() {
    let root = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
    let manifest = std::fs::read_to_string(root.join("Cargo.toml")).expect("read manifest");
    let notice =
        std::fs::read_to_string(root.join("LICENSE-UNICODE")).expect("read Unicode license notice");
    assert!(manifest.contains("license = \"MIT AND Unicode-3.0\""));
    assert!(root.join("LICENSE").is_file());
    assert!(notice.starts_with("UNICODE LICENSE V3\n\nCOPYRIGHT AND PERMISSION NOTICE\n"));
    assert!(notice.contains("Copyright © 1991-2026 Unicode, Inc."));
}

#[test]
fn private_alignment_helpers_do_not_carry_debug_impls() {
    let root = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
    let library = std::fs::read_to_string(root.join("src/lib.rs")).expect("read library source");
    assert!(!library.contains("#[derive(Debug)]\nstruct Stream"));
    assert!(!library.contains("#[derive(Clone, Copy, Debug)]\nstruct Unit"));
}

#[test]
fn empty_debug_performance_placeholder_is_absent() {
    let root = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
    let gate =
        std::fs::read_to_string(root.join("tests/perf_gate.rs")).expect("read performance gate");
    assert!(!gate.contains("release_perf_gate_is_present"));
    assert!(gate.contains("accented_marker_shape_scales_linearly"));
}