refactor: split git::repository::open::tests module
All checks were successful
Rust / build (push) Successful in 1m12s
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful

This commit is contained in:
Paul Campbell 2024-07-05 19:20:11 +01:00
parent 6a8d1bf817
commit 2e374d317a
9 changed files with 398 additions and 454 deletions

View file

@ -1,454 +0,0 @@
//
use crate as git;
use crate::repository::RepositoryLike as _;
use git::tests::given;
use git_next_config as config;
use assert2::let_assert;
type TestResult = Result<(), Box<dyn std::error::Error>>;
mod server_repo_config {
use super::*;
use std::path::PathBuf;
use assert2::let_assert;
use crate::tests::given;
#[test]
fn should_not_return_repo_config_when_no_branches() {
let main = None;
let next = None;
let dev = None;
let src =
config::ServerRepoConfig::new(given::a_name(), given::a_name(), None, main, next, dev);
let_assert!(None = src.repo_config());
}
#[test]
fn should_return_repo_config_when_branches() {
let main = given::a_name();
let next = given::a_name();
let dev = given::a_name();
let src = config::ServerRepoConfig::new(
given::a_name(),
given::a_name(),
None,
Some(main.clone()),
Some(next.clone()),
Some(dev.clone()),
);
let_assert!(Some(rc) = src.repo_config());
assert_eq!(
rc,
config::RepoConfig::new(
config::RepoBranches::new(main, next, dev),
config::RepoConfigSource::Server
)
);
}
#[test]
fn should_return_repo() {
let repo_path = given::a_name();
let src = config::ServerRepoConfig::new(
repo_path.clone(),
given::a_name(),
None,
Some(given::a_name()),
Some(given::a_name()),
Some(given::a_name()),
);
assert_eq!(src.repo(), config::RepoPath::new(repo_path));
}
#[test]
fn should_return_branch() {
let branch = given::a_name();
let src = config::ServerRepoConfig::new(
given::a_name(),
branch.clone(),
None,
Some(given::a_name()),
Some(given::a_name()),
Some(given::a_name()),
);
assert_eq!(src.branch(), config::BranchName::new(branch));
}
#[test]
fn should_return_gitdir() {
let gitdir = given::a_name();
let src = config::ServerRepoConfig::new(
given::a_name(),
given::a_name(),
Some(gitdir.clone().into()),
Some(given::a_name()),
Some(given::a_name()),
Some(given::a_name()),
);
assert_eq!(
src.gitdir(),
Some(config::GitDir::new(PathBuf::default().join(gitdir)))
);
}
}
mod repo_config {
use super::*;
#[test]
fn should_parse_toml() -> TestResult {
let main = given::a_name();
let next = given::a_name();
let dev = given::a_name();
let toml = format!(
r#"
[branches]
main = "{main}"
next = "{next}"
dev = "{dev}"
"#
);
let rc = config::RepoConfig::parse(toml.as_str())?;
assert_eq!(
rc,
config::RepoConfig::new(
config::RepoBranches::new(main, next, dev),
config::RepoConfigSource::Repo // reading from repo is the default
)
);
Ok(())
}
#[test]
fn should_return_branches() {
let main = given::a_name();
let next = given::a_name();
let dev = given::a_name();
let branches = config::RepoBranches::new(main, next, dev);
let repo_config = config::RepoConfig::new(branches.clone(), config::RepoConfigSource::Repo);
assert_eq!(repo_config.branches(), &branches);
}
#[test]
fn should_return_source() {
let main = given::a_name();
let next = given::a_name();
let dev = given::a_name();
let repo_config = config::RepoConfig::new(
config::RepoBranches::new(main, next, dev),
config::RepoConfigSource::Repo,
);
assert_eq!(repo_config.source(), config::RepoConfigSource::Repo);
}
}
mod forge_config {
use super::*;
use std::collections::BTreeMap;
use secrecy::ExposeSecret;
use crate::tests::given;
#[test]
fn should_return_repos() {
let forge_type = config::ForgeType::MockForge;
let hostname = given::a_name();
let user = given::a_name();
let token = given::a_name();
// alphabetical order by key
let red_name = format!("a-{}", given::a_name());
let blue_name = format!("b-{}", given::a_name());
let red = config::ServerRepoConfig::new(
red_name.clone(),
given::a_name(),
None,
None,
None,
None,
);
let blue = config::ServerRepoConfig::new(
blue_name.clone(),
given::a_name(),
None,
None,
None,
None,
);
let mut repos = BTreeMap::new();
repos.insert(red_name.clone(), red.clone());
repos.insert(blue_name.clone(), blue.clone());
let fc = config::ForgeConfig::new(forge_type, hostname, user, token, repos);
let returned_repos = fc.repos().collect::<Vec<_>>();
assert_eq!(
returned_repos,
vec![
// alphabetical order by key
(config::RepoAlias::new(red_name.as_str()), &red),
(config::RepoAlias::new(blue_name.as_str()), &blue),
]
);
}
#[test]
fn should_return_forge_type() {
let forge_type = config::ForgeType::MockForge;
let hostname = given::a_name();
let user = given::a_name();
let token = given::a_name();
let repos = BTreeMap::new();
let fc = config::ForgeConfig::new(forge_type, hostname, user, token, repos);
assert_eq!(fc.forge_type(), config::ForgeType::MockForge);
}
#[test]
fn should_return_hostname() {
let forge_type = config::ForgeType::MockForge;
let hostname = given::a_name();
let user = given::a_name();
let token = given::a_name();
let repos = BTreeMap::new();
let fc = config::ForgeConfig::new(forge_type, hostname.clone(), user, token, repos);
assert_eq!(fc.hostname(), config::Hostname::new(hostname));
}
#[test]
fn should_return_user() {
let forge_type = config::ForgeType::MockForge;
let hostname = given::a_name();
let user = given::a_name();
let token = given::a_name();
let repos = BTreeMap::new();
let fc = config::ForgeConfig::new(forge_type, hostname, user.clone(), token, repos);
assert_eq!(fc.user(), config::User::new(user));
}
#[test]
fn should_return_token() {
let forge_type = config::ForgeType::MockForge;
let hostname = given::a_name();
let user = given::a_name();
let token = given::a_name();
let repos = BTreeMap::new();
let fc = config::ForgeConfig::new(forge_type, hostname, user, token.clone(), repos);
assert_eq!(fc.token().expose_secret(), token.as_str());
}
#[test]
fn should_return_repo() {
let forge_type = config::ForgeType::MockForge;
let hostname = given::a_name();
let user = given::a_name();
let token = given::a_name();
let red_name = given::a_name();
let blue_name = given::a_name();
let red = config::ServerRepoConfig::new(
red_name.clone(),
given::a_name(),
None,
None,
None,
None,
);
let blue = config::ServerRepoConfig::new(
blue_name.clone(),
given::a_name(),
None,
None,
None,
None,
);
let mut repos = BTreeMap::new();
repos.insert(red_name.clone(), red.clone());
repos.insert(blue_name, blue);
let fc = config::ForgeConfig::new(forge_type, hostname, user, token, repos);
let returned_repo = fc.get_repo(red_name.as_str());
assert_eq!(returned_repo, Some(&red),);
}
}
mod find_default_remote {
use super::*;
use assert2::let_assert;
#[test]
fn should_find_default_push_remote() {
// uses the current repo
let_assert!(Ok(cwd) = std::env::current_dir());
let gitdir = config::GitDir::from(cwd.join("../..")); // from ./crate/git directory to the project rook
let_assert!(Ok(repo) = crate::repository::real().open(&gitdir));
let_assert!(Some(remote) = repo.find_default_remote(crate::repository::Direction::Push));
assert_eq!(
remote,
git::GitRemote::new(
config::Hostname::new("git.kemitix.net"),
config::RepoPath::new("kemitix/git-next".to_string())
)
)
}
}
mod fetch {
use assert2::let_assert;
use git_next_config::GitDir;
#[test]
#[ignore] // requires authentication to the server - which the CI doesn't have
fn should_fetch_from_repo() {
// uses the current repo and fetches from the remote server
let_assert!(Ok(cwd) = std::env::current_dir());
let gitdir = GitDir::from(cwd.join("../.."));
let_assert!(Ok(repo) = crate::repository::real().open(&gitdir));
let_assert!(Ok(_) = repo.fetch());
}
}
mod commit_log {
use git::tests::given;
use crate::tests::then;
use super::*;
#[test]
// assumes running in the git-next repo which should have main, next and dev as remote branches
fn should_return_single_item_in_commit_log_when_not_searching() -> TestResult {
let_assert!(Ok(fs) = kxio::fs::temp());
let gitdir: config::GitDir = fs.base().to_path_buf().into();
let test_repository = git::repository::test(fs.clone());
let_assert!(Ok(open_repository) = test_repository.open(&gitdir));
let repo_config = &given::a_repo_config();
let branches = repo_config.branches();
then::create_a_commit_on_branch(&fs, &gitdir, &branches.main())?;
then::create_a_commit_on_branch(&fs, &gitdir, &branches.main())?;
let_assert!(Ok(result) = open_repository.commit_log(&branches.main(), &[]));
assert_eq!(result.len(), 1);
Ok(())
}
#[test]
// assumes running in the git-next repo which should have main, next and dev as remote branches
fn should_return_capacity_50_in_commit_log_when_searching_for_garbage() -> TestResult {
let_assert!(Ok(fs) = kxio::fs::temp());
let branch_name = given::a_branch_name();
let gitdir: config::GitDir = fs.base().to_path_buf().into();
let test_repository = git::repository::test(fs.clone());
let_assert!(Ok(open_repository) = test_repository.open(&gitdir));
for _ in [0; 60] {
// create 60 commits
then::create_a_commit_on_branch(&fs, &gitdir, &branch_name)?;
}
let_assert!(Ok(result) = open_repository.commit_log(&branch_name, &[given::a_commit()]));
assert_eq!(result.len(), 50);
Ok(())
}
#[test]
// assumes running in the git-next repo which should have main, next and dev as remote branches
fn should_return_5_in_commit_log_when_searching_for_5th_item() -> TestResult {
let_assert!(Ok(fs) = kxio::fs::temp(), "create temp directory");
let branch_name = given::a_branch_name();
let gitdir: config::GitDir = fs.base().to_path_buf().into();
let test_repository = git::repository::test(fs.clone());
let_assert!(
Ok(open_repository) = test_repository.open(&gitdir),
"open repository"
);
for _ in [0; 10] {
then::create_a_commit_on_branch(&fs, &gitdir, &branch_name)?;
}
// search to garbage to get all 10 items
let_assert!(
Ok(long_list) = open_repository.commit_log(&branch_name, &[given::a_commit()]),
"get commit_log"
);
// pick the 5th item
let search = &long_list[4]; // zero-based
// search for the 25th item
let_assert!(
Ok(result) = open_repository.commit_log(&branch_name, &[search.clone()]),
"get commit log"
);
// returns
assert_eq!(result.len(), 5);
Ok(())
}
}
mod read_file {
use git::tests::given;
use git::tests::then;
type TestResult = Result<(), Box<dyn std::error::Error>>;
use super::*;
#[test]
// assumes running in the git-next repo which should have main, next and dev as remote branches
fn should_return_file() -> TestResult {
let_assert!(Ok(fs) = kxio::fs::temp());
let repo_config = given::a_repo_config();
let file_name = given::a_pathbuf();
let contents = given::a_name();
let gitdir: config::GitDir = fs.base().to_path_buf().into();
let test_repository = git::repository::test(fs.clone());
let_assert!(Ok(open_repository) = test_repository.open(&gitdir));
then::commit_named_file_to_branch(
&file_name,
&contents,
&fs,
&gitdir,
&repo_config.branches().main(),
)?;
// then::create_a_commit_on_branch(&fs, &gitdir, &repo_config.branches().main())?;
let_assert!(
Ok(result) = open_repository.read_file(&repo_config.branches().main(), &file_name),
"read file"
);
assert_eq!(result, contents);
Ok(())
}
#[test]
// assumes running in the git-next repo which should have main, next and dev as remote branches
fn should_error_on_missing_file() -> TestResult {
let_assert!(Ok(fs) = kxio::fs::temp());
let gitdir: config::GitDir = fs.base().to_path_buf().into();
let test_repository = git::repository::test(fs.clone());
let_assert!(Ok(open_repository) = test_repository.open(&gitdir));
let repo_config = &given::a_repo_config();
let branches = repo_config.branches();
then::create_a_commit_on_branch(&fs, &gitdir, &branches.dev())?;
let_assert!(
Err(err) = open_repository.read_file(&branches.dev(), &given::a_pathbuf()),
"read file"
);
eprintln!("err: {err:#?}");
assert!(matches!(err, git::file::Error::FileNotFound));
Ok(())
}
}

