From 9474b4cf8beef4c21767a494345b485f93e4b8f7 Mon Sep 17 00:00:00 2001 From: cyqsimon <28627918+cyqsimon@users.noreply.github.com> Date: Mon, 6 Nov 2023 10:54:52 +0800 Subject: [PATCH] Rename & sort syntax mapping tests --- src/syntax_mapping.rs | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/syntax_mapping.rs b/src/syntax_mapping.rs index 84893aca..fbf24564 100644 --- a/src/syntax_mapping.rs +++ b/src/syntax_mapping.rs @@ -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::>(); + } + + #[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::>(); - } }