mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 12:25:47 +02:00
Add test showing problem with the display of renamed files
Renaming a file inside the same directory shows it with its full path in the tree view, which isn't what we want. We'll fix this in the next commit. Also adding a few other test cases for moving files; they show that the display of moved files in tree view isn't ideal. For example, moving file1 from top level into dir shows it as "R file1 → file1", which isn't distinguishable from renaming file1 inside dir. I suppose what we would like to have here is "R ../file1 → file1" or something, but I'll leave that for the future; here I only want to fix the regression that was introduced with the root item PR.
This commit is contained in:
parent
facc73a88b
commit
267ef70de6
2 changed files with 37 additions and 0 deletions
36
pkg/integration/tests/file/renamed_files.go
Normal file
36
pkg/integration/tests/file/renamed_files.go
Normal file
|
@ -0,0 +1,36 @@
|
|||
package file
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var RenamedFiles = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Regression test for the display of renamed files in the file tree",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {
|
||||
},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.CreateDir("dir")
|
||||
shell.CreateDir("dir/nested")
|
||||
shell.CreateFileAndAdd("file1", "file1 content\n")
|
||||
shell.CreateFileAndAdd("dir/file2", "file2 content\n")
|
||||
shell.CreateFileAndAdd("dir/nested/file3", "file3 content\n")
|
||||
shell.Commit("initial commit")
|
||||
shell.RunCommand([]string{"git", "mv", "file1", "dir/file1"})
|
||||
shell.RunCommand([]string{"git", "mv", "dir/file2", "dir/file2-renamed"})
|
||||
shell.RunCommand([]string{"git", "mv", "dir/nested/file3", "file3"})
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Files().
|
||||
IsFocused().
|
||||
Lines(
|
||||
Equals("▼ /"),
|
||||
Equals(" ▼ dir"),
|
||||
Equals(" R file1 → file1"),
|
||||
Equals(" R dir/file2 → file2-renamed"), // don't want the 'dir/' prefix here
|
||||
Equals(" R dir/nested/file3 → file3"),
|
||||
)
|
||||
},
|
||||
})
|
|
@ -195,6 +195,7 @@ var tests = []*components.IntegrationTest{
|
|||
file.Gitignore,
|
||||
file.RememberCommitMessageAfterFail,
|
||||
file.RenameSimilarityThresholdChange,
|
||||
file.RenamedFiles,
|
||||
file.StageChildrenRangeSelect,
|
||||
file.StageDeletedRangeSelect,
|
||||
file.StageRangeSelect,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue