mirror of
https://github.com/neovim/neovim.git
synced 2026-01-04 10:26:42 +10:00
test: improve test conventions
Work on https://github.com/neovim/neovim/issues/27004.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user