Skip to content

Commit 1086fcf

Browse files
authored
perf(test): improve tests3 (#352)
* perf(test): improve tests3 * ci(fzf): install fzf binary * perf(test): improve test3 * perf(test): improve tests3 * perf(test): improve tests3 * perf(test): improve tests3 * perf(test): improve tests3 * perf(test): improve tests3 * perf(test): improve tests3 * perf(test): improve tests3 * perf(test): improve tests3 * perf(test): improve tests3 * perf(test): improve tests3 * perf(test): improve tests3 * perf(test): improve tests3 * perf(test): improve tests3 * perf(test): improve tests3 * perf(test): improve tests3 * perf(test): improve tests3 * perf(test): improve tests3 * perf(test): improve tests3 * chore * chore * chore * chore * chore * chore * chore * chore * chore * chore * chore * chore * chore * chore * docs: wording * docs * chore * chore * chore * chore * chore * chore * chore * chore * chore * chore
1 parent 119371c commit 1086fcf

File tree

13 files changed

+1411
-609
lines changed

13 files changed

+1411
-609
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,9 @@ jobs:
7878
luarocks install luacov
7979
luarocks install cluacov
8080
luarocks install vusted
81-
fzfurl=https://github.com/junegunn/fzf/releases/download/0.43.0/fzf-0.43.0-linux_amd64.tar.gz
82-
fzftemp=fzf.zip
83-
curl -fLo "$fzftemp" $fzfurl && tar zxvf "$fzftemp" && rm "$fzftemp"
84-
chmod +x fzf
85-
export PATH="$PWD:$PATH"
81+
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
82+
~/.fzf/install
83+
export PATH="$HOME/.fzf/bin:$PATH"
8684
vusted --coverage --shuffle ./test
8785
- name: Generate coverage reports
8886
shell: bash

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -358,21 +358,21 @@ Commands are named following below rules:
358358
</thead>
359359
<tbody>
360360
<tr>
361-
<td>FzfxLiveGrep(U)</td>
361+
<td>FzfxLiveGrep(B/U)</td>
362362
<td>N</td>
363363
<td rowspan="4">Yes</td>
364364
<td rowspan="4">Yes</td>
365365
</tr>
366366
<tr>
367-
<td>FzfxLiveGrep(U)V</td>
367+
<td>FzfxLiveGrep(B/U)V</td>
368368
<td>V</td>
369369
</tr>
370370
<tr>
371-
<td>FzfxLiveGrep(U)W</td>
371+
<td>FzfxLiveGrep(B/U)W</td>
372372
<td>N</td>
373373
</tr>
374374
<tr>
375-
<td>FzfxLiveGrep(U)P</td>
375+
<td>FzfxLiveGrep(B/U)P</td>
376376
<td>N</td>
377377
</tr>
378378
</tbody>

bin/general/previewer.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ elseif metaopts.previewer_type == "command_list" then
8787
return
8888
end
8989

90-
local async_spawn = shell_helpers.AsyncSpawn:make(cmd_splits, println) --[[@as AsyncSpawn]]
90+
local sp = shell_helpers.Spawn:make(cmd_splits, println) --[[@as Spawn]]
9191
shell_helpers.log_ensure(
92-
async_spawn ~= nil,
92+
sp ~= nil,
9393
"failed to open async command: %s",
9494
vim.inspect(cmd_splits)
9595
)
96-
async_spawn:run()
96+
sp:run()
9797
elseif metaopts.previewer_type == "list" then
9898
local f = io.open(resultfile, "r")
9999
shell_helpers.log_ensure(

bin/general/provider.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,13 @@ then
109109
return
110110
end
111111

112-
local async_spawn = shell_helpers.AsyncSpawn:make(cmd_splits, println) --[[@as AsyncSpawn]]
112+
local sp = shell_helpers.Spawn:make(cmd_splits, println) --[[@as Spawn]]
113113
shell_helpers.log_ensure(
114-
async_spawn ~= nil,
114+
sp ~= nil,
115115
"failed to open async command: %s",
116116
vim.inspect(cmd_splits)
117117
)
118-
async_spawn:run()
118+
sp:run()
119119
elseif metaopts.provider_type == "list" then
120120
local reader = shell_helpers.FileLineReader:open(resultfile) --[[@as FileLineReader ]]
121121
shell_helpers.log_ensure(

lua/fzfx/cmd.lua

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,20 @@ local Cmd = {}
3838
function Cmd:run(source)
3939
local result = CmdResult:new()
4040

41-
local async_cmd = require("fzfx.utils").AsyncSpawn:make(
42-
source,
43-
function(line)
44-
if type(line) == "string" then
45-
table.insert(result.stdout, line)
46-
end
47-
end,
48-
function(line)
49-
if type(line) == "string" then
50-
table.insert(result.stderr, line)
51-
end
41+
local sp = require("fzfx.spawn").Spawn:make(source, function(line)
42+
if type(line) == "string" then
43+
table.insert(result.stdout, line)
44+
end
45+
end, function(line)
46+
if type(line) == "string" then
47+
table.insert(result.stderr, line)
5248
end
53-
) --[[@as AsyncSpawn]]
54-
async_cmd:run()
49+
end) --[[@as Spawn]]
50+
sp:run()
5551

56-
if type(async_cmd.result) == "table" then
57-
result.code = async_cmd.result.code
58-
result.signal = async_cmd.result.signal
52+
if type(sp.result) == "table" then
53+
result.code = sp.result.code
54+
result.signal = sp.result.signal
5955
end
6056

6157
local o = {

0 commit comments

Comments
 (0)