View file

@ -0,0 +1,66 @@
use super::*;
#[test]
// assumes running in the git-next repo which should have main, next and dev as remote branches
fn should_return_single_item_in_commit_log_when_not_searching() -> TestResult {
let_assert!(Ok(fs) = kxio::fs::temp());
let gitdir: config::GitDir = fs.base().to_path_buf().into();
let test_repository = git::repository::test(fs.clone());
let_assert!(Ok(open_repository) = test_repository.open(&gitdir));
let repo_config = &given::a_repo_config();
let branches = repo_config.branches();
then::create_a_commit_on_branch(&fs, &gitdir, &branches.main())?;
then::create_a_commit_on_branch(&fs, &gitdir, &branches.main())?;
let_assert!(Ok(result) = open_repository.commit_log(&branches.main(), &[]));
assert_eq!(result.len(), 1);
Ok(())
}
#[test]
// assumes running in the git-next repo which should have main, next and dev as remote branches
fn should_return_capacity_50_in_commit_log_when_searching_for_garbage() -> TestResult {
let_assert!(Ok(fs) = kxio::fs::temp());
let branch_name = given::a_branch_name();
let gitdir: config::GitDir = fs.base().to_path_buf().into();
let test_repository = git::repository::test(fs.clone());
let_assert!(Ok(open_repository) = test_repository.open(&gitdir));
for _ in [0; 60] {
// create 60 commits
then::create_a_commit_on_branch(&fs, &gitdir, &branch_name)?;
}
let_assert!(Ok(result) = open_repository.commit_log(&branch_name, &[given::a_commit()]));
assert_eq!(result.len(), 50);
Ok(())
}
#[test]
// assumes running in the git-next repo which should have main, next and dev as remote branches
fn should_return_5_in_commit_log_when_searching_for_5th_item() -> TestResult {
let_assert!(Ok(fs) = kxio::fs::temp(), "create temp directory");
let branch_name = given::a_branch_name();
let gitdir: config::GitDir = fs.base().to_path_buf().into();
let test_repository = git::repository::test(fs.clone());
let_assert!(
Ok(open_repository) = test_repository.open(&gitdir),
"open repository"
);
for _ in [0; 10] {
then::create_a_commit_on_branch(&fs, &gitdir, &branch_name)?;
}
// search to garbage to get all 10 items
let_assert!(
Ok(long_list) = open_repository.commit_log(&branch_name, &[given::a_commit()]),
"get commit_log"
);
// pick the 5th item
let search = &long_list[4]; // zero-based
// search for the 25th item
let_assert!(
Ok(result) = open_repository.commit_log(&branch_name, &[search.clone()]),
"get commit log"
);
// returns
assert_eq!(result.len(), 5);
Ok(())
}

