mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
tests/indent: move common code out of main lua/ directory
This commit is contained in:
parent
db97170e4e
commit
dbb1550aaf
6 changed files with 13 additions and 13 deletions
|
|
@ -1,5 +1,5 @@
|
|||
local whole_file = require('nvim-treesitter.test_utils').indent_whole_file
|
||||
local new_line = require('nvim-treesitter.test_utils').indent_new_line
|
||||
local whole_file = require('tests.indent.common').indent_whole_file
|
||||
local new_line = require('tests.indent.common').indent_new_line
|
||||
local scan_dir = require('plenary.scandir').scan_dir
|
||||
|
||||
local opts = {
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ local function compare_indent(before, after)
|
|||
assert:remove_formatter(format_indent)
|
||||
end
|
||||
|
||||
function M.set_buf_indent_opts(opts)
|
||||
local function set_buf_indent_opts(opts)
|
||||
local optnames = {'tabstop', 'shiftwidth', 'softtabstop', 'expandtab', 'filetype'}
|
||||
for _, opt in ipairs(optnames) do
|
||||
if opts[opt] ~= nil then
|
||||
|
|
@ -80,7 +80,7 @@ function M.run_indent_test(file, runner, opts)
|
|||
local before = vim.api.nvim_buf_get_lines(0, 0, -1, true)
|
||||
|
||||
assert.are.same('nvim_treesitter#indent()', vim.bo.indentexpr)
|
||||
M.set_buf_indent_opts(opts)
|
||||
set_buf_indent_opts(opts)
|
||||
|
||||
-- perform the test
|
||||
runner()
|
||||
|
|
@ -108,7 +108,7 @@ end
|
|||
-- on_line: line on which `normal o` is executed
|
||||
-- text: text inserted in the new line
|
||||
-- indent: expected indent before the inserted text (string or int)
|
||||
-- @param opts buffer options passed to M.set_buf_indent_opts
|
||||
-- @param opts buffer options passed to set_buf_indent_opts
|
||||
function M.indent_new_line(file, spec, opts)
|
||||
local before, after = M.run_indent_test(file, function()
|
||||
-- move to the line and input the new one
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
local whole_file = require('nvim-treesitter.test_utils').indent_whole_file
|
||||
local new_line = require('nvim-treesitter.test_utils').indent_new_line
|
||||
local whole_file = require('tests.indent.common').indent_whole_file
|
||||
local new_line = require('tests.indent.common').indent_new_line
|
||||
local scan_dir = require('plenary.scandir').scan_dir
|
||||
local Path = require('plenary.path')
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
local whole_file = require('nvim-treesitter.test_utils').indent_whole_file
|
||||
local new_line = require('nvim-treesitter.test_utils').indent_new_line
|
||||
local whole_file = require('tests.indent.common').indent_whole_file
|
||||
local new_line = require('tests.indent.common').indent_new_line
|
||||
local scan_dir = require('plenary.scandir').scan_dir
|
||||
|
||||
local opts = {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
local whole_file = require('nvim-treesitter.test_utils').indent_whole_file
|
||||
local new_line = require('nvim-treesitter.test_utils').indent_new_line
|
||||
local whole_file = require('tests.indent.common').indent_whole_file
|
||||
local new_line = require('tests.indent.common').indent_new_line
|
||||
local scan_dir = require('plenary.scandir').scan_dir
|
||||
|
||||
local opts = {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
local whole_file = require('nvim-treesitter.test_utils').indent_whole_file
|
||||
local new_line = require('nvim-treesitter.test_utils').indent_new_line
|
||||
local whole_file = require('tests.indent.common').indent_whole_file
|
||||
local new_line = require('tests.indent.common').indent_new_line
|
||||
local scan_dir = require('plenary.scandir').scan_dir
|
||||
|
||||
local opts = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue