summaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2020-06-17 16:51:23 -0400
committerDan Davison <dandavison7@gmail.com>2020-06-17 16:51:23 -0400
commitba8cd95f5e0d2beeb4e6b2d040fea897d0e797ac (patch)
treec00a83890de14a7f6dfe8274dc50577ca10fb787 /src/tests
parent71f1330b9496d4c58f3bced1a60dc91d735ec5e8 (diff)
Add failing test: removal of whitespace error is not an error
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/ansi_test_utils.rs17
-rw-r--r--src/tests/test_example_diffs.rs18
2 files changed, 35 insertions, 0 deletions
diff --git a/src/tests/ansi_test_utils.rs b/src/tests/ansi_test_utils.rs
index 7bbf370b..1b4a8c82 100644
--- a/src/tests/ansi_test_utils.rs
+++ b/src/tests/ansi_test_utils.rs
@@ -24,6 +24,23 @@ pub mod ansi_test_utils {
));
}
+ pub fn assert_line_does_not_have_style(
+ output: &str,
+ line_number: usize,
+ expected_prefix: &str,
+ expected_style: &str,
+ config: &Config,
+ ) {
+ assert!(!_line_has_style(
+ output,
+ line_number,
+ expected_prefix,
+ expected_style,
+ config,
+ false,
+ ));
+ }
+
pub fn assert_line_has_4_bit_color_style(
output: &str,
line_number: usize,
diff --git a/src/tests/test_example_diffs.rs b/src/tests/test_example_diffs.rs
index 885ba51c..668645b9 100644
--- a/src/tests/test_example_diffs.rs
+++ b/src/tests/test_example_diffs.rs
@@ -1116,6 +1116,14 @@ impl<'a> Alignment<'a> { │
]);
let output = integration_test_utils::run_delta(DIFF_WITH_WHITESPACE_ERROR, &config);
ansi_test_utils::assert_line_has_style(&output, 6, " ", whitespace_error_style, &config);
+ let output = integration_test_utils::run_delta(DIFF_WITH_REMOVED_WHITESPACE_ERROR, &config);
+ ansi_test_utils::assert_line_does_not_have_style(
+ &output,
+ 6,
+ " ",
+ whitespace_error_style,
+ &config,
+ );
}
const GIT_DIFF_SINGLE_HUNK: &str = "\
@@ -1581,4 +1589,14 @@ index 0000000..8d1c8b6
@@ -0,0 +1 @@
+
";
+
+ const DIFF_WITH_REMOVED_WHITESPACE_ERROR: &str = r"
+diff --git i/a w/a
+index 8d1c8b6..8b13789 100644
+--- i/a
++++ w/a
+@@ -1 +1 @@
+-
++
+";
}