diff options
| author | dundargoc <gocdundar@gmail.com> | 2024-04-08 11:03:20 +0200 |
|---|---|---|
| committer | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2024-04-08 22:51:00 +0200 |
| commit | 7035125b2b26aa68fcfb7cda39377ac79926a0f9 (patch) | |
| tree | d194a3556a367b42505f9e7d26637e7cb3674928 /test/benchmark | |
| parent | 978962f9a00ce75216d2c36b79397ef3d2b54096 (diff) | |
| download | rneovim-7035125b2b26aa68fcfb7cda39377ac79926a0f9.tar.gz rneovim-7035125b2b26aa68fcfb7cda39377ac79926a0f9.tar.bz2 rneovim-7035125b2b26aa68fcfb7cda39377ac79926a0f9.zip | |
test: improve test conventions
Work on https://github.com/neovim/neovim/issues/27004.
Diffstat (limited to 'test/benchmark')
| -rw-r--r-- | test/benchmark/autocmd_spec.lua | 6 | ||||
| -rw-r--r-- | test/benchmark/bench_regexp_spec.lua | 6 | ||||
| -rw-r--r-- | test/benchmark/preload.lua | 2 | ||||
| -rw-r--r-- | test/benchmark/screenpos_spec.lua | 16 | ||||
| -rw-r--r-- | test/benchmark/treesitter_spec.lua | 8 |
5 files changed, 19 insertions, 19 deletions
diff --git a/test/benchmark/autocmd_spec.lua b/test/benchmark/autocmd_spec.lua index b3421d86eb..0d0d37690f 100644 --- a/test/benchmark/autocmd_spec.lua +++ b/test/benchmark/autocmd_spec.lua @@ -1,7 +1,7 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local clear = helpers.clear -local exec_lua = helpers.exec_lua +local clear = t.clear +local exec_lua = t.exec_lua local N = 7500 diff --git a/test/benchmark/bench_regexp_spec.lua b/test/benchmark/bench_regexp_spec.lua index 4a7c50557b..9c0b86b6b5 100644 --- a/test/benchmark/bench_regexp_spec.lua +++ b/test/benchmark/bench_regexp_spec.lua @@ -1,8 +1,8 @@ -- Test for benchmarking the RE engine. -local helpers = require('test.functional.helpers')(after_each) -local insert, source = helpers.insert, helpers.source -local clear, command = helpers.clear, helpers.command +local t = require('test.functional.testutil')(after_each) +local insert, source = t.insert, t.source +local clear, command = t.clear, t.command -- Temporary file for gathering benchmarking results for each regexp engine. local result_file = 'benchmark.out' diff --git a/test/benchmark/preload.lua b/test/benchmark/preload.lua index 1971ef77cc..9e24b5cdf1 100644 --- a/test/benchmark/preload.lua +++ b/test/benchmark/preload.lua @@ -1,4 +1,4 @@ -- Modules loaded here will not be cleared and reloaded by Busted. -- Busted started doing this to help provide more isolation. See issue #62 -- for more information about this. -local helpers = require('test.functional.helpers') +local t = require('test.functional.testutil') diff --git a/test/benchmark/screenpos_spec.lua b/test/benchmark/screenpos_spec.lua index 8a80712dfa..bd6860f313 100644 --- a/test/benchmark/screenpos_spec.lua +++ b/test/benchmark/screenpos_spec.lua @@ -1,5 +1,5 @@ -local helpers = require('test.functional.helpers')(after_each) -local api = helpers.api +local t = require('test.functional.testutil')(after_each) +local api = t.api local Screen = require('test.functional.ui.screen') local function rand_utf8(count, seed) @@ -78,7 +78,7 @@ local N = 10000 local function benchmark(lines, expected_value) local lnum = #lines - local results = helpers.exec_lua( + local results = t.exec_lua( [==[ local N, lnum = ... @@ -99,7 +99,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 +119,7 @@ end local function benchmarks(benchmark_results) describe('screenpos() perf', function() - before_each(helpers.clear) + before_each(t.clear) -- no breakindent for li, lines_type in ipairs(benchmark_lines) do @@ -134,7 +134,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$') + t.feed('G$') screen:expect(result.screen) benchmark(lines, result.value) end) @@ -153,9 +153,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') + t.command('set breakindent') -- for smaller screen expect (last line always different, first line same as others) - helpers.feed('G$') + t.feed('G$') screen:expect(result.screen) benchmark(lines, result.value) end) diff --git a/test/benchmark/treesitter_spec.lua b/test/benchmark/treesitter_spec.lua index 7c9906a7b2..18b9241081 100644 --- a/test/benchmark/treesitter_spec.lua +++ b/test/benchmark/treesitter_spec.lua @@ -1,7 +1,7 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local clear = helpers.clear -local exec_lua = helpers.exec_lua +local clear = t.clear +local exec_lua = t.exec_lua describe('treesitter perf', function() setup(function() @@ -9,7 +9,7 @@ describe('treesitter perf', function() end) it('can handle large folds', function() - helpers.command 'edit ./src/nvim/eval.c' + t.command 'edit ./src/nvim/eval.c' exec_lua [[ local parser = vim.treesitter.get_parser(0, "c", {}) vim.treesitter.highlighter.new(parser) |