diff options
author | ryuta69 <eyma22s.yu@gmail.com> | 2020-09-20 05:23:27 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-19 16:23:27 -0400 |
commit | b9e083cc7360b172998c4656c5f9b35c5161398e (patch) | |
tree | b80e66462b18918d5f85a76ff8faee5596c3231e /src | |
parent | b401ffb687c9c65ce3c374cfd449f7a031867076 (diff) |
Add test for line numbers with hunk header style is omit (#327)
Diffstat (limited to 'src')
-rw-r--r-- | src/features/line_numbers.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/features/line_numbers.rs b/src/features/line_numbers.rs index 0ad5057d..e03da5f9 100644 --- a/src/features/line_numbers.rs +++ b/src/features/line_numbers.rs @@ -559,6 +559,21 @@ pub mod tests { assert_eq!(strip_ansi_codes(line_2), " 2 ⋮ │-b = 2"); } + #[test] + fn test_hunk_header_style_is_omit() { + let config = make_config_from_args(&["--line-numbers", "--hunk-header-style", "omit"]); + let output = run_delta(TWO_LINE_DIFFS, &config); + let output = strip_ansi_codes(&output); + let mut lines = output.lines().skip(4); + assert_eq!(lines.next().unwrap(), " 1 ⋮ 1 │a = 1"); + assert_eq!(lines.next().unwrap(), " 2 ⋮ │b = 2"); + assert_eq!(lines.next().unwrap(), " ⋮ 2 │bb = 2"); + assert_eq!(lines.next().unwrap(), ""); + assert_eq!(lines.next().unwrap(), "499 ⋮499 │a = 3"); + assert_eq!(lines.next().unwrap(), "500 ⋮ │b = 4"); + assert_eq!(lines.next().unwrap(), " ⋮500 │bb = 4"); + } + pub const TWO_MINUS_LINES_DIFF: &str = "\ diff --git i/a.py w/a.py index 223ca50..e69de29 100644 @@ -591,6 +606,21 @@ index 223ca50..367a6f6 100644 +bb = 2 "; + const TWO_LINE_DIFFS: &str = "\ +diff --git i/a.py w/a.py +index 223ca50..367a6f6 100644 +--- i/a.py ++++ w/a.py +@@ -1,2 +1,2 @@ + a = 1 +-b = 2 ++bb = 2 +@@ -499,2 +499,2 @@ + a = 3 +-b = 4 ++bb = 4 +"; + const FIVE_DIGIT_LINE_NUMBER_DIFF: &str = "\ diff --git i/a.py w/a.py index 223ca50..367a6f6 100644 |