Add test: `custom_mappings_precedence`

This commit is contained in:
cyqsimon 2023-11-06 10:55:22 +08:00
parent 9474b4cf8b
commit 3865908439
No known key found for this signature in database
GPG Key ID: 1D8CE2F297390D65
1 changed files with 14 additions and 0 deletions

View File

@ -183,4 +183,18 @@ mod tests {
Some(MappingTarget::MapTo("My Syntax"))
);
}
#[test]
fn custom_mappings_precedence() {
let mut map = SyntaxMapping::new();
map.insert("/path/to/foo", MappingTarget::MapTo("alpha"))
.ok();
map.insert("/path/to/foo", MappingTarget::MapTo("bravo"))
.ok();
assert_eq!(
map.get_syntax_for("/path/to/foo"),
Some(MappingTarget::MapTo("alpha"))
);
}
}