summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/features/diff_highlight.rs10
-rw-r--r--src/features/diff_so_fancy.rs14
-rw-r--r--src/features/line_numbers.rs16
-rw-r--r--src/features/mod.rs120
-rw-r--r--src/features/navigate.rs57
-rw-r--r--src/features/side_by_side.rs10
-rw-r--r--src/options/theme.rs2
-rw-r--r--src/tests/integration_test_utils.rs58
-rw-r--r--src/tests/test_example_diffs.rs109
9 files changed, 238 insertions, 158 deletions
diff --git a/src/features/diff_highlight.rs b/src/features/diff_highlight.rs
index 03e9792f..ea7ac7c9 100644
--- a/src/features/diff_highlight.rs
+++ b/src/features/diff_highlight.rs
@@ -58,11 +58,15 @@ pub fn _make_feature(bold: bool) -> Vec<(String, OptionValueFunction)> {
mod test_utils {
use std::fs::remove_file;
- use crate::features;
+ use crate::tests::integration_test_utils::integration_test_utils;
#[test]
fn test_diff_highlight_defaults() {
- let opt = features::tests::make_options(&["--features", "diff-highlight"], None, None);
+ let opt = integration_test_utils::make_options_from_args_and_git_config(
+ &["--features", "diff-highlight"],
+ None,
+ None,
+ );
assert_eq!(opt.minus_style, "red");
assert_eq!(opt.minus_non_emph_style, "red");
assert_eq!(opt.minus_emph_style, "red reverse");
@@ -87,7 +91,7 @@ mod test_utils {
";
let git_config_path = "delta__test_diff_highlight.gitconfig";
- let opt = features::tests::make_options(
+ let opt = integration_test_utils::make_options_from_args_and_git_config(
&["--features", "diff-highlight"],
Some(git_config_contents),
Some(git_config_path),
diff --git a/src/features/diff_so_fancy.rs b/src/features/diff_so_fancy.rs
index d05d2e68..cdc0c359 100644
--- a/src/features/diff_so_fancy.rs
+++ b/src/features/diff_so_fancy.rs
@@ -54,11 +54,15 @@ pub fn make_feature() -> Vec<(String, OptionValueFunction)> {
pub mod tests {
use std::fs::remove_file;
- use crate::features;
+ use crate::tests::integration_test_utils::integration_test_utils;
#[test]
fn test_diff_so_fancy_defaults() {
- let opt = features::tests::make_options(&["--features", "diff-so-fancy"], None, None);
+ let opt = integration_test_utils::make_options_from_args_and_git_config(
+ &["--features", "diff-so-fancy"],
+ None,
+ None,
+ );
assert_eq!(opt.commit_style, "bold yellow");
assert_eq!(opt.commit_decoration_style, "none");
@@ -83,7 +87,7 @@ pub mod tests {
";
let git_config_path = "delta__test_diff_so_fancy.gitconfig";
- let opt = features::tests::make_options(
+ let opt = integration_test_utils::make_options_from_args_and_git_config(
&["--features", "diff-so-fancy some-other-feature"],
Some(git_config_contents),
Some(git_config_path),
@@ -117,7 +121,7 @@ pub mod tests {
";
let git_config_path = "delta__test_diff_so_fancy_obeys_feature_precedence_rules.gitconfig";
- let opt = features::tests::make_options(
+ let opt = integration_test_utils::make_options_from_args_and_git_config(
&["--features", "decorations diff-so-fancy"],
Some(git_config_contents),
Some(git_config_path),
@@ -127,7 +131,7 @@ pub mod tests {
assert_eq!(opt.file_decoration_style, "bold yellow ul ol");
- let opt = features::tests::make_options(
+ let opt = integration_test_utils::make_options_from_args_and_git_config(
&["--features", "diff-so-fancy decorations"],
Some(git_config_contents),
Some(git_config_path),
diff --git a/src/features/line_numbers.rs b/src/features/line_numbers.rs
index 8426d529..b1d9b5b0 100644
--- a/src/features/line_numbers.rs
+++ b/src/features/line_numbers.rs
@@ -284,7 +284,9 @@ pub mod tests {
use console::strip_ansi_codes;
use regex::Captures;
- use crate::tests::integration_test_utils::integration_test_utils::{make_config, run_delta};
+ use crate::tests::integration_test_utils::integration_test_utils::{
+ make_config_from_args, run_delta,
+ };
use super::*;
@@ -401,7 +403,7 @@ pub mod tests {
#[test]
fn test_two_minus_lines() {
- let config = make_config(&[
+ let config = make_config_from_args(&[
"--line-numbers",
"--line-numbers-left-format",
"{nm:^4}⋮",
@@ -425,7 +427,7 @@ pub mod tests {
#[test]
fn test_two_plus_lines() {
- let config = make_config(&[
+ let config = make_config_from_args(&[
"--line-numbers",
"--line-numbers-left-format",
"{nm:^4}⋮",
@@ -449,7 +451,7 @@ pub mod tests {
#[test]
fn test_one_minus_one_plus_line() {
- let config = make_config(&[
+ let config = make_config_from_args(&[
"--line-numbers",
"--line-numbers-left-format",
"{nm:^4}⋮",
@@ -474,7 +476,7 @@ pub mod tests {
#[test]
fn test_repeated_placeholder() {
- let config = make_config(&[
+ let config = make_config_from_args(&[
"--line-numbers",
"--line-numbers-left-format",
"{nm:^4} {nm:^4}⋮",
@@ -499,7 +501,7 @@ pub mod tests {
#[test]
fn test_five_digit_line_number() {
- let config = make_config(&["--line-numbers"]);
+ let config = make_config_from_args(&["--line-numbers"]);
let output = run_delta(FIVE_DIGIT_LINE_NUMBER_DIFF, &config);
let output = strip_ansi_codes(&output);
let mut lines = output.lines().skip(4);
@@ -510,7 +512,7 @@ pub mod tests {
#[test]
fn test_unequal_digit_line_number() {
- let config = make_config(&["--line-numbers"]);
+ let config = make_config_from_args(&["--line-numbers"]);
let output = run_delta(UNEQUAL_DIGIT_DIFF, &config);
let output = strip_ansi_codes(&output);
let mut lines = output.lines().skip(4);
diff --git a/src/features/mod.rs b/src/features/mod.rs
index 30b3a7a5..58599ea6 100644
--- a/src/features/mod.rs
+++ b/src/features/mod.rs
@@ -89,15 +89,11 @@ pub mod side_by_side;
#[cfg(test)]
pub mod tests {
use std::collections::HashSet;
- use std::fs::{remove_file, File};
- use std::io::Write;
- use std::path::Path;
-
- use itertools;
+ use std::fs::remove_file;
use crate::cli;
use crate::features::make_builtin_features;
- use crate::git_config::GitConfig;
+ use crate::tests::integration_test_utils::integration_test_utils::make_options_from_args_and_git_config;
#[test]
fn test_builtin_features_have_flags_and_these_set_features() {
@@ -120,7 +116,12 @@ pub mod tests {
let git_config_path = "delta__test_builtin_feature_from_gitconfig.gitconfig";
assert_eq!(
- make_options(&[], Some(git_config_contents), Some(git_config_path)).features,
+ make_options_from_args_and_git_config(
+ &[],
+ Some(git_config_contents),
+ Some(git_config_path)
+ )
+ .features,
"navigate"
);
@@ -137,7 +138,7 @@ pub mod tests {
"delta__test_features_on_command_line_replace_features_in_gitconfig.gitconfig";
assert_eq!(
- make_options(
+ make_options_from_args_and_git_config(
&["--features", "navigate raw"],
Some(git_config_contents),
Some(git_config_path),
@@ -146,7 +147,7 @@ pub mod tests {
"navigate raw"
);
assert_eq!(
- make_options(
+ make_options_from_args_and_git_config(
&["--navigate", "--features", "raw"],
Some(git_config_contents),
Some(git_config_path),
@@ -167,7 +168,7 @@ pub mod tests {
let git_config_path =
"delta__test_feature_flag_on_command_line_does_not_replace_features_in_gitconfig.gitconfig";
assert_eq!(
- make_options(
+ make_options_from_args_and_git_config(
&["--navigate", "--raw"],
Some(git_config_contents),
Some(git_config_path),
@@ -196,7 +197,7 @@ pub mod tests {
let git_config_path = "delta__test_feature_collection.gitconfig";
assert_eq!(
- make_options(
+ make_options_from_args_and_git_config(
&["--raw", "--features", "d a"],
Some(git_config_contents),
Some(git_config_path),
@@ -224,7 +225,11 @@ pub mod tests {
minus-style = blue
";
let git_config_path = "delta__test_recursive_features.gitconfig";
- let opt = make_options(&["delta"], Some(git_config_contents), Some(git_config_path));
+ let opt = make_options_from_args_and_git_config(
+ &["delta"],
+ Some(git_config_contents),
+ Some(git_config_path),
+ );
assert_eq!(opt.features, "feature-4 feature-2 feature-3 feature-1");
remove_file(git_config_path).unwrap();
@@ -240,17 +245,21 @@ pub mod tests {
// First check that it doesn't default to blue, because that's going to be used to signal
// that gitconfig has set the style.
- assert_ne!(make_options(&[], None, None).minus_style, "blue");
+ assert_ne!(
+ make_options_from_args_and_git_config(&[], None, None).minus_style,
+ "blue"
+ );
// Check that --minus-style is honored as we expect.
assert_eq!(
- make_options(&["--minus-style", "red"], None, None).minus_style,
+ make_options_from_args_and_git_config(&["--minus-style", "red"], None, None)
+ .minus_style,
"red"
);
// Check that gitconfig does not override a command line argument
assert_eq!(
- make_options(
+ make_options_from_args_and_git_config(
&["--minus-style", "red"],
Some(git_config_contents),
Some(git_config_path),
@@ -261,7 +270,12 @@ pub mod tests {
// Finally, check that gitconfig is honored when not overridden by a command line argument.
assert_eq!(
- make_options(&[], Some(git_config_contents), Some(git_config_path)).minus_style,
+ make_options_from_args_and_git_config(
+ &[],
+ Some(git_config_contents),
+ Some(git_config_path)
+ )
+ .minus_style,
"blue"
);
@@ -280,7 +294,7 @@ pub mod tests {
let git_config_path = "delta__test_feature.gitconfig";
assert_eq!(
- make_options(
+ make_options_from_args_and_git_config(
&["--features", "my-feature"],
Some(git_config_contents),
Some(git_config_path),
@@ -304,13 +318,18 @@ pub mod tests {
// Without --features the main section takes effect
assert_eq!(
- make_options(&[], Some(git_config_contents), Some(git_config_path)).minus_style,
+ make_options_from_args_and_git_config(
+ &[],
+ Some(git_config_contents),
+ Some(git_config_path)
+ )
+ .minus_style,
"blue"
);
// Event with --features the main section overrides the feature.
assert_eq!(
- make_options(
+ make_options_from_args_and_git_config(
&["--features", "my-feature-1"],
Some(git_config_contents),
Some(git_config_path),
@@ -336,7 +355,7 @@ pub mod tests {
let git_config_path = "delta__test_multiple_features.gitconfig";
assert_eq!(
- make_options(
+ make_options_from_args_and_git_config(
&["--features", "my-feature-1 my-feature-2"],
Some(git_config_contents),
Some(git_config_path),
@@ -346,7 +365,7 @@ pub mod tests {
);
assert_eq!(
- make_options(
+ make_options_from_args_and_git_config(
&["--features", "my-feature-2 my-feature-1"],
Some(git_config_contents),
Some(git_config_path),
@@ -369,12 +388,12 @@ pub mod tests {
";
let git_config_path = "delta__test_invalid_features.gitconfig";
- let default = make_options(&[], None, None).minus_style;
+ let default = make_options_from_args_and_git_config(&[], None, None).minus_style;
assert_ne!(default, "green");
assert_ne!(default, "yellow");
assert_eq!(
- make_options(
+ make_options_from_args_and_git_config(
&["--features", "my-feature-1"],
Some(git_config_contents),
Some(git_config_path),
@@ -384,7 +403,7 @@ pub mod tests {
);
assert_eq!(
- make_options(
+ make_options_from_args_and_git_config(
&["--features", "my-feature-x"],
Some(git_config_contents),
Some(git_config_path),
@@ -394,7 +413,7 @@ pub mod tests {
);
assert_eq!(
- make_options(
+ make_options_from_args_and_git_config(
&["--features", "my-feature-1 my-feature-x"],
Some(git_config_contents),
Some(git_config_path),
@@ -404,7 +423,7 @@ pub mod tests {
);
assert_eq!(
- make_options(
+ make_options_from_args_and_git_config(
&["--features", "my-feature-x my-feature-2 my-feature-x"],
Some(git_config_contents),
Some(git_config_path),
@@ -426,20 +445,24 @@ pub mod tests {
// Git config disabled: hard-coded delta default wins
assert_eq!(
- make_options(&[], None, None).whitespace_error_style,
+ make_options_from_args_and_git_config(&[], None, None).whitespace_error_style,
"magenta reverse"
);
// Unspecified by user: color.diff.whitespace wins
assert_eq!(
- make_options(&[], Some(git_config_contents), Some(git_config_path))
- .whitespace_error_style,
+ make_options_from_args_and_git_config(
+ &[],
+ Some(git_config_contents),
+ Some(git_config_path)
+ )
+ .whitespace_error_style,
"yellow dim ul magenta"
);
// Command line argument wins
assert_eq!(
- make_options(
+ make_options_from_args_and_git_config(
&["--whitespace-error-style", "red reverse"],
Some(git_config_contents),
Some(git_config_path)
@@ -461,7 +484,7 @@ pub mod tests {
// Command line argument wins
assert_eq!(
- make_options(
+ make_options_from_args_and_git_config(
&["--whitespace-error-style", "red reverse"],
Some(git_config_contents),
Some(git_config_path)
@@ -472,8 +495,12 @@ pub mod tests {
// No command line argument or features; main [delta] section wins
assert_eq!(
- make_options(&[], Some(git_config_contents), Some(git_config_path))
- .whitespace_error_style,
+ make_options_from_args_and_git_config(
+ &[],
+ Some(git_config_contents),
+ Some(git_config_path)
+ )
+ .whitespace_error_style,
"blue reverse"
);
@@ -486,7 +513,7 @@ pub mod tests {
//
// In this situation, the value from the feature is overridden.
assert_eq!(
- make_options(
+ make_options_from_args_and_git_config(
&["--features", "my-whitespace-error-style-feature"],
Some(git_config_contents),
Some(git_config_path)
@@ -497,29 +524,4 @@ pub mod tests {
remove_file(git_config_path).unwrap();
}
-
- fn make_git_config(contents: &[u8], path: &str) -> GitConfig {
- let path = Path::new(path);
- let mut file = File::create(path).unwrap();
- file.write_all(contents).unwrap();
- GitConfig::from_path(&path)
- }
-
- pub fn make_options(
- args: &[&str],
- git_config_contents: Option<&[u8]>,
- git_config_path: Option<&str>,
- ) -> cli::Opt {
- let args: Vec<&str> = itertools::chain(
- &["/dev/null", "/dev/null", "--24-bit-color", "always"],
- args,
- )
- .map(|s| *s)
- .collect();
- let mut git_config = match (git_config_contents, git_config_path) {
- (Some(contents), Some(path)) => Some(make_git_config(contents, path)),
- _ => None,
- };
- cli::Opt::from_iter_and_git_config(args, &mut git_config)
- }
}
diff --git a/src/features/navigate.rs b/src/features/navigate.rs
index 1175b13b..35549f24 100644
--- a/src/features/navigate.rs
+++ b/src/features/navigate.rs
@@ -32,7 +32,7 @@ pub fn make_navigate_regexp(config: &Config) -> String {
mod tests {
use std::fs::remove_file;
- use crate::features;
+ use crate::tests::integration_test_utils::integration_test_utils;
#[test]
fn test_navigate_with_overriden_key_in_main_section() {
@@ -44,21 +44,35 @@ mod tests {
let git_config_path = "delta__test_navigate_with_overriden_key_in_main_section.gitconfig";
assert_eq!(
- features::tests::make_options(&[], None, None).file_modified_label,
+ integration_test_utils::make_options_from_args_and_git_config(&[], None, None)
+ .file_modified_label,
""
);
assert_eq!(
- features::tests::make_options(&["--features", "navigate"], None, None)
- .file_modified_label,
+ integration_test_utils::make_options_from_args_and_git_config(
+ &["--features", "navigate"],
+ None,
+ None
+ )
+ .file_modified_label,
"Δ"
);
assert_eq!(
- features::tests::make_options(&["--navigate"], None, None).file_modified_label,
+ integration_test_utils::make_options_from_args_and_git_config(
+ &["--navigate"],
+ None,
+ None
+ )
+ .file_modified_label,
"Δ"
);
assert_eq!(
- features::tests::make_options(&[], Some(git_config_contents), Some(git_config_path))
- .file_modified_label,
+ integration_test_utils::make_options_from_args_and_git_config(
+ &[],
+ Some(git_config_contents),
+ Some(git_config_path)
+ )
+ .file_modified_label,
"modified: "
);
@@ -78,17 +92,26 @@ mod tests {
"delta__test_navigate_with_overriden_key_in_custom_navigate_section.gitconfig";
assert_eq!(
- features::tests::make_options(&[], None, None).file_modified_label,
+ integration_test_utils::make_options_from_args_and_git_config(&[], None, None)
+ .file_modified_label,
""
);
assert_eq!(
- features::tests::make_options(&["--features", "navigate"], None, None)
- .file_modified_label,
+ integration_test_utils::make_options_from_args_and_git_config(
+ &["--features", "navigate"],
+ None,
+ None
+ )
+ .file_modified_label,
"Δ"
);
assert_eq!(
- features::tests::make_options(&[], Some(git_config_contents), Some(git_config_path))
- .file_modified_label,
+ integration_test_utils::make_options_from_args_and_git_config(
+ &[],
+ Some(git_config_contents),
+ Some(git_config_path)
+ )
+ .file_modified_label,
"modified: "
);
@@ -105,12 +128,16 @@ mod tests {
let git_config_path = "delta__test_navigate_activated_by_custom_feature.gitconfig";
assert_eq!(
- features::tests::make_options(&[], Some(git_config_contents), Some(git_config_path))
- .file_modified_label,
+ integration_test_utils::make_options_from_args_and_git_config(
+ &[],
+ Some(git_config_contents),
+ Some(git_config_path)
+ )
+ .file_modified_label,
""
);
assert_eq!(
- features::tests::make_options(
+ integration_test_utils::make_options_from_args_and_git_config(
&["--features", "my-navigate-feature"],
Some(git_config_contents),
Some(git_config_path)
diff --git a/src/features/side_by_side.rs b/src/features/side_by_side.rs
index ada02c71..eb224f16 100644
--- a/src/features/side_by_side.rs
+++ b/src/features/side_by_side.rs
@@ -444,11 +444,13 @@ pub mod tests {
use console::strip_ansi_codes;
use crate::features::line_numbers::tests::*;
- use crate::tests::integration_test_utils::integration_test_utils::{make_config, run_delta};
+ use crate::tests::integration_test_utils::integration_test_utils::{
+ make_config_from_args, run_delta,
+ };
#[test]
fn test_two_minus_lines() {
- let config = make_config(&["--side-by-side", "--width", "40"]);
+ let config = make_config_from_args(&["--side-by-side", "--width", "40"]);
let output = run_delta(TWO_MINUS_LINES_DIFF, &config);
let mut lines = output.lines().skip(4);
let (line_1, line_2) = (lines.next().unwrap(), lines.next().unwrap());
@@ -458,7 +460,7 @@ pub mod tests {
#[test]
fn test_two_plus_lines() {
- let config = make_config(&["--side-by-side", "--width", "40"]);
+ let config = make_config_from_args(&["--side-by-side", "--width", "40"]);
let output = run_delta(TWO_PLUS_LINES_DIFF, &config);
let mut lines = output.lines().skip(4);
let (line_1, line_2) = (lines.next().unwrap(), lines.next().unwrap());
@@ -468,7 +470,7 @@ pub mod tests {
#[test]
fn test_one_minus_one_plus_line() {
- let config = make_config(&["--side-by-side", "--width", "40"]);
+ let config = make_config_from_args(&["--side-by-side", "--width", "40"]);
let output = run_delta(ONE_MINUS_ONE_PLUS_LINE_DIFF, &config);
let output = strip_ansi_codes(&output);
let mut lines = output.lines().skip(4);
diff --git a/src/options/theme.rs b/src/options/theme.rs
index fdee8b03..8dc235e0 100644
--- a/src/options/theme.rs
+++ b/src/options/theme.rs
@@ -201,7 +201,7 @@ mod tests {
}
None => {}
}
- let config = integration_test_utils::make_config(&args);
+ let config = integration_test_utils::make_config_from_args(&args);
assert_eq!(
&config
.syntax_theme
diff --git a/src/tests/integration_test_utils.rs b/src/tests/integration_test_utils.rs
index c5e4b5fa..22a28ca8 100644
--- a/src/tests/integration_test_utils.rs
+++ b/src/tests/integration_test_utils.rs
@@ -1,28 +1,62 @@
#[cfg(test)]
pub mod integration_test_utils {
- use std::io::BufReader;
+ use std::fs::File;
+ use std::io::{BufReader, Write};
+ use std::path::Path;
use bytelines::ByteLines;
use console::strip_ansi_codes;
+ use itertools;
use crate::cli;
use crate::config;
use crate::delta::delta;
+ use crate::git_config::GitConfig;
- fn make_options(args: &[&str]) -> cli::Opt {
- // FIXME: should not be necessary
- let (dummy_minus_file, dummy_plus_file) = ("/dev/null", "/dev/null");
- let mut augmented_args = vec![dummy_minus_file, dummy_plus_file];
+ pub fn make_options_from_args_and_git_config(
+ args: &[&str],
+ git_config_contents: Option<&[u8]>,
+ git_config_path: Option<&str>,
+ ) -> cli::Opt {
+ let mut args: Vec<&str> = itertools::chain(&["/dev/null", "/dev/null"], args)
+ .map(|s| *s)
+ .collect();
+ let mut git_config = match (git_config_contents, git_config_path) {
+ (Some(contents), Some(path)) => Some(make_git_config(contents, path)),
+ _ => {
+ args.push("--no-gitconfig");
+ None
+ }
+ };
+ cli::Opt::from_iter_and_git_config(args, &mut git_config)
+ }
+
+ pub fn make_options_from_args(args: &[&str]) -> cli::Opt {
+ make_options_from_args_and_git_config(args, None, None)
+ }
+
+ #[allow(dead_code)]
+ pub fn make_config_from_args_and_git_config(
+ args: &[&str],
+ git_config_contents: Option<&[u8]>,
+ git_config_path: Option<&str>,
+ ) -> config::Config {
+ config::Config::from(make_options_from_args_and_git_config(
+ args,
+ git_config_contents,
+ git_config_path,
+ ))
+ }
- for arg in args {
- augmented_args.push(arg);
- }
- augmented_args.push("--no-gitconfig");
- cli::Opt::from_iter_and_git_config(augmented_args, &mut None)
+ pub fn make_config_from_args(args: &[&str]) -> config::Config {
+ config::Config::from(make_options_from_args(args))
}
- pub fn make_config(args: &[&str]) -> config::Config {
- config::Config::from(make_options(args))
+ fn make_git_config(contents: &[u8], path: &str) -> GitConfig {
+ let path = Path::new(path);
+ let mut file = File::create(path).unwrap();
+ file.write_all(contents).unwrap();
+ GitConfig::from_path(&path)
}
pub fn get_line_of_code_from_delta(
diff --git a/src/tests/test_example_diffs.rs b/src/tests/test_example_diffs.rs
index 6c94ef1d..fd6caf33 100644
--- a/src/tests/test_example_diffs.rs
+++ b/src/tests/test_example_diffs.rs
@@ -9,7 +9,7 @@ mod tests {
#[test]
fn test_added_file() {
- let config = integration_test_utils::make_config(&[]);
+ let config = integration_test_utils::make_config_from_args(&[]);
let output = integration_test_utils::run_delta(ADDED_FILE_INPUT, &config);
let output = strip_ansi_codes(&output);
assert!(output.contains("\nadded: a.py\n"));
@@ -18,7 +18,7 @@ mod tests {
#[test]
#[ignore] // #128
fn test_added_empty_file() {
- let config = integration_test_utils::make_config(&[]);
+ let config = integration_test_utils::make_config_from_args(&[]);
let output = integration_test_utils::run_delta(ADDED_EMPTY_FILE, &config);
let output = strip_ansi_codes(&output);
assert!(output.contains("\nadded: file\n"));
@@ -26,7 +26,7 @@ mod tests {
#[test]
fn test_added_file_directory_path_containing_space() {
- let config = integration_test_utils::make_config(&[]);
+ let config = integration_test_utils::make_config_from_args(&[]);
let output =
integration_test_utils::run_delta(ADDED_FILES_DIRECTORY_PATH_CONTAINING_SPACE, &config);
let output = strip_ansi_codes(&output);
@@ -36,7 +36,7 @@ mod tests {
#[test]
fn test_renamed_file() {
- let config = integration_test_utils::make_config(&[]);
+ let config = integration_test_utils::make_config_from_args(&[]);
let output = integration_test_utils::run_delta(RENAMED_FILE_INPUT, &config);
let output = strip_ansi_codes(&output);
assert!(output.contains("\nrenamed: a.py ⟶ b.py\n"));
@@ -45,7 +45,7 @@ mod tests {
#[test]
fn test_recognized_file_type() {
// In addition to the background color, the code has language syntax highlighting.
- let config = integration_test_utils::make_config(&[]);
+ let config = integration_test_utils::make_config_from_args(&[]);
let output = integration_test_utils::get_line_of_code_from_delta(
&ADDED_FILE_INPUT,
12,
@@ -59,7 +59,7 @@ mod tests {
fn test_unrecognized_file_type_with_syntax_theme() {
// In addition to the background color, the code has the foreground color using the default
// .txt syntax under the theme.
- let config = integration_test_utils::make_config(&[]);
+ let config = integration_test_utils::make_config_from_args(&[]);
let input = ADDED_FILE_INPUT.replace("a.py", "a");
let output =
integration_test_utils::get_line_of_code_from_delta(&input, 12, "class X:", &config);
@@ -70,8 +70,12 @@ mod tests {
fn test_unrecognized_file_type_no_syntax_theme() {
// The code has the background color only. (Since there is no theme, the code has no
// foreground ansi color codes.)
- let config =
- integration_test_utils::make_config(&["--syntax-theme", "none", "--width", "variable"]);
+ let config = integration_test_utils::make_config_from_args(&[
+ "--syntax-theme",
+ "none",
+ "--width",
+ "variable",
+ ]);
let input = ADDED_FILE_INPUT.replace("a.py", "a");
let output =
integration_test_utils::get_line_of_code_from_delta(&input, 12, "class X:", &config);
@@ -80,7 +84,7 @@ mod tests {
#[test]
fn test_diff_unified_two_files() {
- let config = integration_test_utils::make_config(&[]);
+ let config = integration_test_utils::make_config_from_args(&[]);
let output = integration_test_utils::run_delta(DIFF_UNIFIED_TWO_FILES, &config);
let output = strip_ansi_codes(&output);
let mut lines = output.split('\n');
@@ -99,7 +103,7 @@ mod tests {