summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-08-12 09:19:39 +1000
committerJesse Duffield <jessedduffield@gmail.com>2022-08-13 13:55:17 +1000
commitb8d944399901685e5edc1bded23457db0dd283c5 (patch)
treea3af791e513fc1aa55bd001490625cf937ca1ea2
parentde84b6c4b94c3b97be97b1ccccf653cd366fb8b4 (diff)
rename helpers to components
-rw-r--r--pkg/integration/components/assert.go (renamed from pkg/integration/helpers/assert.go)2
-rw-r--r--pkg/integration/components/input.go (renamed from pkg/integration/helpers/input.go)2
-rw-r--r--pkg/integration/components/shell.go (renamed from pkg/integration/helpers/shell.go)2
-rw-r--r--pkg/integration/components/test.go (renamed from pkg/integration/helpers/test.go)2
-rw-r--r--pkg/integration/integration.go10
-rw-r--r--pkg/integration/integration_test.go3
-rw-r--r--pkg/integration/runner/main.go7
-rw-r--r--pkg/integration/tests/branch/suggestions.go8
-rw-r--r--pkg/integration/tests/commit/commit.go8
-rw-r--r--pkg/integration/tests/commit/new_branch.go8
-rw-r--r--pkg/integration/tests/interactive_rebase/one.go8
-rw-r--r--pkg/integration/tests/tests.go4
-rw-r--r--pkg/integration/tui/main.go5
13 files changed, 33 insertions, 36 deletions
diff --git a/pkg/integration/helpers/assert.go b/pkg/integration/components/assert.go
index 41b280bcb..11048532d 100644
--- a/pkg/integration/helpers/assert.go
+++ b/pkg/integration/components/assert.go
@@ -1,4 +1,4 @@
-package helpers
+package components
import (
"fmt"
diff --git a/pkg/integration/helpers/input.go b/pkg/integration/components/input.go
index 55e1f8527..bf52e554c 100644
--- a/pkg/integration/helpers/input.go
+++ b/pkg/integration/components/input.go
@@ -1,4 +1,4 @@
-package helpers
+package components
import (
"fmt"
diff --git a/pkg/integration/helpers/shell.go b/pkg/integration/components/shell.go
index b70a8ffaa..ee57cf401 100644
--- a/pkg/integration/helpers/shell.go
+++ b/pkg/integration/components/shell.go
@@ -1,4 +1,4 @@
-package helpers
+package components
import (
"fmt"
diff --git a/pkg/integration/helpers/test.go b/pkg/integration/components/test.go
index fb876be7f..13ffe73f1 100644
--- a/pkg/integration/helpers/test.go
+++ b/pkg/integration/components/test.go
@@ -1,4 +1,4 @@
-package helpers
+package components
import (
"os"
diff --git a/pkg/integration/integration.go b/pkg/integration/integration.go
index 6227649e6..c50594054 100644
--- a/pkg/integration/integration.go
+++ b/pkg/integration/integration.go
@@ -12,7 +12,7 @@ import (
"github.com/jesseduffield/generics/slices"
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
- "github.com/jesseduffield/lazygit/pkg/integration/helpers"
+ "github.com/jesseduffield/lazygit/pkg/integration/components"
"github.com/jesseduffield/lazygit/pkg/integration/tests"
"github.com/stretchr/testify/assert"
)
@@ -45,7 +45,7 @@ type (
func RunTests(
logf logf,
runCmd func(cmd *exec.Cmd) error,
- fnWrapper func(test *helpers.IntegrationTest, f func() error),
+ fnWrapper func(test *components.IntegrationTest, f func() error),
mode Mode,
includeSkipped bool,
) error {
@@ -229,12 +229,12 @@ func compareSnapshots(logf logf, configDir string, actualDir string, expectedDir
return nil
}
-func createFixture(test *helpers.IntegrationTest, actualDir string, rootDir string) error {
+func createFixture(test *components.IntegrationTest, actualDir string, rootDir string) error {
if err := os.Chdir(actualDir); err != nil {
panic(err)
}
- shell := helpers.NewShell()
+ shell := components.NewShell()
shell.RunCommand("git init")
shell.RunCommand(`git config user.email "CI@example.com"`)
shell.RunCommand(`git config user.name "CI"`)
@@ -249,7 +249,7 @@ func createFixture(test *helpers.IntegrationTest, actualDir string, rootDir stri
return nil
}
-func getLazygitCommand(test *helpers.IntegrationTest, testPath string, rootDir string) (*exec.Cmd, error) {
+func getLazygitCommand(test *components.IntegrationTest, testPath string, rootDir string) (*exec.Cmd, error) {
osCommand := oscommands.NewDummyOSCommand()
templateConfigDir := filepath.Join(rootDir, "test", "default_test_config")
diff --git a/pkg/integration/integration_test.go b/pkg/integration/integration_test.go
index 2c59b94df..3637b0a70 100644
--- a/pkg/integration/integration_test.go
+++ b/pkg/integration/integration_test.go
@@ -15,7 +15,6 @@ import (
"testing"
"github.com/creack/pty"
- "github.com/jesseduffield/lazygit/pkg/integration/helpers"
"github.com/stretchr/testify/assert"
)
@@ -34,7 +33,7 @@ func TestIntegration(t *testing.T) {
err := RunTests(
t.Logf,
runCmdHeadless,
- func(test *helpers.IntegrationTest, f func() error) {
+ func(test *components.IntegrationTest, f func() error) {
defer func() { testNumber += 1 }()
if testNumber%parallelTotal != parallelIndex {
return
diff --git a/pkg/integration/runner/main.go b/pkg/integration/runner/main.go
index 820df712a..25c0acf8f 100644
--- a/pkg/integration/runner/main.go
+++ b/pkg/integration/runner/main.go
@@ -7,7 +7,6 @@ import (
"github.com/jesseduffield/generics/slices"
"github.com/jesseduffield/lazygit/pkg/integration"
- "github.com/jesseduffield/lazygit/pkg/integration/helpers"
)
// see pkg/integration/README.md
@@ -17,7 +16,7 @@ import (
func main() {
mode := integration.GetModeFromEnv()
includeSkipped := os.Getenv("INCLUDE_SKIPPED") == "true"
- var testsToRun []*helpers.IntegrationTest
+ var testsToRun []*components.IntegrationTest
if len(os.Args) > 1 {
outer:
@@ -35,14 +34,14 @@ func main() {
testsToRun = integration.Tests
}
- testNames := slices.Map(testsToRun, func(test *helpers.IntegrationTest) string {
+ testNames := slices.Map(testsToRun, func(test *components.IntegrationTest) string {
return test.Name()
})
err := integration.RunTests(
log.Printf,
runCmdInTerminal,
- func(test *helpers.IntegrationTest, f func() error) {
+ func(test *components.IntegrationTest, f func() error) {
if !slices.Contains(testNames, test.Name()) {
return
}
diff --git a/pkg/integration/tests/branch/suggestions.go b/pkg/integration/tests/branch/suggestions.go
index 33d0cf316..2bd4fa340 100644
--- a/pkg/integration/tests/branch/suggestions.go
+++ b/pkg/integration/tests/branch/suggestions.go
@@ -2,15 +2,15 @@ package branch
import (
"github.com/jesseduffield/lazygit/pkg/config"
- "github.com/jesseduffield/lazygit/pkg/integration/helpers"
+ "github.com/jesseduffield/lazygit/pkg/integration/components"
)
-var Suggestions = helpers.NewIntegrationTest(helpers.NewIntegrationTestArgs{
+var Suggestions = components.NewIntegrationTest(components.NewIntegrationTestArgs{
Description: "Checking out a branch with name suggestions",
ExtraCmdArgs: "",
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
- SetupRepo: func(shell *helpers.Shell) {
+ SetupRepo: func(shell *components.Shell) {
shell.
EmptyCommit("my commit message").
NewBranch("new-branch").
@@ -20,7 +20,7 @@ var Suggestions = helpers.NewIntegrationTest(helpers.NewIntegrationTestArgs{
NewBranch("other-new-branch-2").
NewBranch("other-new-branch-3")
},
- Run: func(shell *helpers.Shell, input *helpers.Input, assert *helpers.Assert, keys config.KeybindingConfig) {
+ Run: func(shell *components.Shell, input *components.Input, assert *components.Assert, keys config.KeybindingConfig) {
input.SwitchToBranchesWindow()
input.PressKeys(keys.Branches.CheckoutBranchByName)
diff --git a/pkg/integration/tests/commit/commit.go b/pkg/integration/tests/commit/commit.go
index bbdcf5278..12a68925d 100644
--- a/pkg/integration/tests/commit/commit.go
+++ b/pkg/integration/tests/commit/commit.go
@@ -2,19 +2,19 @@ package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
- "github.com/jesseduffield/lazygit/pkg/integration/helpers"
+ "github.com/jesseduffield/lazygit/pkg/integration/components"
)
-var Commit = helpers.NewIntegrationTest(helpers.NewIntegrationTestArgs{
+var Commit = components.NewIntegrationTest(components.NewIntegrationTestArgs{
Description: "Staging a couple files and committing",
ExtraCmdArgs: "",
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
- SetupRepo: func(shell *helpers.Shell) {
+ SetupRepo: func(shell *components.Shell) {
shell.CreateFile("myfile", "myfile content")
shell.CreateFile("myfile2", "myfile2 content")
},
- Run: func(shell *helpers.Shell, input *helpers.Input, assert *helpers.Assert, keys config.KeybindingConfig) {
+ Run: func(shell *components.Shell, input *components.Input, assert *components.Assert, keys config.KeybindingConfig) {
assert.CommitCount(0)
input.Select()
diff --git a/pkg/integration/tests/commit/new_branch.go b/pkg/integration/tests/commit/new_branch.go
index 419da6890..ad96938f5 100644
--- a/pkg/integration/tests/commit/new_branch.go
+++ b/pkg/integration/tests/commit/new_branch.go
@@ -2,21 +2,21 @@ package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
- "github.com/jesseduffield/lazygit/pkg/integration/helpers"
+ "github.com/jesseduffield/lazygit/pkg/integration/components"
)
-var NewBranch = helpers.NewIntegrationTest(helpers.NewIntegrationTestArgs{
+var NewBranch = components.NewIntegrationTest(components.NewIntegrationTestArgs{
Description: "Creating a new branch from a commit",
ExtraCmdArgs: "",
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
- SetupRepo: func(shell *helpers.Shell) {
+ SetupRepo: func(shell *components.Shell) {
shell.
EmptyCommit("commit 1").
EmptyCommit("commit 2").
EmptyCommit("commit 3")
},
- Run: func(shell *helpers.Shell, input *helpers.Input, assert *helpers.Assert, keys config.KeybindingConfig) {
+ Run: func(shell *components.Shell, input *components.Input, assert *components.Assert, keys config.KeybindingConfig) {
assert.CommitCount(3)
input.SwitchToCommitsWindow()
diff --git a/pkg/integration/tests/interactive_rebase/one.go b/pkg/integration/tests/interactive_rebase/one.go
index 69332c7de..3c785a727 100644
--- a/pkg/integration/tests/interactive_rebase/one.go
+++ b/pkg/integration/tests/interactive_rebase/one.go
@@ -2,19 +2,19 @@ package interactive_rebase
import (
"github.com/jesseduffield/lazygit/pkg/config"
- "github.com/jesseduffield/lazygit/pkg/integration/helpers"
+ "github.com/jesseduffield/lazygit/pkg/integration/components"
)
-var One = helpers.NewIntegrationTest(helpers.NewIntegrationTestArgs{
+var One = components.NewIntegrationTest(components.NewIntegrationTestArgs{
Description: "Begins an interactive rebase, then fixups, drops, and squashes some commits",
ExtraCmdArgs: "",
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
- SetupRepo: func(shell *helpers.Shell) {
+ SetupRepo: func(shell *components.Shell) {
shell.
CreateNCommits(5) // these will appears at commit 05, 04, 04, down to 01
},
- Run: func(shell *helpers.Shell, input *helpers.Input, assert *helpers.Assert, keys config.KeybindingConfig) {
+ Run: func(shell *components.Shell, input *components.Input, assert *components.Assert, keys config.KeybindingConfig) {
input.SwitchToCommitsWindow()
assert.CurrentViewName("commits")
diff --git a/pkg/integration/tests/tests.go b/pkg/integration/tests/tests.go
index dbd44470d..e9794169a 100644
--- a/pkg/integration/tests/tests.go
+++ b/pkg/integration/tests/tests.go
@@ -1,7 +1,7 @@
package tests
import (
- "github.com/jesseduffield/lazygit/pkg/integration/helpers"
+ "github.com/jesseduffield/lazygit/pkg/integration/components"
"github.com/jesseduffield/lazygit/pkg/integration/tests/branch"
"github.com/jesseduffield/lazygit/pkg/integration/tests/commit"
"github.com/jesseduffield/lazygit/pkg/integration/tests/interactive_rebase"
@@ -10,7 +10,7 @@ import (
// Here is where we lists the actual tests that will run. When you create a new test,
// be sure to add it to this list.
-var Tests = []*helpers.IntegrationTest{
+var Tests = []*components.IntegrationTest{
commit.Commit,
commit.NewBranch,
branch.Suggestions,
diff --git a/pkg/integration/tui/main.go b/pkg/integration/tui/main.go
index 8b00c4951..97aa90c2e 100644
--- a/pkg/integration/tui/main.go
+++ b/pkg/integration/tui/main.go
@@ -11,21 +11,20 @@ import (
"github.com/jesseduffield/lazygit/pkg/gui"
"github.com/jesseduffield/lazygit/pkg/gui/style"
"github.com/jesseduffield/lazygit/pkg/integration"
- "github.com/jesseduffield/lazygit/pkg/integration/helpers"
"github.com/jesseduffield/lazygit/pkg/secureexec"
)
// this program lets you manage integration tests in a TUI. See pkg/integration/README.md for more info.
type App struct {
- tests []*helpers.IntegrationTest
+ tests []*components.IntegrationTest
itemIdx int
testDir string
filtering bool
g *gocui.Gui
}
-func (app *App) getCurrentTest() *helpers.IntegrationTest {
+func (app *App) getCurrentTest() *components.IntegrationTest {
if len(app.tests) > 0 {
return app.tests[app.itemIdx]
}