View file

@ -0,0 +1,11 @@
use super::*;
#[test]
#[ignore] // requires authentication to the server - which the CI doesn't have
fn should_fetch_from_repo() {
// uses the current repo and fetches from the remote server
let_assert!(Ok(cwd) = std::env::current_dir());
let gitdir = GitDir::from(cwd.join("../.."));
let_assert!(Ok(repo) = crate::repository::real().open(&gitdir));
let_assert!(Ok(_) = repo.fetch());
}

View file

@ -0,0 +1,17 @@
use super::*;
#[test]
fn should_find_default_push_remote() {
// uses the current repo
let_assert!(Ok(cwd) = std::env::current_dir());
let gitdir = config::GitDir::from(cwd.join("../..")); // from ./crate/git directory to the project rook
let_assert!(Ok(repo) = crate::repository::real().open(&gitdir));
let_assert!(Some(remote) = repo.find_default_remote(crate::repository::Direction::Push));
assert_eq!(
remote,
git::GitRemote::new(
config::Hostname::new("git.kemitix.net"),
config::RepoPath::new("kemitix/git-next".to_string())
)
)
}

View file

@ -0,0 +1,102 @@
use super::*;
#[test]
fn should_return_repos() {
let forge_type = config::ForgeType::MockForge;
let hostname = given::a_name();
let user = given::a_name();
let token = given::a_name();
// alphabetical order by key
let red_name = format!("a-{}", given::a_name());
let blue_name = format!("b-{}", given::a_name());
let red =
config::ServerRepoConfig::new(red_name.clone(), given::a_name(), None, None, None, None);
let blue =
config::ServerRepoConfig::new(blue_name.clone(), given::a_name(), None, None, None, None);
let mut repos = BTreeMap::new();
repos.insert(red_name.clone(), red.clone());
repos.insert(blue_name.clone(), blue.clone());
let fc = config::ForgeConfig::new(forge_type, hostname, user, token, repos);
let returned_repos = fc.repos().collect::<Vec<_>>();
assert_eq!(
returned_repos,
vec![
// alphabetical order by key
(config::RepoAlias::new(red_name.as_str()), &red),
(config::RepoAlias::new(blue_name.as_str()), &blue),
]
);
}
#[test]
fn should_return_forge_type() {
let forge_type = config::ForgeType::MockForge;
let hostname = given::a_name();
let user = given::a_name();
let token = given::a_name();
let repos = BTreeMap::new();
let fc = config::ForgeConfig::new(forge_type, hostname, user, token, repos);
assert_eq!(fc.forge_type(), config::ForgeType::MockForge);
}
#[test]
fn should_return_hostname() {
let forge_type = config::ForgeType::MockForge;
let hostname = given::a_name();
let user = given::a_name();
let token = given::a_name();
let repos = BTreeMap::new();
let fc = config::ForgeConfig::new(forge_type, hostname.clone(), user, token, repos);
assert_eq!(fc.hostname(), config::Hostname::new(hostname));
}
#[test]
fn should_return_user() {
let forge_type = config::ForgeType::MockForge;
let hostname = given::a_name();
let user = given::a_name();
let token = given::a_name();
let repos = BTreeMap::new();
let fc = config::ForgeConfig::new(forge_type, hostname, user.clone(), token, repos);
assert_eq!(fc.user(), config::User::new(user));
}
#[test]
fn should_return_token() {
let forge_type = config::ForgeType::MockForge;
let hostname = given::a_name();
let user = given::a_name();
let token = given::a_name();
let repos = BTreeMap::new();
let fc = config::ForgeConfig::new(forge_type, hostname, user, token.clone(), repos);
assert_eq!(fc.token().expose_secret(), token.as_str());
}
#[test]
fn should_return_repo() {
let forge_type = config::ForgeType::MockForge;
let hostname = given::a_name();
let user = given::a_name();
let token = given::a_name();
let red_name = given::a_name();
let blue_name = given::a_name();
let red =
config::ServerRepoConfig::new(red_name.clone(), given::a_name(), None, None, None, None);
let blue =
config::ServerRepoConfig::new(blue_name.clone(), given::a_name(), None, None, None, None);
let mut repos = BTreeMap::new();
repos.insert(red_name.clone(), red.clone());
repos.insert(blue_name, blue);
let fc = config::ForgeConfig::new(forge_type, hostname, user, token, repos);
let returned_repo = fc.get_repo(red_name.as_str());
assert_eq!(returned_repo, Some(&red),);
}

