Rename & sort syntax mapping tests

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

View File

@ -130,7 +130,26 @@ impl<'a> SyntaxMapping<'a> {
mod tests {
use super::*;
#[test]
fn basic() {
fn builtin_mappings_work() {
let map = SyntaxMapping::new();
assert_eq!(
map.get_syntax_for("/path/to/build"),
Some(MappingTarget::MapToUnknown)
);
}
#[test]
fn all_fixed_builtin_mappings_can_compile() {
let map = SyntaxMapping::new();
// collect call evaluates all lazy closures
// fixed builtin mappings will panic if they fail to compile
let _mappings = map.builtin_mappings().collect::<Vec<_>>();
}
#[test]
fn custom_mappings_work() {
let mut map = SyntaxMapping::new();
map.insert("/path/to/Cargo.lock", MappingTarget::MapTo("TOML"))
.ok();
@ -150,7 +169,7 @@ mod tests {
}
#[test]
fn user_can_override_builtin_mappings() {
fn custom_mappings_override_builtin() {
let mut map = SyntaxMapping::new();
assert_eq!(
@ -164,23 +183,4 @@ mod tests {
Some(MappingTarget::MapTo("My Syntax"))
);
}
#[test]
fn builtin_mappings() {
let map = SyntaxMapping::new();
assert_eq!(
map.get_syntax_for("/path/to/build"),
Some(MappingTarget::MapToUnknown)
);
}
#[test]
fn all_fixed_builtin_mappings_can_compile() {
let map = SyntaxMapping::new();
// collect call evaluates all lazy closures
// fixed builtin mappings will panic if they fail to compile
let _mappings = map.builtin_mappings().collect::<Vec<_>>();
}
}