diff options
author | Dan Davison <dandavison7@gmail.com> | 2020-05-23 11:16:07 -0400 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2020-05-23 12:13:56 -0400 |
commit | e421d044b73f7b746eb77102693985caadbfeb2a (patch) | |
tree | bee1da8b96c00d5148bf185ae7ed8721f04a3a5e /src/tests | |
parent | 0be7aa9d3976bc2f6c72455d0c1e4f7d5fcaca95 (diff) |
Use CLI defaults when constructing command line options for tests
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/integration_test_utils.rs | 45 |
1 files changed, 8 insertions, 37 deletions
diff --git a/src/tests/integration_test_utils.rs b/src/tests/integration_test_utils.rs index a780faf8..1395d97b 100644 --- a/src/tests/integration_test_utils.rs +++ b/src/tests/integration_test_utils.rs @@ -1,50 +1,21 @@ #[cfg(test)] pub mod integration_test_utils { + use std::ffi::OsString; + use std::io::BufReader; + use bytelines::ByteLines; use console::strip_ansi_codes; - use std::io::BufReader; + use structopt::StructOpt; use crate::cli; use crate::config; use crate::delta::delta; - // TODO: These should be set in a more principled way, based on the default - // argument values. pub fn get_command_line_options() -> cli::Opt { - cli::Opt { - light: false, - dark: false, - minus_style: "normal auto".to_string(), - minus_emph_style: "normal auto".to_string(), - minus_non_emph_style: None, - zero_style: "syntax normal".to_string(), - plus_style: "syntax auto".to_string(), - plus_emph_style: "syntax auto".to_string(), - plus_non_emph_style: None, - deprecated_minus_background_color: None, - deprecated_minus_emph_background_color: None, - deprecated_plus_background_color: None, - deprecated_plus_emph_background_color: None, - color_only: false, - keep_plus_minus_markers: false, - theme: None, - deprecated_highlight_minus_lines: false, - commit_style: cli::SectionStyle::Plain, - commit_color: "Yellow".to_string(), - file_style: cli::SectionStyle::Underline, - file_color: "Blue".to_string(), - hunk_style: cli::SectionStyle::Box, - hunk_color: "blue".to_string(), - true_color: "always".to_string(), - width: Some("variable".to_string()), - paging_mode: "auto".to_string(), - tab_width: 4, - show_background_colors: false, - list_languages: false, - list_theme_names: false, - list_themes: false, - max_line_distance: 0.3, - } + let mut opt = cli::Opt::from_iter(Vec::<OsString>::new()); + opt.theme = None; // TODO: Why does opt.theme have the value Some("")? + opt.width = Some("variable".to_string()); + opt } pub fn get_line_of_code_from_delta<'a>( |