From 1212917fae923bb59801b17a92a0e443e536d579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20K=C3=B6rber?= Date: Thu, 26 May 2022 14:02:32 +0200 Subject: [PATCH] Add unit tests for `Repo::fullname()` --- src/repo.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/repo.rs b/src/repo.rs index 02d040f..d020330 100644 --- a/src/repo.rs +++ b/src/repo.rs @@ -447,6 +447,26 @@ mod tests { fn check_unsupported_protocol_git() { detect_remote_type("git://example.com"); } + + #[test] + fn repo_check_fullname() { + let with_namespace = Repo { + name: "name".to_string(), + namespace: Some("namespace".to_string()), + worktree_setup: false, + remotes: None, + }; + + let without_namespace = Repo { + name: "name".to_string(), + namespace: None, + worktree_setup: false, + remotes: None, + }; + + assert_eq!(with_namespace.fullname(), "namespace/name"); + assert_eq!(without_namespace.fullname(), "name"); + } } pub fn detect_remote_type(remote_url: &str) -> Option {