diff options
author | Dan Davison <dandavison7@gmail.com> | 2021-12-04 16:52:45 -0500 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2021-12-05 11:25:05 -0500 |
commit | 1f41d4f7cdde5480658ac2b1f051e135536922e6 (patch) | |
tree | 861f9152dc77b9e793b9e56c0016152349c520b2 /src | |
parent | 975f4e867f20fe3e0c4b61404c22484125f43411 (diff) |
Add test of parsing cthulhu commit hunk header
Ref #813
Diffstat (limited to 'src')
-rw-r--r-- | src/handlers/hunk_header.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/handlers/hunk_header.rs b/src/handlers/hunk_header.rs index 2aa052ff..cf66e7bb 100644 --- a/src/handlers/hunk_header.rs +++ b/src/handlers/hunk_header.rs @@ -334,6 +334,19 @@ pub mod tests { assert_eq!(line_numbers_and_hunk_lengths[1], (358, 15),); assert_eq!(line_numbers_and_hunk_lengths[2], (358, 16),); } + + #[test] + fn test_parse_hunk_header_cthulhu() { + let parsed = parse_hunk_header("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -444,17 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 -446,6 +444,17 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ int snd_soc_jack_add_gpios(struct snd_s"); + let code_fragment = parsed.0; + let line_numbers_and_hunk_lengths = parsed.1; + assert_eq!(code_fragment, " int snd_soc_jack_add_gpios(struct snd_s"); + assert_eq!(line_numbers_and_hunk_lengths[0], (446, 6),); + assert_eq!(line_numbers_and_hunk_lengths[1], (446, 6),); + assert_eq!(line_numbers_and_hunk_lengths[2], (446, 6),); + assert_eq!(line_numbers_and_hunk_lengths[65], (446, 6),); + } + #[test] fn test_paint_file_path_with_line_number_default() { let cfg = integration_test_utils::make_config_from_args(&[]); |