aboutsummaryrefslogtreecommitdiff
path: root/test/benchmark/screenpos_spec.lua
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-05-24 19:18:11 +0000
committerJosh Rahm <joshuarahm@gmail.com>2024-05-24 19:18:11 +0000
commitff7ed8f586589d620a806c3758fac4a47a8e7e15 (patch)
tree729bbcb92231538fa61dab6c3d890b025484b7f5 /test/benchmark/screenpos_spec.lua
parent376914f419eb08fdf4c1a63a77e1f035898a0f10 (diff)
parent28c04948a1c887a1cc0cb64de79fa32631700466 (diff)
downloadrneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.tar.gz
rneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.tar.bz2
rneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.zip
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'test/benchmark/screenpos_spec.lua')
-rw-r--r--test/benchmark/screenpos_spec.lua18
1 files changed, 10 insertions, 8 deletions
diff --git a/test/benchmark/screenpos_spec.lua b/test/benchmark/screenpos_spec.lua
index 8a80712dfa..db8f918817 100644
--- a/test/benchmark/screenpos_spec.lua
+++ b/test/benchmark/screenpos_spec.lua
@@ -1,7 +1,9 @@
-local helpers = require('test.functional.helpers')(after_each)
-local api = helpers.api
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
+local api = n.api
+
local function rand_utf8(count, seed)
math.randomseed(seed)
local symbols = { 'i', 'À', 'Ⱡ', '𐀀' }
@@ -78,7 +80,7 @@ local N = 10000
local function benchmark(lines, expected_value)
local lnum = #lines
- local results = helpers.exec_lua(
+ local results = n.exec_lua(
[==[
local N, lnum = ...
@@ -99,7 +101,7 @@ local function benchmark(lines, expected_value)
)
for _, value in ipairs(results[1]) do
- helpers.eq(expected_value, value)
+ t.eq(expected_value, value)
end
local stats = results[2]
table.sort(stats)
@@ -119,7 +121,7 @@ end
local function benchmarks(benchmark_results)
describe('screenpos() perf', function()
- before_each(helpers.clear)
+ before_each(n.clear)
-- no breakindent
for li, lines_type in ipairs(benchmark_lines) do
@@ -134,7 +136,7 @@ local function benchmarks(benchmark_results)
screen:attach()
api.nvim_buf_set_lines(0, 0, 1, false, lines)
-- for smaller screen expect (last line always different, first line same as others)
- helpers.feed('G$')
+ n.feed('G$')
screen:expect(result.screen)
benchmark(lines, result.value)
end)
@@ -153,9 +155,9 @@ local function benchmarks(benchmark_results)
local screen = Screen.new(width, height + 1)
screen:attach()
api.nvim_buf_set_lines(0, 0, 1, false, lines)
- helpers.command('set breakindent')
+ n.command('set breakindent')
-- for smaller screen expect (last line always different, first line same as others)
- helpers.feed('G$')
+ n.feed('G$')
screen:expect(result.screen)
benchmark(lines, result.value)
end)