abbrs: use safer API

This commit is contained in:
Johannes Altmanninger
2026-06-02 11:27:06 +08:00
parent f717c5e2a0
commit b5ae8df24c

View File

@@ -283,7 +283,7 @@ pub fn abbrs_match(token: &wstr, position: Position, cmd: &wstr) -> Vec<Replacer
#[cfg(test)]
mod tests {
use super::{Abbreviation, Position, abbrs_get_set, abbrs_match, with_abbrs_mut};
use super::{Abbreviation, Position, abbrs_match, with_abbrs_mut};
use crate::editable_line::{Edit, apply_edit};
use crate::highlight::HighlightSpec;
use crate::prelude::*;
@@ -295,8 +295,7 @@ mod tests {
fn test_abbreviations() {
test_init();
let parser = &mut TestParser::new();
{
let mut abbrs = abbrs_get_set();
with_abbrs_mut(|abbrs| {
abbrs.add(Abbreviation::new(
L!("gc").to_owned(),
L!("gc").to_owned(),
@@ -325,7 +324,7 @@ fn test_abbreviations() {
Position::Anywhere,
false,
));
}
});
// Helper to expand an abbreviation, enforcing we have no more than one result.
macro_rules! abbr_expand_1 {