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/rust_spec.lua | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'lua/tests/indent/rust_spec.lua') diff --git a/lua/tests/indent/rust_spec.lua b/lua/tests/indent/rust_spec.lua index 374e3db6d..ad9e948c4 100644 --- a/lua/tests/indent/rust_spec.lua +++ b/lua/tests/indent/rust_spec.lua @@ -1,17 +1,18 @@ local whole_file = require('nvim-treesitter.test_utils').indent_whole_file +local scan_dir = require('plenary.scandir').scan_dir -describe('indent rust', function() - local files = { - 'basic.rs', - } - for _, file in ipairs(files) do - it(file, function() - whole_file('lua/tests/indent/rust/' .. file, { - tabstop = 4, - shiftwidth = 4, - softtabstop = 0, - expandtab = true, - }) - end) - end +describe('indent Rust:', function() + describe('whole file:', function() + local files = scan_dir('lua/tests/indent/rust'); + 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