aboutsummaryrefslogtreecommitdiffstats
path: root/tests/indent/cpp_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tests/indent/cpp_spec.lua')
-rw-r--r--tests/indent/cpp_spec.lua19
1 files changed, 10 insertions, 9 deletions
diff --git a/tests/indent/cpp_spec.lua b/tests/indent/cpp_spec.lua
index d3c98401c..261c00499 100644
--- a/tests/indent/cpp_spec.lua
+++ b/tests/indent/cpp_spec.lua
@@ -15,10 +15,18 @@ local get_name = function(file)
return Path:new(file):make_relative('tests/indent')
end
+local run = function(file, spec, title)
+ title = title and title or tostring(spec.on_line)
+ it(string.format('%s[%s]', get_name(file), title), function()
+ new_line(file, spec, opts)
+ end)
+end
+
describe('indent C++:', function()
describe('whole file:', function()
- local files = scan_dir('tests/indent/c');
- vim.list_extend(files, scan_dir('tests/indent/cpp'))
+ local files = vim.tbl_flatten(vim.tbl_map(scan_dir, {
+ 'tests/indent/c', 'tests/indent/cpp',
+ }))
for _, file in ipairs(files) do
it(get_name(file), function()
@@ -28,13 +36,6 @@ describe('indent C++:', 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]', get_name(file), title), function()
- new_line(file, spec, opts)
- end)
- end
-
run('tests/indent/cpp/access.cpp', { on_line = 3, text = 'protected:', indent = 0 })
run('tests/indent/cpp/class.cpp', { on_line = 2, text = 'using T = int;', indent = 4 })
run('tests/indent/cpp/stream.cpp', { on_line = 5, text = '<< x + 3', indent = 8 })