summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2021-06-03 13:59:24 -0400
committerDan Davison <dandavison7@gmail.com>2021-06-03 13:59:24 -0400
commit8f792ee3d3b32ee45ed90fe8354b31fcadcc5983 (patch)
tree46b032003e7d0c430376f33487726a3edfe38b0e
parentfb1d16ef44600c3cef496cb9e9c6ad61381f6192 (diff)
Add test case reproducing #625625-get_file_paths_from_diff_line-crash
-rw-r--r--src/parse.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/parse.rs b/src/parse.rs
index 8e93dd6a..eb82a2e2 100644
--- a/src/parse.rs
+++ b/src/parse.rs
@@ -258,6 +258,28 @@ mod tests {
use super::*;
#[test]
+ fn test_get_file_paths_from_diff_line() {
+ assert_eq!(
+ get_file_paths_from_diff_line("diff --git a/src/main.rs b/src/main.rs"),
+ (
+ Some("src/main.rs".to_string()),
+ Some("src/main.rs".to_string())
+ )
+ )
+ }
+
+ #[test]
+ fn test_get_file_paths_from_diff_line_with_spaces_in_file_paths() {
+ assert_eq!(
+ get_file_paths_from_diff_line("diff --git a/.config/Code - Insiders/User/settings.json b/.config/Code - Insiders/User/settings.json"),
+ (
+ Some(".config/Code - Insiders/User/settings.json".to_string()),
+ Some(".config/Code - Insiders/User/settings.json".to_string())
+ )
+ )
+ }
+
+ #[test]
fn test_get_file_extension_from_marker_line() {
assert_eq!(
get_file_extension_from_marker_line(