Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Apply = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Apply a custom patch", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.NewBranch("branch-a") shell.CreateFileAndAdd("file1", "first line\n") shell.Commit("first commit") shell.NewBranch("branch-b") shell.UpdateFileAndAdd("file1", "first line\nsecond line\n") shell.Commit("update") shell.Checkout("branch-a") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). Lines( Contains("branch-a").IsSelected(), Contains("branch-b"), ). Press(keys.Universal.NextItem). PressEnter() t.Views().SubCommits(). IsFocused(). Lines( Contains("update").IsSelected(), Contains("first commit"), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("M file1").IsSelected(), ). PressPrimaryAction() t.Views().Information().Content(Contains("building patch")) t.Views().PatchBuildingSecondary().Content(Contains("second line")) t.Common().SelectPatchOption(MatchesRegexp(`apply patch$`)) t.Views().Files(). Focus(). Lines( Contains("file1").IsSelected(), ) t.Views().Main(). Content(Contains("second line")) }, })
View Source
var ApplyInReverse = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Apply a custom patch in reverse", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "file1 content\n") shell.CreateFileAndAdd("file2", "file2 content\n") shell.Commit("first commit") }, 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(), Contains("file2"), ). PressPrimaryAction() t.Views().Information().Content(Contains("building patch")) t.Views().PatchBuildingSecondary().Content(Contains("+file1 content")) t.Common().SelectPatchOption(Contains("apply patch in reverse")) t.Views().Files(). Focus(). Lines( Contains("D").Contains("file1").IsSelected(), ) t.Views().Main(). Content(Contains("-file1 content")) }, })
View Source
var ApplyInReverseWithConflict = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Apply a custom patch in reverse, resulting in a conflict", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "file1 content\n") shell.CreateFileAndAdd("file2", "file2 content\n") shell.Commit("first commit") shell.UpdateFileAndAdd("file1", "file1 content\nmore file1 content\n") shell.UpdateFileAndAdd("file2", "file2 content\nmore file2 content\n") shell.Commit("second commit") shell.UpdateFileAndAdd("file1", "file1 content\nmore file1 content\neven more file1\n") shell.Commit("third commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("third commit").IsSelected(), Contains("second commit"), Contains("first commit"), ). NavigateToLine(Contains("second commit")). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("M").Contains("file1").IsSelected(), Contains("M").Contains("file2"), ). PressPrimaryAction(). Tap(func() { t.Views().Information().Content(Contains("building patch")) t.Views().PatchBuildingSecondary().Content( Contains("+more file1 content")) }). SelectNextItem(). PressPrimaryAction() t.Views().PatchBuildingSecondary().Content( Contains("+more file1 content").Contains("+more file2 content")) t.Common().SelectPatchOption(Contains("apply patch in reverse")) t.ExpectPopup().Alert(). Title(Equals("Error")). Content(Contains("Applied patch to 'file1' with conflicts."). Contains("Applied patch to 'file2' cleanly.")). Confirm() t.Views().Files(). Focus(). Lines( Contains("UU").Contains("file1").IsSelected(), ). PressPrimaryAction() t.Views().MergeConflicts(). IsFocused(). ContainsLines( Contains("file1 content"), Contains("<<<<<<< ours").IsSelected(), Contains("more file1 content").IsSelected(), Contains("even more file1").IsSelected(), Contains("=======").IsSelected(), Contains(">>>>>>> theirs"), ). SelectNextItem(). PressPrimaryAction() t.Views().Files(). Focus(). Lines( Contains("M").Contains("file1").IsSelected(), Contains("M").Contains("file2"), ) t.Views().Main(). ContainsLines( Contains(" file1 content"), Contains("-more file1 content"), Contains("-even more file1"), ) }, })
View Source
var CopyPatchToClipboard = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Create a patch from the commits and copy the patch to clipbaord.", ExtraCmdArgs: "", Skip: true, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.NewBranch("branch-a") shell.CreateFileAndAdd("file1", "first line\n") shell.Commit("first commit") shell.NewBranch("branch-b") shell.UpdateFileAndAdd("file1", "first line\nsecond line\n") shell.Commit("update") shell.Checkout("branch-a") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). Lines( Contains("branch-a").IsSelected(), Contains("branch-b"), ). Press(keys.Universal.NextItem). PressEnter(). PressEnter() t.Views(). CommitFiles(). Lines( Contains("M file1").IsSelected(), ). PressPrimaryAction() t.Views().Information().Content(Contains("building patch")) t.Common().SelectPatchOption(Contains("copy patch to clipboard")) t.ExpectToast(Contains("Patch copied to clipboard")) t.ExpectClipboard(Contains("diff --git a/file1 b/file1")) }, })
View Source
var MoveToEarlierCommit = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Move a patch from a commit to an earlier commit", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateDir("dir") shell.CreateFileAndAdd("dir/file1", "file1 content") shell.CreateFileAndAdd("dir/file2", "file2 content") shell.Commit("first commit") shell.CreateFileAndAdd("unrelated-file", "") shell.Commit("destination commit") shell.UpdateFileAndAdd("dir/file1", "file1 content with old changes") shell.DeleteFileAndAdd("dir/file2") shell.CreateFileAndAdd("dir/file3", "file3 content") shell.Commit("commit to move from") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("commit to move from").IsSelected(), Contains("destination commit"), Contains("first commit"), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("dir").IsSelected(), Contains(" M file1"), Contains(" D file2"), Contains(" A file3"), ). PressPrimaryAction(). PressEscape() t.Views().Information().Content(Contains("building patch")) t.Views().Commits(). IsFocused(). SelectNextItem() t.Common().SelectPatchOption(Contains("move patch to selected commit")) t.Views().Commits(). IsFocused(). Lines( Contains("commit to move from"), Contains("destination commit").IsSelected(), Contains("first commit"), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("dir").IsSelected(), Contains(" M file1"), Contains(" D file2"), Contains(" A file3"), Contains("A unrelated-file"), ). PressEscape() t.Views().Commits(). IsFocused(). SelectPreviousItem(). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("(none)"), ) }, })
View Source
var MoveToIndex = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Move a patch from a commit to the index", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "file1 content\n") shell.CreateFileAndAdd("file2", "file2 content\n") shell.Commit("first commit") }, 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(), Contains("file2"), ). PressPrimaryAction() t.Views().Information().Content(Contains("building patch")) t.Views().PatchBuildingSecondary().Content(Contains("+file1 content")) t.Common().SelectPatchOption(Contains("move patch out into index")) t.Views().Files(). Lines( Contains("A").Contains("file1"), ) t.Views().CommitFiles(). IsFocused(). Lines( Contains("file2").IsSelected(), ). PressEscape() t.Views().Main(). Content(Contains("+file2 content")) t.Views().Commits(). Lines( Contains("first commit").IsSelected(), ) t.Views().Files(). Focus() t.Views().Main(). Content(Contains("file1 content")) }, })
View Source
var MoveToIndexPartOfAdjacentAddedLines = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Move a patch from a commit to the index, with only some lines of a range of adjacent added lines in the patch", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "") shell.Commit("first commit") shell.UpdateFileAndAdd("file1", "1st line\n2nd line\n") shell.Commit("commit to move from") shell.UpdateFileAndAdd("unrelated-file", "") shell.Commit("third commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("third commit").IsSelected(), Contains("commit to move from"), Contains("first commit"), ). SelectNextItem(). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file1").IsSelected(), ). PressEnter() t.Views().PatchBuilding(). IsFocused(). PressEnter(). PressPrimaryAction() t.Views().Information().Content(Contains("building patch")) t.Common().SelectPatchOption(Contains("move patch out into index")) t.Views().CommitFiles(). IsFocused(). Lines( Contains("file1").IsSelected(), ). Tap(func() { t.Views().Main(). Content(Contains("+2nd line"). DoesNotContain("1st line")) }) t.Views().Files(). Focus(). ContainsLines( Contains("M").Contains("file1"), ) t.Views().Main(). Content(Contains("+1st line\n 2nd line\n")) }, })
View Source
var MoveToIndexPartial = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Move a patch from a commit to the index. This is different from the MoveToIndex test in that we're only selecting a partial patch from a file", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "first line\nsecond line\nthird line\n") shell.Commit("first commit") shell.UpdateFileAndAdd("file1", "first line2\nsecond line\nthird line2\n") shell.Commit("second commit") shell.CreateFileAndAdd("file2", "file1 content") shell.Commit("third commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("third commit").IsSelected(), Contains("second commit"), Contains("first commit"), ). NavigateToLine(Contains("second commit")). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file1").IsSelected(), ). PressEnter() t.Views().PatchBuilding(). IsFocused(). ContainsLines( Contains(`-first line`).IsSelected(), Contains(`+first line2`), Contains(` second line`), Contains(`-third line`), Contains(`+third line2`), ). PressPrimaryAction(). SelectNextItem(). PressPrimaryAction(). Tap(func() { t.Views().Information().Content(Contains("building patch")) t.Views().PatchBuildingSecondary(). ContainsLines( Contains(`-first line`), Contains(`+first line2`), Contains(` second line`), Contains(` third line`), ) t.Common().SelectPatchOption(Contains("move patch out into index")) t.Views().Files(). Lines( Contains("M").Contains("file1"), ) }) t.Views().CommitFiles(). IsFocused(). Lines( Contains("file1"), ) t.Views().Main(). ContainsLines( Contains(` first line`), Contains(` second line`), Contains(`-third line`), Contains(`+third line2`), ) t.Views().Files(). Focus() t.Views().Main(). ContainsLines( Contains(`-first line`), Contains(`+first line2`), Contains(` second line`), Contains(` third line2`), ) }, })
View Source
var MoveToIndexWithConflict = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Move a patch from a commit to the index, causing a conflict", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "file1 content") shell.Commit("first commit") shell.UpdateFileAndAdd("file1", "file1 content with old changes") shell.Commit("second commit") shell.UpdateFileAndAdd("file1", "file1 content with new changes") shell.Commit("third commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("third commit").IsSelected(), Contains("second commit"), Contains("first commit"), ). SelectNextItem(). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file1").IsSelected(), ). PressPrimaryAction() t.Views().Information().Content(Contains("building patch")) t.Common().SelectPatchOption(Contains("move patch out into index")) t.Common().AcknowledgeConflicts() t.Views().Files(). IsFocused(). Lines( Contains("UU").Contains("file1"), ). PressPrimaryAction() t.Views().MergeConflicts(). IsFocused(). ContainsLines( Contains("<<<<<<< HEAD").IsSelected(), Contains("file1 content").IsSelected(), Contains("=======").IsSelected(), Contains("file1 content with new changes"), Contains(">>>>>>>"), ). PressPrimaryAction() t.Common().ContinueOnConflictsResolved() t.ExpectPopup().Alert(). Title(Equals("Error")). Content(Contains("Applied patch to 'file1' with conflicts")). Confirm() t.Views().Files(). IsFocused(). Lines( Contains("UU").Contains("file1"), ). PressEnter() t.Views().MergeConflicts(). TopLines( Contains("<<<<<<< ours"), Contains("file1 content"), Contains("======="), Contains("file1 content with old changes"), Contains(">>>>>>> theirs"), ). IsFocused() }, })
View Source
var MoveToLaterCommit = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Move a patch from a commit to a later commit", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateDir("dir") shell.CreateFileAndAdd("dir/file1", "file1 content") shell.CreateFileAndAdd("dir/file2", "file2 content") shell.Commit("first commit") shell.UpdateFileAndAdd("dir/file1", "file1 content with old changes") shell.DeleteFileAndAdd("dir/file2") shell.CreateFileAndAdd("dir/file3", "file3 content") shell.Commit("commit to move from") shell.CreateFileAndAdd("unrelated-file", "") shell.Commit("destination commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("destination commit").IsSelected(), Contains("commit to move from"), Contains("first commit"), ). SelectNextItem(). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("dir").IsSelected(), Contains(" M file1"), Contains(" D file2"), Contains(" A file3"), ). PressPrimaryAction(). PressEscape() t.Views().Information().Content(Contains("building patch")) t.Views().Commits(). IsFocused(). SelectPreviousItem() t.Common().SelectPatchOption(Contains("move patch to selected commit")) t.Views().Commits(). IsFocused(). Lines( Contains("destination commit").IsSelected(), Contains("commit to move from"), Contains("first commit"), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("dir").IsSelected(), Contains(" M file1"), Contains(" D file2"), Contains(" A file3"), Contains("A unrelated-file"), ). PressEscape() t.Views().Commits(). IsFocused(). SelectNextItem(). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("(none)"), ) }, })
View Source
var MoveToLaterCommitPartialHunk = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Move a patch from a commit to a later commit, with only parts of a hunk in the patch", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "") shell.Commit("first commit") shell.UpdateFileAndAdd("file1", "1st line\n2nd line\n") shell.Commit("commit to move from") shell.UpdateFileAndAdd("unrelated-file", "") shell.Commit("destination commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("destination commit").IsSelected(), Contains("commit to move from"), Contains("first commit"), ). SelectNextItem(). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file1").IsSelected(), ). PressEnter() t.Views().PatchBuilding(). IsFocused(). PressEnter(). PressPrimaryAction(). PressEscape() t.Views().Information().Content(Contains("building patch")) t.Views().CommitFiles(). IsFocused(). PressEscape() t.Views().Commits(). IsFocused(). SelectPreviousItem() t.Common().SelectPatchOption(Contains("move patch to selected commit")) t.Views().Commits(). IsFocused(). Lines( Contains("destination commit").IsSelected(), Contains("commit to move from"), Contains("first commit"), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file1").IsSelected(), Contains("unrelated-file"), ). Tap(func() { t.Views().Main(). Content(Contains("+1st line\n 2nd line")) }). PressEscape() t.Views().Commits(). IsFocused(). SelectNextItem(). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file1").IsSelected(), ). Tap(func() { t.Views().Main(). Content(Contains("+2nd line"). DoesNotContain("1st line")) }) }, })
View Source
var MoveToNewCommit = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Move a patch from a commit to a new commit", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateDir("dir") shell.CreateFileAndAdd("dir/file1", "file1 content") shell.CreateFileAndAdd("dir/file2", "file2 content") shell.Commit("first commit") shell.UpdateFileAndAdd("dir/file1", "file1 content with old changes") shell.DeleteFileAndAdd("dir/file2") shell.CreateFileAndAdd("dir/file3", "file3 content") shell.Commit("commit to move from") shell.UpdateFileAndAdd("dir/file1", "file1 content with new changes") shell.Commit("third commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("third commit").IsSelected(), Contains("commit to move from"), Contains("first commit"), ). SelectNextItem(). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("dir").IsSelected(), Contains(" M file1"), Contains(" D file2"), Contains(" A file3"), ). PressPrimaryAction(). PressEscape() t.Views().Information().Content(Contains("building patch")) t.Common().SelectPatchOption(Contains("move patch into new commit")) t.Views().Commits(). IsFocused(). Lines( Contains("third commit"), Contains(`Split from "commit to move from"`).IsSelected(), Contains("commit to move from"), Contains("first commit"), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("dir").IsSelected(), Contains(" M file1"), Contains(" D file2"), Contains(" A file3"), ). PressEscape() t.Views().Commits(). IsFocused(). Lines( Contains("third commit"), Contains(`Split from "commit to move from"`).IsSelected(), Contains("commit to move from"), Contains("first commit"), ). SelectNextItem(). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("(none)"), ) }, })
View Source
var MoveToNewCommitPartialHunk = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Move a patch from a commit to a new commit, with only parts of a hunk in the patch", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "") shell.Commit("first commit") shell.UpdateFileAndAdd("file1", "1st line\n2nd line\n") shell.Commit("commit to move from") shell.UpdateFileAndAdd("file1", "1st line\n2nd line\n3rd line\n") shell.Commit("third commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("third commit").IsSelected(), Contains("commit to move from"), Contains("first commit"), ). SelectNextItem(). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file1").IsSelected(), ). PressEnter() t.Views().PatchBuilding(). IsFocused(). PressEnter(). PressPrimaryAction() t.Views().Information().Content(Contains("building patch")) t.Common().SelectPatchOption(Contains("move patch into new commit")) t.Views().CommitFiles(). IsFocused(). Lines( Contains("file1").IsSelected(), ). Tap(func() { t.Views().Main(). Content(Contains("+1st line\n 2nd line")) }). PressEscape() t.Views().Commits(). IsFocused(). Lines( Contains("third commit"), Contains(`Split from "commit to move from"`).IsSelected(), Contains("commit to move from"), Contains("first commit"), ). SelectNextItem(). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file1").IsSelected(), ). Tap(func() { t.Views().Main(). Content(Contains("+2nd line"). DoesNotContain("1st line")) }) }, })
View Source
var RemoveFromCommit = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Remove a custom patch from a commit", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "file1 content\n") shell.CreateFileAndAdd("file2", "file2 content\n") shell.Commit("first commit") }, 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(), Contains("file2"), ). PressPrimaryAction() t.Views().Information().Content(Contains("building patch")) t.Views().PatchBuildingSecondary().Content(Contains("+file1 content")) t.Common().SelectPatchOption(Contains("remove patch from original commit")) t.Views().Files().IsEmpty() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file2").IsSelected(), ). PressEscape() t.Views().Main(). Content(Contains("+file2 content")) t.Views().Commits(). Lines( Contains("first commit").IsSelected(), ) }, })
View Source
var ResetWithEscape = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Reset a custom patch with the escape keybinding", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "file1 content") shell.Commit("first commit") }, 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(). Tap(func() { t.Views().Information().Content(Contains("building patch")) }). PressEscape() t.Views().Commits(). IsFocused(). PressEscape() t.Views().Information().Content(DoesNotContain("building patch")) }, })
View Source
var SelectAllFiles = NewIntegrationTest(NewIntegrationTestArgs{ Description: "All all files of a commit to a custom patch with the 'a' keybinding", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "file1 content") shell.CreateFileAndAdd("file2", "file2 content") shell.CreateFileAndAdd("file3", "file3 content") shell.Commit("first commit") }, 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(), Contains("file2"), Contains("file3"), ). Press(keys.Files.ToggleStagedAll) t.Views().Information().Content(Contains("building patch")) t.Views().Secondary().Content( Contains("file1").Contains("file3").Contains("file3"), ) }, })
View Source
var SpecificSelection = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Build a custom patch with a specific selection of lines, adding individual lines, as well as a range and hunk, and adding a file directly", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("hunk-file", "1a\n1b\n1c\n1d\n1e\n1f\n1g\n1h\n1i\n1j\n1k\n1l\n1m\n1n\n1o\n1p\n1q\n1r\n1s\n1t\n1u\n1v\n1w\n1x\n1y\n1z\n") shell.Commit("first commit") shell.UpdateFileAndAdd("hunk-file", "aa\n1b\ncc\n1d\n1e\n1f\n1g\n1h\n1i\n1j\n1k\n1l\n1m\n1n\n1o\n1p\n1q\n1r\n1s\ntt\nuu\nvv\n1w\n1x\n1y\n1z\n") shell.CreateFileAndAdd("line-file", "2a\n2b\n2c\n2d\n2e\n2f\n2g\n2h\n2i\n2j\n2k\n2l\n2m\n2n\n2o\n2p\n2q\n2r\n2s\n2t\n2u\n2v\n2w\n2x\n2y\n2z\n") shell.CreateFileAndAdd("direct-file", "direct file content") shell.Commit("second commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("second commit").IsSelected(), Contains("first commit"), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("direct-file").IsSelected(), Contains("hunk-file"), Contains("line-file"), ). PressPrimaryAction(). Tap(func() { t.Views().Information().Content(Contains("building patch")) t.Views().Secondary().Content(Contains("direct file content")) }). NavigateToLine(Contains("hunk-file")). PressEnter() t.Views().PatchBuilding(). IsFocused(). SelectedLines( Contains("-1a"), ). Press(keys.Main.ToggleSelectHunk). SelectedLines( Contains(`@@ -1,6 +1,6 @@`), Contains(`-1a`), Contains(`+aa`), Contains(` 1b`), Contains(`-1c`), Contains(`+cc`), Contains(` 1d`), Contains(` 1e`), Contains(` 1f`), ). PressPrimaryAction(). SelectedLines( Contains(`@@ -1,6 +1,6 @@`), Contains(`-1a`), Contains(`+aa`), Contains(` 1b`), Contains(`-1c`), Contains(`+cc`), Contains(` 1d`), Contains(` 1e`), Contains(` 1f`), ). Tap(func() { t.Views().Information().Content(Contains("building patch")) t.Views().Secondary().Content( DoesNotContain("direct file content"). Contains("@@ -1,6 +1,6 @@"). Contains(" 1f"), ) }). PressEscape() t.Views().CommitFiles(). IsFocused(). NavigateToLine(Contains("line-file")). PressEnter() t.Views().PatchBuilding(). IsFocused(). ContainsLines( Contains("@@ -0,0 +1,26 @@").IsSelected(), ). Press(keys.Main.ToggleSelectHunk). SelectedLines( Contains("+2a"), ). PressPrimaryAction(). NavigateToLine(Contains("+2c")). Press(keys.Main.ToggleDragSelect). NavigateToLine(Contains("+2e")). PressPrimaryAction(). NavigateToLine(Contains("+2g")). PressPrimaryAction(). Tap(func() { t.Views().Information().Content(Contains("building patch")) t.Views().Secondary().ContainsLines( Contains("+2a"), Contains("+2c"), Contains("+2d"), Contains("+2e"), Contains("+2g"), ) }). PressEscape(). Tap(func() { t.Views().Secondary().ContainsLines( Contains(`diff --git a/direct-file b/direct-file`), Contains(`new file mode 100644`), Contains(`index`), Contains(`--- /dev/null`), Contains(`+++ b/direct-file`), Contains(`@@ -0,0 +1 @@`), Contains(`+direct file content`), Contains(`\ No newline at end of file`), Contains(`diff --git a/hunk-file b/hunk-file`), Contains(`index`), Contains(`--- a/hunk-file`), Contains(`+++ b/hunk-file`), Contains(`@@ -1,6 +1,6 @@`), Contains(`-1a`), Contains(`+aa`), Contains(` 1b`), Contains(`-1c`), Contains(`+cc`), Contains(` 1d`), Contains(` 1e`), Contains(` 1f`), Contains(`diff --git a/line-file b/line-file`), Contains(`new file mode 100644`), Contains(`index`), Contains(`--- /dev/null`), Contains(`+++ b/line-file`), Contains(`@@ -0,0 +1,5 @@`), Contains(`+2a`), Contains(`+2c`), Contains(`+2d`), Contains(`+2e`), Contains(`+2g`), ) }) }, })
View Source
var StartNewPatch = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Attempt to add a file from another commit to a patch, then agree to start a new patch", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "file1 content") shell.Commit("first commit") shell.CreateFileAndAdd("file2", "file2 content") shell.Commit("second commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("second commit").IsSelected(), Contains("first commit"), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file2").IsSelected(), ). PressPrimaryAction(). Tap(func() { t.Views().Information().Content(Contains("building patch")) t.Views().Secondary().Content(Contains("file2")) }). PressEscape() t.Views().Commits(). IsFocused(). NavigateToLine(Contains("first commit")). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file1").IsSelected(), ). PressPrimaryAction(). Tap(func() { t.ExpectPopup().Confirmation(). Title(Contains("Discard Patch")). Content(Contains("You can only build a patch from one commit/stash-entry at a time. Discard current patch?")). Confirm() t.Views().Secondary().Content(Contains("file1").DoesNotContain("file2")) }) }, })
Functions ¶
This section is empty.
Types ¶
This section is empty.
Source Files ¶
- apply.go
- apply_in_reverse.go
- apply_in_reverse_with_conflict.go
- copy_patch_to_clipboard.go
- move_to_earlier_commit.go
- move_to_index.go
- move_to_index_part_of_adjacent_added_lines.go
- move_to_index_partial.go
- move_to_index_with_conflict.go
- move_to_later_commit.go
- move_to_later_commit_partial_hunk.go
- move_to_new_commit.go
- move_to_new_commit_partial_hunk.go
- remove_from_commit.go
- reset_with_escape.go
- select_all_files.go
- specific_selection.go
- start_new_patch.go
Click to show internal directories.
Click to hide internal directories.