mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 04:15:48 +02:00
fix CI
This commit is contained in:
parent
b8d9443999
commit
faed509bfd
6 changed files with 10 additions and 32 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -15,6 +15,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/creack/pty"
|
||||
"github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue