1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-15 00:15:32 +02:00

Add unit test

This commit is contained in:
Cristian Betivu
2023-08-19 19:10:35 +03:00
parent 03694f7502
commit 382ecb6bfe

View File

@ -55,6 +55,24 @@ func TestGetRepoPathsAux(t *testing.T) {
}, },
Err: nil, Err: nil,
}, },
{
Name: "worktree with trailing separator in path",
BeforeFunc: func(fs afero.Fs) {
// setup for linked worktree
_ = fs.MkdirAll("/path/to/repo/.git/worktrees/worktree1", 0o755)
_ = afero.WriteFile(fs, "/path/to/repo/worktree1/.git", []byte("gitdir: /path/to/repo/.git/worktrees/worktree1/"), 0o644)
},
Path: "/path/to/repo/worktree1",
Expected: &RepoPaths{
currentPath: "/path/to/repo/worktree1",
worktreePath: "/path/to/repo/worktree1",
worktreeGitDirPath: "/path/to/repo/.git/worktrees/worktree1",
repoPath: "/path/to/repo",
repoGitDirPath: "/path/to/repo/.git",
repoName: "repo",
},
Err: nil,
},
{ {
Name: "worktree .git file missing gitdir directive", Name: "worktree .git file missing gitdir directive",
BeforeFunc: func(fs afero.Fs) { BeforeFunc: func(fs afero.Fs) {