aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorBenoƮt Cortier2022-01-08 15:32:50 +0000
committerGitHub2022-01-08 15:32:50 +0000
commit05e5520ec0fba35316519dca233277761e8fd17f (patch)
tree63fd93b819ddf9fb87e97da72ecdbbf1a1b78bfb /helix-term
parent939261fc078cea86d0e7f712222b9ae22785478c (diff)
Put some tests behind #[cfg(test)] (#1459)
It was missing in a few places.
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/config.rs51
1 files changed, 28 insertions, 23 deletions
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::<Config>(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::<Config>(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()
+ }
+ );
+ }
}