summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Haller <stefan@haller-berlin.de>2024-02-18 15:21:13 +0100
committerStefan Haller <stefan@haller-berlin.de>2024-02-18 15:24:09 +0100
commit236f42879ce9174600c9944f136e0fe266287413 (patch)
treeff71e43fdf84b59c3efc83b291a955ae5a88f76d
parentd329c9255436316869560d2d96766bc62453d8c2 (diff)
Add integration test
The test would fail without the fixes in the previous commits; even if only one of the configs is set.
-rw-r--r--pkg/integration/tests/patch_building/move_to_index_works_even_if_noprefix_is_set.go50
-rw-r--r--pkg/integration/tests/test_list.go1
2 files changed, 51 insertions, 0 deletions
diff --git a/pkg/integration/tests/patch_building/move_to_index_works_even_if_noprefix_is_set.go b/pkg/integration/tests/patch_building/move_to_index_works_even_if_noprefix_is_set.go
new file mode 100644
index 000000000..391223c60
--- /dev/null
+++ b/pkg/integration/tests/patch_building/move_to_index_works_even_if_noprefix_is_set.go
@@ -0,0 +1,50 @@
+package patch_building
+
+import (
+ "github.com/jesseduffield/lazygit/pkg/config"
+ . "github.com/jesseduffield/lazygit/pkg/integration/components"
+)
+
+var MoveToIndexWorksEvenIfNoprefixIsSet = NewIntegrationTest(NewIntegrationTestArgs{
+ Description: "Moving a patch to the index works even if diff.noprefix or diff.external are set",
+ ExtraCmdArgs: []string{},
+ Skip: false,
+ SetupConfig: func(config *config.AppConfig) {},
+ SetupRepo: func(shell *Shell) {
+ shell.CreateFileAndAdd("file1", "file1 content\n")
+ shell.Commit("first commit")
+
+ // Test that this works even if custom diff options are set
+ shell.SetConfig("diff.noprefix", "true")
+ shell.SetConfig("diff.external", "echo")
+ },
+ Run: func(t *TestDriver, keys config.KeybindingConfig) {
+ t.Views().Commits().
+ Focus().
+ Lines(
+ Contains("first commit").IsSelected(),
+ ).
+ PressEnter()
+
+ t.Views().CommitFiles().
+ IsFocused().
+ Lines(
+ Contains("file1").IsSelected(),
+ ).
+ PressPrimaryAction()
+
+ t.Views().PatchBuildingSecondary().Content(Contains("+file1 content"))
+
+ t.Common().SelectPatchOption(Contains("Move patch out into index"))
+
+ t.Views().CommitFiles().IsFocused().
+ Lines(
+ Equals("(none)"),
+ )
+
+ t.Views().Files().
+ Lines(
+ Contains("A").Contains("file1"),
+ )
+ },
+})
diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go
index 3abc41853..b770b953d 100644
--- a/pkg/integration/tests/test_list.go
+++ b/pkg/integration/tests/test_list.go
@@ -204,6 +204,7 @@ var tests = []*components.IntegrationTest{
patch_building.MoveToIndexPartOfAdjacentAddedLines,
patch_building.MoveToIndexPartial,
patch_building.MoveToIndexWithConflict,
+ patch_building.MoveToIndexWorksEvenIfNoprefixIsSet,
patch_building.MoveToLaterCommit,
patch_building.MoveToLaterCommitPartialHunk,
patch_building.MoveToNewCommit,