tests/indent: move the run helper functions to top-level

This commit is contained in:
Jędrzej Boczar 2021-04-22 21:23:24 +02:00 committed by Kiyan
parent 63a88c873f
commit db97170e4e
5 changed files with 38 additions and 37 deletions

View file

@ -9,6 +9,13 @@ local opts = {
expandtab = true,
}
local run = function(file, spec, title)
title = title and title or tostring(spec.on_line)
it(string.format('%s[%s]', file, title), function()
new_line('tests/indent/rust/' .. file, spec, opts)
end)
end
describe('indent Rust:', function()
describe('whole file:', function()
local files = scan_dir('tests/indent/rust');
@ -20,13 +27,6 @@ describe('indent Rust:', function()
end)
describe('new line:', function()
local run = function(file, spec, title)
title = title and title or tostring(spec.on_line)
it(string.format('%s[%s]', file, title), function()
new_line('tests/indent/rust/' .. file, spec, opts)
end)
end
run('array.rs', { on_line = 2, text = '0,', indent = 4 })
run('array.rs', { on_line = 8, text = '0,', indent = 8 })
run('comment.rs', { on_line = 3, text = 'a', indent = '/// ' })