diff options
| author | Jędrzej Boczar <yendreij@gmail.com> | 2021-04-22 21:23:24 +0200 |
|---|---|---|
| committer | Kiyan <yazdani.kiyan@protonmail.com> | 2021-04-23 21:21:38 +0200 |
| commit | db97170e4e5f873f46f33564f0773a151f018c2f (patch) | |
| tree | bc749ebb68ab3b52440c282ea3b9b5b1a9df5f7c /tests/indent/cpp_spec.lua | |
| parent | move all tests to top-level tests/ directory (diff) | |
| download | nvim-treesitter-db97170e4e5f873f46f33564f0773a151f018c2f.tar nvim-treesitter-db97170e4e5f873f46f33564f0773a151f018c2f.tar.gz nvim-treesitter-db97170e4e5f873f46f33564f0773a151f018c2f.tar.bz2 nvim-treesitter-db97170e4e5f873f46f33564f0773a151f018c2f.tar.lz nvim-treesitter-db97170e4e5f873f46f33564f0773a151f018c2f.tar.xz nvim-treesitter-db97170e4e5f873f46f33564f0773a151f018c2f.tar.zst nvim-treesitter-db97170e4e5f873f46f33564f0773a151f018c2f.zip | |
tests/indent: move the run helper functions to top-level
Diffstat (limited to 'tests/indent/cpp_spec.lua')
| -rw-r--r-- | tests/indent/cpp_spec.lua | 19 |
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 }) |
