From 05e5520ec0fba35316519dca233277761e8fd17f Mon Sep 17 00:00:00 2001 From: BenoƮt Cortier Date: Sat, 8 Jan 2022 10:32:50 -0500 Subject: Put some tests behind #[cfg(test)] (#1459) It was missing in a few places.--- helix-term/src/config.rs | 51 ++++++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 23 deletions(-) (limited to 'helix-term') diff --git a/helix-term/src/config.rs b/helix-term/src/config.rs index 3745f871..6b8bbc1b 100644 --- a/helix-term/src/config.rs +++ b/helix-term/src/config.rs @@ -20,14 +20,18 @@ pub struct LspConfig { pub display_messages: bool, } -#[test] -fn parsing_keymaps_config_file() { - use crate::keymap; - use crate::keymap::Keymap; - use helix_core::hashmap; - use helix_view::document::Mode; - - let sample_keymaps = r#" +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn parsing_keymaps_config_file() { + use crate::keymap; + use crate::keymap::Keymap; + use helix_core::hashmap; + use helix_view::document::Mode; + + let sample_keymaps = r#" [keys.insert] y = "move_line_down" S-C-a = "delete_selection" @@ -36,19 +40,20 @@ fn parsing_keymaps_config_file() { A-F12 = "move_next_word_end" "#; - assert_eq!( - toml::from_str::(sample_keymaps).unwrap(), - Config { - keys: Keymaps(hashmap! { - Mode::Insert => Keymap::new(keymap!({ "Insert mode" - "y" => move_line_down, - "S-C-a" => delete_selection, - })), - Mode::Normal => Keymap::new(keymap!({ "Normal mode" - "A-F12" => move_next_word_end, - })), - }), - ..Default::default() - } - ); + assert_eq!( + toml::from_str::(sample_keymaps).unwrap(), + Config { + keys: Keymaps(hashmap! { + Mode::Insert => Keymap::new(keymap!({ "Insert mode" + "y" => move_line_down, + "S-C-a" => delete_selection, + })), + Mode::Normal => Keymap::new(keymap!({ "Normal mode" + "A-F12" => move_next_word_end, + })), + }), + ..Default::default() + } + ); + } } -- cgit v1.2.3-70-g09d2