mirror of
https://github.com/sharkdp/bat
synced 2024-11-27 22:30:33 +00:00
Rename & sort syntax mapping tests
This commit is contained in:
parent
b48bda21a3
commit
9474b4cf8b
1 changed files with 21 additions and 21 deletions
|
@ -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 a new issue