1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-04-13 11:50:28 +02:00

migrate submodule remove test

This commit is contained in:
Jesse Duffield 2023-02-12 10:01:45 +11:00
parent 010f6d7f6e
commit 1c48842277
41 changed files with 47 additions and 86 deletions

View File

@ -0,0 +1,46 @@
package submodule
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var Remove = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Remove a submodule",
ExtraCmdArgs: "",
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("first commit")
shell.RunCommand("git clone --bare . ../other_repo")
shell.RunCommand("git submodule add ../other_repo my_submodule")
shell.GitAddAll()
shell.Commit("add submodule")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Submodules().Focus().
Lines(
Contains("my_submodule").IsSelected(),
).
Press(keys.Universal.Remove).
Tap(func() {
t.ExpectPopup().Confirmation().
Title(Equals("Remove submodule")).
Content(Equals("Are you sure you want to remove submodule 'my_submodule' and its corresponding directory? This is irreversible.")).
Confirm()
}).
IsEmpty()
t.Views().Files().Focus().
Lines(
MatchesRegexp(`M.*\.gitmodules`).IsSelected(),
MatchesRegexp(`D.*my_submodule`),
)
t.Views().Main().Content(
Contains("-[submodule \"my_submodule\"]").
Contains("- path = my_submodule").
Contains("- url = ../other_repo"),
)
},
})

View File

