mirror of
https://github.com/sharkdp/bat.git
synced 2024-11-22 15:53:29 +01:00
Rename & sort syntax mapping tests
This commit is contained in:
parent
b48bda21a3
commit
9474b4cf8b
@ -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<_>>();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user