chore: add script for a quick integration test
Summary: This is just a little script that will run a search and print out the timings for each of the searches that ivy will preform. For example running ``` nvim -l ./scripts/integration.lua /path/to/repo test 2> /dev/null ``` will output ``` t 0.074737 te 0.016494 tes 0.018898 test 0.017214 ``` Test Plan: Does not really require testing, this is a little helper script for development. If it does not work on another machine then we can cross that bridge when we come to it. Reviewers: AdeAttwood Reviewed By: AdeAttwood Differential Revision: https://ph.baln.co.uk/D2
This commit is contained in:
parent
57d652cb9d
commit
fef45c2d7e
1 changed files with 30 additions and 0 deletions
30
scripts/integration.lua
Normal file
30
scripts/integration.lua
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
vim.opt.rtp:append(vim.fn.getcwd())
|
||||||
|
|
||||||
|
local ivy = require "ivy"
|
||||||
|
local prompt = require "ivy.prompt"
|
||||||
|
require "plugin.ivy"
|
||||||
|
|
||||||
|
if #vim.v.argv ~= 5 then
|
||||||
|
print "[ERROR] Expected 5 arguments"
|
||||||
|
print " Usage: nvim -l ./scripts/integration.lua <directory> <search>"
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
ivy.setup()
|
||||||
|
|
||||||
|
vim.fn.chdir(vim.v.argv[4])
|
||||||
|
print("Working in " .. vim.fn.getcwd())
|
||||||
|
|
||||||
|
vim.cmd "IvyFd"
|
||||||
|
|
||||||
|
for _, value in pairs(vim.split(vim.v.argv[5], "")) do
|
||||||
|
local start_time = os.clock()
|
||||||
|
|
||||||
|
vim.ivy.input(value)
|
||||||
|
vim.wait(0)
|
||||||
|
|
||||||
|
local running_time = os.clock() - start_time
|
||||||
|
|
||||||
|
io.stdout:write(prompt.text() .. "\t" .. running_time .. "\n")
|
||||||
|
end
|
||||||
Loading…
Reference in a new issue