diff options
author | Dan Davison <dandavison7@gmail.com> | 2020-12-05 01:06:31 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-05 06:06:31 +0000 |
commit | 73571485466055335401990d8c47b8621f3f4f7e (patch) | |
tree | 788302cd3477653554110bd03aa15c24c1b53f20 /src/tests/test_example_diffs.rs | |
parent | beb700f88974420d36cad494b1fac80de3e01093 (diff) |
Fix whitespace errors under keep-plus-minus-markers (#425)
* Add failing test of added empty line with keep-plus-minus-markers
* Fix whitespace error flagging with keep-plus-minus-markers
Fixes #388
* Possibly more efficient implementation
* Fix clippy
* Fix clippy II
* Increase tarpaulin timeout
* Increase tarpaulin timeout
* Add failing test of line with one non-whitespace character
* Fix test of line with one non-whitespace character
* Revert tarpaulin changes
Diffstat (limited to 'src/tests/test_example_diffs.rs')
-rw-r--r-- | src/tests/test_example_diffs.rs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/tests/test_example_diffs.rs b/src/tests/test_example_diffs.rs index 4fd2184f..6668acce 100644 --- a/src/tests/test_example_diffs.rs +++ b/src/tests/test_example_diffs.rs @@ -1303,6 +1303,32 @@ impl<'a> Alignment<'a> { │ } #[test] + fn test_added_empty_line_is_not_whitespace_error() { + let plus_style = "bold yellow red ul"; + let config = integration_test_utils::make_config_from_args(&[ + "--light", + "--keep-plus-minus-markers", + "--plus-style", + plus_style, + ]); + let output = integration_test_utils::run_delta(DIFF_WITH_ADDED_EMPTY_LINE, &config); + ansi_test_utils::assert_line_has_style(&output, 6, "", plus_style, &config) + } + + #[test] + fn test_single_character_line_is_not_whitespace_error() { + let plus_style = "bold yellow red ul"; + let config = integration_test_utils::make_config_from_args(&[ + "--light", + "--keep-plus-minus-markers", + "--plus-style", + plus_style, + ]); + let output = integration_test_utils::run_delta(DIFF_WITH_SINGLE_CHARACTER_LINE, &config); + ansi_test_utils::assert_line_has_style(&output, 12, "+}", plus_style, &config) + } + + #[test] fn test_color_only() { let config = integration_test_utils::make_config_from_args(&["--color-only"]); let output = integration_test_utils::run_delta(GIT_DIFF_SINGLE_HUNK, &config); @@ -1850,6 +1876,22 @@ index e69de29..8b13789 100644 + "; + const DIFF_WITH_SINGLE_CHARACTER_LINE: &str = r" +diff --git a/Person.java b/Person.java +new file mode 100644 +index 0000000..c6c830c +--- /dev/null ++++ b/Person.java +@@ -0,0 +1,7 @@ ++import lombok.Data; ++ ++@Data ++public class Person { ++ private Long id; ++ private String name; ++} +"; + const DIFF_WITH_WHITESPACE_ERROR: &str = r" diff --git c/a i/a new file mode 100644 |