aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJędrzej Boczar <yendreij@gmail.com>2021-04-22 21:23:24 +0200
committerKiyan <yazdani.kiyan@protonmail.com>2021-04-23 21:21:38 +0200
commitdb97170e4e5f873f46f33564f0773a151f018c2f (patch)
treebc749ebb68ab3b52440c282ea3b9b5b1a9df5f7c
parentmove all tests to top-level tests/ directory (diff)
downloadnvim-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
-rw-r--r--tests/indent/c_spec.lua14
-rw-r--r--tests/indent/cpp_spec.lua19
-rw-r--r--tests/indent/lua_spec.lua14
-rw-r--r--tests/indent/python_spec.lua14
-rw-r--r--tests/indent/rust_spec.lua14
5 files changed, 38 insertions, 37 deletions
diff --git a/tests/indent/c_spec.lua b/tests/indent/c_spec.lua
index 98311c772..1089ee4eb 100644
--- a/tests/indent/c_spec.lua
+++ b/tests/indent/c_spec.lua
@@ -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/c/' .. file, spec, opts)
+ end)
+end
+
describe('indent C:', function()
describe('whole file:', function()
local files = scan_dir('tests/indent/c');
@@ -20,13 +27,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]', file, title), function()
- new_line('tests/indent/c/' .. file, spec, opts)
- end)
- end
-
run('array.c', { on_line = 2, text = '0,', indent = 4 })
run('cond.c', { on_line = 3, text = 'x++;', indent = 8 })
run('cond.c', { on_line = 8, text = 'x++;', indent = 8 })
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/