aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src
diff options
context:
space:
mode:
authorGokul Soumya2022-01-09 05:08:58 +0000
committerGokul Soumya2022-01-09 05:08:58 +0000
commitb3b4e78585d6a458954b8cb5b2c2a271a78b730b (patch)
tree4253fadc0dd035ac82c139adfc07927925f622fe /helix-view/src
parent449624965b05fd2abc9e3ba2f791f8de8b1eeb3e (diff)
parent97e12f5c5a26cbbc2eddffd91a2e506403d4d453 (diff)
Merge branch 'master' into cursor-shape-new
Diffstat (limited to 'helix-view/src')
-rw-r--r--helix-view/src/theme.rs85
1 files changed, 45 insertions, 40 deletions
diff --git a/helix-view/src/theme.rs b/helix-view/src/theme.rs
index 4a2ecbba..00c1bbbd 100644
--- a/helix-view/src/theme.rs
+++ b/helix-view/src/theme.rs
@@ -296,53 +296,58 @@ impl TryFrom<Value> for ThemePalette {
}
}
-#[test]
-fn test_parse_style_string() {
- let fg = Value::String("#ffffff".to_string());
+#[cfg(test)]
+mod tests {
+ use super::*;
- let mut style = Style::default();
- let palette = ThemePalette::default();
- palette.parse_style(&mut style, fg).unwrap();
+ #[test]
+ fn test_parse_style_string() {
+ let fg = Value::String("#ffffff".to_string());
- assert_eq!(style, Style::default().fg(Color::Rgb(255, 255, 255)));
-}
+ let mut style = Style::default();
+ let palette = ThemePalette::default();
+ palette.parse_style(&mut style, fg).unwrap();
-#[test]
-fn test_palette() {
- use helix_core::hashmap;
- let fg = Value::String("my_color".to_string());
+ assert_eq!(style, Style::default().fg(Color::Rgb(255, 255, 255)));
+ }
- let mut style = Style::default();
- let palette =
- ThemePalette::new(hashmap! { "my_color".to_string() => Color::Rgb(255, 255, 255) });
- palette.parse_style(&mut style, fg).unwrap();
+ #[test]
+ fn test_palette() {
+ use helix_core::hashmap;
+ let fg = Value::String("my_color".to_string());
- assert_eq!(style, Style::default().fg(Color::Rgb(255, 255, 255)));
-}
+ let mut style = Style::default();
+ let palette =
+ ThemePalette::new(hashmap! { "my_color".to_string() => Color::Rgb(255, 255, 255) });
+ palette.parse_style(&mut style, fg).unwrap();
-#[test]
-fn test_parse_style_table() {
- let table = toml::toml! {
- "keyword" = {
- fg = "#ffffff",
- bg = "#000000",
- modifiers = ["bold"],
- }
- };
+ assert_eq!(style, Style::default().fg(Color::Rgb(255, 255, 255)));
+ }
- let mut style = Style::default();
- let palette = ThemePalette::default();
- if let Value::Table(entries) = table {
- for (_name, value) in entries {
- palette.parse_style(&mut style, value).unwrap();
+ #[test]
+ fn test_parse_style_table() {
+ let table = toml::toml! {
+ "keyword" = {
+ fg = "#ffffff",
+ bg = "#000000",
+ modifiers = ["bold"],
+ }
+ };
+
+ let mut style = Style::default();
+ let palette = ThemePalette::default();
+ if let Value::Table(entries) = table {
+ for (_name, value) in entries {
+ palette.parse_style(&mut style, value).unwrap();
+ }
}
- }
- assert_eq!(
- style,
- Style::default()
- .fg(Color::Rgb(255, 255, 255))
- .bg(Color::Rgb(0, 0, 0))
- .add_modifier(Modifier::BOLD)
- );
+ assert_eq!(
+ style,
+ Style::default()
+ .fg(Color::Rgb(255, 255, 255))
+ .bg(Color::Rgb(0, 0, 0))
+ .add_modifier(Modifier::BOLD)
+ );
+ }
}