@ -77,6 +77,7 @@ var tests = []*components.IntegrationTest{
filter_by_path.TypeFile,
patch_building.BuildPatchAndCopyToClipboard,
submodule.Add,
submodule.Remove,
}
func GetTests() []*components.IntegrationTest {

View File

@ -1 +0,0 @@
ref: refs/heads/master

View File

@ -1,8 +0,0 @@
[core]
repositoryformatversion = 0
filemode = true
bare = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = /Users/jesseduffieldduffield/go/src/github.com/jesseduffield/lazygit/test/integration/submoduleRemove/actual/./repo

View File

@ -1 +0,0 @@
Unnamed repository; edit this file 'description' to name the repository.

View File

@ -1,7 +0,0 @@
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
.DS_Store

View File

@ -1,2 +0,0 @@
x�ÍM
ƒ0@á®sŠÙJ&Nþ Á•Ç“  I¡Þ¾¡ÛÇ/µZ×HîÖÐâRÑì%d"Áàr@ÃX<-4dG…“5Š?ýݘfxNó(_®û&�Ôê Ðä£ñ6Â]£Öêª×¤ËŸ\Õ³¬› ú5,ß

View File

@ -1,2 +0,0 @@
# pack-refs with: peeled fully-peeled sorted
42530e986dbb65877ed8d61ca0c816e425e5c62e refs/heads/master

View File

@ -1 +0,0 @@
ref: refs/heads/master

View File

@ -1,10 +0,0 @@
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[user]
email = CI@example.com
name = CI

View File

@ -1 +0,0 @@
Unnamed repository; edit this file 'description' to name the repository.

View File

@ -1,7 +0,0 @@
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
.DS_Store

View File

@ -1,4 +0,0 @@
0000000000000000000000000000000000000000 a50a5125768001a3ea263ffb7cafbc421a508153 CI <CI@example.com> 1534792759 +0100 commit (initial): myfile1
a50a5125768001a3ea263ffb7cafbc421a508153 42530e986dbb65877ed8d61ca0c816e425e5c62e CI <CI@example.com> 1534792759 +0100 commit: myfile2
42530e986dbb65877ed8d61ca0c816e425e5c62e 9d10a5a0a21eb2cfdb6206f474ed57fd5cd51440 CI <CI@example.com> 1534792759 +0100 commit: add submodule
9d10a5a0a21eb2cfdb6206f474ed57fd5cd51440 611cac756ef1944ab56d12f4ea3ae4623724c8cf CI <CI@example.com> 1648348134 +1100 commit: remove submodule

View File

@ -1,4 +0,0 @@
0000000000000000000000000000000000000000 a50a5125768001a3ea263ffb7cafbc421a508153 CI <CI@example.com> 1534792759 +0100 commit (initial): myfile1
a50a5125768001a3ea263ffb7cafbc421a508153 42530e986dbb65877ed8d61ca0c816e425e5c62e CI <CI@example.com> 1534792759 +0100 commit: myfile2
42530e986dbb65877ed8d61ca0c816e425e5c62e 9d10a5a0a21eb2cfdb6206f474ed57fd5cd51440 CI <CI@example.com> 1534792759 +0100 commit: add submodule
9d10a5a0a21eb2cfdb6206f474ed57fd5cd51440 611cac756ef1944ab56d12f4ea3ae4623724c8cf CI <CI@example.com> 1648348134 +1100 commit: remove submodule

View File

@ -1,2 +0,0 @@
x�ÍM
ƒ0@á®sŠÙJ&Nþ Á•Ç“  I¡Þ¾¡ÛÇ/µZ×HîÖÐâRÑì%d"Áàr@ÃX<-4dG…“5Š?ýݘfxNó(_®û&�Ôê Ðä£ñ6Â]£Öêª×¤ËŸ\Õ³¬› ú5,ß

View File

@ -1 +0,0 @@
611cac756ef1944ab56d12f4ea3ae4623724c8cf

View File

@ -1 +0,0 @@
{"KeyEvents":[{"Timestamp":912,"Mod":0,"Key":256,"Ch":93},{"Timestamp":1280,"Mod":0,"Key":256,"Ch":100},{"Timestamp":1696,"Mod":0,"Key":13,"Ch":13},{"Timestamp":2544,"Mod":0,"Key":256,"Ch":91},{"Timestamp":2984,"Mod":0,"Key":256,"Ch":99},{"Timestamp":3680,"Mod":0,"Key":256,"Ch":114},{"Timestamp":3736,"Mod":0,"Key":256,"Ch":101},{"Timestamp":3824,"Mod":0,"Key":256,"Ch":109},{"Timestamp":3872,"Mod":0,"Key":256,"Ch":111},{"Timestamp":3944,"Mod":0,"Key":256,"Ch":118},{"Timestamp":3976,"Mod":0,"Key":256,"Ch":101},{"Timestamp":4064,"Mod":0,"Key":256,"Ch":32},{"Timestamp":4152,"Mod":0,"Key":256,"Ch":115},{"Timestamp":4248,"Mod":0,"Key":256,"Ch":117},{"Timestamp":4320,"Mod":0,"Key":256,"Ch":98},{"Timestamp":4560,"Mod":0,"Key":256,"Ch":109},{"Timestamp":4632,"Mod":0,"Key":256,"Ch":111},{"Timestamp":4720,"Mod":0,"Key":256,"Ch":100},{"Timestamp":4824,"Mod":0,"Key":256,"Ch":117},{"Timestamp":4880,"Mod":0,"Key":256,"Ch":108},{"Timestamp":4944,"Mod":0,"Key":256,"Ch":101},{"Timestamp":5152,"Mod":0,"Key":13,"Ch":13},{"Timestamp":5648,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":74}]}

View File

@ -1,27 +0,0 @@
#!/bin/sh
set -e
cd $1
export GIT_COMMITTER_DATE="Mon 20 Aug 2018 20:19:19 BST"
export GIT_AUTHOR_DATE="Mon 20 Aug 2018 20:19:19 BST"
git init
git config user.email "CI@example.com"
git config user.name "CI"
echo test1 > myfile1
git add .
git commit -am "myfile1"
echo test2 > myfile2
git add .
git commit -am "myfile2"
cd ..
git clone --bare ./repo other_repo
cd repo
git -c protocol.file.allow=always submodule add ../other_repo
git commit -am "add submodule"

View File

@ -1,4 +0,0 @@
{
"description": "Remove a submodule",
"speed": 20
}