View file

@ -0,0 +1,21 @@
//
use crate as git;
use assert2::let_assert;
use config::GitDir;
use git::repository::RepositoryLike as _;
use git::tests::given;
use git::tests::then;
use git_next_config as config;
use secrecy::ExposeSecret;
use std::collections::BTreeMap;
use std::path::PathBuf;
type TestResult = Result<(), Box<dyn std::error::Error>>;
mod commit_log;
mod fetch;
mod find_default_remote;
mod forge_config;
mod read_file;
mod repo_config;
mod server_repo_config;

View file

@ -0,0 +1,47 @@
use super::*;
#[test]
// assumes running in the git-next repo which should have main, next and dev as remote branches
fn should_return_file() -> TestResult {
let_assert!(Ok(fs) = kxio::fs::temp());
let repo_config = given::a_repo_config();
let file_name = given::a_pathbuf();
let contents = given::a_name();
let gitdir: config::GitDir = fs.base().to_path_buf().into();
let test_repository = git::repository::test(fs.clone());
let_assert!(Ok(open_repository) = test_repository.open(&gitdir));
then::commit_named_file_to_branch(
&file_name,
&contents,
&fs,
&gitdir,
&repo_config.branches().main(),
)?;
// then::create_a_commit_on_branch(&fs, &gitdir, &repo_config.branches().main())?;
let_assert!(
Ok(result) = open_repository.read_file(&repo_config.branches().main(), &file_name),
"read file"
);
assert_eq!(result, contents);
Ok(())
}
#[test]
// assumes running in the git-next repo which should have main, next and dev as remote branches
fn should_error_on_missing_file() -> TestResult {
let_assert!(Ok(fs) = kxio::fs::temp());
let gitdir: config::GitDir = fs.base().to_path_buf().into();
let test_repository = git::repository::test(fs.clone());
let_assert!(Ok(open_repository) = test_repository.open(&gitdir));
let repo_config = &given::a_repo_config();
let branches = repo_config.branches();
then::create_a_commit_on_branch(&fs, &gitdir, &branches.dev())?;
let_assert!(
Err(err) = open_repository.read_file(&branches.dev(), &given::a_pathbuf()),
"read file"
);
eprintln!("err: {err:#?}");
assert!(matches!(err, git::file::Error::FileNotFound));
Ok(())
}

