1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-17 00:18:05 +02:00

suggest files when picking a path to filter on

async fetching of suggestions

remove limit

cache the trie for future use

more

more
This commit is contained in:
Jesse Duffield
2021-10-18 19:00:03 +11:00
parent a496858c62
commit ca7252ef8e
54 changed files with 4615 additions and 17 deletions

View File

@ -0,0 +1,44 @@
package tasks
import (
"fmt"
"sync"
"testing"
"github.com/stretchr/testify/assert"
)
func TestAsyncHandler(t *testing.T) {
wg := sync.WaitGroup{}
wg.Add(2)
handler := NewAsyncHandler()
handler.onReject = func() {
wg.Done()
}
result := 0
wg2 := sync.WaitGroup{}
wg2.Add(1)
handler.Do(func() func() {
wg2.Wait()
return func() {
fmt.Println("setting to 1")
result = 1
}
})
handler.Do(func() func() {
return func() {
fmt.Println("setting to 2")
result = 2
wg.Done()
wg2.Done()
}
})
wg.Wait()
assert.EqualValues(t, 2, result)
}