summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyooooooga <eial5q265e5@gmail.com>2022-10-15 11:57:19 +0900
committerRyooooooga <eial5q265e5@gmail.com>2022-10-16 09:30:03 +0900
commite78e829e3a8940f5b7b8f0bfc77b3316d19e1e8b (patch)
treed74268b4a7027bc93a6ebc419ec9e945f029d89e
parenteceb3a5aa6de864f31c52016e6fd497b9b6a1214 (diff)
test: add an integration test for rename stash
-rw-r--r--pkg/integration/components/shell.go5
-rw-r--r--pkg/integration/tests/stash/rename.go33
-rw-r--r--pkg/integration/tests/tests.go2
-rw-r--r--test/integration_new/stash/rename/expected/repo/.git_keep/COMMIT_EDITMSG1
-rw-r--r--test/integration_new/stash/rename/expected/repo/.git_keep/FETCH_HEAD0
-rw-r--r--test/integration_new/stash/rename/expected/repo/.git_keep/HEAD1
-rw-r--r--test/integration_new/stash/rename/expected/repo/.git_keep/ORIG_HEAD1
-rw-r--r--test/integration_new/stash/rename/expected/repo/.git_keep/commit-template.txt0
-rw-r--r--test/integration_new/stash/rename/expected/repo/.git_keep/config12
-rw-r--r--test/integration_new/stash/rename/expected/repo/.git_keep/description1
-rw-r--r--test/integration_new/stash/rename/expected/repo/.git_keep/indexbin0 -> 65 bytes
-rw-r--r--test/integration_new/stash/rename/expected/repo/.git_keep/info/exclude0
-rw-r--r--test/integration_new/stash/rename/expected/repo/.git_keep/logs/HEAD2
-rw-r--r--test/integration_new/stash/rename/expected/repo/.git_keep/logs/refs/heads/master1
-rw-r--r--test/integration_new/stash/rename/expected/repo/.git_keep/logs/refs/stash1
-rw-r--r--test/integration_new/stash/rename/expected/repo/.git_keep/objects/25/0122ffb92a8c1c2a6554ce2ac84b49e5f3afe3bin0 -> 31 bytes
-rw-r--r--test/integration_new/stash/rename/expected/repo/.git_keep/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904bin0 -> 15 bytes
-rw-r--r--test/integration_new/stash/rename/expected/repo/.git_keep/objects/4d/ff185ecddfb638f76215fa07adde0f4e97da7c2
-rw-r--r--test/integration_new/stash/rename/expected/repo/.git_keep/objects/8d/4897b3dcbb5c8fbc8fa8439ec7e9627c3159cf2
-rw-r--r--test/integration_new/stash/rename/expected/repo/.git_keep/objects/c6/f35659c0cf57c794d79df88283d7ee933831ddbin0 -> 181 bytes
-rw-r--r--test/integration_new/stash/rename/expected/repo/.git_keep/objects/fc/66bff0a9fdfe660b6e490dc217a9c26ffc5fffbin0 -> 48 bytes
-rw-r--r--test/integration_new/stash/rename/expected/repo/.git_keep/refs/heads/master1
-rw-r--r--test/integration_new/stash/rename/expected/repo/.git_keep/refs/stash1
23 files changed, 66 insertions, 0 deletions
diff --git a/pkg/integration/components/shell.go b/pkg/integration/components/shell.go
index 5f7fef350..1d8182edb 100644
--- a/pkg/integration/components/shell.go
+++ b/pkg/integration/components/shell.go
@@ -111,3 +111,8 @@ func (s *Shell) CreateNCommits(n int) *Shell {
return s
}
+
+func (s *Shell) StashWithMessage(message string) *Shell {
+ s.RunCommand(fmt.Sprintf(`git stash -m "%s"`, message))
+ return s
+}
diff --git a/pkg/integration/tests/stash/rename.go b/pkg/integration/tests/stash/rename.go
new file mode 100644
index 000000000..97cfae006
--- /dev/null
+++ b/pkg/integration/tests/stash/rename.go
@@ -0,0 +1,33 @@
+package stash
+
+import (
+ "github.com/jesseduffield/lazygit/pkg/config"
+ . "github.com/jesseduffield/lazygit/pkg/integration/components"
+)
+
+var Rename = NewIntegrationTest(NewIntegrationTestArgs{
+ Description: "Try to rename the stash.",
+ ExtraCmdArgs: "",
+ Skip: false,
+ SetupConfig: func(config *config.AppConfig) {},
+ SetupRepo: func(shell *Shell) {
+ shell.
+ EmptyCommit("blah").
+ CreateFileAndAdd("foo", "change to stash").
+ StashWithMessage("bar")
+ },
+ Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
+ input.SwitchToStashWindow()
+ assert.CurrentViewName("stash")
+
+ assert.MatchSelectedLine(Equals("On master: bar"))
+ input.PressKeys(keys.Stash.RenameStash)
+ assert.InPrompt()
+ assert.MatchCurrentViewTitle(Equals("Rename stash: stash@{0}"))
+
+ input.Type(" baz")
+ input.Confirm()
+
+ assert.MatchSelectedLine(Equals("On master: bar baz"))
+ },
+})
diff --git a/pkg/integration/tests/tests.go b/pkg/integration/tests/tests.go
index 21f06a376..6b4583e6d 100644
--- a/pkg/integration/tests/tests.go
+++ b/pkg/integration/tests/tests.go
@@ -16,6 +16,7 @@ import (
"github.com/jesseduffield/lazygit/pkg/integration/tests/commit"
"github.com/jesseduffield/lazygit/pkg/integration/tests/custom_commands"
"github.com/jesseduffield/lazygit/pkg/integration/tests/interactive_rebase"
+ "github.com/jesseduffield/lazygit/pkg/integration/tests/stash"
)
// Here is where we lists the actual tests that will run. When you create a new test,
@@ -38,6 +39,7 @@ var tests = []*components.IntegrationTest{
cherry_pick.CherryPick,
cherry_pick.CherryPickConflicts,
custom_commands.FormPrompts,
+ stash.Rename,
}
func GetTests() []*components.IntegrationTest {
diff --git a/test/integration_new/stash/rename/expected/repo/.git_keep/COMMIT_EDITMSG b/test/integration_new/stash/rename/expected/repo/.git_keep/COMMIT_EDITMSG
new file mode 100644
index 000000000..907b30816
--- /dev/null
+++ b/test/integration_new/stash/rename/expected/repo/.git_keep/COMMIT_EDITMSG
@@ -0,0 +1 @@
+blah
diff --git a/test/integration_new/stash/rename/expected/repo/.git_keep/FETCH_HEAD b/test/integration_new/stash/rename/expected/repo/.git_keep/FETCH_HEAD
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/test/integration_new/stash/rename/expected/repo/.git_keep/FETCH_HEAD
diff --git a/test/integration_new/stash/rename/expected/repo/.git_keep/HEAD b/test/integration_new/stash/rename/expected/repo/.git_keep/HEAD
new file mode 100644
index 000000000..cb089cd89
--- /dev/null
+++ b/test/integration_new/stash/rename/expected/repo/.git_keep/HEAD
@@ -0,0 +1 @@
+ref: refs/heads/master
diff --git a/test/integration_new/stash/rename/expected/repo/.git_keep/ORIG_HEAD b/test/integration_new/stash/rename/expected/repo/.git_keep/ORIG_HEAD
new file mode 100644
index 000000000..4db7189cb
--- /dev/null
+++ b/test/integration_new/stash/rename/expected/repo/.git_keep/ORIG_HEAD
@@ -0,0 +1 @@
+8d4897b3dcbb5c8fbc8fa8439ec7e9627c3159cf
diff --git a/test/integration_new/stash/rename/expected/repo/.git_keep/commit-template.txt b/test/integration_new/stash/rename/expected/repo/.git_keep/commit-template.txt
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/test/integration_new/stash/rename/expected/repo/.git_keep/commit-template.txt
diff --git a/test/integration_new/stash/rename/expected/repo/.git_keep/config b/test/integration_new/stash/rename/expected/repo/.git_keep/config
new file mode 100644
index 000000000..8a748ce32
--- /dev/null
+++ b/test/integration_new/stash/rename/expected/repo/.git_keep/config
@@ -0,0 +1,12 @@
+[core]
+ repositoryformatversion = 0
+ filemode = true
+ bare = false
+ logallrefupdates = true
+ ignorecase = true
+ precomposeunicode = true
+[user]
+ email = CI@example.com
+ name = CI
+[commit]
+ gpgSign = false
diff --git a/test/integration_new/stash/rename/expected/repo/.git_keep/description b/test/integration_new/stash/rename/expected/repo/.git_keep/description
new file mode 100644
index 000000000..498b267a8
--- /dev/null
+++ b/test/integration_new/stash/rename/expected/repo/.git_keep/description
@@ -0,0 +1 @@
+Unnamed repository; edit this file 'description' to name the repository.
diff --git a/test/integration_new/stash/rename/expected/repo/.git_keep/index b/test/integration_new/stash/rename/expected/repo/.git_keep/index
new file mode 100644
index 000000000..65d675154
--- /dev/null
+++ b/test/integration_new/stash/rename/expected/repo/.git_keep/index
Binary files differ
diff --git a/test/integration_new/stash/rename/expected/repo/.git_keep/info/exclude b/test/integration_new/stash/rename/expected/repo/.git_keep/info/exclude
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/test/integration_new/stash/rename/expected/repo/.git_keep/info/exclude
diff --git a/test/integration_new/stash/rename/expected/repo/.git_keep/logs/HEAD b/test/integration_new/stash/rename/expected/repo/.git_keep/logs/HEAD
new file mode 100644
index 000000000..bca9be914
--- /dev/null
+++ b/test/integration_new/stash/rename/expected/repo/.git_keep/logs/HEAD
@@ -0,0 +1,2 @@
+0000000000000000000000000000000000000000 8d4897b3dcbb5c8fbc8fa8439ec7e9627c3159cf CI <CI@example.com> 1665802395 +0900 commit (initial): blah
+8d4897b3dcbb5c8fbc8fa8439ec7e9627c3159cf 8d4897b3dcbb5c8fbc8fa8439ec7e9627c3159cf CI <CI@example.com> 1665802396 +0900 reset: moving to HEAD
diff --git a/test/integration_new/stash/rename/expected/repo/.git_keep/logs/refs/heads/master b/test/integration_new/stash/rename/expected/repo/.git_keep/logs/refs/heads/master
new file mode 100644
index 000000000..698928dd3
--- /dev/null
+++ b/test/integration_new/stash/rename/expected/repo/.git_keep/logs/refs/heads/master
@@ -0,0 +1 @@
+0000000000000000000000000000000000000000 8d4897b3dcbb5c8fbc8fa8439ec7e9627c3159cf CI <CI@example.com> 1665802395 +0900 commit (initial): blah
diff --git a/test/integration_new/stash/rename/expected/repo/.git_keep/logs/refs/stash b/test/integration_new/stash/rename/expected/repo/.git_keep/logs/refs/stash
new file mode 100644
index 000000000..02b7af510
--- /dev/null
+++ b/test/integration_new/stash/rename/expected/repo/.git_keep/logs/refs/stash
@@ -0,0 +1 @@
+0000000000000000000000000000000000000000 c6f35659c0cf57c794d79df88283d7ee933831dd CI <CI@example.com> 1665802399 +0900 On master: bar baz
diff --git a/test/integration_new/stash/rename/expected/repo/.git_keep/objects/25/0122ffb92a8c1c2a6554ce2ac84b49e5f3afe3 b/test/integration_new/stash/rename/expected/repo/.git_keep/objects/25/0122ffb92a8c1c2a6554ce2ac84b49e5f3afe3
new file mode 100644
index 000000000..2a62b4b9d
--- /dev/null
+++ b/test/integration_new/stash/rename/expected/repo/.git_keep/objects/25/0122ffb92a8c1c2a6554ce2ac84b49e5f3afe3
Binary files differ
diff --git a/test/integration_new/stash/rename/expected/repo/.git_keep/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 b/test/integration_new/stash/rename/expected/repo/.git_keep/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904
new file mode 100644
index 000000000..adf64119a
--- /dev/null
+++ b/test/integration_new/stash/rename/expected/repo/.git_keep/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904
Binary files differ
diff --git a/test/integration_new/stash/rename/expected/repo/.git_keep/objects/4d/ff185ecddfb638f76215fa07adde0f4e97da7c b/test/integration_new/stash/rename/expected/repo/.git_keep/objects/4d/ff185ecddfb638f76215fa07adde0f4e97da7c
new file mode 100644
index 000000000..6d964ed92
--- /dev/null
+++ b/test/integration_new/stash/rename/expected/repo/.git_keep/objects/4d/ff185ecddfb638f76215fa07adde0f4e97da7c
@@ -0,0 +1,2 @@
+xA
+0E)f_(1)\yd2Q)x龋לKE@1@TmDi&vUrf ,|j<uNc^IMM%V>e\wxKYn'T&%k͹QEʹ$9`] a4_C^ \ No newline at end of file
diff --git a/test/integration_new/stash/rename/expected/repo/.git_keep/objects/8d/4897b3dcbb5c8fbc8fa8439ec7e9627c3159cf b/test/integration_new/stash/rename/expected/repo/.git_keep/objects/8d/4897b3dcbb5c8fbc8fa8439ec7e9627c3159cf
new file mode 100644
index 000000000..98e81aa49
--- /dev/null
+++ b/test/integration_new/stash/rename/expected/repo/.git_keep/objects/8d/4897b3dcbb5c8fbc8fa8439ec7e9627c3159cf
@@ -0,0 +1,2 @@
+x
+0 a}ɺ4$ "h +Qw烿Z_/p2i)LiFFOd,Qd5wR?}kL3ܧ\߻J`51t~?+ \ No newline at end of file
diff --git a/test/integration_new/stash/rename/expected/repo/.git_keep/objects/c6/f35659c0cf57c794d79df88283d7ee933831dd b/test/integration_new/stash/rename/expected/repo/.git_keep/objects/c6/f35659c0cf57c794d79df88283d7ee933831dd
new file mode 100644
index 000000000..0eda98367
--- /dev/null
+++ b/test/integration_new/stash/rename/expected/repo/.git_keep/objects/c6/f35659c0cf57c794d79df88283d7ee933831dd
Binary files differ
diff --git a/test/integration_new/stash/rename/expected/repo/.git_keep/objects/fc/66bff0a9fdfe660b6e490dc217a9c26ffc5fff b/test/integration_new/stash/rename/expected/repo/.git_keep/objects/fc/66bff0a9fdfe660b6e490dc217a9c26ffc5fff
new file mode 100644
index 000000000..77bae3f92
--- /dev/null
+++ b/test/integration_new/stash/rename/expected/repo/.git_keep/objects/fc/66bff0a9fdfe660b6e490dc217a9c26ffc5fff
Binary files differ
diff --git a/test/integration_new/stash/rename/expected/repo/.git_keep/refs/heads/master b/test/integration_new/stash/rename/expected/repo/.git_keep/refs/heads/master
new file mode 100644
index 000000000..4db7189cb
--- /dev/null
+++ b/test/integration_new/stash/rename/expected/repo/.git_keep/refs/heads/master
@@ -0,0 +1 @@
+8d4897b3dcbb5c8fbc8fa8439ec7e9627c3159cf
diff --git a/test/integration_new/stash/rename/expected/repo/.git_keep/refs/stash b/test/integration_new/stash/rename/expected/repo/.git_keep/refs/stash
new file mode 100644
index 000000000..c467f289e
--- /dev/null
+++ b/test/integration_new/stash/rename/expected/repo/.git_keep/refs/stash
@@ -0,0 +1 @@
+c6f35659c0cf57c794d79df88283d7ee933831dd