Put some tests behind #[cfg(test)] (#1459)

It was missing in a few places.
pull/1465/head
Benoît Cortier 3 years ago committed by GitHub
parent 939261fc07
commit 05e5520ec0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -20,8 +20,12 @@ pub struct LspConfig {
pub display_messages: bool, pub display_messages: bool,
} }
#[test] #[cfg(test)]
fn parsing_keymaps_config_file() { mod tests {
use super::*;
#[test]
fn parsing_keymaps_config_file() {
use crate::keymap; use crate::keymap;
use crate::keymap::Keymap; use crate::keymap::Keymap;
use helix_core::hashmap; use helix_core::hashmap;
@ -51,4 +55,5 @@ fn parsing_keymaps_config_file() {
..Default::default() ..Default::default()
} }
); );
}
} }

@ -296,8 +296,12 @@ impl TryFrom<Value> for ThemePalette {
} }
} }
#[test] #[cfg(test)]
fn test_parse_style_string() { mod tests {
use super::*;
#[test]
fn test_parse_style_string() {
let fg = Value::String("#ffffff".to_string()); let fg = Value::String("#ffffff".to_string());
let mut style = Style::default(); let mut style = Style::default();
@ -305,10 +309,10 @@ fn test_parse_style_string() {
palette.parse_style(&mut style, fg).unwrap(); palette.parse_style(&mut style, fg).unwrap();
assert_eq!(style, Style::default().fg(Color::Rgb(255, 255, 255))); assert_eq!(style, Style::default().fg(Color::Rgb(255, 255, 255)));
} }
#[test] #[test]
fn test_palette() { fn test_palette() {
use helix_core::hashmap; use helix_core::hashmap;
let fg = Value::String("my_color".to_string()); let fg = Value::String("my_color".to_string());
@ -318,10 +322,10 @@ fn test_palette() {
palette.parse_style(&mut style, fg).unwrap(); palette.parse_style(&mut style, fg).unwrap();
assert_eq!(style, Style::default().fg(Color::Rgb(255, 255, 255))); assert_eq!(style, Style::default().fg(Color::Rgb(255, 255, 255)));
} }
#[test] #[test]
fn test_parse_style_table() { fn test_parse_style_table() {
let table = toml::toml! { let table = toml::toml! {
"keyword" = { "keyword" = {
fg = "#ffffff", fg = "#ffffff",
@ -345,4 +349,5 @@ fn test_parse_style_table() {
.bg(Color::Rgb(0, 0, 0)) .bg(Color::Rgb(0, 0, 0))
.add_modifier(Modifier::BOLD) .add_modifier(Modifier::BOLD)
); );
}
} }

Loading…
Cancel
Save