Fix tests

This commit is contained in:
Anton Medvedev 2023-09-15 09:16:36 +02:00
parent 91cfbb11cc
commit 2c634b27d1
No known key found for this signature in database
3 changed files with 8 additions and 6 deletions

View File

@ -129,7 +129,7 @@ func main() {
fileName: fileName, fileName: fileName,
digInput: digInput, digInput: digInput,
searchInput: searchInput, searchInput: searchInput,
search: NewSearch(), search: newSearch(),
} }
p := tea.NewProgram(m, tea.WithAltScreen(), tea.WithMouseCellMotion()) p := tea.NewProgram(m, tea.WithAltScreen(), tea.WithMouseCellMotion())
@ -714,7 +714,7 @@ func (m *model) dig(value string) *node {
} }
func (m *model) doSearch(s string) { func (m *model) doSearch(s string) {
m.search = NewSearch() m.search = newSearch()
if s == "" { if s == "" {
return return

View File

@ -29,9 +29,11 @@ func TestOutput(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
m := &model{ m := &model{
top: head, top: head,
head: head, head: head,
wrap: true, wrap: true,
showCursor: true,
search: newSearch(),
} }
tm := teatest.NewTestModel( tm := teatest.NewTestModel(
t, m, t, m,

View File

@ -8,7 +8,7 @@ type search struct {
keys map[*node][]match keys map[*node][]match
} }
func NewSearch() *search { func newSearch() *search {
return &search{ return &search{
results: make([]*node, 0), results: make([]*node, 0),
values: make(map[*node][]match), values: make(map[*node][]match),