From faed509bfd142a93cddf92a8795eaeb7e754b794 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Fri, 12 Aug 2022 09:24:39 +1000 Subject: [PATCH] fix CI --- pkg/gui/services/custom_commands/resolver.go | 8 -------- pkg/integration/components/input.go | 6 +++--- pkg/integration/integration.go | 8 ++++---- pkg/integration/integration_test.go | 1 + pkg/integration/runner/main.go | 1 + pkg/integration/tui/main.go | 18 +----------------- 6 files changed, 10 insertions(+), 32 deletions(-) diff --git a/pkg/gui/services/custom_commands/resolver.go b/pkg/gui/services/custom_commands/resolver.go index 1b80987c1..4702d36c4 100644 --- a/pkg/gui/services/custom_commands/resolver.go +++ b/pkg/gui/services/custom_commands/resolver.go @@ -2,7 +2,6 @@ package custom_commands import ( "bytes" - "fmt" "text/template" "github.com/jesseduffield/lazygit/pkg/common" @@ -106,13 +105,6 @@ func (self *Resolver) resolveMenuOption(option *config.CustomCommandMenuOption, }, nil } -func main() { - fmt.Println(ResolveTemplate("old approach: {{index .PromptResponses 0}}, new approach: {{ .Form.a }}", CustomCommandObject{ - PromptResponses: []string{"a"}, - Form: map[string]string{"a": "B"}, - })) -} - type CustomCommandObject struct { // deprecated. Use Responses instead PromptResponses []string diff --git a/pkg/integration/components/input.go b/pkg/integration/components/input.go index bf52e554c..52d721ff9 100644 --- a/pkg/integration/components/input.go +++ b/pkg/integration/components/input.go @@ -117,9 +117,9 @@ func (self *Input) Log(message string) { // this will look for a list item in the current panel and if it finds it, it will // enter the keypresses required to navigate to it. // The test will fail if: -// - the user is not in a list item -// - no list item is found containing the given text -// - multiple list items are found containing the given text in the initial page of items +// - the user is not in a list item +// - no list item is found containing the given text +// - multiple list items are found containing the given text in the initial page of items // // NOTE: this currently assumes that ViewBufferLines returns all the lines that can be accessed. // If this changes in future, we'll need to update this code to first attempt to find the item diff --git a/pkg/integration/integration.go b/pkg/integration/integration.go index c50594054..f30101e26 100644 --- a/pkg/integration/integration.go +++ b/pkg/integration/integration.go @@ -101,7 +101,7 @@ func RunTests( switch mode { case UPDATE_SNAPSHOT: - if err := updateSnapshot(logf, actualDir, expectedDir); err != nil { + if err := updateSnapshot(actualDir, expectedDir); err != nil { return err } logf("Test passed: %s", test.Name()) @@ -112,7 +112,7 @@ func RunTests( logf("Test passed: %s", test.Name()) case ASK_TO_UPDATE_SNAPSHOT: if _, err := os.Stat(expectedDir); os.IsNotExist(err) { - if err := updateSnapshot(logf, actualDir, expectedDir); err != nil { + if err := updateSnapshot(actualDir, expectedDir); err != nil { return err } logf("No existing snapshot found for %s. Created snapshot.", test.Name()) @@ -125,7 +125,7 @@ func RunTests( // prompt user whether to update the snapshot (Y/N) if promptUserToUpdateSnapshot() { - if err := updateSnapshot(logf, actualDir, expectedDir); err != nil { + if err := updateSnapshot(actualDir, expectedDir); err != nil { return err } logf("Snapshot updated: %s", test.Name()) @@ -153,7 +153,7 @@ func promptUserToUpdateSnapshot() bool { return input == "y" } -func updateSnapshot(logf logf, actualDir string, expectedDir string) error { +func updateSnapshot(actualDir string, expectedDir string) error { // create/update snapshot err := oscommands.CopyDir(actualDir, expectedDir) if err != nil { diff --git a/pkg/integration/integration_test.go b/pkg/integration/integration_test.go index 3637b0a70..0e55f9886 100644 --- a/pkg/integration/integration_test.go +++ b/pkg/integration/integration_test.go @@ -15,6 +15,7 @@ import ( "testing" "github.com/creack/pty" + "github.com/jesseduffield/lazygit/pkg/integration/components" "github.com/stretchr/testify/assert" ) diff --git a/pkg/integration/runner/main.go b/pkg/integration/runner/main.go index 25c0acf8f..97c49440e 100644 --- a/pkg/integration/runner/main.go +++ b/pkg/integration/runner/main.go @@ -7,6 +7,7 @@ import ( "github.com/jesseduffield/generics/slices" "github.com/jesseduffield/lazygit/pkg/integration" + "github.com/jesseduffield/lazygit/pkg/integration/components" ) // see pkg/integration/README.md diff --git a/pkg/integration/tui/main.go b/pkg/integration/tui/main.go index 97aa90c2e..07f136f82 100644 --- a/pkg/integration/tui/main.go +++ b/pkg/integration/tui/main.go @@ -11,6 +11,7 @@ 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/components" "github.com/jesseduffield/lazygit/pkg/secureexec" ) @@ -31,23 +32,6 @@ func (app *App) getCurrentTest() *components.IntegrationTest { return nil } -func (app *App) refreshTests() { - app.loadTests() - app.g.Update(func(*gocui.Gui) error { - listView, err := app.g.View("list") - if err != nil { - return err - } - - listView.Clear() - for _, test := range app.tests { - fmt.Fprintln(listView, test.Name()) - } - - return nil - }) -} - func (app *App) loadTests() { app.tests = integration.Tests if app.itemIdx > len(app.tests)-1 {