Skip to content

Commit

Permalink
chore: add script for a quick integration test
Browse files Browse the repository at this point in the history
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
  • Loading branch information
AdeAttwood committed Jul 21, 2024
1 parent 57d652c commit fef45c2
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions scripts/integration.lua
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit fef45c2

Please sign in to comment.