summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-08-09 20:27:44 +1000
committerJesse Duffield <jessedduffield@gmail.com>2022-08-13 13:51:56 +1000
commit46ae55f91e4feab67b01fcd63631dbaf47b3665f (patch)
tree175da9f1489b78c0335107b0ba8d90909a346924 /test
parent225c563c630e8771c2c6741c78e8a427b3283f58 (diff)
introduce gui adapter
Diffstat (limited to 'test')
-rw-r--r--test/runner/main.go26
-rw-r--r--test/runner_old/main.go (renamed from test/runner_new/main.go)25
2 files changed, 26 insertions, 25 deletions
diff --git a/test/runner/main.go b/test/runner/main.go
index ea6af59e8..691f0de4f 100644
--- a/test/runner/main.go
+++ b/test/runner/main.go
@@ -8,11 +8,11 @@ import (
"testing"
"github.com/jesseduffield/lazygit/pkg/integration"
+ "github.com/jesseduffield/lazygit/pkg/integration/integration_tests"
+ "github.com/jesseduffield/lazygit/pkg/integration/types"
"github.com/stretchr/testify/assert"
)
-// Deprecated: This file is part of the old way of doing things. See test/runner_new/main.go for the new way
-
// see docs/Integration_Tests.md
// This file can be invoked directly, but you might find it easier to go through
// test/lazyintegration/main.go, which provides a convenient gui wrapper to integration tests.
@@ -23,15 +23,28 @@ import (
func main() {
mode := integration.GetModeFromEnv()
- speedEnv := os.Getenv("SPEED")
includeSkipped := os.Getenv("INCLUDE_SKIPPED") == "true"
selectedTestName := os.Args[1]
- err := integration.RunTests(
+ // check if our given test name actually exists
+ if selectedTestName != "" {
+ found := false
+ for _, test := range integration_tests.Tests {
+ if test.Name() == selectedTestName {
+ found = true
+ break
+ }
+ }
+ if !found {
+ log.Fatalf("test %s not found. Perhaps you forgot to add it to `pkg/integration/integration_tests/tests.go`?", selectedTestName)
+ }
+ }
+
+ err := integration.RunTestsNew(
log.Printf,
runCmdInTerminal,
- func(test *integration.Test, f func(*testing.T) error) {
- if selectedTestName != "" && test.Name != selectedTestName {
+ func(test types.Test, f func(*testing.T) error) {
+ if selectedTestName != "" && test.Name() != selectedTestName {
return
}
if err := f(nil); err != nil {
@@ -39,7 +52,6 @@ func main() {
}
},
mode,
- speedEnv,
func(_t *testing.T, expected string, actual string, prefix string) { //nolint:thelper
assert.Equal(MockTestingT{}, expected, actual, fmt.Sprintf("Unexpected %s. Expected:\n%s\nActual:\n%s\n", prefix, expected, actual))
},
diff --git a/test/runner_new/main.go b/test/runner_old/main.go
index 19a5dba03..ea6af59e8 100644
--- a/test/runner_new/main.go
+++ b/test/runner_old/main.go
@@ -8,10 +8,11 @@ import (
"testing"
"github.com/jesseduffield/lazygit/pkg/integration"
- "github.com/jesseduffield/lazygit/pkg/integration/types"
"github.com/stretchr/testify/assert"
)
+// Deprecated: This file is part of the old way of doing things. See test/runner_new/main.go for the new way
+
// see docs/Integration_Tests.md
// This file can be invoked directly, but you might find it easier to go through
// test/lazyintegration/main.go, which provides a convenient gui wrapper to integration tests.
@@ -22,28 +23,15 @@ import (
func main() {
mode := integration.GetModeFromEnv()
+ speedEnv := os.Getenv("SPEED")
includeSkipped := os.Getenv("INCLUDE_SKIPPED") == "true"
selectedTestName := os.Args[1]
- // check if our given test name actually exists
- if selectedTestName != "" {
- found := false
- for _, test := range integration.Tests {
- if test.Name() == selectedTestName {
- found = true
- break
- }
- }
- if !found {
- log.Fatalf("test %s not found. Perhaps you forgot to add it to `pkg/integration/integration_tests/tests.go`?", selectedTestName)
- }
- }
-
- err := integration.RunTestsNew(
+ err := integration.RunTests(
log.Printf,
runCmdInTerminal,
- func(test types.Test, f func(*testing.T) error) {
- if selectedTestName != "" && test.Name() != selectedTestName {
+ func(test *integration.Test, f func(*testing.T) error) {
+ if selectedTestName != "" && test.Name != selectedTestName {
return
}
if err := f(nil); err != nil {
@@ -51,6 +39,7 @@ func main() {
}
},
mode,
+ speedEnv,
func(_t *testing.T, expected string, actual string, prefix string) { //nolint:thelper
assert.Equal(MockTestingT{}, expected, actual, fmt.Sprintf("Unexpected %s. Expected:\n%s\nActual:\n%s\n", prefix, expected, actual))
},