use crate::char_struct::CharType;
use crate::rules::RuleMeta;
use crate::rules::context::RuleContext;
use crate::rules::traits::{BrailleRule, Phase, RuleResult};
pub static META: RuleMeta = RuleMeta {
section: "56",
subsection: None,
name: "combining_emphasis_marks",
standard_ref: "2024 Korean Braille Standard, Ch.6 Sec.13 Art.56",
description: "Treat combining emphasis marks as formatting annotations",
};
pub struct Rule56;
impl BrailleRule for Rule56 {
fn meta(&self) -> &'static RuleMeta {
&META
}
fn phase(&self) -> Phase {
Phase::CoreEncoding
}
fn priority(&self) -> u16 {
380 }
fn matches(&self, ctx: &RuleContext) -> bool {
matches!(ctx.char_type, CharType::CombiningMark)
}
fn apply(&self, _ctx: &mut RuleContext) -> Result<RuleResult, String> {
Ok(RuleResult::Consumed)
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn apply_exercise() {
let mut owned = crate::test_helpers::CtxOwned::for_text("A", false);
let mut ctx = owned.ctx_at(0);
let _ = Rule56.apply(&mut ctx);
}
#[test]
fn matches_does_not_panic() {
let mut owned = crate::test_helpers::CtxOwned::for_text("A", false);
let ctx = owned.ctx_at(0);
let _ = Rule56.matches(&ctx);
}
}