Skip to content

Commit

Permalink
make more stable
Browse files Browse the repository at this point in the history
  • Loading branch information
tjmtmmnk committed Nov 30, 2020
1 parent 7e24714 commit f6c262a
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions fuzzyfinder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,7 @@ func TestFind(t *testing.T) {
}...)...)},
}

var seqMutex sync.Mutex
for name, c := range cases {
seqMutex.Lock()
t.Run(name, func(t *testing.T) {
events := c.events

Expand All @@ -207,12 +205,12 @@ func TestFind(t *testing.T) {
t.Fatalf("Find must return ErrAbort, but got '%s'", err)
}

time.Sleep(4000 * time.Millisecond)
res := term.GetResult()
term.Screen().Fini()
return res
})
})
seqMutex.Unlock()
}
}

Expand Down Expand Up @@ -247,6 +245,7 @@ func TestFind_hotReload(t *testing.T) {
t.Fatalf("Find must return ErrAbort, but got '%s'", err)
}

time.Sleep(2000 * time.Millisecond)
res := term.GetResult()
term.Screen().Fini()
return res
Expand All @@ -258,8 +257,16 @@ func TestFind_enter(t *testing.T) {
events []tcell.Event
expected int
}{
"initial": {events: keys(input{tcell.KeyTab, rune(tcell.KeyTab), tcell.ModNone}), expected: 0},
"mode smart to case-sensitive": {events: runes("CHI"), expected: 7},
"initial": {events: keys(input{tcell.KeyTab, rune(tcell.KeyTab), tcell.ModNone}), expected: 0},
"mode smart to case-sensitive": {events: append(runes("JI"), keys([]input{
{tcell.KeyTab, rune(tcell.KeyTab), tcell.ModNone}, // tab earn time for filter
{tcell.KeyTab, rune(tcell.KeyTab), tcell.ModNone},
{tcell.KeyTab, rune(tcell.KeyTab), tcell.ModNone},
{tcell.KeyTab, rune(tcell.KeyTab), tcell.ModNone},
{tcell.KeyTab, rune(tcell.KeyTab), tcell.ModNone},
{tcell.KeyTab, rune(tcell.KeyTab), tcell.ModNone},
{tcell.KeyTab, rune(tcell.KeyTab), tcell.ModNone},
}...)...), expected: 7},
}

for name, c := range cases {
Expand All @@ -277,6 +284,7 @@ func TestFind_enter(t *testing.T) {
return tracks[i].Name
},
)

if err != nil {
t.Fatalf("Find must not return an error, but got '%s'", err)
}
Expand Down

0 comments on commit f6c262a

Please sign in to comment.