View file

@ -0,0 +1,50 @@
use super::*;
#[test]
fn should_parse_toml() -> TestResult {
let main = given::a_name();
let next = given::a_name();
let dev = given::a_name();
let toml = format!(
r#"
[branches]
main = "{main}"
next = "{next}"
dev = "{dev}"
"#
);
let rc = config::RepoConfig::parse(toml.as_str())?;
assert_eq!(
rc,
config::RepoConfig::new(
config::RepoBranches::new(main, next, dev),
config::RepoConfigSource::Repo // reading from repo is the default
)
);
Ok(())
}
#[test]
fn should_return_branches() {
let main = given::a_name();
let next = given::a_name();
let dev = given::a_name();
let branches = config::RepoBranches::new(main, next, dev);
let repo_config = config::RepoConfig::new(branches.clone(), config::RepoConfigSource::Repo);
assert_eq!(repo_config.branches(), &branches);
}
#[test]
fn should_return_source() {
let main = given::a_name();
let next = given::a_name();
let dev = given::a_name();
let repo_config = config::RepoConfig::new(
config::RepoBranches::new(main, next, dev),
config::RepoConfigSource::Repo,
);
assert_eq!(repo_config.source(), config::RepoConfigSource::Repo);
}

View file

@ -0,0 +1,84 @@
use super::*;
#[test]
fn should_not_return_repo_config_when_no_branches() {
let main = None;
let next = None;
let dev = None;
let src =
config::ServerRepoConfig::new(given::a_name(), given::a_name(), None, main, next, dev);
let_assert!(None = src.repo_config());
}
#[test]
fn should_return_repo_config_when_branches() {
let main = given::a_name();
let next = given::a_name();
let dev = given::a_name();
let src = config::ServerRepoConfig::new(
given::a_name(),
given::a_name(),
None,
Some(main.clone()),
Some(next.clone()),
Some(dev.clone()),
);
let_assert!(Some(rc) = src.repo_config());
assert_eq!(
rc,
config::RepoConfig::new(
config::RepoBranches::new(main, next, dev),
config::RepoConfigSource::Server
)
);
}
#[test]
fn should_return_repo() {
let repo_path = given::a_name();
let src = config::ServerRepoConfig::new(
repo_path.clone(),
given::a_name(),
None,
Some(given::a_name()),
Some(given::a_name()),
Some(given::a_name()),
);
assert_eq!(src.repo(), config::RepoPath::new(repo_path));
}
#[test]
fn should_return_branch() {
let branch = given::a_name();
let src = config::ServerRepoConfig::new(
given::a_name(),
branch.clone(),
None,
Some(given::a_name()),
Some(given::a_name()),
Some(given::a_name()),
);
assert_eq!(src.branch(), config::BranchName::new(branch));
}
#[test]
fn should_return_gitdir() {
let gitdir = given::a_name();
let src = config::ServerRepoConfig::new(
given::a_name(),
given::a_name(),
Some(gitdir.clone().into()),
Some(given::a_name()),
Some(given::a_name()),
Some(given::a_name()),
);
assert_eq!(
src.gitdir(),
Some(config::GitDir::new(PathBuf::default().join(gitdir)))
);
}