diff options
author | Dan Davison <dandavison7@gmail.com> | 2020-05-17 18:19:57 -0400 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2020-05-22 13:57:52 -0400 |
commit | f08effc46de52655c8431498c6bc214c0eda30e5 (patch) | |
tree | 4fd806d5199b42f3ce77c87050795f59408b1a24 /src/tests | |
parent | 54da480bd0465daf698f2566c454e0921110d69c (diff) |
Introduce style strings to replace color options
https://git-scm.com/docs/git-config#Documentation/git-config.txt-color
- Support "syntax" pseudo foreground color
- Delete the --syntax-highlight CLI option
This was never released.
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/integration_test_utils.rs | 17 | ||||
-rw-r--r-- | src/tests/test_hunk_highlighting.rs | 60 |
2 files changed, 30 insertions, 47 deletions
diff --git a/src/tests/integration_test_utils.rs b/src/tests/integration_test_utils.rs index 6836d85d..cc4dc22b 100644 --- a/src/tests/integration_test_utils.rs +++ b/src/tests/integration_test_utils.rs @@ -12,18 +12,17 @@ pub mod integration_test_utils { cli::Opt { light: false, dark: false, - minus_color: None, - minus_emph_color: None, - minus_foreground_color: None, - minus_emph_foreground_color: None, - plus_color: None, - plus_emph_color: None, - plus_foreground_color: None, - plus_emph_foreground_color: None, + minus_style: None, + minus_emph_style: None, + plus_style: None, + plus_emph_style: None, + _deprecated_minus_color: None, + _deprecated_minus_emph_color: None, + _deprecated_plus_color: None, + _deprecated_plus_emph_color: None, color_only: false, keep_plus_minus_markers: false, theme: None, - lines_to_be_syntax_highlighted: "0+".to_string(), highlight_minus_lines: false, commit_style: cli::SectionStyle::Plain, commit_color: "Yellow".to_string(), diff --git a/src/tests/test_hunk_highlighting.rs b/src/tests/test_hunk_highlighting.rs index 730218c0..8c2bbe35 100644 --- a/src/tests/test_hunk_highlighting.rs +++ b/src/tests/test_hunk_highlighting.rs @@ -16,45 +16,29 @@ mod tests { let mut options = integration_test_utils::get_command_line_options(); options.theme = Some("GitHub".to_string()); options.max_line_distance = 1.0; - options.minus_emph_color = Some("#ffa0a0".to_string()); - options.plus_emph_color = Some("#80ef80".to_string()); - for minus_foreground_color in vec![None, Some("green".to_string())] { - options.minus_foreground_color = minus_foreground_color; - for minus_emph_foreground_color in vec![None, Some("#80ef80".to_string())] { - options.minus_emph_foreground_color = minus_emph_foreground_color; - for plus_foreground_color in vec![None, Some("red".to_string())] { - options.plus_foreground_color = plus_foreground_color; - for plus_emph_foreground_color in vec![None, Some("#ffa0a0".to_string())] { - options.plus_emph_foreground_color = plus_emph_foreground_color; - for lines_to_be_syntax_highlighted in vec!["none", "all"] { - options.lines_to_be_syntax_highlighted = - lines_to_be_syntax_highlighted.to_string(); - if VERBOSE { - println!(); - print!( - " --syntax-highlight {:?}", - options.lines_to_be_syntax_highlighted - ); - print!( - " --minus-foreground-color {:?}", - options.minus_foreground_color - ); - print!( - " --minus-emph-foreground-color {:?}", - options.minus_emph_foreground_color - ); - print!( - " --plus-foreground-color {:?}", - options.plus_foreground_color - ); - print!( - " --plus-emph-foreground-color {:?}", - options.plus_emph_foreground_color - ); - println!(); - } - _do_hunk_color_test(options.clone()); + let minus_emph_background = "#ffa0a0"; + let plus_emph_background = "#80ef80"; + for minus_foreground in vec!["none", "green"] { + for minus_emph_foreground in vec!["none", "#80ef80"] { + for plus_foreground in vec!["none", "red"] { + for plus_emph_foreground in vec!["none", "#ffa0a0"] { + options.minus_style = Some(minus_foreground.to_string()); + options.minus_emph_style = Some(format!( + "{} {}", + minus_emph_foreground, minus_emph_background + )); + options.plus_style = Some(plus_foreground.to_string()); + options.plus_emph_style = + Some(format!("{} {}", plus_emph_foreground, plus_emph_background)); + if VERBOSE { + println!(); + print!(" --minus-style {:?}", options.minus_style); + print!(" --minus-emph-style {:?}", options.minus_emph_style); + print!(" --plus-style {:?}", options.plus_style); + print!(" --plus-emph-style {:?}", options.plus_emph_style); + println!(); } + _do_hunk_color_test(options.clone()); } } } |