From 77c97d0f8bdc16bdd2a0800fe66bf3ffddfe6ec3 Mon Sep 17 00:00:00 2001 From: Jędrzej Boczar Date: Sat, 17 Apr 2021 22:45:42 +0200 Subject: tests/indent: refactor indent test runner and auto-discover language test files --- lua/tests/indent/python_spec.lua | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) (limited to 'lua/tests/indent/python_spec.lua') diff --git a/lua/tests/indent/python_spec.lua b/lua/tests/indent/python_spec.lua index 70017bde1..1bdb4aa48 100644 --- a/lua/tests/indent/python_spec.lua +++ b/lua/tests/indent/python_spec.lua @@ -1,26 +1,18 @@ local whole_file = require('nvim-treesitter.test_utils').indent_whole_file +local scan_dir = require('plenary.scandir').scan_dir -describe('indent python', function() - local files = { - 'aligned_indent.py', - 'basic_blocks.py', - 'basic_collections.py', - 'branches.py', - 'comprehensions.py', - 'control_flow.py', - 'hanging_indent.py', - 'join_lines.py', - 'nested_collections.py', - 'strings.py', - } - for _, file in ipairs(files) do - it(file, function() - whole_file('lua/tests/indent/python/' .. file, { - tabstop = 4, - shiftwidth = 4, - softtabstop = 0, - expandtab = true, - }) - end) - end +describe('indent Python:', function() + describe('whole file:', function() + local files = scan_dir('lua/tests/indent/python'); + for _, file in ipairs(files) do + it(vim.fn.fnamemodify(file, ':t'), function() + whole_file(file, { + tabstop = 4, + shiftwidth = 4, + softtabstop = 0, + expandtab = true, + }) + end) + end + end) end) -- cgit v1.2.3-70-g09d2