diff options
| author | Thomas Otto <th1000s@posteo.net> | 2021-11-01 22:31:33 +0100 |
|---|---|---|
| committer | Dan Davison <dandavison7@gmail.com> | 2021-11-10 20:08:28 -0500 |
| commit | 93d37649ae63312548bb319e5d6d7305834e502f (patch) | |
| tree | 22f54397bed36d19f3667d80ffeca0e618901286 /src/tests/test_example_diffs.rs | |
| parent | 54bab7051774c82d5af9d6024f03529008254657 (diff) | |
Remove +/- line prefix instead of substituting a space
Simplifies line handling and printing by removing a "magical"
1-offset previously required in various locations.
Now explicitly prepend "" in `tokenize()`.
Diffstat (limited to 'src/tests/test_example_diffs.rs')
| -rw-r--r-- | src/tests/test_example_diffs.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/tests/test_example_diffs.rs b/src/tests/test_example_diffs.rs index d60067b..dda5bcf 100644 --- a/src/tests/test_example_diffs.rs +++ b/src/tests/test_example_diffs.rs @@ -972,11 +972,10 @@ src/align.rs if args.contains(&"--max-line-length") { return; } - for n in 0..input_lines.len() { - let input_line = input_lines[n]; + for (n, input_line) in input_lines.into_iter().enumerate() { // If config.line_numbers is enabled, // we should remove line_numbers decoration while checking. - let output_line = if config.line_numbers && n > 11 && n < input_lines.len() { + let output_line = if config.line_numbers && n > 11 { &output_lines[n][14..] } else { output_lines[n] @@ -1532,7 +1531,7 @@ src/align.rs:71: impl<'a> Alignment<'a> { │ } #[test] - fn test_color_only() { + fn test_color_only_mode() { let config = integration_test_utils::make_config_from_args(&["--color-only"]); let output = integration_test_utils::run_delta(GIT_DIFF_SINGLE_HUNK, &config); ansi_test_utils::assert_line_has_syntax_highlighted_substring( |
