Skip to content

Commit

Permalink
take lock
Browse files Browse the repository at this point in the history
  • Loading branch information
tjmtmmnk committed Dec 1, 2020
1 parent ae89753 commit 7fa1592
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
run: go build

- name: Test
run: go test -p 1 -v -coverpkg ./... -covermode atomic -coverprofile coverage.txt -tags fuzz -numCases 10 -numEvents 10 ./...
run: go test -v -coverpkg ./... -covermode atomic -coverprofile coverage.txt -tags fuzz -numCases 10 -numEvents 10 ./...

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
Expand Down
2 changes: 0 additions & 2 deletions fuzzyfinder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ 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
Expand Down Expand Up @@ -245,7 +244,6 @@ 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 Down
5 changes: 5 additions & 0 deletions mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ func (t *TerminalMock) GetResult() string {

setCursor()

t.resultMu.Lock()

cells, width, height := t.screen.GetContents()

for h := 0; h < height; h++ {
Expand Down Expand Up @@ -76,6 +78,9 @@ func (t *TerminalMock) GetResult() string {
s += "\n"
}
s += "\x1b\x5b\x6d" // Reset previous color.

t.resultMu.Unlock()

return s
}

Expand Down

0 comments on commit 7fa1592

Please sign in to comment.