diff options
author | Dan Davison <dandavison7@gmail.com> | 2020-06-11 15:21:03 -0400 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2020-06-11 18:01:50 -0400 |
commit | 307e2f8e483e139769f75b1b1b60372a31e5ec3c (patch) | |
tree | 4d77da34e4f07a5149117a32505cbbdbd780d0bf /src/tests | |
parent | a3bc374a9757abd894b7defd770f76ddd45111b3 (diff) |
Add test of truncation bug
Bug appeared after changing tokenization regex
a3bc374a9757abd894b7defd770f76ddd45111b3
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/test_example_diffs.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/tests/test_example_diffs.rs b/src/tests/test_example_diffs.rs index 3cfb1435..e427d96b 100644 --- a/src/tests/test_example_diffs.rs +++ b/src/tests/test_example_diffs.rs @@ -136,6 +136,18 @@ mod tests { } #[test] + // A bug appeared with the change to the tokenization regex in + // b5d87819a1f76de9ef8f16f1bfb413468af50b62. This test asserts that the bug is not present. + fn test_no_post_tokenization_regex_change_truncation_bug() { + for input in vec![DIFF_EXHIBITING_TRUNCATION_BUG] { + let config = integration_test_utils::make_config(&["--color-only"]); + let output = integration_test_utils::run_delta(input, &config); + assert_eq!(strip_ansi_codes(&output), input); + assert_ne!(output, input); + } + } + + #[test] fn test_delta_paints_diff_when_there_is_unrecognized_initial_content() { for input in vec![ DIFF_WITH_UNRECOGNIZED_PRECEDING_MATERIAL_1, @@ -1422,4 +1434,14 @@ index 759070d,3daf9eb..0000000 release: @make -f release.Makefile release "#; + + const DIFF_EXHIBITING_TRUNCATION_BUG: &str = r#" +diff --git a/a.rs b/b.rs +index cba6064..ba1a4de 100644 +--- a/a.rs ++++ b/b.rs +@@ -1,1 +1,1 @@ +- Co ++ let col = Co +"#; } |