From 9b13f7bd77f74cbe5c54378eac065659b39849da Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Sat, 24 Apr 2021 07:55:02 -0400 Subject: Test HTTPS and SSH Github URLs --- src/git_config/git_config_entry.rs | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/git_config/git_config_entry.rs b/src/git_config/git_config_entry.rs index bf324ef6..f8c63c69 100644 --- a/src/git_config/git_config_entry.rs +++ b/src/git_config/git_config_entry.rs @@ -44,22 +44,20 @@ mod tests { use super::*; #[test] - fn test_parse_github_url_with_dot_git_suffix() { - let parsed = GitRemoteRepo::from_str("git@github.com:dandavison/delta.git"); - assert!(parsed.is_ok()); - assert_eq!( - parsed.unwrap(), - GitRemoteRepo::GitHubRepo("dandavison/delta".to_string()) - ); - } - - #[test] - fn test_parse_github_url_without_dot_git_suffix() { - let parsed = GitRemoteRepo::from_str("git@github.com:dandavison/delta"); - assert!(parsed.is_ok()); - assert_eq!( - parsed.unwrap(), - GitRemoteRepo::GitHubRepo("dandavison/delta".to_string()) - ); + fn test_parse_github_urls() { + let urls = &[ + "https://github.com/dandavison/delta.git", + "https://github.com/dandavison/delta", + "git@github.com:dandavison/delta.git", + "git@github.com:dandavison/delta", + ]; + for url in urls { + let parsed = GitRemoteRepo::from_str(url); + assert!(parsed.is_ok()); + assert_eq!( + parsed.unwrap(), + GitRemoteRepo::GitHubRepo("dandavison/delta".to_string()) + ); + } } } -- cgit v1.2.3