Skip to content

Missing test for get_regex_accelerator negative path #257

@antimora

Description

@antimora

Summary

get_regex_accelerator in accelerators.rs:57-64 has no direct test for the negative path (unknown pattern returning None).

Details

The function is the core dispatch mechanism for the inventory-based accelerator hook system (PR #249). The positive path (matching a registered pattern) is tested indirectly through oracle tests. But the negative path (unknown pattern) has no test.

If get_regex_accelerator were accidentally changed to panic instead of returning None on unknown patterns, no test would catch that directly.

Suggested fix

#[test]
fn test_unknown_pattern_returns_none() {
    let unknown = ConstRegexPattern::Basic("not_a_real_pattern");
    assert!(get_regex_accelerator(&unknown).is_none());
}

Files

  • crates/wordchipper/src/spanners/span_lexers/accelerators.rs:57-64

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions