diff options
| author | Christian Clason <c.clason@uni-graz.at> | 2023-06-12 09:54:30 -0600 |
|---|---|---|
| committer | Christian Clason <c.clason@uni-graz.at> | 2025-05-12 18:43:40 +0200 |
| commit | 692b051b09935653befdb8f7ba8afdb640adf17b (patch) | |
| tree | 167162b6b129ae04f68c5735078521a72917c742 /tests/indent | |
| parent | feat(c-family): inherit injections (diff) | |
| download | nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.gz nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.bz2 nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.lz nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.xz nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.zst nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.zip | |
feat!: drop modules, general refactor and cleanup
Diffstat (limited to 'tests/indent')
45 files changed, 1349 insertions, 1058 deletions
diff --git a/tests/indent/algorithm_spec.lua b/tests/indent/algorithm_spec.lua index faf7998ec..d93521040 100644 --- a/tests/indent/algorithm_spec.lua +++ b/tests/indent/algorithm_spec.lua @@ -1,18 +1,34 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner -- local XFAIL = require("tests.indent.common").XFAIL -local runner = Runner:new(it, "tests/indent/algorithm", { +local runner = Runner:new(it, 'tests/indent/algorithm', { tabstop = 4, shiftwidth = 4, softtabstop = 4, expandtab = true, }) -describe("test indent algorithm: ", function() - describe("new line:", function() - runner:new_line("trailing.py", { on_line = 1, text = "x: str", indent = 4 }, "indent next line, ignore comment") - runner:new_line("trailing.py", { on_line = 4, text = "pass", indent = 8 }, "indent next line, ignore comment") - runner:new_line("trailing.py", { on_line = 6, text = "pass", indent = 4 }, "indent next line, ignore whitespace") - runner:new_line("trailing_whitespace.html", { on_line = 9, text = "x", indent = 8 }, "not ignore @indent.end") +describe('test indent algorithm: ', function() + describe('new line:', function() + runner:new_line( + 'trailing.py', + { on_line = 1, text = 'x: str', indent = 4 }, + 'indent next line, ignore comment' + ) + runner:new_line( + 'trailing.py', + { on_line = 4, text = 'pass', indent = 8 }, + 'indent next line, ignore comment' + ) + runner:new_line( + 'trailing.py', + { on_line = 6, text = 'pass', indent = 4 }, + 'indent next line, ignore whitespace' + ) + runner:new_line( + 'trailing_whitespace.html', + { on_line = 9, text = 'x', indent = 8 }, + 'not ignore @indent.end' + ) end) end) diff --git a/tests/indent/angular_spec.lua b/tests/indent/angular_spec.lua index 2090420ce..3ead248b7 100644 --- a/tests/indent/angular_spec.lua +++ b/tests/indent/angular_spec.lua @@ -1,18 +1,18 @@ -local Runner = require("tests.indent.common").Runner -local runner = Runner:new(it, "tests/indent/angular", { +local Runner = require('tests.indent.common').Runner +local runner = Runner:new(it, 'tests/indent/angular', { tabstop = 2, shiftwidth = 2, expandtab = true, - filetype = "htmlangular", + filetype = 'htmlangular', }) -describe("indent HTML Angular:", function() - describe("whole file:", function() - runner:whole_file "." +describe('indent HTML Angular:', function() + describe('whole file:', function() + runner:whole_file('.') end) - describe("new line:", function() - for _, info in ipairs { + describe('new line:', function() + for _, info in ipairs({ { 1, 2 }, { 2, 2 }, { 3, 2 }, @@ -25,11 +25,11 @@ describe("indent HTML Angular:", function() { 12, 6 }, { 13, 4 }, { 14, 2 }, - } do - runner:new_line("if-else.html", { on_line = info[1], text = "//", indent = info[2] }) + }) do + runner:new_line('if-else.html', { on_line = info[1], text = '//', indent = info[2] }) end - for _, info in ipairs { + for _, info in ipairs({ { 1, 2 }, { 2, 4 }, { 3, 6 }, @@ -39,21 +39,21 @@ describe("indent HTML Angular:", function() { 9, 6 }, { 10, 6 }, { 12, 2 }, - } do - runner:new_line("switch-case.html", { on_line = info[1], text = "//", indent = info[2] }) + }) do + runner:new_line('switch-case.html', { on_line = info[1], text = '//', indent = info[2] }) end - for _, info in ipairs { + for _, info in ipairs({ { 1, 2 }, { 2, 2 }, { 3, 2 }, { 4, 2 }, { 5, 0 }, - } do - runner:new_line("for.html", { on_line = info[1], text = "//", indent = info[2] }) + }) do + runner:new_line('for.html', { on_line = info[1], text = '//', indent = info[2] }) end - for _, info in ipairs { + for _, info in ipairs({ { 1, 2 }, { 2, 2 }, { 3, 2 }, @@ -63,8 +63,8 @@ describe("indent HTML Angular:", function() { 7, 2 }, { 8, 2 }, { 9, 0 }, - } do - runner:new_line("defer.html", { on_line = info[1], text = "//", indent = info[2] }) + }) do + runner:new_line('defer.html', { on_line = info[1], text = '//', indent = info[2] }) end end) end) diff --git a/tests/indent/c_spec.lua b/tests/indent/c_spec.lua index 4e2826a54..528933599 100644 --- a/tests/indent/c_spec.lua +++ b/tests/indent/c_spec.lua @@ -1,58 +1,63 @@ -local Runner = require("tests.indent.common").Runner -local XFAIL = require("tests.indent.common").XFAIL +local Runner = require('tests.indent.common').Runner +local XFAIL = require('tests.indent.common').XFAIL -local runner = Runner:new(it, "tests/indent/c", { +local runner = Runner:new(it, 'tests/indent/c', { tabstop = 4, shiftwidth = 4, softtabstop = 0, expandtab = true, }) -describe("indent C:", function() - describe("whole file:", function() - runner:whole_file(".", { +describe('indent C:', function() + describe('whole file:', function() + runner:whole_file('.', { expected_failures = { - "./preproc_func.c", - "./unfinished_comment.c", + './preproc_func.c', + './unfinished_comment.c', }, }) end) - describe("new line:", function() - runner:new_line("array.c", { on_line = 2, text = "0,", indent = 4 }) - runner:new_line("compound_lit.c", { on_line = 7, text = ".z = 5,", indent = 8 }) - runner:new_line("cond.c", { on_line = 3, text = "x++;", indent = 8 }) - runner:new_line("cond.c", { on_line = 6, text = "x++;", indent = 8 }) - runner:new_line("cond.c", { on_line = 8, text = "x++;", indent = 8 }) - runner:new_line("cond.c", { on_line = 9, text = "x++;", indent = 4 }) - runner:new_line("expr.c", { on_line = 10, text = "2 *", indent = 8 }) - runner:new_line("func.c", { on_line = 17, text = "int z,", indent = 4 }) - runner:new_line("label.c", { on_line = 3, text = "normal:", indent = 0 }) - runner:new_line("loop.c", { on_line = 3, text = "x++;", indent = 8 }) - runner:new_line("preproc_cond.c", { on_line = 5, text = "x++;", indent = 4 }) - runner:new_line("preproc_func.c", { on_line = 3, text = "x++; \\", indent = 8 }, "expected failure", XFAIL) - runner:new_line("string.c", { on_line = 1, text = "brave new \\", indent = 0 }) - runner:new_line("string.c", { on_line = 4, text = '"brave new "', indent = 4 }) - runner:new_line("struct.c", { on_line = 4, text = "int y;", indent = 8 }) - runner:new_line("switch.c", { on_line = 3, text = "x++;", indent = 12 }) - runner:new_line("ternary.c", { on_line = 4, text = ": (x == 0) : 0", indent = 8 }) - runner:new_line("issue-1568.c", { on_line = 4, text = "x++;", indent = 8 }) - runner:new_line("issue-2086.c", { on_line = 3, text = "}", indent = 0 }) - runner:new_line("issue-4079.c", { on_line = 2, text = "return;", indent = 8 }) - runner:new_line("issue-4079.c", { on_line = 2, text = "{", indent = 4 }) - runner:new_line("issue-4079.c", { on_line = 6, text = "{", indent = 4 }) - runner:new_line("issue-4117.c", { on_line = 3, text = "else", indent = 4 }) + describe('new line:', function() + runner:new_line('array.c', { on_line = 2, text = '0,', indent = 4 }) + runner:new_line('compound_lit.c', { on_line = 7, text = '.z = 5,', indent = 8 }) + runner:new_line('cond.c', { on_line = 3, text = 'x++;', indent = 8 }) + runner:new_line('cond.c', { on_line = 6, text = 'x++;', indent = 8 }) + runner:new_line('cond.c', { on_line = 8, text = 'x++;', indent = 8 }) + runner:new_line('cond.c', { on_line = 9, text = 'x++;', indent = 4 }) + runner:new_line('expr.c', { on_line = 10, text = '2 *', indent = 8 }) + runner:new_line('func.c', { on_line = 17, text = 'int z,', indent = 4 }) + runner:new_line('label.c', { on_line = 3, text = 'normal:', indent = 0 }) + runner:new_line('loop.c', { on_line = 3, text = 'x++;', indent = 8 }) + runner:new_line('preproc_cond.c', { on_line = 5, text = 'x++;', indent = 4 }) + runner:new_line( + 'preproc_func.c', + { on_line = 3, text = 'x++; \\', indent = 8 }, + 'expected failure', + XFAIL + ) + runner:new_line('string.c', { on_line = 1, text = 'brave new \\', indent = 0 }) + runner:new_line('string.c', { on_line = 4, text = '"brave new "', indent = 4 }) + runner:new_line('struct.c', { on_line = 4, text = 'int y;', indent = 8 }) + runner:new_line('switch.c', { on_line = 3, text = 'x++;', indent = 12 }) + runner:new_line('ternary.c', { on_line = 4, text = ': (x == 0) : 0', indent = 8 }) + runner:new_line('issue-1568.c', { on_line = 4, text = 'x++;', indent = 8 }) + runner:new_line('issue-2086.c', { on_line = 3, text = '}', indent = 0 }) + runner:new_line('issue-4079.c', { on_line = 2, text = 'return;', indent = 8 }) + runner:new_line('issue-4079.c', { on_line = 2, text = '{', indent = 4 }) + runner:new_line('issue-4079.c', { on_line = 6, text = '{', indent = 4 }) + runner:new_line('issue-4117.c', { on_line = 3, text = 'else', indent = 4 }) -- the line after inserted one will be left with wrong indent but we only care about the inserted one - for _, line in ipairs { 2, 4, 7, 10 } do - runner:new_line("no_braces.c", { on_line = line, text = "x++;", indent = 8 }) + for _, line in ipairs({ 2, 4, 7, 10 }) do + runner:new_line('no_braces.c', { on_line = line, text = 'x++;', indent = 8 }) end - for _, line in ipairs { 2, 5, 7, 10, 12, 14, 20, 22, 25, 27, 28, 33 } do - runner:new_line("if_else.c", { on_line = line, text = "x++;", indent = 8 }) + for _, line in ipairs({ 2, 5, 7, 10, 12, 14, 20, 22, 25, 27, 28, 33 }) do + runner:new_line('if_else.c', { on_line = line, text = 'x++;', indent = 8 }) end - for _, line in ipairs { 3, 6, 8, 13, 15, 20, 23 } do - runner:new_line("if_else.c", { on_line = line, text = "else", indent = 4 }) + for _, line in ipairs({ 3, 6, 8, 13, 15, 20, 23 }) do + runner:new_line('if_else.c', { on_line = line, text = 'else', indent = 4 }) end - for _, info in ipairs { + for _, info in ipairs({ { 36, 12 }, { 37, 16 }, { 38, 12 }, @@ -66,15 +71,15 @@ describe("indent C:", function() { 52, 8 }, { 53, 12 }, { 54, 12 }, - } do - runner:new_line("if_else.c", { on_line = info[1], text = "x++;", indent = info[2] }) + }) do + runner:new_line('if_else.c', { on_line = info[1], text = 'x++;', indent = info[2] }) end -- dedent braces on new line - for _, line in ipairs { 10, 12, 14 } do - runner:new_line("if_else.c", { on_line = line, text = "{}", indent = 4 }) + for _, line in ipairs({ 10, 12, 14 }) do + runner:new_line('if_else.c', { on_line = line, text = '{}', indent = 4 }) end - for _, info in ipairs { + for _, info in ipairs({ { 8, 0 }, { 10, 0 }, { 13, 4 }, @@ -86,8 +91,8 @@ describe("indent C:", function() { 20, 8 }, { 21, 8 }, { 22, 4 }, - } do - runner:new_line("issue-4525.c", { on_line = info[1], text = "x++;", indent = info[2] }) + }) do + runner:new_line('issue-4525.c', { on_line = info[1], text = 'x++;', indent = info[2] }) end end) end) diff --git a/tests/indent/capnp_spec.lua b/tests/indent/capnp_spec.lua index 7c8418b06..d5dd8c5fd 100644 --- a/tests/indent/capnp_spec.lua +++ b/tests/indent/capnp_spec.lua @@ -1,30 +1,30 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner -local run = Runner:new(it, "tests/indent/capnp", { +local run = Runner:new(it, 'tests/indent/capnp', { tabstop = 2, shiftwidth = 2, expandtab = true, }) describe("indent Cap'n Proto:", function() - describe("whole file:", function() - run:whole_file(".", { + describe('whole file:', function() + run:whole_file('.', { expected_failures = {}, }) end) - describe("new line:", function() - run:new_line("test.capnp", { on_line = 31, text = "foo @0;", indent = 2 }) - run:new_line("test.capnp", { on_line = 96, text = "boolField = true,", indent = 4 }) - run:new_line("test.capnp", { on_line = 340, text = "grault @7 :UInt64;", indent = 8 }) - run:new_line("test.capnp", { + describe('new line:', function() + run:new_line('test.capnp', { on_line = 31, text = 'foo @0;', indent = 2 }) + run:new_line('test.capnp', { on_line = 96, text = 'boolField = true,', indent = 4 }) + run:new_line('test.capnp', { on_line = 340, text = 'grault @7 :UInt64;', indent = 8 }) + run:new_line('test.capnp', { on_line = 573, - text = "call @0 Inner2(Text) -> (qux :Qux, gen :TestGenerics(TestAllTypes, TestAnyPointer));", + text = 'call @0 Inner2(Text) -> (qux :Qux, gen :TestGenerics(TestAllTypes, TestAnyPointer));', indent = 4, }) - run:new_line("test.capnp", { on_line = 617, text = "foo @0 :Foo;", indent = 4 }) - run:new_line("test.capnp", { on_line = 654, text = "foo = (int16Field = 123),", indent = 4 }) - run:new_line("test.capnp", { on_line = 695, text = 'textField = "nested",', indent = 6 }) - run:new_line("test.capnp", { on_line = 970, text = "testTailCaller @4;", indent = 4 }) + run:new_line('test.capnp', { on_line = 617, text = 'foo @0 :Foo;', indent = 4 }) + run:new_line('test.capnp', { on_line = 654, text = 'foo = (int16Field = 123),', indent = 4 }) + run:new_line('test.capnp', { on_line = 695, text = 'textField = "nested",', indent = 6 }) + run:new_line('test.capnp', { on_line = 970, text = 'testTailCaller @4;', indent = 4 }) end) end) diff --git a/tests/indent/common.lua b/tests/indent/common.lua index 6cfedafff..5c291070e 100644 --- a/tests/indent/common.lua +++ b/tests/indent/common.lua @@ -1,11 +1,11 @@ local M = {} -local assert = require "luassert" -local say = require "say" -local scan_dir = require("plenary.scandir").scan_dir -local Path = require "plenary.path" +local assert = require('luassert') +local say = require('say') +local scan_dir = require('plenary.scandir').scan_dir +local Path = require('plenary.path') -M.XFAIL = "xfail" +M.XFAIL = 'xfail' local function same_indent(state, arguments) local before = arguments[1] @@ -14,11 +14,11 @@ local function same_indent(state, arguments) local ok = true local errors = { before = {}, after = {} } for line = 1, #before do - if #string.match(before[line], "^%s*") ~= #string.match(after[line], "^%s*") then + if #string.match(before[line], '^%s*') ~= #string.match(after[line], '^%s*') then if before[line] and after[line] then -- store the actual indentation length for each line - errors.before[line] = #string.match(before[line], "^%s*") - errors.after[line] = #string.match(after[line], "^%s*") + errors.before[line] = #string.match(before[line], '^%s*') + errors.after[line] = #string.match(after[line], '^%s*') end ok = false end @@ -42,39 +42,39 @@ local function format_indent(arg, fmtargs) end width = width + 3 - local header_fmt = "%8s %2s%-" .. tostring(width + 1) .. "s %s" - local fmt = "%8s %2s |%-" .. tostring(width) .. "s |%s" + local header_fmt = '%8s %2s%-' .. tostring(width + 1) .. 's %s' + local fmt = '%8s %2s |%-' .. tostring(width) .. 's |%s' - local output = { header_fmt:format("", "", "Found:", "Expected:") } + local output = { header_fmt:format('', '', 'Found:', 'Expected:') } for i, line in ipairs(arg) do if fmtargs.errors.before[i] then - local indents = string.format("%d vs %d", fmtargs.errors.after[i], fmtargs.errors.before[i]) - table.insert(output, fmt:format(indents, "=>", fmtargs.other[i], line)) + local indents = string.format('%d vs %d', fmtargs.errors.after[i], fmtargs.errors.before[i]) + table.insert(output, fmt:format(indents, '=>', fmtargs.other[i], line)) else - table.insert(output, fmt:format("", "", fmtargs.other[i], line)) + table.insert(output, fmt:format('', '', fmtargs.other[i], line)) end end - return table.concat(output, "\n") + return table.concat(output, '\n') end -say:set_namespace "en" -say:set("assertion.same_indent.positive", "Incorrect indentation\n%s") -say:set("assertion.same_indent.negative", "Incorrect indentation\n%s") +say:set_namespace('en') +say:set('assertion.same_indent.positive', 'Incorrect indentation\n%s') +say:set('assertion.same_indent.negative', 'Incorrect indentation\n%s') assert:register( - "assertion", - "same_indent", + 'assertion', + 'same_indent', same_indent, - "assertion.same_indent.positive", - "assert.same_indent.negative" + 'assertion.same_indent.positive', + 'assert.same_indent.negative' ) -- Custom assertion better suited for indentation diffs local function compare_indent(before, after, xfail) assert:add_formatter(format_indent) if xfail then - io.stdout:write "Warning! Known failure of this test! Please help to fix it! " + io.stdout:write('Warning! Known failure of this test! Please help to fix it! ') assert.is_not.same_indent(before, after) else assert.is.same_indent(before, after) @@ -83,7 +83,8 @@ local function compare_indent(before, after, xfail) end local function set_buf_indent_opts(opts) - local optnames = { "tabstop", "shiftwidth", "softtabstop", "expandtab", "filetype", "lispoptions" } + local optnames = + { 'tabstop', 'shiftwidth', 'softtabstop', 'expandtab', 'filetype', 'lispoptions' } for _, opt in ipairs(optnames) do if opts[opt] ~= nil then vim.bo[opt] = opts[opt] @@ -95,11 +96,11 @@ function M.run_indent_test(file, runner, opts) assert.are.same(1, vim.fn.filereadable(file), string.format('File "%s" not readable', file)) -- load reference file - vim.cmd(string.format("edit %s", file)) - vim.bo.indentexpr = "nvim_treesitter#indent()" + vim.cmd(string.format('edit %s', file)) + vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" local before = vim.api.nvim_buf_get_lines(0, 0, -1, true) - assert.are.same("nvim_treesitter#indent()", vim.bo.indentexpr) + assert.are.same("v:lua.require'nvim-treesitter'.indentexpr()", vim.bo.indentexpr) set_buf_indent_opts(opts) -- perform the test @@ -109,14 +110,14 @@ function M.run_indent_test(file, runner, opts) local after = vim.api.nvim_buf_get_lines(0, 0, -1, true) -- clear any changes to avoid 'No write since last change (add ! to override)' - vim.cmd "edit!" + vim.cmd('edit!') return before, after end function M.indent_whole_file(file, opts, xfail) local before, after = M.run_indent_test(file, function() - vim.cmd "silent normal gg=G" + vim.cmd('silent normal gg=G') end, opts) compare_indent(before, after, xfail) @@ -132,22 +133,24 @@ end function M.indent_new_line(file, spec, opts, xfail) local before, after = M.run_indent_test(file, function() -- move to the line and input the new one - vim.cmd(string.format("normal! %dG", spec.on_line)) - vim.cmd(string.format("normal! o%s", spec.text)) + vim.cmd(string.format('normal! %dG', spec.on_line)) + vim.cmd(string.format('normal! o%s', spec.text)) end, opts) - local indent = type(spec.indent) == "string" and spec.indent or string.rep(" ", spec.indent) + local indent = type(spec.indent) == 'string' and spec.indent or string.rep(' ', spec.indent) table.insert(before, spec.on_line + 1, indent .. spec.text) compare_indent(before, after, xfail) before, after = M.run_indent_test(file, function() -- move to the line and input the new one - vim.cmd(string.format("normal! %dG$", spec.on_line)) - vim.cmd(string.format(vim.api.nvim_replace_termcodes("normal! a<cr>%s", true, true, true), spec.text)) + vim.cmd(string.format('normal! %dG$', spec.on_line)) + vim.cmd( + string.format(vim.api.nvim_replace_termcodes('normal! a<cr>%s', true, true, true), spec.text) + ) end, opts) - indent = type(spec.indent) == "string" and spec.indent or string.rep(" ", spec.indent) + indent = type(spec.indent) == 'string' and spec.indent or string.rep(' ', spec.indent) table.insert(before, spec.on_line + 1, indent .. spec.text) compare_indent(before, after, xfail) @@ -174,13 +177,13 @@ function Runner:whole_file(dirs, opts) expected_failures = vim.tbl_map(function(f) return Path:new(f):make_relative(self.base_dir.filename) end, expected_failures) - dirs = type(dirs) == "table" and dirs or { dirs } + dirs = type(dirs) == 'table' and dirs or { dirs } dirs = vim.tbl_map(function(dir) dir = self.base_dir / Path:new(dir) assert.is.same(1, vim.fn.isdirectory(dir.filename)) return dir.filename end, dirs) - local files = require("nvim-treesitter.compat").flatten(vim.tbl_map(scan_dir, dirs)) + local files = require('nvim-treesitter.compat').flatten(vim.tbl_map(scan_dir, dirs)) for _, file in ipairs(files) do local relpath = Path:new(file):make_relative(self.base_dir.filename) self.it(relpath, function() @@ -191,7 +194,7 @@ end function Runner:new_line(file, spec, title, xfail) title = title and title or tostring(spec.on_line) - self.it(string.format("%s[%s]", file, title), function() + self.it(string.format('%s[%s]', file, title), function() local path = self.base_dir / file M.indent_new_line(path.filename, spec, self.buf_opts, xfail) end) diff --git a/tests/indent/cpp_spec.lua b/tests/indent/cpp_spec.lua index 7ac69e2a6..8e97c805e 100644 --- a/tests/indent/cpp_spec.lua +++ b/tests/indent/cpp_spec.lua @@ -1,51 +1,56 @@ -local Runner = require("tests.indent.common").Runner -local XFAIL = require("tests.indent.common").XFAIL +local Runner = require('tests.indent.common').Runner +local XFAIL = require('tests.indent.common').XFAIL -- will use both c/ and cpp/ -local run = Runner:new(it, "tests/indent", { +local run = Runner:new(it, 'tests/indent', { tabstop = 4, shiftwidth = 4, softtabstop = 0, expandtab = true, - filetype = "cpp", + filetype = 'cpp', }) -describe("indent C++:", function() - describe("whole file:", function() - run:whole_file({ "c/", "cpp/" }, { +describe('indent C++:', function() + describe('whole file:', function() + run:whole_file({ 'c/', 'cpp/' }, { expected_failures = { -- C - "c/preproc_func.c", - "c/unfinished_comment.c", + 'c/preproc_func.c', + 'c/unfinished_comment.c', }, }) end) - describe("new line:", function() - run:new_line("cpp/access.cpp", { on_line = 3, text = "protected:", indent = 0 }) - run:new_line("cpp/class.cpp", { on_line = 2, text = "using T = int;", indent = 4 }) - run:new_line("cpp/stream.cpp", { on_line = 5, text = "<< x + 3", indent = 8 }) + describe('new line:', function() + run:new_line('cpp/access.cpp', { on_line = 3, text = 'protected:', indent = 0 }) + run:new_line('cpp/class.cpp', { on_line = 2, text = 'using T = int;', indent = 4 }) + run:new_line('cpp/stream.cpp', { on_line = 5, text = '<< x + 3', indent = 8 }) -- TODO: find a clean way to import these from c_spec.lua - run:new_line("c/array.c", { on_line = 2, text = "0,", indent = 4 }) - run:new_line("c/cond.c", { on_line = 3, text = "x++;", indent = 8 }) - run:new_line("c/cond.c", { on_line = 6, text = "x++;", indent = 8 }) - run:new_line("c/cond.c", { on_line = 8, text = "x++;", indent = 8 }) - run:new_line("c/cond.c", { on_line = 9, text = "x++;", indent = 4 }) - run:new_line("c/expr.c", { on_line = 10, text = "2 *", indent = 8 }) - run:new_line("c/func.c", { on_line = 17, text = "int z,", indent = 4 }) - run:new_line("c/label.c", { on_line = 3, text = "normal:", indent = 0 }) - run:new_line("c/loop.c", { on_line = 3, text = "x++;", indent = 8 }) - run:new_line("c/preproc_cond.c", { on_line = 5, text = "x++;", indent = 4 }) - run:new_line("c/preproc_func.c", { on_line = 3, text = "x++; \\", indent = 8 }, "expected failure", XFAIL) - run:new_line("c/string.c", { on_line = 1, text = "brave new \\", indent = 0 }) - run:new_line("c/string.c", { on_line = 4, text = '"brave new "', indent = 4 }) - run:new_line("c/struct.c", { on_line = 4, text = "int y;", indent = 8 }) - run:new_line("c/switch.c", { on_line = 3, text = "x++;", indent = 12 }) - run:new_line("c/ternary.c", { on_line = 4, text = ": (x == 0) : 0", indent = 8 }) + run:new_line('c/array.c', { on_line = 2, text = '0,', indent = 4 }) + run:new_line('c/cond.c', { on_line = 3, text = 'x++;', indent = 8 }) + run:new_line('c/cond.c', { on_line = 6, text = 'x++;', indent = 8 }) + run:new_line('c/cond.c', { on_line = 8, text = 'x++;', indent = 8 }) + run:new_line('c/cond.c', { on_line = 9, text = 'x++;', indent = 4 }) + run:new_line('c/expr.c', { on_line = 10, text = '2 *', indent = 8 }) + run:new_line('c/func.c', { on_line = 17, text = 'int z,', indent = 4 }) + run:new_line('c/label.c', { on_line = 3, text = 'normal:', indent = 0 }) + run:new_line('c/loop.c', { on_line = 3, text = 'x++;', indent = 8 }) + run:new_line('c/preproc_cond.c', { on_line = 5, text = 'x++;', indent = 4 }) + run:new_line( + 'c/preproc_func.c', + { on_line = 3, text = 'x++; \\', indent = 8 }, + 'expected failure', + XFAIL + ) + run:new_line('c/string.c', { on_line = 1, text = 'brave new \\', indent = 0 }) + run:new_line('c/string.c', { on_line = 4, text = '"brave new "', indent = 4 }) + run:new_line('c/struct.c', { on_line = 4, text = 'int y;', indent = 8 }) + run:new_line('c/switch.c', { on_line = 3, text = 'x++;', indent = 12 }) + run:new_line('c/ternary.c', { on_line = 4, text = ': (x == 0) : 0', indent = 8 }) -- the line after inserted one will be left with wrong indent but we only care about the inserted one - run:new_line("c/no_braces.c", { on_line = 4, text = "x++;", indent = 8 }) - run:new_line("c/no_braces.c", { on_line = 7, text = "x++;", indent = 8 }) - run:new_line("c/no_braces.c", { on_line = 10, text = "x++;", indent = 8 }) + run:new_line('c/no_braces.c', { on_line = 4, text = 'x++;', indent = 8 }) + run:new_line('c/no_braces.c', { on_line = 7, text = 'x++;', indent = 8 }) + run:new_line('c/no_braces.c', { on_line = 10, text = 'x++;', indent = 8 }) end) end) diff --git a/tests/indent/css_spec.lua b/tests/indent/css_spec.lua index 46c7e1afb..69de62e92 100644 --- a/tests/indent/css_spec.lua +++ b/tests/indent/css_spec.lua @@ -1,22 +1,22 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner -local run = Runner:new(it, "tests/indent/css", { +local run = Runner:new(it, 'tests/indent/css', { tabstop = 2, shiftwidth = 2, softtabstop = 0, expandtab = true, }) -describe("indent CSS:", function() - describe("whole file:", function() - run:whole_file(".", { +describe('indent CSS:', function() + describe('whole file:', function() + run:whole_file('.', { expected_failures = {}, }) end) - describe("new line:", function() - run:new_line("open_block.css", { on_line = 1, text = "}", indent = 0 }) - run:new_line("open_block.css", { on_line = 1, text = "color: green;", indent = 2 }) - run:new_line("next_rule.css", { on_line = 3, text = ".next {", indent = 0 }) + describe('new line:', function() + run:new_line('open_block.css', { on_line = 1, text = '}', indent = 0 }) + run:new_line('open_block.css', { on_line = 1, text = 'color: green;', indent = 2 }) + run:new_line('next_rule.css', { on_line = 3, text = '.next {', indent = 0 }) end) end) diff --git a/tests/indent/dart_spec.lua b/tests/indent/dart_spec.lua index c1d018738..4817c2ab2 100644 --- a/tests/indent/dart_spec.lua +++ b/tests/indent/dart_spec.lua @@ -1,46 +1,51 @@ -local Runner = require("tests.indent.common").Runner -local XFAIL = require("tests.indent.common").XFAIL +local Runner = require('tests.indent.common').Runner +local XFAIL = require('tests.indent.common').XFAIL -local run = Runner:new(it, "tests/indent/dart", { +local run = Runner:new(it, 'tests/indent/dart', { tabstop = 2, shiftwidth = 2, softtabstop = 2, expandtab = true, }) -describe("indent Lua:", function() - describe("whole file:", function() - run:whole_file(".", { +describe('indent Lua:', function() + describe('whole file:', function() + run:whole_file('.', { expected_failures = { - "./multiple_arguments.dart", - "./class.dart", - "./class_function_argument.dart", + './multiple_arguments.dart', + './class.dart', + './class_function_argument.dart', }, }) end) end) -describe("new line:", function() - run:new_line("class.dart", { on_line = 4, text = "int five;", indent = 2 }) - run:new_line("class.dart", { on_line = 6, text = "'100'", indent = 8 }, "expected failure", XFAIL) - run:new_line("class.dart", { on_line = 7, text = "int five = 5", indent = 2 }, "expected failure", XFAIL) - run:new_line("try.dart", { on_line = 2, text = "var x;", indent = 4 }) - for _, content in ipairs { "var x;", "var x" } do - run:new_line("try.dart", { on_line = 10, text = content, indent = 6 }) +describe('new line:', function() + run:new_line('class.dart', { on_line = 4, text = 'int five;', indent = 2 }) + run:new_line('class.dart', { on_line = 6, text = "'100'", indent = 8 }, 'expected failure', XFAIL) + run:new_line( + 'class.dart', + { on_line = 7, text = 'int five = 5', indent = 2 }, + 'expected failure', + XFAIL + ) + run:new_line('try.dart', { on_line = 2, text = 'var x;', indent = 4 }) + for _, content in ipairs({ 'var x;', 'var x' }) do + run:new_line('try.dart', { on_line = 10, text = content, indent = 6 }) end - run:new_line("switch.dart", { on_line = 3, text = "x = 1;", indent = 6 }) - run:new_line("switch.dart", { on_line = 9, text = "x = 1;", indent = 6 }) - run:new_line("switch.dart", { on_line = 3, text = "case 2:", indent = 4 }) - run:new_line("switch.dart", { on_line = 16, text = "abc;", indent = 4 }) - run:new_line("switch.dart", { on_line = 20, text = "abc;", indent = 4 }) - run:new_line("switch.dart", { on_line = 28, text = "y++;", indent = 6 }) + run:new_line('switch.dart', { on_line = 3, text = 'x = 1;', indent = 6 }) + run:new_line('switch.dart', { on_line = 9, text = 'x = 1;', indent = 6 }) + run:new_line('switch.dart', { on_line = 3, text = 'case 2:', indent = 4 }) + run:new_line('switch.dart', { on_line = 16, text = 'abc;', indent = 4 }) + run:new_line('switch.dart', { on_line = 20, text = 'abc;', indent = 4 }) + run:new_line('switch.dart', { on_line = 28, text = 'y++;', indent = 6 }) - run:new_line("multiple_arguments.dart", { on_line = 10, text = "var x;", indent = 4 }) + run:new_line('multiple_arguments.dart', { on_line = 10, text = 'var x;', indent = 4 }) run:new_line( - "multiple_arguments.dart", - { on_line = 11, text = "var x;", indent = 4 }, - "expected failure issue #4637", + 'multiple_arguments.dart', + { on_line = 11, text = 'var x;', indent = 4 }, + 'expected failure issue #4637', XFAIL ) - run:new_line("class_function_argument.dart", { on_line = 11, text = "}", indent = 4 }) + run:new_line('class_function_argument.dart', { on_line = 11, text = '}', indent = 4 }) end) diff --git a/tests/indent/dot_spec.lua b/tests/indent/dot_spec.lua index ac78f8d92..135321da2 100644 --- a/tests/indent/dot_spec.lua +++ b/tests/indent/dot_spec.lua @@ -1,25 +1,25 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner -local run = Runner:new(it, "tests/indent/dot", { +local run = Runner:new(it, 'tests/indent/dot', { tabstop = 2, shiftwidth = 2, softtabstop = 0, expandtab = true, }) -describe("indent dot:", function() - describe("whole file:", function() - run:whole_file(".", { +describe('indent dot:', function() + describe('whole file:', function() + run:whole_file('.', { expected_failures = {}, }) end) - describe("new line:", function() - run:new_line("test.dot", { on_line = 1, text = "node [", indent = 2 }) - run:new_line("test.dot", { on_line = 2, text = "shape=ellipse,", indent = 4 }) - run:new_line("test.dot", { on_line = 4, text = "subgraph sub {", indent = 2 }) - run:new_line("test.dot", { on_line = 5, text = "a1 -> a2 -> a3;", indent = 4 }) - run:new_line("test.dot", { on_line = 6, text = "}", indent = 2 }) - run:new_line("test.dot", { on_line = 7, text = "}", indent = 0 }) + describe('new line:', function() + run:new_line('test.dot', { on_line = 1, text = 'node [', indent = 2 }) + run:new_line('test.dot', { on_line = 2, text = 'shape=ellipse,', indent = 4 }) + run:new_line('test.dot', { on_line = 4, text = 'subgraph sub {', indent = 2 }) + run:new_line('test.dot', { on_line = 5, text = 'a1 -> a2 -> a3;', indent = 4 }) + run:new_line('test.dot', { on_line = 6, text = '}', indent = 2 }) + run:new_line('test.dot', { on_line = 7, text = '}', indent = 0 }) end) end) diff --git a/tests/indent/gdscript_spec.lua b/tests/indent/gdscript_spec.lua index c1770f41a..ee6f58a4b 100644 --- a/tests/indent/gdscript_spec.lua +++ b/tests/indent/gdscript_spec.lua @@ -1,20 +1,20 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner -local run = Runner:new(it, "tests/indent/gdscript", { +local run = Runner:new(it, 'tests/indent/gdscript', { tabstop = 4, shiftwidth = 4, softtabstop = 0, expandtab = false, }) -describe("indent GDScript:", function() - describe("whole file:", function() - run:whole_file(".", { +describe('indent GDScript:', function() + describe('whole file:', function() + run:whole_file('.', { expected_failures = {}, }) end) - describe("new line:", function() - run:new_line("basic_blocks.gd", { on_line = 1, text = "var member := 0", indent = 0 }) + describe('new line:', function() + run:new_line('basic_blocks.gd', { on_line = 1, text = 'var member := 0', indent = 0 }) end) end) diff --git a/tests/indent/gleam_spec.lua b/tests/indent/gleam_spec.lua index 8de57fd50..1d77e52a1 100644 --- a/tests/indent/gleam_spec.lua +++ b/tests/indent/gleam_spec.lua @@ -1,127 +1,127 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner -local run = Runner:new(it, "tests/indent/gleam", { +local run = Runner:new(it, 'tests/indent/gleam', { tabstop = 2, shiftwidth = 2, softtabstop = 2, expandtab = true, }) -describe("indent Gleam:", function() - describe("whole file:", function() - run:whole_file "." +describe('indent Gleam:', function() + describe('whole file:', function() + run:whole_file('.') end) - describe("new line:", function() - run:new_line("type.gleam", { on_line = 1, text = "//", indent = 2 }) - run:new_line("type.gleam", { on_line = 2, text = "//", indent = 2 }) - run:new_line("type.gleam", { on_line = 3, text = "//", indent = 0 }) - run:new_line("type.gleam", { on_line = 4, text = "//", indent = 0 }) - run:new_line("type.gleam", { on_line = 5, text = "//", indent = 2 }) - run:new_line("type.gleam", { on_line = 6, text = "//", indent = 2 }) - run:new_line("type.gleam", { on_line = 7, text = "//", indent = 2 }) - run:new_line("type.gleam", { on_line = 8, text = "//", indent = 0 }) - run:new_line("type.gleam", { on_line = 9, text = "//", indent = 0 }) - run:new_line("type.gleam", { on_line = 10, text = "//", indent = 2 }) - run:new_line("type.gleam", { on_line = 11, text = "//", indent = 2 }) - run:new_line("type.gleam", { on_line = 12, text = "//", indent = 0 }) - run:new_line("type.gleam", { on_line = 13, text = "//", indent = 0 }) - run:new_line("type.gleam", { on_line = 14, text = "//", indent = 2 }) - run:new_line("type.gleam", { on_line = 15, text = "//", indent = 0 }) - run:new_line("type.gleam", { on_line = 16, text = "//", indent = 0 }) - run:new_line("type.gleam", { on_line = 17, text = "//", indent = 2 }) - run:new_line("type.gleam", { on_line = 18, text = "//", indent = 0 }) + describe('new line:', function() + run:new_line('type.gleam', { on_line = 1, text = '//', indent = 2 }) + run:new_line('type.gleam', { on_line = 2, text = '//', indent = 2 }) + run:new_line('type.gleam', { on_line = 3, text = '//', indent = 0 }) + run:new_line('type.gleam', { on_line = 4, text = '//', indent = 0 }) + run:new_line('type.gleam', { on_line = 5, text = '//', indent = 2 }) + run:new_line('type.gleam', { on_line = 6, text = '//', indent = 2 }) + run:new_line('type.gleam', { on_line = 7, text = '//', indent = 2 }) + run:new_line('type.gleam', { on_line = 8, text = '//', indent = 0 }) + run:new_line('type.gleam', { on_line = 9, text = '//', indent = 0 }) + run:new_line('type.gleam', { on_line = 10, text = '//', indent = 2 }) + run:new_line('type.gleam', { on_line = 11, text = '//', indent = 2 }) + run:new_line('type.gleam', { on_line = 12, text = '//', indent = 0 }) + run:new_line('type.gleam', { on_line = 13, text = '//', indent = 0 }) + run:new_line('type.gleam', { on_line = 14, text = '//', indent = 2 }) + run:new_line('type.gleam', { on_line = 15, text = '//', indent = 0 }) + run:new_line('type.gleam', { on_line = 16, text = '//', indent = 0 }) + run:new_line('type.gleam', { on_line = 17, text = '//', indent = 2 }) + run:new_line('type.gleam', { on_line = 18, text = '//', indent = 0 }) - run:new_line("function.gleam", { on_line = 1, text = "//", indent = 0 }) - run:new_line("function.gleam", { on_line = 2, text = "//", indent = 0 }) - run:new_line("function.gleam", { on_line = 3, text = "//", indent = 2 }) - run:new_line("function.gleam", { on_line = 4, text = "//", indent = 2 }) - run:new_line("function.gleam", { on_line = 5, text = "//", indent = 0 }) - run:new_line("function.gleam", { on_line = 6, text = "//", indent = 0 }) - run:new_line("function.gleam", { on_line = 7, text = "//", indent = 2 }) - run:new_line("function.gleam", { on_line = 8, text = "//", indent = 2 }) - run:new_line("function.gleam", { on_line = 9, text = "//", indent = 0 }) - run:new_line("function.gleam", { on_line = 10, text = "//", indent = 0 }) - run:new_line("function.gleam", { on_line = 11, text = "//", indent = 2 }) - run:new_line("function.gleam", { on_line = 12, text = "//", indent = 2 }) - run:new_line("function.gleam", { on_line = 13, text = "//", indent = 2 }) - run:new_line("function.gleam", { on_line = 14, text = "//", indent = 2 }) - run:new_line("function.gleam", { on_line = 15, text = "//", indent = 2 }) + run:new_line('function.gleam', { on_line = 1, text = '//', indent = 0 }) + run:new_line('function.gleam', { on_line = 2, text = '//', indent = 0 }) + run:new_line('function.gleam', { on_line = 3, text = '//', indent = 2 }) + run:new_line('function.gleam', { on_line = 4, text = '//', indent = 2 }) + run:new_line('function.gleam', { on_line = 5, text = '//', indent = 0 }) + run:new_line('function.gleam', { on_line = 6, text = '//', indent = 0 }) + run:new_line('function.gleam', { on_line = 7, text = '//', indent = 2 }) + run:new_line('function.gleam', { on_line = 8, text = '//', indent = 2 }) + run:new_line('function.gleam', { on_line = 9, text = '//', indent = 0 }) + run:new_line('function.gleam', { on_line = 10, text = '//', indent = 0 }) + run:new_line('function.gleam', { on_line = 11, text = '//', indent = 2 }) + run:new_line('function.gleam', { on_line = 12, text = '//', indent = 2 }) + run:new_line('function.gleam', { on_line = 13, text = '//', indent = 2 }) + run:new_line('function.gleam', { on_line = 14, text = '//', indent = 2 }) + run:new_line('function.gleam', { on_line = 15, text = '//', indent = 2 }) - run:new_line("list.gleam", { on_line = 1, text = "//", indent = 2 }) - run:new_line("list.gleam", { on_line = 2, text = "//", indent = 4 }) - run:new_line("list.gleam", { on_line = 3, text = "//", indent = 4 }) - run:new_line("list.gleam", { on_line = 4, text = "//", indent = 6 }) - run:new_line("list.gleam", { on_line = 5, text = "//", indent = 6 }) - run:new_line("list.gleam", { on_line = 6, text = "//", indent = 8 }) - run:new_line("list.gleam", { on_line = 7, text = "//", indent = 8 }) - run:new_line("list.gleam", { on_line = 8, text = "//", indent = 6 }) - run:new_line("list.gleam", { on_line = 9, text = "//", indent = 4 }) - run:new_line("list.gleam", { on_line = 10, text = "//", indent = 2 }) - run:new_line("list.gleam", { on_line = 11, text = "//", indent = 0 }) + run:new_line('list.gleam', { on_line = 1, text = '//', indent = 2 }) + run:new_line('list.gleam', { on_line = 2, text = '//', indent = 4 }) + run:new_line('list.gleam', { on_line = 3, text = '//', indent = 4 }) + run:new_line('list.gleam', { on_line = 4, text = '//', indent = 6 }) + run:new_line('list.gleam', { on_line = 5, text = '//', indent = 6 }) + run:new_line('list.gleam', { on_line = 6, text = '//', indent = 8 }) + run:new_line('list.gleam', { on_line = 7, text = '//', indent = 8 }) + run:new_line('list.gleam', { on_line = 8, text = '//', indent = 6 }) + run:new_line('list.gleam', { on_line = 9, text = '//', indent = 4 }) + run:new_line('list.gleam', { on_line = 10, text = '//', indent = 2 }) + run:new_line('list.gleam', { on_line = 11, text = '//', indent = 0 }) - run:new_line("tuple.gleam", { on_line = 1, text = "//", indent = 2 }) - run:new_line("tuple.gleam", { on_line = 2, text = "//", indent = 4 }) - run:new_line("tuple.gleam", { on_line = 3, text = "//", indent = 4 }) - run:new_line("tuple.gleam", { on_line = 4, text = "//", indent = 6 }) - run:new_line("tuple.gleam", { on_line = 5, text = "//", indent = 6 }) - run:new_line("tuple.gleam", { on_line = 6, text = "//", indent = 8 }) - run:new_line("tuple.gleam", { on_line = 7, text = "//", indent = 8 }) - run:new_line("tuple.gleam", { on_line = 8, text = "//", indent = 6 }) - run:new_line("tuple.gleam", { on_line = 9, text = "//", indent = 4 }) - run:new_line("tuple.gleam", { on_line = 10, text = "//", indent = 2 }) - run:new_line("tuple.gleam", { on_line = 11, text = "//", indent = 0 }) + run:new_line('tuple.gleam', { on_line = 1, text = '//', indent = 2 }) + run:new_line('tuple.gleam', { on_line = 2, text = '//', indent = 4 }) + run:new_line('tuple.gleam', { on_line = 3, text = '//', indent = 4 }) + run:new_line('tuple.gleam', { on_line = 4, text = '//', indent = 6 }) + run:new_line('tuple.gleam', { on_line = 5, text = '//', indent = 6 }) + run:new_line('tuple.gleam', { on_line = 6, text = '//', indent = 8 }) + run:new_line('tuple.gleam', { on_line = 7, text = '//', indent = 8 }) + run:new_line('tuple.gleam', { on_line = 8, text = '//', indent = 6 }) + run:new_line('tuple.gleam', { on_line = 9, text = '//', indent = 4 }) + run:new_line('tuple.gleam', { on_line = 10, text = '//', indent = 2 }) + run:new_line('tuple.gleam', { on_line = 11, text = '//', indent = 0 }) - run:new_line("case.gleam", { on_line = 1, text = "//", indent = 2 }) - run:new_line("case.gleam", { on_line = 2, text = "//", indent = 4 }) - run:new_line("case.gleam", { on_line = 3, text = "//", indent = 4 }) - run:new_line("case.gleam", { on_line = 4, text = "//", indent = 6 }) - run:new_line("case.gleam", { on_line = 5, text = "//", indent = 8 }) - run:new_line("case.gleam", { on_line = 6, text = "//", indent = 8 }) - run:new_line("case.gleam", { on_line = 7, text = "//", indent = 6 }) - run:new_line("case.gleam", { on_line = 8, text = "//", indent = 4 }) - run:new_line("case.gleam", { on_line = 9, text = "//", indent = 2 }) - run:new_line("case.gleam", { on_line = 10, text = "//", indent = 0 }) + run:new_line('case.gleam', { on_line = 1, text = '//', indent = 2 }) + run:new_line('case.gleam', { on_line = 2, text = '//', indent = 4 }) + run:new_line('case.gleam', { on_line = 3, text = '//', indent = 4 }) + run:new_line('case.gleam', { on_line = 4, text = '//', indent = 6 }) + run:new_line('case.gleam', { on_line = 5, text = '//', indent = 8 }) + run:new_line('case.gleam', { on_line = 6, text = '//', indent = 8 }) + run:new_line('case.gleam', { on_line = 7, text = '//', indent = 6 }) + run:new_line('case.gleam', { on_line = 8, text = '//', indent = 4 }) + run:new_line('case.gleam', { on_line = 9, text = '//', indent = 2 }) + run:new_line('case.gleam', { on_line = 10, text = '//', indent = 0 }) - run:new_line("let.gleam", { on_line = 1, text = "//", indent = 2 }) - run:new_line("let.gleam", { on_line = 2, text = "//", indent = 4 }) - run:new_line("let.gleam", { on_line = 3, text = "//", indent = 4 }) - run:new_line("let.gleam", { on_line = 4, text = "//", indent = 0 }) + run:new_line('let.gleam', { on_line = 1, text = '//', indent = 2 }) + run:new_line('let.gleam', { on_line = 2, text = '//', indent = 4 }) + run:new_line('let.gleam', { on_line = 3, text = '//', indent = 4 }) + run:new_line('let.gleam', { on_line = 4, text = '//', indent = 0 }) - run:new_line("pipe.gleam", { on_line = 1, text = "//", indent = 2 }) - run:new_line("pipe.gleam", { on_line = 2, text = "//", indent = 2 }) - run:new_line("pipe.gleam", { on_line = 3, text = "//", indent = 2 }) - run:new_line("pipe.gleam", { on_line = 4, text = "//", indent = 0 }) + run:new_line('pipe.gleam', { on_line = 1, text = '//', indent = 2 }) + run:new_line('pipe.gleam', { on_line = 2, text = '//', indent = 2 }) + run:new_line('pipe.gleam', { on_line = 3, text = '//', indent = 2 }) + run:new_line('pipe.gleam', { on_line = 4, text = '//', indent = 0 }) - run:new_line("binary_expression.gleam", { on_line = 1, text = "//", indent = 2 }) - run:new_line("binary_expression.gleam", { on_line = 2, text = "//", indent = 4 }) - run:new_line("binary_expression.gleam", { on_line = 3, text = "//", indent = 4 }) - run:new_line("binary_expression.gleam", { on_line = 4, text = "//", indent = 0 }) + run:new_line('binary_expression.gleam', { on_line = 1, text = '//', indent = 2 }) + run:new_line('binary_expression.gleam', { on_line = 2, text = '//', indent = 4 }) + run:new_line('binary_expression.gleam', { on_line = 3, text = '//', indent = 4 }) + run:new_line('binary_expression.gleam', { on_line = 4, text = '//', indent = 0 }) - run:new_line("import.gleam", { on_line = 1, text = "//", indent = 2 }) - run:new_line("import.gleam", { on_line = 2, text = "//", indent = 2 }) - run:new_line("import.gleam", { on_line = 3, text = "//", indent = 2 }) - run:new_line("import.gleam", { on_line = 4, text = "//", indent = 0 }) + run:new_line('import.gleam', { on_line = 1, text = '//', indent = 2 }) + run:new_line('import.gleam', { on_line = 2, text = '//', indent = 2 }) + run:new_line('import.gleam', { on_line = 3, text = '//', indent = 2 }) + run:new_line('import.gleam', { on_line = 4, text = '//', indent = 0 }) - run:new_line("constant.gleam", { on_line = 1, text = "//", indent = 2 }) - run:new_line("constant.gleam", { on_line = 2, text = "//", indent = 2 }) + run:new_line('constant.gleam', { on_line = 1, text = '//', indent = 2 }) + run:new_line('constant.gleam', { on_line = 2, text = '//', indent = 2 }) - run:new_line("assert.gleam", { on_line = 1, text = "//", indent = 2 }) - run:new_line("assert.gleam", { on_line = 2, text = "//", indent = 4 }) - run:new_line("assert.gleam", { on_line = 3, text = "//", indent = 2 }) - run:new_line("assert.gleam", { on_line = 4, text = "//", indent = 0 }) + run:new_line('assert.gleam', { on_line = 1, text = '//', indent = 2 }) + run:new_line('assert.gleam', { on_line = 2, text = '//', indent = 4 }) + run:new_line('assert.gleam', { on_line = 3, text = '//', indent = 2 }) + run:new_line('assert.gleam', { on_line = 4, text = '//', indent = 0 }) - run:new_line("todo.gleam", { on_line = 1, text = "//", indent = 2 }) - run:new_line("todo.gleam", { on_line = 2, text = "//", indent = 4 }) - run:new_line("todo.gleam", { on_line = 3, text = "//", indent = 4 }) - run:new_line("todo.gleam", { on_line = 4, text = "//", indent = 2 }) - run:new_line("todo.gleam", { on_line = 5, text = "//", indent = 0 }) + run:new_line('todo.gleam', { on_line = 1, text = '//', indent = 2 }) + run:new_line('todo.gleam', { on_line = 2, text = '//', indent = 4 }) + run:new_line('todo.gleam', { on_line = 3, text = '//', indent = 4 }) + run:new_line('todo.gleam', { on_line = 4, text = '//', indent = 2 }) + run:new_line('todo.gleam', { on_line = 5, text = '//', indent = 0 }) - run:new_line("anonymous_function.gleam", { on_line = 1, text = "//", indent = 2 }) - run:new_line("anonymous_function.gleam", { on_line = 2, text = "//", indent = 4 }) - run:new_line("anonymous_function.gleam", { on_line = 3, text = "//", indent = 6 }) - run:new_line("anonymous_function.gleam", { on_line = 4, text = "//", indent = 6 }) - run:new_line("anonymous_function.gleam", { on_line = 5, text = "//", indent = 4 }) - run:new_line("anonymous_function.gleam", { on_line = 6, text = "//", indent = 2 }) - run:new_line("anonymous_function.gleam", { on_line = 7, text = "//", indent = 0 }) + run:new_line('anonymous_function.gleam', { on_line = 1, text = '//', indent = 2 }) + run:new_line('anonymous_function.gleam', { on_line = 2, text = '//', indent = 4 }) + run:new_line('anonymous_function.gleam', { on_line = 3, text = '//', indent = 6 }) + run:new_line('anonymous_function.gleam', { on_line = 4, text = '//', indent = 6 }) + run:new_line('anonymous_function.gleam', { on_line = 5, text = '//', indent = 4 }) + run:new_line('anonymous_function.gleam', { on_line = 6, text = '//', indent = 2 }) + run:new_line('anonymous_function.gleam', { on_line = 7, text = '//', indent = 0 }) end) end) diff --git a/tests/indent/go_spec.lua b/tests/indent/go_spec.lua index 4d604f3ef..f29379139 100644 --- a/tests/indent/go_spec.lua +++ b/tests/indent/go_spec.lua @@ -1,24 +1,24 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner --local XFAIL = require("tests.indent.common").XFAIL -local run = Runner:new(it, "tests/indent/go", { +local run = Runner:new(it, 'tests/indent/go', { tabstop = 4, shiftwidth = 4, softtabstop = 4, expandtab = false, }) -describe("indent Go:", function() - describe("whole file:", function() - run:whole_file(".", { +describe('indent Go:', function() + describe('whole file:', function() + run:whole_file('.', { expected_failures = {}, }) end) - describe("new lines:", function() - run:new_line("issue-2369.go", { on_line = 13, text = "// some comment", indent = 1 }) - run:new_line("issue-2369-newline.go", { on_line = 8, text = "// comment", indent = 0 }) - run:new_line("const_declaration.go", { on_line = 3, text = "Constant", indent = 1 }) - run:new_line("const_declaration.go", { on_line = 7, text = "func main() {", indent = 0 }) + describe('new lines:', function() + run:new_line('issue-2369.go', { on_line = 13, text = '// some comment', indent = 1 }) + run:new_line('issue-2369-newline.go', { on_line = 8, text = '// comment', indent = 0 }) + run:new_line('const_declaration.go', { on_line = 3, text = 'Constant', indent = 1 }) + run:new_line('const_declaration.go', { on_line = 7, text = 'func main() {', indent = 0 }) end) end) diff --git a/tests/indent/graphql_spec.lua b/tests/indent/graphql_spec.lua index 9fc9896a7..d54cf60c5 100644 --- a/tests/indent/graphql_spec.lua +++ b/tests/indent/graphql_spec.lua @@ -1,19 +1,19 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner --local XFAIL = require("tests.indent.common").XFAIL -local run = Runner:new(it, "tests/indent/graphql", { +local run = Runner:new(it, 'tests/indent/graphql', { tabstop = 2, shiftwidth = 2, softtabstop = 0, expandtab = true, }) -describe("indent GraphQL:", function() - describe("whole file:", function() - run:whole_file(".", { +describe('indent GraphQL:', function() + describe('whole file:', function() + run:whole_file('.', { expected_failures = {}, }) end) - describe("new line:", function() end) + describe('new line:', function() end) end) diff --git a/tests/indent/html_spec.lua b/tests/indent/html_spec.lua index b94653613..b240b7150 100644 --- a/tests/indent/html_spec.lua +++ b/tests/indent/html_spec.lua @@ -1,28 +1,28 @@ -local Runner = require("tests.indent.common").Runner -local runner = Runner:new(it, "tests/indent/html", { +local Runner = require('tests.indent.common').Runner +local runner = Runner:new(it, 'tests/indent/html', { tabstop = 2, shiftwidth = 2, expandtab = true, }) -describe("indent HTML:", function() - describe("whole file:", function() - runner:whole_file "." +describe('indent HTML:', function() + describe('whole file:', function() + runner:whole_file('.') end) - describe("new line:", function() - runner:new_line("start_tag.html", { on_line = 1, text = "anything", indent = 0 }) - runner:new_line("start_tag.html", { on_line = 4, text = "anything", indent = 4 }) - runner:new_line("start_tag.html", { on_line = 6, text = "charset = utf-8", indent = 6 }) - runner:new_line("start_tag.html", { on_line = 6, text = ">", indent = 4 }) - runner:new_line("start_tag.html", { on_line = 6, text = "/>", indent = 4 }) - runner:new_line("issue-3986.html", { on_line = 3, text = "indent once", indent = 2 }) - runner:new_line("self_closing_tag.html", { on_line = 10, text = "Something", indent = 4 }) - runner:new_line("self_closing_tag.html", { on_line = 12, text = "disabled", indent = 6 }) - runner:new_line("self_closing_tag.html", { on_line = 12, text = "/>", indent = 4 }) - runner:new_line("script_style.html", { on_line = 5, text = "body", indent = 2 }) - runner:new_line("script_style.html", { on_line = 6, text = "<div></div>", indent = 2 }) - runner:new_line("script_style.html", { on_line = 9, text = "const x = 1", indent = 2 }) - runner:new_line("script_style.html", { on_line = 11, text = "Text", indent = 2 }) + describe('new line:', function() + runner:new_line('start_tag.html', { on_line = 1, text = 'anything', indent = 0 }) + runner:new_line('start_tag.html', { on_line = 4, text = 'anything', indent = 4 }) + runner:new_line('start_tag.html', { on_line = 6, text = 'charset = utf-8', indent = 6 }) + runner:new_line('start_tag.html', { on_line = 6, text = '>', indent = 4 }) + runner:new_line('start_tag.html', { on_line = 6, text = '/>', indent = 4 }) + runner:new_line('issue-3986.html', { on_line = 3, text = 'indent once', indent = 2 }) + runner:new_line('self_closing_tag.html', { on_line = 10, text = 'Something', indent = 4 }) + runner:new_line('self_closing_tag.html', { on_line = 12, text = 'disabled', indent = 6 }) + runner:new_line('self_closing_tag.html', { on_line = 12, text = '/>', indent = 4 }) + runner:new_line('script_style.html', { on_line = 5, text = 'body', indent = 2 }) + runner:new_line('script_style.html', { on_line = 6, text = '<div></div>', indent = 2 }) + runner:new_line('script_style.html', { on_line = 9, text = 'const x = 1', indent = 2 }) + runner:new_line('script_style.html', { on_line = 11, text = 'Text', indent = 2 }) end) end) diff --git a/tests/indent/java_spec.lua b/tests/indent/java_spec.lua index 1d10046bb..97354dbc7 100644 --- a/tests/indent/java_spec.lua +++ b/tests/indent/java_spec.lua @@ -1,39 +1,45 @@ -local Runner = require("tests.indent.common").Runner -local XFAIL = require("tests.indent.common").XFAIL +local Runner = require('tests.indent.common').Runner +local XFAIL = require('tests.indent.common').XFAIL -local run = Runner:new(it, "tests/indent/java", { +local run = Runner:new(it, 'tests/indent/java', { tabstop = 2, shiftwidth = 2, softtabstop = 0, expandtab = true, }) -describe("indent Java:", function() - describe("whole file:", function() - run:whole_file(".", { +describe('indent Java:', function() + describe('whole file:', function() + run:whole_file('.', { expected_failures = {}, }) end) - describe("new line:", function() - run:new_line("method.java", { on_line = 1, text = "void foo() {}", indent = 2 }) - run:new_line("issue_2571.java", { on_line = 5, text = "void bar() {}", indent = 2 }) - run:new_line("enum.java", { on_line = 2, text = "THING_B,", indent = 2 }) - run:new_line("class_with_annotation.java", { on_line = 2, text = "void foo() {}", indent = 2 }) - run:new_line("enum_with_annotation.java", { on_line = 2, text = "THING;", indent = 2 }) - run:new_line("interface.java", { on_line = 1, text = "void foo();", indent = 2 }) - run:new_line("javadoc.java", { on_line = 2, text = "* Sample javadoc line", indent = 3 }) + describe('new line:', function() + run:new_line('method.java', { on_line = 1, text = 'void foo() {}', indent = 2 }) + run:new_line('issue_2571.java', { on_line = 5, text = 'void bar() {}', indent = 2 }) + run:new_line('enum.java', { on_line = 2, text = 'THING_B,', indent = 2 }) + run:new_line('class_with_annotation.java', { on_line = 2, text = 'void foo() {}', indent = 2 }) + run:new_line('enum_with_annotation.java', { on_line = 2, text = 'THING;', indent = 2 }) + run:new_line('interface.java', { on_line = 1, text = 'void foo();', indent = 2 }) + run:new_line('javadoc.java', { on_line = 2, text = '* Sample javadoc line', indent = 3 }) run:new_line( - "issue_2583.java", - { on_line = 3, text = "int x = 1;", indent = 4 }, - "fails because tree is in a broken state", + 'issue_2583.java', + { on_line = 3, text = 'int x = 1;', indent = 4 }, + 'fails because tree is in a broken state', XFAIL ) - run:new_line("issue_2583.java", { on_line = 4, text = "int x = 1;", indent = 4 }) - run:new_line("method_chaining.java", { on_line = 4, text = '.append("b");', indent = 6 }) - run:new_line("constructor_with_arguments_on_multiple_lines.java", { on_line = 4, text = "}", indent = 2 }) - run:new_line("method_with_arguments_on_multiple_lines.java", { on_line = 4, text = "}", indent = 2 }) - run:new_line("annotation.java", { on_line = 1, text = "abstract public Foo(){}", indent = 2 }) - run:new_line("annotation_2.java", { on_line = 2, text = "Bar.class", indent = 4 }) + run:new_line('issue_2583.java', { on_line = 4, text = 'int x = 1;', indent = 4 }) + run:new_line('method_chaining.java', { on_line = 4, text = '.append("b");', indent = 6 }) + run:new_line( + 'constructor_with_arguments_on_multiple_lines.java', + { on_line = 4, text = '}', indent = 2 } + ) + run:new_line( + 'method_with_arguments_on_multiple_lines.java', + { on_line = 4, text = '}', indent = 2 } + ) + run:new_line('annotation.java', { on_line = 1, text = 'abstract public Foo(){}', indent = 2 }) + run:new_line('annotation_2.java', { on_line = 2, text = 'Bar.class', indent = 4 }) end) end) diff --git a/tests/indent/javascript_spec.lua b/tests/indent/javascript_spec.lua index 5659b22a1..4a7c3bcc3 100644 --- a/tests/indent/javascript_spec.lua +++ b/tests/indent/javascript_spec.lua @@ -1,40 +1,50 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner -- local XFAIL = require("tests.indent.common").XFAIL -local run = Runner:new(it, "tests/indent", { +local run = Runner:new(it, 'tests/indent', { tabstop = 2, shiftwidth = 2, softtabstop = 0, expandtab = true, - filetype = "javascript", + filetype = 'javascript', }) -describe("indent JavaScript:", function() - describe("whole file:", function() - run:whole_file({ "ecma/" }, { +describe('indent JavaScript:', function() + describe('whole file:', function() + run:whole_file({ 'ecma/' }, { expected_failures = {}, }) end) - describe("new line:", function() - for _, info in ipairs { + describe('new line:', function() + for _, info in ipairs({ { 1, 2 }, { 2, 4 }, { 3, 4 }, - } do - run:new_line("ecma/binary_expression.js", { on_line = info[1], text = "//", indent = info[2] }, info[3], info[4]) + }) do + run:new_line( + 'ecma/binary_expression.js', + { on_line = info[1], text = '//', indent = info[2] }, + info[3], + info[4] + ) end - run:new_line("ecma/new-line-after-class.js", { on_line = 2, text = "", indent = 0 }) + run:new_line('ecma/new-line-after-class.js', { on_line = 2, text = '', indent = 0 }) - for _, info in ipairs { + for _, info in ipairs({ { 4, 2 }, { 6, 0 }, - } do - run:new_line("ecma/callback.js", { on_line = info[1], text = "//", indent = info[2] }, info[3], info[4]) + }) do + run:new_line( + 'ecma/callback.js', + { on_line = info[1], text = '//', indent = info[2] }, + info[3], + info[4] + ) end - for _, info in ipairs { + for _, info in ipairs({ { 1, 2 }, { 2, 4 }, { 3, 6 }, @@ -42,11 +52,16 @@ describe("indent JavaScript:", function() { 8, 2 }, { 11, 4 }, { 13, 4 }, - } do - run:new_line("ecma/class.js", { on_line = info[1], text = "//", indent = info[2] }, info[3], info[4]) + }) do + run:new_line( + 'ecma/class.js', + { on_line = info[1], text = '//', indent = info[2] }, + info[3], + info[4] + ) end - for _, info in ipairs { + for _, info in ipairs({ { 2, 2 }, { 5, 2 }, { 7, 0 }, @@ -61,11 +76,16 @@ describe("indent JavaScript:", function() { 48, 4 }, { 49, 4 }, { 50, 2 }, - } do - run:new_line("ecma/func.js", { on_line = info[1], text = "//", indent = info[2] }, info[3], info[4]) + }) do + run:new_line( + 'ecma/func.js', + { on_line = info[1], text = '//', indent = info[2] }, + info[3], + info[4] + ) end - for _, info in ipairs { + for _, info in ipairs({ { 1, 2 }, { 2, 2 }, { 3, 2 }, @@ -77,25 +97,40 @@ describe("indent JavaScript:", function() { 13, 0 }, { 16, 0 }, { 19, 2 }, - } do - run:new_line("ecma/if_else.js", { on_line = info[1], text = "hello()", indent = info[2] }, info[3], info[4]) + }) do + run:new_line( + 'ecma/if_else.js', + { on_line = info[1], text = 'hello()', indent = info[2] }, + info[3], + info[4] + ) end - for _, info in ipairs { + for _, info in ipairs({ { 2, 2 }, { 5, 0 }, - } do - run:new_line("ecma/object.js", { on_line = info[1], text = "//", indent = info[2] }, info[3], info[4]) + }) do + run:new_line( + 'ecma/object.js', + { on_line = info[1], text = '//', indent = info[2] }, + info[3], + info[4] + ) end - for _, info in ipairs { + for _, info in ipairs({ { 3, 6 }, { 4, 6 }, - } do - run:new_line("ecma/ternary.js", { on_line = info[1], text = "//", indent = info[2] }, info[3], info[4]) + }) do + run:new_line( + 'ecma/ternary.js', + { on_line = info[1], text = '//', indent = info[2] }, + info[3], + info[4] + ) end - for _, info in ipairs { + for _, info in ipairs({ { 1, 2 }, { 2, 2 }, { 3, 2 }, @@ -103,23 +138,36 @@ describe("indent JavaScript:", function() { 5, 2 }, { 6, 2 }, { 7, 0 }, - } do - run:new_line("ecma/try_catch.js", { on_line = info[1], text = "hello()", indent = info[2] }, info[3], info[4]) + }) do + run:new_line( + 'ecma/try_catch.js', + { on_line = info[1], text = 'hello()', indent = info[2] }, + info[3], + info[4] + ) end - for _, info in ipairs { + for _, info in ipairs({ { 1, 2 }, { 2, 0 }, - } do - run:new_line("ecma/variable.js", { on_line = info[1], text = "hello()", indent = info[2] }, info[3], info[4]) + }) do + run:new_line( + 'ecma/variable.js', + { on_line = info[1], text = 'hello()', indent = info[2] }, + info[3], + info[4] + ) end - for _, line in ipairs { 2, 6 } do - run:new_line("ecma/issue-2515.js", { on_line = line, text = "{}", indent = 4 }) + for _, line in ipairs({ 2, 6 }) do + run:new_line('ecma/issue-2515.js', { on_line = line, text = '{}', indent = 4 }) end - for _, info in ipairs { { line = 2, indent = 0 } } do - run:new_line("ecma/array-issue3382.js", { on_line = info.line, text = "foo();", indent = info.indent }) + for _, info in ipairs({ { line = 2, indent = 0 } }) do + run:new_line( + 'ecma/array-issue3382.js', + { on_line = info.line, text = 'foo();', indent = info.indent } + ) end end) end) diff --git a/tests/indent/jsx_spec.lua b/tests/indent/jsx_spec.lua index e75b21f4f..7a32dbcc4 100644 --- a/tests/indent/jsx_spec.lua +++ b/tests/indent/jsx_spec.lua @@ -1,43 +1,49 @@ -local Runner = require("tests.indent.common").Runner -local runner = Runner:new(it, "tests/indent/jsx", { +local Runner = require('tests.indent.common').Runner +local runner = Runner:new(it, 'tests/indent/jsx', { tabstop = 2, shiftwidth = 2, expandtab = true, - filetype = "jsx", + filetype = 'jsx', }) -describe("indent JSX Elements:", function() - describe("whole file:", function() - runner:whole_file(".", { +describe('indent JSX Elements:', function() + describe('whole file:', function() + runner:whole_file('.', { expected_failures = {}, }) end) - describe("new line:", function() - for _, info in ipairs { + describe('new line:', function() + for _, info in ipairs({ { 5, 8 }, { 6, 6 }, { 7, 6 }, { 8, 4 }, { 9, 2 }, - } do - runner:new_line("issue-3986.jsx", { on_line = info[1], text = "text", indent = info[2] }) + }) do + runner:new_line('issue-3986.jsx', { on_line = info[1], text = 'text', indent = info[2] }) end - for _, info in ipairs { + for _, info in ipairs({ { 4, 8 }, { 6, 10 }, { 9, 8 }, { 11, 8 }, - } do - runner:new_line("element_attributes.jsx", { on_line = info[1], text = "disabled", indent = info[2] }) + }) do + runner:new_line( + 'element_attributes.jsx', + { on_line = info[1], text = 'disabled', indent = info[2] } + ) end - for _, info in ipairs { + for _, info in ipairs({ { 5, 10 }, { 7, 8 }, { 11, 10 }, - } do - runner:new_line("jsx_expression.jsx", { on_line = info[1], text = "{disabled}", indent = info[2] }) + }) do + runner:new_line( + 'jsx_expression.jsx', + { on_line = info[1], text = '{disabled}', indent = info[2] } + ) end end) end) diff --git a/tests/indent/julia_spec.lua b/tests/indent/julia_spec.lua index 538685307..b7605a55d 100644 --- a/tests/indent/julia_spec.lua +++ b/tests/indent/julia_spec.lua @@ -1,16 +1,16 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner -- local XFAIL = require("tests.indent.common").XFAIL -local run = Runner:new(it, "tests/indent/julia", { +local run = Runner:new(it, 'tests/indent/julia', { tabstop = 4, shiftwidth = 4, softtabstop = 4, expandtab = true, }) -describe("indent Julia:", function() - describe("whole file:", function() - run:whole_file(".", { +describe('indent Julia:', function() + describe('whole file:', function() + run:whole_file('.', { expected_failures = {}, }) end) diff --git a/tests/indent/lua_spec.lua b/tests/indent/lua_spec.lua index 6d99a0fff..ecafc7008 100644 --- a/tests/indent/lua_spec.lua +++ b/tests/indent/lua_spec.lua @@ -1,49 +1,49 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner --local XFAIL = require("tests.indent.common").XFAIL -local run = Runner:new(it, "tests/indent/lua", { +local run = Runner:new(it, 'tests/indent/lua', { tabstop = 2, shiftwidth = 2, softtabstop = 0, expandtab = true, }) -describe("indent Lua:", function() - describe("whole file:", function() - run:whole_file(".", { +describe('indent Lua:', function() + describe('whole file:', function() + run:whole_file('.', { expected_failures = {}, }) end) - describe("new line:", function() - run:new_line("comment.lua", { on_line = 1, text = "line", indent = "-- " }) - run:new_line("comment.lua", { on_line = 5, text = "multiline", indent = " " }) - run:new_line("func.lua", { on_line = 1, text = "x = x + 1", indent = 2 }) - run:new_line("func.lua", { on_line = 2, text = "y = y + 1", indent = 4 }) - run:new_line("func.lua", { on_line = 4, text = "y = y + 1", indent = 2 }) - run:new_line("func.lua", { on_line = 5, text = "3,", indent = 4 }) - run:new_line("func.lua", { on_line = 9, text = "x = x + 1", indent = 0 }) - run:new_line("func.lua", { on_line = 11, text = "x = x + 1", indent = 2 }) - run:new_line("string.lua", { on_line = 1, text = "x", indent = 0 }) - run:new_line("string.lua", { on_line = 2, text = "x", indent = 0 }) - run:new_line("string.lua", { on_line = 3, text = "x", indent = 2 }) - run:new_line("string.lua", { on_line = 4, text = "x", indent = 4 }) - run:new_line("string.lua", { on_line = 9, text = "x", indent = 0 }) - run:new_line("table.lua", { on_line = 1, text = "b = 0,", indent = 2 }) - run:new_line("table.lua", { on_line = 5, text = "4,", indent = 4 }) - run:new_line("table.lua", { on_line = 7, text = "4,", indent = 4 }) - run:new_line("loop.lua", { on_line = 4, text = "x = x + 1", indent = 2 }) - run:new_line("cond.lua", { on_line = 5, text = "x = x + 1", indent = 2 }) - run:new_line("cond.lua", { on_line = 7, text = "x = x + 1", indent = 2 }) - run:new_line("cond.lua", { on_line = 8, text = "x = x + 1", indent = 4 }) - run:new_line("cond.lua", { on_line = 10, text = "x = x + 1", indent = 2 }) - run:new_line("cond.lua", { on_line = 12, text = "x = x + 1", indent = 0 }) - run:new_line("cond.lua", { on_line = 14, text = "x = x + 1", indent = 2 }) - run:new_line("cond.lua", { on_line = 14, text = "end", indent = 0 }) - run:new_line("no-indent-after-paren-pairs.lua", { on_line = 3, text = "x = x + 1", indent = 0 }) - run:new_line("no-indent-after-paren-pairs.lua", { on_line = 6, text = "x = x + 1", indent = 0 }) - run:new_line("nested-table.lua", { on_line = 5, text = "{}", indent = 4 }) - run:new_line("method_index_expr.lua", { on_line = 1, text = ":test()", indent = 2 }) - run:new_line("method_index_expr.lua", { on_line = 3, text = "local a = 1", indent = 0 }) + describe('new line:', function() + run:new_line('comment.lua', { on_line = 1, text = 'line', indent = '-- ' }) + run:new_line('comment.lua', { on_line = 5, text = 'multiline', indent = ' ' }) + run:new_line('func.lua', { on_line = 1, text = 'x = x + 1', indent = 2 }) + run:new_line('func.lua', { on_line = 2, text = 'y = y + 1', indent = 4 }) + run:new_line('func.lua', { on_line = 4, text = 'y = y + 1', indent = 2 }) + run:new_line('func.lua', { on_line = 5, text = '3,', indent = 4 }) + run:new_line('func.lua', { on_line = 9, text = 'x = x + 1', indent = 0 }) + run:new_line('func.lua', { on_line = 11, text = 'x = x + 1', indent = 2 }) + run:new_line('string.lua', { on_line = 1, text = 'x', indent = 0 }) + run:new_line('string.lua', { on_line = 2, text = 'x', indent = 0 }) + run:new_line('string.lua', { on_line = 3, text = 'x', indent = 2 }) + run:new_line('string.lua', { on_line = 4, text = 'x', indent = 4 }) + run:new_line('string.lua', { on_line = 9, text = 'x', indent = 0 }) + run:new_line('table.lua', { on_line = 1, text = 'b = 0,', indent = 2 }) + run:new_line('table.lua', { on_line = 5, text = '4,', indent = 4 }) + run:new_line('table.lua', { on_line = 7, text = '4,', indent = 4 }) + run:new_line('loop.lua', { on_line = 4, text = 'x = x + 1', indent = 2 }) + run:new_line('cond.lua', { on_line = 5, text = 'x = x + 1', indent = 2 }) + run:new_line('cond.lua', { on_line = 7, text = 'x = x + 1', indent = 2 }) + run:new_line('cond.lua', { on_line = 8, text = 'x = x + 1', indent = 4 }) + run:new_line('cond.lua', { on_line = 10, text = 'x = x + 1', indent = 2 }) + run:new_line('cond.lua', { on_line = 12, text = 'x = x + 1', indent = 0 }) + run:new_line('cond.lua', { on_line = 14, text = 'x = x + 1', indent = 2 }) + run:new_line('cond.lua', { on_line = 14, text = 'end', indent = 0 }) + run:new_line('no-indent-after-paren-pairs.lua', { on_line = 3, text = 'x = x + 1', indent = 0 }) + run:new_line('no-indent-after-paren-pairs.lua', { on_line = 6, text = 'x = x + 1', indent = 0 }) + run:new_line('nested-table.lua', { on_line = 5, text = '{}', indent = 4 }) + run:new_line('method_index_expr.lua', { on_line = 1, text = ':test()', indent = 2 }) + run:new_line('method_index_expr.lua', { on_line = 3, text = 'local a = 1', indent = 0 }) end) end) diff --git a/tests/indent/meson_spec.lua b/tests/indent/meson_spec.lua index bc2372ee0..ba23965a6 100644 --- a/tests/indent/meson_spec.lua +++ b/tests/indent/meson_spec.lua @@ -1,28 +1,28 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner -local run = Runner:new(it, "tests/indent/meson", { +local run = Runner:new(it, 'tests/indent/meson', { tabstop = 2, shiftwidth = 2, softtabstop = 0, expandtab = true, }) -describe("indent Meson:", function() - describe("whole file:", function() - run:whole_file(".", { +describe('indent Meson:', function() + describe('whole file:', function() + run:whole_file('.', { expected_failures = {}, }) end) - describe("new line:", function() - run:new_line("cond.meson", { on_line = 3, text = "foo()", indent = 2 }) - run:new_line("cond.meson", { on_line = 6, text = "foo()", indent = 2 }) - run:new_line("cond.meson", { on_line = 7, text = "foo()", indent = 2 }) - run:new_line("cond.meson", { on_line = 12, text = "foo()", indent = 2 }) - run:new_line("cond.meson", { on_line = 14, text = "foo()", indent = 2 }) - run:new_line("dict.meson", { on_line = 13, text = ",'x':1,", indent = 2 }) - run:new_line("loop.meson", { on_line = 3, text = "foo()", indent = 2 }) - run:new_line("loop.meson", { on_line = 7, text = "foo()", indent = 2 }) - run:new_line("ternary.meson", { on_line = 11, text = "x : y", indent = 2 }) + describe('new line:', function() + run:new_line('cond.meson', { on_line = 3, text = 'foo()', indent = 2 }) + run:new_line('cond.meson', { on_line = 6, text = 'foo()', indent = 2 }) + run:new_line('cond.meson', { on_line = 7, text = 'foo()', indent = 2 }) + run:new_line('cond.meson', { on_line = 12, text = 'foo()', indent = 2 }) + run:new_line('cond.meson', { on_line = 14, text = 'foo()', indent = 2 }) + run:new_line('dict.meson', { on_line = 13, text = ",'x':1,", indent = 2 }) + run:new_line('loop.meson', { on_line = 3, text = 'foo()', indent = 2 }) + run:new_line('loop.meson', { on_line = 7, text = 'foo()', indent = 2 }) + run:new_line('ternary.meson', { on_line = 11, text = 'x : y', indent = 2 }) end) end) diff --git a/tests/indent/nickel_spec.lua b/tests/indent/nickel_spec.lua index d178dab52..0c2458a5b 100644 --- a/tests/indent/nickel_spec.lua +++ b/tests/indent/nickel_spec.lua @@ -1,25 +1,25 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner -local run = Runner:new(it, "tests/indent/nickel", { +local run = Runner:new(it, 'tests/indent/nickel', { shiftwidth = 2, expandtab = true, }) -describe("indent Nickel:", function() - describe("whole file:", function() - run:whole_file(".", { +describe('indent Nickel:', function() + describe('whole file:', function() + run:whole_file('.', { expected_failures = {}, }) end) - describe("new line:", function() - run:new_line("indent-newline.ncl", { on_line = 1, text = "stmt", indent = 2 }) - run:new_line("indent-newline.ncl", { on_line = 2, text = "stmt", indent = 2 }) - run:new_line("indent-newline.ncl", { on_line = 3, text = "stmt", indent = 4 }) - run:new_line("indent-newline.ncl", { on_line = 4, text = "]", indent = 2 }) - run:new_line("indent-newline.ncl", { on_line = 5, text = "stmt", indent = 2 }) - run:new_line("indent-newline.ncl", { on_line = 6, text = "stmt", indent = 4 }) - run:new_line("indent-newline.ncl", { on_line = 7, text = "}", indent = 2 }) - run:new_line("indent-newline.ncl", { on_line = 11, text = "stmt", indent = 0 }) + describe('new line:', function() + run:new_line('indent-newline.ncl', { on_line = 1, text = 'stmt', indent = 2 }) + run:new_line('indent-newline.ncl', { on_line = 2, text = 'stmt', indent = 2 }) + run:new_line('indent-newline.ncl', { on_line = 3, text = 'stmt', indent = 4 }) + run:new_line('indent-newline.ncl', { on_line = 4, text = ']', indent = 2 }) + run:new_line('indent-newline.ncl', { on_line = 5, text = 'stmt', indent = 2 }) + run:new_line('indent-newline.ncl', { on_line = 6, text = 'stmt', indent = 4 }) + run:new_line('indent-newline.ncl', { on_line = 7, text = '}', indent = 2 }) + run:new_line('indent-newline.ncl', { on_line = 11, text = 'stmt', indent = 0 }) end) end) diff --git a/tests/indent/nix_spec.lua b/tests/indent/nix_spec.lua index 709a0a109..bad8b53f7 100644 --- a/tests/indent/nix_spec.lua +++ b/tests/indent/nix_spec.lua @@ -1,30 +1,30 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner -local runner = Runner:new(it, "tests/indent/nix", { +local runner = Runner:new(it, 'tests/indent/nix', { tabstop = 2, shiftwidth = 2, softtabstop = 2, expandtab = true, }) -describe("indent Nix:", function() - describe("whole file:", function() - runner:whole_file(".", { +describe('indent Nix:', function() + describe('whole file:', function() + runner:whole_file('.', { expected_failures = {}, }) end) - describe("new line:", function() - for _, info in ipairs { + describe('new line:', function() + for _, info in ipairs({ { 14, 2 }, { 16, 2 }, { 48, 4 }, { 112, 6 }, - } do - runner:new_line("general.nix", { on_line = info[1], text = "x = 1;", indent = info[2] }) + }) do + runner:new_line('general.nix', { on_line = info[1], text = 'x = 1;', indent = info[2] }) end - for _, info in ipairs { + for _, info in ipairs({ { 115, 6 }, { 113, 10 }, { 6, 4 }, @@ -33,8 +33,8 @@ describe("indent Nix:", function() { 35, 6 }, { 23, 2 }, { 21, 6 }, - } do - runner:new_line("conds.nix", { on_line = info[1], text = "x = 1;", indent = info[2] }) + }) do + runner:new_line('conds.nix', { on_line = info[1], text = 'x = 1;', indent = info[2] }) end end) end) diff --git a/tests/indent/nu_spec.lua b/tests/indent/nu_spec.lua index 37c02ebea..5dfdb5128 100644 --- a/tests/indent/nu_spec.lua +++ b/tests/indent/nu_spec.lua @@ -1,16 +1,16 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner --local XFAIL = require("tests.indent.common").XFAIL -local run = Runner:new(it, "tests/indent/nu", { +local run = Runner:new(it, 'tests/indent/nu', { tabstop = 2, shiftwidth = 2, softtabstop = -1, expandtab = true, }) -describe("indent Nu:", function() - describe("whole file:", function() - run:whole_file(".", { +describe('indent Nu:', function() + describe('whole file:', function() + run:whole_file('.', { expected_failures = {}, }) end) diff --git a/tests/indent/php_spec.lua b/tests/indent/php_spec.lua index c3f84e6e2..49983caa2 100644 --- a/tests/indent/php_spec.lua +++ b/tests/indent/php_spec.lua @@ -1,76 +1,75 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner -local run = Runner:new(it, "tests/indent/php", { +local run = Runner:new(it, 'tests/indent/php', { tabstop = 4, shiftwidth = 4, softtabstop = 0, expandtab = true, }) -describe("indent PHP:", function() - describe("whole file:", function() - run:whole_file(".", { +describe('indent PHP:', function() + describe('whole file:', function() + run:whole_file('.', { expected_failures = {}, }) end) - describe("new line:", function() - run:new_line("example.php", { on_line = 11, text = "// new line starts 1 indentation to far", indent = 4 }) + describe('new line:', function() run:new_line( - "example2.php", - { on_line = 5, text = "indentation with `enter` in insert mode is not correct", indent = 4 } + 'example.php', + { on_line = 11, text = '// new line starts 1 indentation to far', indent = 4 } ) - run:new_line("issue-2497.php", { on_line = 5, text = "$a =", indent = 4 }) - run:new_line("unfinished-call.php", { on_line = 6, text = "$a =", indent = 4 }) - run:new_line("issue-3591.php", { on_line = 4, text = "$a =", indent = 8 }) - run:new_line("enum-indent.php", { on_line = 4, text = "case", indent = 4 }) - run:new_line("issue-4848.php", { on_line = 3, text = "true", indent = 4 }) - run:new_line("issue-4848.php", { on_line = 4, text = "return;", indent = 4 }) - run:new_line("issue-4848.php", { on_line = 7, text = "true", indent = 4 }) - run:new_line("issue-4848.php", { on_line = 10, text = "|| false", indent = 4 }) - run:new_line("issue-4848.php", { on_line = 11, text = "$a = 0;", indent = 0 }) - run:new_line("issue-4848.php", { on_line = 13, text = "true", indent = 4 }) - run:new_line("issue-4848.php", { on_line = 16, text = "$a,", indent = 4 }) - run:new_line("issue-4848.php", { on_line = 17, text = "true", indent = 4 }) - run:new_line("issue-4848.php", { on_line = 20, text = "$a,", indent = 4 }) - run:new_line("issue-4848.php", { on_line = 21, text = "return $a;", indent = 4 }) - run:new_line("issue-4848.php", { on_line = 24, text = "return;", indent = 4 }) - run:new_line("issue-4848.php", { on_line = 27, text = "true", indent = 4 }) - run:new_line("issue-4848.php", { on_line = 28, text = "true => null,", indent = 4 }) - run:new_line("issue-4848.php", { on_line = 31, text = "true => null,", indent = 4 }) - run:new_line("issue-4848.php", { on_line = 35, text = "function a() {}", indent = 4 }) - run:new_line("issue-4848.php", { on_line = 37, text = "return;", indent = 8 }) - run:new_line("issue-4848.php", { on_line = 40, text = "$a,", indent = 8 }) - run:new_line("issue-4848.php", { on_line = 41, text = "return $a;", indent = 8 }) - run:new_line("issue-4848.php", { on_line = 45, text = "->foo()", indent = 4 }) - run:new_line("issue-4848.php", { on_line = 46, text = "$a,", indent = 8 }) - run:new_line("issue-4848.php", { on_line = 47, text = "->foo()", indent = 4 }) - run:new_line("issue-4848.php", { on_line = 48, text = "$a;", indent = 0 }) - run:new_line("issue-4848.php", { on_line = 50, text = "->foo()", indent = 4 }) - run:new_line("issue-4848.php", { on_line = 51, text = "return $a;", indent = 8 }) - run:new_line("issue-4848.php", { on_line = 52, text = "->foo()", indent = 4 }) - run:new_line("issue-4848.php", { on_line = 53, text = "$a,", indent = 8 }) - run:new_line("issue-4848.php", { on_line = 54, text = "$a,", indent = 12 }) - run:new_line("issue-4848.php", { on_line = 55, text = "return $a;", indent = 12 }) - run:new_line("issue-4848.php", { on_line = 56, text = "$a,", indent = 8 }) - run:new_line("issue-4848.php", { on_line = 57, text = "$a;", indent = 0 }) - run:new_line("issue-4848.php", { on_line = 59, text = "->foo()", indent = 4 }) - run:new_line("issue-4848.php", { on_line = 60, text = "return $a;", indent = 8 }) - run:new_line("issue-4848.php", { on_line = 61, text = "->foo()", indent = 4 }) - run:new_line("issue-4848.php", { on_line = 62, text = "$a,", indent = 8 }) - run:new_line("issue-4848.php", { on_line = 63, text = "$a,", indent = 12 }) - run:new_line("issue-4848.php", { on_line = 64, text = "return $a;", indent = 12 }) - run:new_line("issue-4848.php", { on_line = 65, text = "$a,", indent = 8 }) - run:new_line("issue-4848.php", { on_line = 66, text = "$a;", indent = 0 }) - run:new_line("issue-6888.php", { on_line = 2, text = "$a;", indent = 0 }) - run:new_line("issue-6888.php", { on_line = 3, text = "case Funday = 2;", indent = 4 }) - run:new_line("issue-6888.php", { on_line = 6, text = "$a;", indent = 0 }) - run:new_line("issue-6888.php", { on_line = 8, text = "$a;", indent = 4 }) - run:new_line("issue-6888.php", { on_line = 11, text = "$a;", indent = 0 }) - run:new_line("property-hooks.php", { on_line = 7, text = "get;", indent = 8 }) - run:new_line("property-hooks.php", { on_line = 8, text = "set;", indent = 8 }) - run:new_line("property-hooks.php", { on_line = 9, text = "$a;", indent = 12 }) - run:new_line("property-hooks.php", { on_line = 11, text = "get;", indent = 8 }) - run:new_line("property-hooks.php", { on_line = 12, text = "get;", indent = 4 }) + run:new_line('issue-2497.php', { on_line = 5, text = '$a =', indent = 4 }) + run:new_line('unfinished-call.php', { on_line = 6, text = '$a =', indent = 4 }) + run:new_line('issue-3591.php', { on_line = 4, text = '$a =', indent = 8 }) + run:new_line('enum-indent.php', { on_line = 4, text = 'case', indent = 4 }) + run:new_line('issue-4848.php', { on_line = 3, text = 'true', indent = 4 }) + run:new_line('issue-4848.php', { on_line = 4, text = 'return;', indent = 4 }) + run:new_line('issue-4848.php', { on_line = 7, text = 'true', indent = 4 }) + run:new_line('issue-4848.php', { on_line = 10, text = '|| false', indent = 4 }) + run:new_line('issue-4848.php', { on_line = 11, text = '$a = 0;', indent = 0 }) + run:new_line('issue-4848.php', { on_line = 13, text = 'true', indent = 4 }) + run:new_line('issue-4848.php', { on_line = 16, text = '$a,', indent = 4 }) + run:new_line('issue-4848.php', { on_line = 17, text = 'true', indent = 4 }) + run:new_line('issue-4848.php', { on_line = 20, text = '$a,', indent = 4 }) + run:new_line('issue-4848.php', { on_line = 21, text = 'return $a;', indent = 4 }) + run:new_line('issue-4848.php', { on_line = 24, text = 'return;', indent = 4 }) + run:new_line('issue-4848.php', { on_line = 27, text = 'true', indent = 4 }) + run:new_line('issue-4848.php', { on_line = 28, text = 'true => null,', indent = 4 }) + run:new_line('issue-4848.php', { on_line = 31, text = 'true => null,', indent = 4 }) + run:new_line('issue-4848.php', { on_line = 35, text = 'function a() {}', indent = 4 }) + run:new_line('issue-4848.php', { on_line = 37, text = 'return;', indent = 8 }) + run:new_line('issue-4848.php', { on_line = 40, text = '$a,', indent = 8 }) + run:new_line('issue-4848.php', { on_line = 41, text = 'return $a;', indent = 8 }) + run:new_line('issue-4848.php', { on_line = 45, text = '->foo()', indent = 4 }) + run:new_line('issue-4848.php', { on_line = 46, text = '$a,', indent = 8 }) + run:new_line('issue-4848.php', { on_line = 47, text = '->foo()', indent = 4 }) + run:new_line('issue-4848.php', { on_line = 48, text = '$a;', indent = 0 }) + run:new_line('issue-4848.php', { on_line = 50, text = '->foo()', indent = 4 }) + run:new_line('issue-4848.php', { on_line = 51, text = 'return $a;', indent = 8 }) + run:new_line('issue-4848.php', { on_line = 52, text = '->foo()', indent = 4 }) + run:new_line('issue-4848.php', { on_line = 53, text = '$a,', indent = 8 }) + run:new_line('issue-4848.php', { on_line = 54, text = '$a,', indent = 12 }) + run:new_line('issue-4848.php', { on_line = 55, text = 'return $a;', indent = 12 }) + run:new_line('issue-4848.php', { on_line = 56, text = '$a,', indent = 8 }) + run:new_line('issue-4848.php', { on_line = 57, text = '$a;', indent = 0 }) + run:new_line('issue-4848.php', { on_line = 59, text = '->foo()', indent = 4 }) + run:new_line('issue-4848.php', { on_line = 60, text = 'return $a;', indent = 8 }) + run:new_line('issue-4848.php', { on_line = 61, text = '->foo()', indent = 4 }) + run:new_line('issue-4848.php', { on_line = 62, text = '$a,', indent = 8 }) + run:new_line('issue-4848.php', { on_line = 63, text = '$a,', indent = 12 }) + run:new_line('issue-4848.php', { on_line = 64, text = 'return $a;', indent = 12 }) + run:new_line('issue-4848.php', { on_line = 65, text = '$a,', indent = 8 }) + run:new_line('issue-4848.php', { on_line = 66, text = '$a;', indent = 0 }) + run:new_line('issue-6888.php', { on_line = 2, text = '$a;', indent = 0 }) + run:new_line('issue-6888.php', { on_line = 3, text = 'case Funday = 2;', indent = 4 }) + run:new_line('issue-6888.php', { on_line = 6, text = '$a;', indent = 0 }) + run:new_line('issue-6888.php', { on_line = 8, text = '$a;', indent = 4 }) + run:new_line('issue-6888.php', { on_line = 11, text = '$a;', indent = 0 }) + run:new_line('property-hooks.php', { on_line = 7, text = 'get;', indent = 8 }) + run:new_line('property-hooks.php', { on_line = 8, text = 'set;', indent = 8 }) + run:new_line('property-hooks.php', { on_line = 9, text = '$a;', indent = 12 }) + run:new_line('property-hooks.php', { on_line = 11, text = 'get;', indent = 8 }) + run:new_line('property-hooks.php', { on_line = 12, text = 'get;', indent = 4 }) end) end) diff --git a/tests/indent/python_spec.lua b/tests/indent/python_spec.lua index 193b9901e..65be126fa 100644 --- a/tests/indent/python_spec.lua +++ b/tests/indent/python_spec.lua @@ -1,101 +1,101 @@ -local Runner = require("tests.indent.common").Runner -local XFAIL = require("tests.indent.common").XFAIL +local Runner = require('tests.indent.common').Runner +local XFAIL = require('tests.indent.common').XFAIL -local run = Runner:new(it, "tests/indent/python", { +local run = Runner:new(it, 'tests/indent/python', { tabstop = 4, shiftwidth = 4, softtabstop = 0, expandtab = true, }) -describe("indent Python:", function() - describe("whole file:", function() - run:whole_file(".", { +describe('indent Python:', function() + describe('whole file:', function() + run:whole_file('.', { expected_failures = {}, }) end) - describe("new line:", function() - run:new_line("aligned_indent.py", { on_line = 1, text = "arg3,", indent = 19 }) - run:new_line("aligned_indent_2.py", { on_line = 2, text = "x", indent = 4 }) - run:new_line("aligned_indent_2.py", { on_line = 9, text = "x", indent = 4 }) - run:new_line("aligned_indent_2.py", { on_line = 12, text = "x", indent = 4 }) - run:new_line("basic_blocks.py", { on_line = 1, text = "wait,", indent = 4 }) - run:new_line("basic_blocks.py", { on_line = 6, text = "x += 1", indent = 4 }) - run:new_line("basic_blocks.py", { on_line = 7, text = "x += 1", indent = 4 }) - run:new_line("basic_blocks.py", { on_line = 10, text = "x += 1", indent = 8 }) - run:new_line("basic_blocks.py", { on_line = 14, text = "x += 1", indent = 8 }) - run:new_line("basic_collections.py", { on_line = 3, text = "4,", indent = 4 }) - run:new_line("comprehensions.py", { on_line = 8, text = "if x != 2", indent = 4 }) - run:new_line("control_flow.py", { on_line = 2, text = "x = 4", indent = 4 }) - run:new_line("control_flow.py", { on_line = 4, text = "x = 4", indent = 4 }) - run:new_line("control_flow.py", { on_line = 6, text = "x = 4", indent = 4 }) - run:new_line("control_flow.py", { on_line = 9, text = "x = 4", indent = 4 }) - run:new_line("control_flow.py", { on_line = 12, text = "x = 4", indent = 4 }) - run:new_line("control_flow.py", { on_line = 15, text = "x = 4", indent = 4 }) - run:new_line("control_flow.py", { on_line = 18, text = "x = 4", indent = 4 }) - run:new_line("control_flow.py", { on_line = 20, text = "x = 4", indent = 4 }) - run:new_line("control_flow.py", { on_line = 22, text = "x = 4", indent = 4 }) - run:new_line("control_flow.py", { on_line = 24, text = "c < 6 and", indent = 7 }) - run:new_line("control_flow.py", { on_line = 26, text = "x = 4", indent = 4 }) - run:new_line("control_flow.py", { on_line = 28, text = "x = 4", indent = 4 }) - run:new_line("control_flow.py", { on_line = 31, text = "try:", indent = 4 }) - run:new_line("branches.py", { on_line = 25, text = "x > 9 and", indent = 4 }) - run:new_line("branches.py", { on_line = 29, text = "and x > 9", indent = 4 }) - run:new_line("hanging_indent.py", { on_line = 1, text = "arg0,", indent = 4 }) - run:new_line("hanging_indent.py", { on_line = 5, text = "0,", indent = 4 }) - run:new_line("error_state_def.py", { on_line = 6, text = "b,", indent = 11 }) - run:new_line("error_state_tuple.py", { on_line = 7, text = "b,", indent = 1 }) - run:new_line("error_state_tuple_align.py", { on_line = 7, text = "b,", indent = 1 }) - run:new_line("error_state_list.py", { on_line = 5, text = "3,", indent = 6 }) - run:new_line("error_state_dict.py", { on_line = 6, text = "9:10,", indent = 6 }) - run:new_line("error_state_set.py", { on_line = 5, text = "9,", indent = 6 }) - run:new_line("error_state_funcall.py", { on_line = 5, text = "6,", indent = 2 }) - run:new_line("if_else.py", { on_line = 5, text = "else:", indent = 4 }) - run:new_line("if_else.py", { on_line = 5, text = "elif False:", indent = 4 }) + describe('new line:', function() + run:new_line('aligned_indent.py', { on_line = 1, text = 'arg3,', indent = 19 }) + run:new_line('aligned_indent_2.py', { on_line = 2, text = 'x', indent = 4 }) + run:new_line('aligned_indent_2.py', { on_line = 9, text = 'x', indent = 4 }) + run:new_line('aligned_indent_2.py', { on_line = 12, text = 'x', indent = 4 }) + run:new_line('basic_blocks.py', { on_line = 1, text = 'wait,', indent = 4 }) + run:new_line('basic_blocks.py', { on_line = 6, text = 'x += 1', indent = 4 }) + run:new_line('basic_blocks.py', { on_line = 7, text = 'x += 1', indent = 4 }) + run:new_line('basic_blocks.py', { on_line = 10, text = 'x += 1', indent = 8 }) + run:new_line('basic_blocks.py', { on_line = 14, text = 'x += 1', indent = 8 }) + run:new_line('basic_collections.py', { on_line = 3, text = '4,', indent = 4 }) + run:new_line('comprehensions.py', { on_line = 8, text = 'if x != 2', indent = 4 }) + run:new_line('control_flow.py', { on_line = 2, text = 'x = 4', indent = 4 }) + run:new_line('control_flow.py', { on_line = 4, text = 'x = 4', indent = 4 }) + run:new_line('control_flow.py', { on_line = 6, text = 'x = 4', indent = 4 }) + run:new_line('control_flow.py', { on_line = 9, text = 'x = 4', indent = 4 }) + run:new_line('control_flow.py', { on_line = 12, text = 'x = 4', indent = 4 }) + run:new_line('control_flow.py', { on_line = 15, text = 'x = 4', indent = 4 }) + run:new_line('control_flow.py', { on_line = 18, text = 'x = 4', indent = 4 }) + run:new_line('control_flow.py', { on_line = 20, text = 'x = 4', indent = 4 }) + run:new_line('control_flow.py', { on_line = 22, text = 'x = 4', indent = 4 }) + run:new_line('control_flow.py', { on_line = 24, text = 'c < 6 and', indent = 7 }) + run:new_line('control_flow.py', { on_line = 26, text = 'x = 4', indent = 4 }) + run:new_line('control_flow.py', { on_line = 28, text = 'x = 4', indent = 4 }) + run:new_line('control_flow.py', { on_line = 31, text = 'try:', indent = 4 }) + run:new_line('branches.py', { on_line = 25, text = 'x > 9 and', indent = 4 }) + run:new_line('branches.py', { on_line = 29, text = 'and x > 9', indent = 4 }) + run:new_line('hanging_indent.py', { on_line = 1, text = 'arg0,', indent = 4 }) + run:new_line('hanging_indent.py', { on_line = 5, text = '0,', indent = 4 }) + run:new_line('error_state_def.py', { on_line = 6, text = 'b,', indent = 11 }) + run:new_line('error_state_tuple.py', { on_line = 7, text = 'b,', indent = 1 }) + run:new_line('error_state_tuple_align.py', { on_line = 7, text = 'b,', indent = 1 }) + run:new_line('error_state_list.py', { on_line = 5, text = '3,', indent = 6 }) + run:new_line('error_state_dict.py', { on_line = 6, text = '9:10,', indent = 6 }) + run:new_line('error_state_set.py', { on_line = 5, text = '9,', indent = 6 }) + run:new_line('error_state_funcall.py', { on_line = 5, text = '6,', indent = 2 }) + run:new_line('if_else.py', { on_line = 5, text = 'else:', indent = 4 }) + run:new_line('if_else.py', { on_line = 5, text = 'elif False:', indent = 4 }) run:new_line( - "join_lines.py", - { on_line = 1, text = "+ 1 \\", indent = 4 }, - "fails due two not working query at python/indent.scm:30", + 'join_lines.py', + { on_line = 1, text = '+ 1 \\', indent = 4 }, + 'fails due two not working query at python/indent.scm:30', XFAIL ) run:new_line( - "join_lines.py", - { on_line = 4, text = "+ 1 \\", indent = 4 }, - "fails due two not working query at python/indent.scm:30", + 'join_lines.py', + { on_line = 4, text = '+ 1 \\', indent = 4 }, + 'fails due two not working query at python/indent.scm:30', XFAIL ) - run:new_line("join_lines.py", { on_line = 7, text = "+ 1 \\", indent = 4 }) - run:new_line("nested_collections.py", { on_line = 5, text = "0,", indent = 12 }) - run:new_line("nested_collections.py", { on_line = 6, text = ",0", indent = 12 }) - run:new_line("nested_collections.py", { on_line = 29, text = "[1, 2],", indent = 12 }) - run:new_line("nested_collections.py", { on_line = 39, text = "0,", indent = 5 }) - run:new_line("strings.py", { on_line = 14, text = "x", indent = 4 }) - run:new_line("strings.py", { on_line = 15, text = "x", indent = 0 }) - run:new_line("strings.py", { on_line = 16, text = "x", indent = 8 }) - run:new_line("line_after_indent.py", { on_line = 4, text = "x", indent = 0 }) - run:new_line("line_after_indent.py", { on_line = 8, text = "x", indent = 0 }) - run:new_line("line_after_indent.py", { on_line = 4, text = "x", indent = 0 }) - run:new_line("line_after_indent.py", { on_line = 14, text = "x", indent = 0 }) - run:new_line("line_after_indent.py", { on_line = 20, text = "x", indent = 0 }) - run:new_line("line_after_indent.py", { on_line = 26, text = "x", indent = 0 }) - run:new_line("line_after_indent.py", { on_line = 30, text = "x", indent = 0 }) - run:new_line("line_after_indent.py", { on_line = 34, text = "x", indent = 0 }) - run:new_line("line_after_indent.py", { on_line = 38, text = "x", indent = 0 }) - run:new_line("line_after_indent.py", { on_line = 42, text = "x", indent = 0 }) - run:new_line("line_after_indent.py", { on_line = 46, text = "x", indent = 0 }) - run:new_line("line_after_indent.py", { on_line = 49, text = "x", indent = 0 }) - run:new_line("line_after_indent.py", { on_line = 55, text = "x", indent = 4 }) - run:new_line("line_after_indent.py", { on_line = 63, text = "x", indent = 4 }) - run:new_line("match_case.py", { on_line = 4, text = "pass", indent = 8 }) - run:new_line("match_case.py", { on_line = 5, text = "pass", indent = 12 }) - run:new_line("match_case.py", { on_line = 10, text = "pass", indent = 8 }) - run:new_line("match_case.py", { on_line = 15, text = "pass", indent = 12 }) - run:new_line("break_continue.py", { on_line = 4, text = "pass", indent = 8 }) - run:new_line("break_continue.py", { on_line = 9, text = "pass", indent = 8 }) + run:new_line('join_lines.py', { on_line = 7, text = '+ 1 \\', indent = 4 }) + run:new_line('nested_collections.py', { on_line = 5, text = '0,', indent = 12 }) + run:new_line('nested_collections.py', { on_line = 6, text = ',0', indent = 12 }) + run:new_line('nested_collections.py', { on_line = 29, text = '[1, 2],', indent = 12 }) + run:new_line('nested_collections.py', { on_line = 39, text = '0,', indent = 5 }) + run:new_line('strings.py', { on_line = 14, text = 'x', indent = 4 }) + run:new_line('strings.py', { on_line = 15, text = 'x', indent = 0 }) + run:new_line('strings.py', { on_line = 16, text = 'x', indent = 8 }) + run:new_line('line_after_indent.py', { on_line = 4, text = 'x', indent = 0 }) + run:new_line('line_after_indent.py', { on_line = 8, text = 'x', indent = 0 }) + run:new_line('line_after_indent.py', { on_line = 4, text = 'x', indent = 0 }) + run:new_line('line_after_indent.py', { on_line = 14, text = 'x', indent = 0 }) + run:new_line('line_after_indent.py', { on_line = 20, text = 'x', indent = 0 }) + run:new_line('line_after_indent.py', { on_line = 26, text = 'x', indent = 0 }) + run:new_line('line_after_indent.py', { on_line = 30, text = 'x', indent = 0 }) + run:new_line('line_after_indent.py', { on_line = 34, text = 'x', indent = 0 }) + run:new_line('line_after_indent.py', { on_line = 38, text = 'x', indent = 0 }) + run:new_line('line_after_indent.py', { on_line = 42, text = 'x', indent = 0 }) + run:new_line('line_after_indent.py', { on_line = 46, text = 'x', indent = 0 }) + run:new_line('line_after_indent.py', { on_line = 49, text = 'x', indent = 0 }) + run:new_line('line_after_indent.py', { on_line = 55, text = 'x', indent = 4 }) + run:new_line('line_after_indent.py', { on_line = 63, text = 'x', indent = 4 }) + run:new_line('match_case.py', { on_line = 4, text = 'pass', indent = 8 }) + run:new_line('match_case.py', { on_line = 5, text = 'pass', indent = 12 }) + run:new_line('match_case.py', { on_line = 10, text = 'pass', indent = 8 }) + run:new_line('match_case.py', { on_line = 15, text = 'pass', indent = 12 }) + run:new_line('break_continue.py', { on_line = 4, text = 'pass', indent = 8 }) + run:new_line('break_continue.py', { on_line = 9, text = 'pass', indent = 8 }) - for _, line in ipairs { 2, 5, 8, 11, 16, 21, 24, 27, 34, 39 } do - run:new_line("return_dedent.py", { on_line = line, text = "x", indent = 0 }) + for _, line in ipairs({ 2, 5, 8, 11, 16, 21, 24, 27, 34, 39 }) do + run:new_line('return_dedent.py', { on_line = line, text = 'x', indent = 0 }) end end) end) diff --git a/tests/indent/ql_spec.lua b/tests/indent/ql_spec.lua index cfdce9077..605aa2365 100644 --- a/tests/indent/ql_spec.lua +++ b/tests/indent/ql_spec.lua @@ -1,24 +1,24 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner -local run = Runner:new(it, "tests/indent/ql", { +local run = Runner:new(it, 'tests/indent/ql', { tabstop = 2, shiftwidth = 2, softtabstop = 0, expandtab = true, }) -describe("indent Lua:", function() - describe("whole file:", function() - run:whole_file(".", { +describe('indent Lua:', function() + describe('whole file:', function() + run:whole_file('.', { expected_failures = {}, }) end) end) -describe("new line:", function() - run:new_line("module.ql", { on_line = 1, text = "predicate foo() {}", indent = 2 }) +describe('new line:', function() + run:new_line('module.ql', { on_line = 1, text = 'predicate foo() {}', indent = 2 }) end) -describe("new line:", function() - run:new_line("module.ql", { on_line = 2, text = "predicate foo() {}", indent = 2 }) +describe('new line:', function() + run:new_line('module.ql', { on_line = 2, text = 'predicate foo() {}', indent = 2 }) end) diff --git a/tests/indent/query_spec.lua b/tests/indent/query_spec.lua index ca2ccdef5..f884009a0 100644 --- a/tests/indent/query_spec.lua +++ b/tests/indent/query_spec.lua @@ -1,28 +1,28 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner -local run = Runner:new(it, "tests/indent/query", { +local run = Runner:new(it, 'tests/indent/query', { tabstop = 2, shiftwidth = 2, softtabstop = 2, expandtab = true, - lispoptions = "expr:1", + lispoptions = 'expr:1', }) -describe("indent Query:", function() - describe("whole file:", function() - run:whole_file(".", {}) +describe('indent Query:', function() + describe('whole file:', function() + run:whole_file('.', {}) end) - describe("new line:", function() - run:new_line("test.scm", { on_line = 3, text = "(node)", indent = 2 }) - run:new_line("test.scm", { on_line = 5, text = "(node)", indent = 2 }) - run:new_line("test.scm", { on_line = 12, text = "(node)", indent = 2 }) - run:new_line("test.scm", { on_line = 25, text = "(#my-directive!)", indent = 10 }) - run:new_line("test.scm", { on_line = 34, text = '"more"', indent = 2 }) - run:new_line("test.scm", { on_line = 35, text = "(node)", indent = 0 }) - run:new_line("test.scm", { on_line = 40, text = "(node)", indent = 0 }) - run:new_line("test.scm", { on_line = 44, text = "(node)", indent = 2 }) - run:new_line("test.scm", { on_line = 46, text = "(node)", indent = 2 }) - run:new_line("test.scm", { on_line = 48, text = "(node)", indent = 2 }) - run:new_line("test.scm", { on_line = 50, text = "node_name", indent = 2 }) + describe('new line:', function() + run:new_line('test.scm', { on_line = 3, text = '(node)', indent = 2 }) + run:new_line('test.scm', { on_line = 5, text = '(node)', indent = 2 }) + run:new_line('test.scm', { on_line = 12, text = '(node)', indent = 2 }) + run:new_line('test.scm', { on_line = 25, text = '(#my-directive!)', indent = 10 }) + run:new_line('test.scm', { on_line = 34, text = '"more"', indent = 2 }) + run:new_line('test.scm', { on_line = 35, text = '(node)', indent = 0 }) + run:new_line('test.scm', { on_line = 40, text = '(node)', indent = 0 }) + run:new_line('test.scm', { on_line = 44, text = '(node)', indent = 2 }) + run:new_line('test.scm', { on_line = 46, text = '(node)', indent = 2 }) + run:new_line('test.scm', { on_line = 48, text = '(node)', indent = 2 }) + run:new_line('test.scm', { on_line = 50, text = 'node_name', indent = 2 }) end) end) diff --git a/tests/indent/r_spec.lua b/tests/indent/r_spec.lua index 08df5e11b..b6e814068 100644 --- a/tests/indent/r_spec.lua +++ b/tests/indent/r_spec.lua @@ -1,42 +1,42 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner --local XFAIL = require("tests.indent.common").XFAIL -local run = Runner:new(it, "tests/indent/r", { +local run = Runner:new(it, 'tests/indent/r', { tabstop = 2, shiftwidth = 2, softtabstop = 0, expandtab = true, }) -describe("indent R:", function() - describe("whole file:", function() - run:whole_file(".", {}) +describe('indent R:', function() + describe('whole file:', function() + run:whole_file('.', {}) end) - describe("new line:", function() - run:new_line("comment.R", { on_line = 1, text = "# new comment", indent = 0 }) + describe('new line:', function() + run:new_line('comment.R', { on_line = 1, text = '# new comment', indent = 0 }) - run:new_line("cond.R", { on_line = 1, text = "x <- x + 1", indent = 0 }) - run:new_line("cond.R", { on_line = 4, text = "x <- x + 1", indent = 2 }) - run:new_line("cond.R", { on_line = 5, text = "x <- x + 1", indent = 2 }) - run:new_line("cond.R", { on_line = 8, text = "x <- x + 1", indent = 4 }) + run:new_line('cond.R', { on_line = 1, text = 'x <- x + 1', indent = 0 }) + run:new_line('cond.R', { on_line = 4, text = 'x <- x + 1', indent = 2 }) + run:new_line('cond.R', { on_line = 5, text = 'x <- x + 1', indent = 2 }) + run:new_line('cond.R', { on_line = 8, text = 'x <- x + 1', indent = 4 }) - run:new_line("func.R", { on_line = 1, text = "x <- x + 1", indent = 2 }) - run:new_line("func.R", { on_line = 2, text = "a <- a + 1", indent = 4 }) - run:new_line("func.R", { on_line = 6, text = "0,", indent = 6 }) - run:new_line("func.R", { on_line = 6, text = "0,", indent = 6 }) - run:new_line("func.R", { on_line = 16, text = "x <- x + 1", indent = 4 }) + run:new_line('func.R', { on_line = 1, text = 'x <- x + 1', indent = 2 }) + run:new_line('func.R', { on_line = 2, text = 'a <- a + 1', indent = 4 }) + run:new_line('func.R', { on_line = 6, text = '0,', indent = 6 }) + run:new_line('func.R', { on_line = 6, text = '0,', indent = 6 }) + run:new_line('func.R', { on_line = 16, text = 'x <- x + 1', indent = 4 }) - run:new_line("loop.R", { on_line = 1, text = "x <- x + 1", indent = 0 }) - run:new_line("loop.R", { on_line = 3, text = "x <- x + 1", indent = 2 }) - run:new_line("loop.R", { on_line = 8, text = "x <- x + 1", indent = 2 }) - run:new_line("loop.R", { on_line = 14, text = "print('lol')", indent = 4 }) + run:new_line('loop.R', { on_line = 1, text = 'x <- x + 1', indent = 0 }) + run:new_line('loop.R', { on_line = 3, text = 'x <- x + 1', indent = 2 }) + run:new_line('loop.R', { on_line = 8, text = 'x <- x + 1', indent = 2 }) + run:new_line('loop.R', { on_line = 14, text = "print('lol')", indent = 4 }) - run:new_line("pipe.R", { on_line = 1, text = "head(n = 10L) |>", indent = 2 }) - run:new_line("pipe.R", { on_line = 9, text = "head()", indent = 2 }) + run:new_line('pipe.R', { on_line = 1, text = 'head(n = 10L) |>', indent = 2 }) + run:new_line('pipe.R', { on_line = 9, text = 'head()', indent = 2 }) - run:new_line("incomplete_pipe.R", { on_line = 2, text = "head %>%", indent = 2 }) + run:new_line('incomplete_pipe.R', { on_line = 2, text = 'head %>%', indent = 2 }) - run:new_line("aligned_indent.R", { on_line = 1, text = "z,", indent = 17 }) + run:new_line('aligned_indent.R', { on_line = 1, text = 'z,', indent = 17 }) end) end) diff --git a/tests/indent/rescript_spec.lua b/tests/indent/rescript_spec.lua index 5b1f06abd..e97cd1e8b 100644 --- a/tests/indent/rescript_spec.lua +++ b/tests/indent/rescript_spec.lua @@ -1,33 +1,33 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner -local run = Runner:new(it, "tests/indent/rescript", { +local run = Runner:new(it, 'tests/indent/rescript', { tabstop = 2, shiftwidth = 2, softtabstop = 0, expandtab = true, }) -describe("indent ReScript:", function() - describe("whole file:", function() - run:whole_file(".", {}) +describe('indent ReScript:', function() + describe('whole file:', function() + run:whole_file('.', {}) end) - describe("new line:", function() - run:new_line("basic.res", { on_line = 5, text = "x", indent = 0 }) - run:new_line("basic.res", { on_line = 9, text = '"another": here,', indent = 2 }) - run:new_line("basic.res", { on_line = 10, text = "}", indent = 0 }) - run:new_line("basic.res", { on_line = 14, text = "~test: test,", indent = 2 }) - run:new_line("basic.res", { on_line = 18, text = "x", indent = 0 }) + describe('new line:', function() + run:new_line('basic.res', { on_line = 5, text = 'x', indent = 0 }) + run:new_line('basic.res', { on_line = 9, text = '"another": here,', indent = 2 }) + run:new_line('basic.res', { on_line = 10, text = '}', indent = 0 }) + run:new_line('basic.res', { on_line = 14, text = '~test: test,', indent = 2 }) + run:new_line('basic.res', { on_line = 18, text = 'x', indent = 0 }) - run:new_line("complex.res", { on_line = 3, text = "x", indent = 2 }) - run:new_line("complex.res", { on_line = 5, text = "x", indent = 4 }) - run:new_line("complex.res", { on_line = 17, text = "|", indent = 10 }) - run:new_line("complex.res", { on_line = 25, text = "x", indent = 2 }) - run:new_line("complex.res", { on_line = 60, text = "x", indent = 6 }) - run:new_line("complex.res", { on_line = 120, text = "x", indent = 14 }) - run:new_line("complex.res", { on_line = 136, text = "x", indent = 2 }) + run:new_line('complex.res', { on_line = 3, text = 'x', indent = 2 }) + run:new_line('complex.res', { on_line = 5, text = 'x', indent = 4 }) + run:new_line('complex.res', { on_line = 17, text = '|', indent = 10 }) + run:new_line('complex.res', { on_line = 25, text = 'x', indent = 2 }) + run:new_line('complex.res', { on_line = 60, text = 'x', indent = 6 }) + run:new_line('complex.res', { on_line = 120, text = 'x', indent = 14 }) + run:new_line('complex.res', { on_line = 136, text = 'x', indent = 2 }) - run:new_line("conditional.res", { on_line = 6, text = "test: bool,", indent = 2 }) - run:new_line("conditional.res", { on_line = 95, text = "x", indent = 10 }) + run:new_line('conditional.res', { on_line = 6, text = 'test: bool,', indent = 2 }) + run:new_line('conditional.res', { on_line = 95, text = 'x', indent = 10 }) end) end) diff --git a/tests/indent/ruby_spec.lua b/tests/indent/ruby_spec.lua index b669b8938..4dcd4d0fa 100644 --- a/tests/indent/ruby_spec.lua +++ b/tests/indent/ruby_spec.lua @@ -1,22 +1,22 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner -local run = Runner:new(it, "tests/indent/ruby", { +local run = Runner:new(it, 'tests/indent/ruby', { shiftwidth = 2, expandtab = true, }) -describe("indent Ruby:", function() - describe("whole file:", function() - run:whole_file(".", { - expected_failures = { "./period-issue-3364.rb" }, +describe('indent Ruby:', function() + describe('whole file:', function() + run:whole_file('.', { + expected_failures = { './period-issue-3364.rb' }, }) end) - describe("new line:", function() - run:new_line("indent-unless.rb", { on_line = 1, text = "stmt", indent = 2 }) - run:new_line("indent-assignment.rb", { on_line = 1, text = "1 +", indent = 2 }) - run:new_line("indent-parenthesized-statements.rb", { on_line = 1, text = "stmt", indent = 2 }) - run:new_line("indent-rescue.rb", { on_line = 1, text = "rescue", indent = 0 }) - run:new_line("indent-ensure.rb", { on_line = 1, text = "ensure", indent = 0 }) + describe('new line:', function() + run:new_line('indent-unless.rb', { on_line = 1, text = 'stmt', indent = 2 }) + run:new_line('indent-assignment.rb', { on_line = 1, text = '1 +', indent = 2 }) + run:new_line('indent-parenthesized-statements.rb', { on_line = 1, text = 'stmt', indent = 2 }) + run:new_line('indent-rescue.rb', { on_line = 1, text = 'rescue', indent = 0 }) + run:new_line('indent-ensure.rb', { on_line = 1, text = 'ensure', indent = 0 }) end) end) diff --git a/tests/indent/rust_spec.lua b/tests/indent/rust_spec.lua index 795765ba5..3671e9ee7 100644 --- a/tests/indent/rust_spec.lua +++ b/tests/indent/rust_spec.lua @@ -1,66 +1,66 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner -local run = Runner:new(it, "tests/indent/rust", { +local run = Runner:new(it, 'tests/indent/rust', { tabstop = 4, shiftwidth = 4, softtabstop = 0, expandtab = true, }) -describe("indent Rust:", function() - describe("whole file:", function() - run:whole_file "." +describe('indent Rust:', function() + describe('whole file:', function() + run:whole_file('.') end) - describe("new line:", function() - run:new_line("array.rs", { on_line = 2, text = "0,", indent = 4 }) - run:new_line("array.rs", { on_line = 8, text = "0,", indent = 8 }) - run:new_line("comment.rs", { on_line = 3, text = "a", indent = "/// " }) - run:new_line("comment.rs", { on_line = 10, text = "a", indent = " /// " }) - run:new_line("cond.rs", { on_line = 11, text = "x += 1;", indent = 12 }) - run:new_line("cond.rs", { on_line = 2, text = "x += 1;", indent = 8 }) - run:new_line("cond.rs", { on_line = 4, text = "x += 1;", indent = 8 }) - run:new_line("cond.rs", { on_line = 6, text = "x += 1;", indent = 8 }) - run:new_line("cond.rs", { on_line = 8, text = "x += 1;", indent = 4 }) - run:new_line("if_let_cond.rs", { on_line = 2, text = "let a = 1;", indent = 8 }) - run:new_line("if_let_cond.rs", { on_line = 4, text = "let a = 1;", indent = 8 }) - run:new_line("if_let_cond.rs", { on_line = 6, text = "let a = 1;", indent = 4 }) - run:new_line("enum.rs", { on_line = 2, text = "Q,", indent = 4 }) - run:new_line("enum.rs", { on_line = 4, text = "i32,", indent = 8 }) - run:new_line("enum.rs", { on_line = 8, text = "z: u32,", indent = 8 }) - run:new_line("enum.rs", { on_line = 11, text = "let _x = 1;", indent = 0 }) - run:new_line("func.rs", { on_line = 1, text = "let _x = 1;", indent = 4 }) - run:new_line("func.rs", { on_line = 3, text = "let _x = 1;", indent = 0 }) - run:new_line("func.rs", { on_line = 6, text = "z: i32,", indent = 4 }) - run:new_line("impl.rs", { on_line = 3, text = "const FOO: u32 = 1;", indent = 4 }) - run:new_line("impl.rs", { on_line = 4, text = "let _x = 1;", indent = 8 }) - run:new_line("impl.rs", { on_line = 6, text = "let _x = 1;", indent = 4 }) - run:new_line("impl.rs", { on_line = 7, text = "let _x = 1;", indent = 0 }) - run:new_line("loop.rs", { on_line = 10, text = "x += 1;", indent = 8 }) - run:new_line("loop.rs", { on_line = 2, text = "x += 1;", indent = 8 }) - run:new_line("loop.rs", { on_line = 6, text = "x += 1;", indent = 8 }) - run:new_line("macro.rs", { on_line = 1, text = "() => {},", indent = 4 }) - run:new_line("macro.rs", { on_line = 12, text = "B C", indent = 4 }) - run:new_line("macro.rs", { on_line = 2, text = "struct $c;", indent = 8 }) - run:new_line("match.rs", { on_line = 2, text = "-1 => -1,", indent = 8 }) - run:new_line("match.rs", { on_line = 7, text = "let y = 1;", indent = 12 }) - run:new_line("match.rs", { on_line = 10, text = "let y = 1;", indent = 4 }) - run:new_line("mod.rs", { on_line = 1, text = "const Z: i32 = 1;", indent = 4 }) - run:new_line("mod.rs", { on_line = 2, text = "const Z: i32 = 1;", indent = 4 }) - run:new_line("mod.rs", { on_line = 6, text = "const Z: i32 = 1;", indent = 8 }) - run:new_line("mod.rs", { on_line = 7, text = "const Z: i32 = 1;", indent = 4 }) - run:new_line("string.rs", { on_line = 2, text = "brave new", indent = 0 }) - run:new_line("string.rs", { on_line = 5, text = "brave new \\", indent = 8 }) - run:new_line("string.rs", { on_line = 9, text = "brave new \\", indent = 8 }) - run:new_line("struct.rs", { on_line = 1, text = "z: i32,", indent = 4 }) - run:new_line("struct.rs", { on_line = 2, text = "z: i32,", indent = 4 }) - run:new_line("struct.rs", { on_line = 4, text = "let y = 1;", indent = 0 }) - run:new_line("trait.rs", { on_line = 4, text = "fn baz();", indent = 4 }) - run:new_line("trait.rs", { on_line = 5, text = "let y = 1;", indent = 0 }) - run:new_line("trait.rs", { on_line = 7, text = "fn baz();", indent = 4 }) - run:new_line("trait.rs", { on_line = 8, text = "()", indent = 8 }) - run:new_line("where.rs", { on_line = 17, text = "T: Debug,", indent = 4 }) - run:new_line("where.rs", { on_line = 2, text = "T: Debug,", indent = 4 }) - run:new_line("where.rs", { on_line = 9, text = "T: Debug,", indent = 4 }) + describe('new line:', function() + run:new_line('array.rs', { on_line = 2, text = '0,', indent = 4 }) + run:new_line('array.rs', { on_line = 8, text = '0,', indent = 8 }) + run:new_line('comment.rs', { on_line = 3, text = 'a', indent = '/// ' }) + run:new_line('comment.rs', { on_line = 10, text = 'a', indent = ' /// ' }) + run:new_line('cond.rs', { on_line = 11, text = 'x += 1;', indent = 12 }) + run:new_line('cond.rs', { on_line = 2, text = 'x += 1;', indent = 8 }) + run:new_line('cond.rs', { on_line = 4, text = 'x += 1;', indent = 8 }) + run:new_line('cond.rs', { on_line = 6, text = 'x += 1;', indent = 8 }) + run:new_line('cond.rs', { on_line = 8, text = 'x += 1;', indent = 4 }) + run:new_line('if_let_cond.rs', { on_line = 2, text = 'let a = 1;', indent = 8 }) + run:new_line('if_let_cond.rs', { on_line = 4, text = 'let a = 1;', indent = 8 }) + run:new_line('if_let_cond.rs', { on_line = 6, text = 'let a = 1;', indent = 4 }) + run:new_line('enum.rs', { on_line = 2, text = 'Q,', indent = 4 }) + run:new_line('enum.rs', { on_line = 4, text = 'i32,', indent = 8 }) + run:new_line('enum.rs', { on_line = 8, text = 'z: u32,', indent = 8 }) + run:new_line('enum.rs', { on_line = 11, text = 'let _x = 1;', indent = 0 }) + run:new_line('func.rs', { on_line = 1, text = 'let _x = 1;', indent = 4 }) + run:new_line('func.rs', { on_line = 3, text = 'let _x = 1;', indent = 0 }) + run:new_line('func.rs', { on_line = 6, text = 'z: i32,', indent = 4 }) + run:new_line('impl.rs', { on_line = 3, text = 'const FOO: u32 = 1;', indent = 4 }) + run:new_line('impl.rs', { on_line = 4, text = 'let _x = 1;', indent = 8 }) + run:new_line('impl.rs', { on_line = 6, text = 'let _x = 1;', indent = 4 }) + run:new_line('impl.rs', { on_line = 7, text = 'let _x = 1;', indent = 0 }) + run:new_line('loop.rs', { on_line = 10, text = 'x += 1;', indent = 8 }) + run:new_line('loop.rs', { on_line = 2, text = 'x += 1;', indent = 8 }) + run:new_line('loop.rs', { on_line = 6, text = 'x += 1;', indent = 8 }) + run:new_line('macro.rs', { on_line = 1, text = '() => {},', indent = 4 }) + run:new_line('macro.rs', { on_line = 12, text = 'B C', indent = 4 }) + run:new_line('macro.rs', { on_line = 2, text = 'struct $c;', indent = 8 }) + run:new_line('match.rs', { on_line = 2, text = '-1 => -1,', indent = 8 }) + run:new_line('match.rs', { on_line = 7, text = 'let y = 1;', indent = 12 }) + run:new_line('match.rs', { on_line = 10, text = 'let y = 1;', indent = 4 }) + run:new_line('mod.rs', { on_line = 1, text = 'const Z: i32 = 1;', indent = 4 }) + run:new_line('mod.rs', { on_line = 2, text = 'const Z: i32 = 1;', indent = 4 }) + run:new_line('mod.rs', { on_line = 6, text = 'const Z: i32 = 1;', indent = 8 }) + run:new_line('mod.rs', { on_line = 7, text = 'const Z: i32 = 1;', indent = 4 }) + run:new_line('string.rs', { on_line = 2, text = 'brave new', indent = 0 }) + run:new_line('string.rs', { on_line = 5, text = 'brave new \\', indent = 8 }) + run:new_line('string.rs', { on_line = 9, text = 'brave new \\', indent = 8 }) + run:new_line('struct.rs', { on_line = 1, text = 'z: i32,', indent = 4 }) + run:new_line('struct.rs', { on_line = 2, text = 'z: i32,', indent = 4 }) + run:new_line('struct.rs', { on_line = 4, text = 'let y = 1;', indent = 0 }) + run:new_line('trait.rs', { on_line = 4, text = 'fn baz();', indent = 4 }) + run:new_line('trait.rs', { on_line = 5, text = 'let y = 1;', indent = 0 }) + run:new_line('trait.rs', { on_line = 7, text = 'fn baz();', indent = 4 }) + run:new_line('trait.rs', { on_line = 8, text = '()', indent = 8 }) + run:new_line('where.rs', { on_line = 17, text = 'T: Debug,', indent = 4 }) + run:new_line('where.rs', { on_line = 2, text = 'T: Debug,', indent = 4 }) + run:new_line('where.rs', { on_line = 9, text = 'T: Debug,', indent = 4 }) end) end) diff --git a/tests/indent/smali_spec.lua b/tests/indent/smali_spec.lua index cddc4f9d2..44e4a9881 100644 --- a/tests/indent/smali_spec.lua +++ b/tests/indent/smali_spec.lua @@ -1,25 +1,28 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner -local run = Runner:new(it, "tests/indent/smali", { +local run = Runner:new(it, 'tests/indent/smali', { tabstop = 4, shiftwidth = 4, expandtab = false, }) -describe("indent Smali:", function() - describe("whole file:", function() - run:whole_file(".", { +describe('indent Smali:', function() + describe('whole file:', function() + run:whole_file('.', { expected_failures = {}, }) end) - describe("new line:", function() - run:new_line("field.smali", { on_line = 7, text = 'value1 = "test"', indent = 1 }) - run:new_line("field.smali", { on_line = 10, text = "value2 = Lsome/enum;", indent = 2 }) - run:new_line("array_and_switch.smali", { on_line = 43, text = "1 2 3 4 5 6 200", indent = 2 }) - run:new_line("array_and_switch.smali", { on_line = 48, text = "Label10:", indent = 2 }) - run:new_line("method.smali", { on_line = 7, text = ".registers 10", indent = 1 }) - run:new_line("parameter.smali", { on_line = 20, text = ".annotation runtime Lsome/annotation;", indent = 3 }) - run:new_line("parameter.smali", { on_line = 21, text = 'something = "some value"', indent = 3 }) + describe('new line:', function() + run:new_line('field.smali', { on_line = 7, text = 'value1 = "test"', indent = 1 }) + run:new_line('field.smali', { on_line = 10, text = 'value2 = Lsome/enum;', indent = 2 }) + run:new_line('array_and_switch.smali', { on_line = 43, text = '1 2 3 4 5 6 200', indent = 2 }) + run:new_line('array_and_switch.smali', { on_line = 48, text = 'Label10:', indent = 2 }) + run:new_line('method.smali', { on_line = 7, text = '.registers 10', indent = 1 }) + run:new_line( + 'parameter.smali', + { on_line = 20, text = '.annotation runtime Lsome/annotation;', indent = 3 } + ) + run:new_line('parameter.smali', { on_line = 21, text = 'something = "some value"', indent = 3 }) end) end) diff --git a/tests/indent/sql_spec.lua b/tests/indent/sql_spec.lua index 2fdfc9b1b..9d3a3a8e6 100644 --- a/tests/indent/sql_spec.lua +++ b/tests/indent/sql_spec.lua @@ -1,19 +1,19 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner --local XFAIL = require("tests.indent.common").XFAIL -local run = Runner:new(it, "tests/indent/sql", { +local run = Runner:new(it, 'tests/indent/sql', { tabstop = 4, shiftwidth = 4, softtabstop = 0, expandtab = true, }) -describe("indent SQL:", function() - describe("whole file:", function() - run:whole_file(".", { +describe('indent SQL:', function() + describe('whole file:', function() + run:whole_file('.', { expected_failures = {}, }) end) - describe("new line:", function() end) + describe('new line:', function() end) end) diff --git a/tests/indent/sway_spec.lua b/tests/indent/sway_spec.lua index d37573ae9..d6f4506ef 100644 --- a/tests/indent/sway_spec.lua +++ b/tests/indent/sway_spec.lua @@ -1,20 +1,20 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner -local run = Runner:new(it, "tests/indent/sway", { +local run = Runner:new(it, 'tests/indent/sway', { tabstop = 4, shiftwidth = 4, softtabstop = 4, expandtab = true, }) -describe("indent Sway:", function() - describe("whole file:", function() - run:whole_file(".", {}) +describe('indent Sway:', function() + describe('whole file:', function() + run:whole_file('.', {}) end) - describe("new line:", function() - run:new_line("main.sw", { on_line = 12, text = "const CONST: u32 = 2;", indent = 0 }) - run:new_line("main.sw", { on_line = 14, text = "let hi = 5;", indent = 4 }) - run:new_line("main.sw", { on_line = 15, text = "let hi = 5;", indent = 8 }) - run:new_line("main.sw", { on_line = 92, text = "let hi = 5;", indent = 12 }) + describe('new line:', function() + run:new_line('main.sw', { on_line = 12, text = 'const CONST: u32 = 2;', indent = 0 }) + run:new_line('main.sw', { on_line = 14, text = 'let hi = 5;', indent = 4 }) + run:new_line('main.sw', { on_line = 15, text = 'let hi = 5;', indent = 8 }) + run:new_line('main.sw', { on_line = 92, text = 'let hi = 5;', indent = 12 }) end) end) diff --git a/tests/indent/swift_spec.lua b/tests/indent/swift_spec.lua index 501cbfa81..8c9b2d063 100644 --- a/tests/indent/swift_spec.lua +++ b/tests/indent/swift_spec.lua @@ -1,22 +1,37 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner -local run = Runner:new(it, "tests/indent/swift", { +local run = Runner:new(it, 'tests/indent/swift', { tabstop = 2, shiftwidth = 2, softtabstop = 2, expandtab = true, }) -describe("indent Swift:", function() - describe("whole file:", function() - run:whole_file(".", {}) +describe('indent Swift:', function() + describe('whole file:', function() + run:whole_file('.', {}) end) - describe("new line:", function() - run:new_line("declarations.swift", { on_line = 6, text = "var x = 1", indent = 2 }) - run:new_line("declarations.swift", { on_line = 12, text = "var textInsideInit = true", indent = 4 }) - run:new_line("declarations.swift", { on_line = 19, text = "var textInsideWillSet = 1", indent = 6 }) - run:new_line("declarations.swift", { on_line = 22, text = "var textInsideDidSet = 1", indent = 6 }) - run:new_line("declarations.swift", { on_line = 27, text = "var textInsideOverrideFunc", indent = 4 }) - run:new_line("declarations.swift", { on_line = 33, text = "var InsideProtocol: String { get }", indent = 2 }) + describe('new line:', function() + run:new_line('declarations.swift', { on_line = 6, text = 'var x = 1', indent = 2 }) + run:new_line( + 'declarations.swift', + { on_line = 12, text = 'var textInsideInit = true', indent = 4 } + ) + run:new_line( + 'declarations.swift', + { on_line = 19, text = 'var textInsideWillSet = 1', indent = 6 } + ) + run:new_line( + 'declarations.swift', + { on_line = 22, text = 'var textInsideDidSet = 1', indent = 6 } + ) + run:new_line( + 'declarations.swift', + { on_line = 27, text = 'var textInsideOverrideFunc', indent = 4 } + ) + run:new_line( + 'declarations.swift', + { on_line = 33, text = 'var InsideProtocol: String { get }', indent = 2 } + ) end) end) diff --git a/tests/indent/t32_spec.lua b/tests/indent/t32_spec.lua index 88d26612b..30c6542e0 100644 --- a/tests/indent/t32_spec.lua +++ b/tests/indent/t32_spec.lua @@ -1,137 +1,171 @@ -local Runner = require("tests.indent.common").Runner -local XFAIL = require("tests.indent.common").XFAIL +local Runner = require('tests.indent.common').Runner +local XFAIL = require('tests.indent.common').XFAIL -local runner = Runner:new(it, "tests/indent/t32", { +local runner = Runner:new(it, 'tests/indent/t32', { tabstop = 2, shiftwidth = 2, softtabstop = 0, expandtab = true, }) -describe("indent t32:", function() - describe("whole file:", function() - runner:whole_file "." +describe('indent t32:', function() + describe('whole file:', function() + runner:whole_file('.') end) - describe("new line:", function() - runner:new_line("if_block.cmm", { on_line = 2, text = "GOTO start", indent = 0 }, "command after IF", XFAIL) + describe('new line:', function() + runner:new_line( + 'if_block.cmm', + { on_line = 2, text = 'GOTO start', indent = 0 }, + 'command after IF', + XFAIL + ) - runner:new_line("if_block.cmm", { on_line = 5, text = "GOTO start", indent = 2 }, "command in IF then block") + runner:new_line( + 'if_block.cmm', + { on_line = 5, text = 'GOTO start', indent = 2 }, + 'command in IF then block' + ) - runner:new_line("if_block.cmm", { on_line = 4, text = "(", indent = 0 }, "block after IF") + runner:new_line('if_block.cmm', { on_line = 4, text = '(', indent = 0 }, 'block after IF') - for ii, test in ipairs { + for ii, test in ipairs({ { 1, 2 }, { 14, 2 }, { 19, 2 }, { 21, 2 }, { 41, 2 }, { 42, 4 }, - } do + }) do runner:new_line( - "if_block.cmm", - { on_line = test[1], text = "&x=1.", indent = test[2] }, - "command in IF then[" .. ii .. "]" + 'if_block.cmm', + { on_line = test[1], text = '&x=1.', indent = test[2] }, + 'command in IF then[' .. ii .. ']' ) end -- Insertion of a command right before the existing block results in -- incorrect syntax. The parse either detect an error or incorrectly -- assumes "ELSE IF" is a command. - for ii, test in ipairs { + for ii, test in ipairs({ { 26, 2 }, { 30, 2 }, - } do + }) do runner:new_line( - "if_block.cmm", + 'if_block.cmm', { on_line = test[1], text = 'PRINT ""', indent = test[2] }, - "displace block in IF then[" .. ii .. "]", + 'displace block in IF then[' .. ii .. ']', XFAIL ) end - runner:new_line("if_block.cmm", { on_line = 45, text = "&x=1.", indent = 6 }, "command in IF then", XFAIL) + runner:new_line( + 'if_block.cmm', + { on_line = 45, text = '&x=1.', indent = 6 }, + 'command in IF then', + XFAIL + ) - for ii, test in ipairs { + for ii, test in ipairs({ { 16, 2 }, { 21, 2 }, { 23, 2 }, { 44, 4 }, - } do + }) do runner:new_line( - "if_block.cmm", - { on_line = test[1], text = "CONTinue\n", indent = test[2] }, - "command in IF else[" .. ii .. "]" + 'if_block.cmm', + { on_line = test[1], text = 'CONTinue\n', indent = test[2] }, + 'command in IF else[' .. ii .. ']' ) end - runner:new_line("while_block.cmm", { on_line = 2, text = "&x=1.", indent = 2 }, "command after WHILE") + runner:new_line( + 'while_block.cmm', + { on_line = 2, text = '&x=1.', indent = 2 }, + 'command after WHILE' + ) - runner:new_line("while_block.cmm", { on_line = 4, text = "&x=1.", indent = 0 }, "command after WHILE") + runner:new_line( + 'while_block.cmm', + { on_line = 4, text = '&x=1.', indent = 0 }, + 'command after WHILE' + ) - runner:new_line("while_block.cmm", { on_line = 1, text = "(\n", indent = 0 }, "block in WHILE then") + runner:new_line( + 'while_block.cmm', + { on_line = 1, text = '(\n', indent = 0 }, + 'block in WHILE then' + ) - for ii, test in ipairs { + for ii, test in ipairs({ { 5, 2 }, { 12, 2 }, - } do + }) do runner:new_line( - "while_block.cmm", - { on_line = test[1], text = "&x=1.", indent = test[2] }, - "command in WHILE then block[" .. ii .. "]" + 'while_block.cmm', + { on_line = test[1], text = '&x=1.', indent = test[2] }, + 'command in WHILE then block[' .. ii .. ']' ) end - for ii, test in ipairs { + for ii, test in ipairs({ { 1, 0 }, { 4, 2 }, - } do + }) do runner:new_line( - "repeat_block.cmm", - { on_line = test[1], text = "&x=1.", indent = test[2] }, - "command after RePeaT[" .. ii .. "]" + 'repeat_block.cmm', + { on_line = test[1], text = '&x=1.', indent = test[2] }, + 'command after RePeaT[' .. ii .. ']' ) end - runner:new_line("repeat_block.cmm", { on_line = 3, text = "(\n", indent = 0 }, "block in RePeaT then") + runner:new_line( + 'repeat_block.cmm', + { on_line = 3, text = '(\n', indent = 0 }, + 'block in RePeaT then' + ) - for ii, test in ipairs { + for ii, test in ipairs({ { 7, 2 }, { 18, 2 }, { 24, 2 }, - } do + }) do runner:new_line( - "repeat_block.cmm", - { on_line = test[1], text = "&x=1.", indent = test[2] }, - "command in RePeaT then block [" .. ii .. "]" + 'repeat_block.cmm', + { on_line = test[1], text = '&x=1.', indent = test[2] }, + 'command in RePeaT then block [' .. ii .. ']' ) end - runner:new_line("subroutine_block.cmm", { on_line = 1, text = "(\n", indent = 0 }, "block after call label") + runner:new_line( + 'subroutine_block.cmm', + { on_line = 1, text = '(\n', indent = 0 }, + 'block after call label' + ) - for ii, test in ipairs { + for ii, test in ipairs({ { 2, 2 }, { 3, 2 }, { 8, 2 }, { 12, 2 }, { 19, 2 }, - } do + }) do runner:new_line( - "subroutine_block.cmm", - { on_line = test[1], text = "&x=1.", indent = test[2] }, - "command in subroutine block[" .. ii .. "]" + 'subroutine_block.cmm', + { on_line = test[1], text = '&x=1.', indent = test[2] }, + 'command in subroutine block[' .. ii .. ']' ) end - for ii, test in ipairs { + for ii, test in ipairs({ { 5, 2 }, { 13, 2 }, { 23, 2 }, - } do + }) do runner:new_line( - "subroutine_block.cmm", - { on_line = test[1], text = "&x=1.", indent = test[2] }, - "command after subroutine block[" .. ii .. "]" + 'subroutine_block.cmm', + { on_line = test[1], text = '&x=1.', indent = test[2] }, + 'command after subroutine block[' .. ii .. ']' ) end end) diff --git a/tests/indent/terraform_spec.lua b/tests/indent/terraform_spec.lua index 49fa22c20..3cfcb937b 100644 --- a/tests/indent/terraform_spec.lua +++ b/tests/indent/terraform_spec.lua @@ -1,35 +1,56 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner --local XFAIL = require("tests.indent.common").XFAIL -local run = Runner:new(it, "tests/indent/terraform", { +local run = Runner:new(it, 'tests/indent/terraform', { tabstop = 2, shiftwidth = 2, expandtab = true, }) -describe("indent Terraform:", function() - describe("whole file:", function() - run:whole_file(".", { +describe('indent Terraform:', function() + describe('whole file:', function() + run:whole_file('.', { expected_failures = {}, }) end) - describe("new line:", function() - run:new_line("no-indent-after-brace.tf", { on_line = 4, text = "# Wow, no indent here please", indent = 0 }) - run:new_line("indent-in-multiline-tuples.tf", { on_line = 4, text = "3,", indent = 4 }) - run:new_line("indent-in-multiline-tuples.tf", { on_line = 3, text = "# as elements", indent = 4 }) - run:new_line("indent-in-multiline-tuples.tf", { on_line = 5, text = "# as outer block", indent = 2 }) - run:new_line("indent-in-multiline-tuples.tf", { on_line = 1, text = "# as outer block", indent = 2 }) - run:new_line("indent-in-multiline-objects.tf", { on_line = 4, text = '3: "baz",', indent = 4 }) - run:new_line("indent-in-multiline-objects.tf", { on_line = 3, text = "# as elements", indent = 4 }) - run:new_line("indent-in-multiline-objects.tf", { on_line = 5, text = "# as outer block", indent = 2 }) - run:new_line("indent-in-multiline-objects.tf", { on_line = 1, text = "# as outer block", indent = 2 }) - run:new_line("multiple-attributes.tf", { on_line = 2, text = "a = 1", indent = 2 }) - run:new_line("multiple-attributes.tf", { on_line = 3, text = "a = 1", indent = 2 }) - run:new_line("multiple-attributes.tf", { on_line = 4, text = "a = 1", indent = 0 }) - run:new_line("nested_blocks.tf", { on_line = 3, text = "a = 1", indent = 4 }) - run:new_line("nested_blocks.tf", { on_line = 4, text = "a = 1", indent = 2 }) - run:new_line("function_call.tf", { on_line = 4, text = "c,", indent = 4 }) - run:new_line("function_call.tf", { on_line = 5, text = "a = 1", indent = 2 }) + describe('new line:', function() + run:new_line( + 'no-indent-after-brace.tf', + { on_line = 4, text = '# Wow, no indent here please', indent = 0 } + ) + run:new_line('indent-in-multiline-tuples.tf', { on_line = 4, text = '3,', indent = 4 }) + run:new_line( + 'indent-in-multiline-tuples.tf', + { on_line = 3, text = '# as elements', indent = 4 } + ) + run:new_line( + 'indent-in-multiline-tuples.tf', + { on_line = 5, text = '# as outer block', indent = 2 } + ) + run:new_line( + 'indent-in-multiline-tuples.tf', + { on_line = 1, text = '# as outer block', indent = 2 } + ) + run:new_line('indent-in-multiline-objects.tf', { on_line = 4, text = '3: "baz",', indent = 4 }) + run:new_line( + 'indent-in-multiline-objects.tf', + { on_line = 3, text = '# as elements', indent = 4 } + ) + run:new_line( + 'indent-in-multiline-objects.tf', + { on_line = 5, text = '# as outer block', indent = 2 } + ) + run:new_line( + 'indent-in-multiline-objects.tf', + { on_line = 1, text = '# as outer block', indent = 2 } + ) + run:new_line('multiple-attributes.tf', { on_line = 2, text = 'a = 1', indent = 2 }) + run:new_line('multiple-attributes.tf', { on_line = 3, text = 'a = 1', indent = 2 }) + run:new_line('multiple-attributes.tf', { on_line = 4, text = 'a = 1', indent = 0 }) + run:new_line('nested_blocks.tf', { on_line = 3, text = 'a = 1', indent = 4 }) + run:new_line('nested_blocks.tf', { on_line = 4, text = 'a = 1', indent = 2 }) + run:new_line('function_call.tf', { on_line = 4, text = 'c,', indent = 4 }) + run:new_line('function_call.tf', { on_line = 5, text = 'a = 1', indent = 2 }) end) end) diff --git a/tests/indent/tiger_spec.lua b/tests/indent/tiger_spec.lua index c1f252fd8..b41019c12 100644 --- a/tests/indent/tiger_spec.lua +++ b/tests/indent/tiger_spec.lua @@ -1,113 +1,233 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner -local runner = Runner:new(it, "tests/indent/tiger", { +local runner = Runner:new(it, 'tests/indent/tiger', { tabstop = 2, shiftwidth = 2, softtabstop = 0, expandtab = true, }) -describe("indent Tiger:", function() - describe("whole file:", function() - runner:whole_file "." +describe('indent Tiger:', function() + describe('whole file:', function() + runner:whole_file('.') end) - describe("new line:", function() - runner:new_line("classes.tig", { on_line = 1, text = "var a := 0", indent = 2 }, "class declaration beginning") - runner:new_line("classes.tig", { on_line = 2, text = "var a := 0", indent = 2 }, "class declaration after field") - runner:new_line("classes.tig", { on_line = 4, text = "var a := 0", indent = 2 }, "class declaration after method") - runner:new_line("classes.tig", { on_line = 5, text = "var a := 0", indent = 0 }, "after class declaration") - runner:new_line("classes.tig", { on_line = 7, text = "var a := 0", indent = 2 }, "class type beginning") - runner:new_line("classes.tig", { on_line = 8, text = "var a := 0", indent = 2 }, "class type after field") - runner:new_line("classes.tig", { on_line = 10, text = "self.a := 0", indent = 4 }, "inside method") - runner:new_line("classes.tig", { on_line = 13, text = "var a := 0", indent = 2 }, "class type after method") - runner:new_line("classes.tig", { on_line = 14, text = "var a := 0", indent = 0 }, "after class type") + describe('new line:', function() + runner:new_line( + 'classes.tig', + { on_line = 1, text = 'var a := 0', indent = 2 }, + 'class declaration beginning' + ) + runner:new_line( + 'classes.tig', + { on_line = 2, text = 'var a := 0', indent = 2 }, + 'class declaration after field' + ) + runner:new_line( + 'classes.tig', + { on_line = 4, text = 'var a := 0', indent = 2 }, + 'class declaration after method' + ) + runner:new_line( + 'classes.tig', + { on_line = 5, text = 'var a := 0', indent = 0 }, + 'after class declaration' + ) + runner:new_line( + 'classes.tig', + { on_line = 7, text = 'var a := 0', indent = 2 }, + 'class type beginning' + ) + runner:new_line( + 'classes.tig', + { on_line = 8, text = 'var a := 0', indent = 2 }, + 'class type after field' + ) + runner:new_line( + 'classes.tig', + { on_line = 10, text = 'self.a := 0', indent = 4 }, + 'inside method' + ) + runner:new_line( + 'classes.tig', + { on_line = 13, text = 'var a := 0', indent = 2 }, + 'class type after method' + ) + runner:new_line( + 'classes.tig', + { on_line = 14, text = 'var a := 0', indent = 0 }, + 'after class type' + ) - runner:new_line("control-flow.tig", { on_line = 2, text = "true", indent = 4 }, "if condition") - runner:new_line("control-flow.tig", { on_line = 4, text = "true", indent = 4 }, "if consequence") - runner:new_line("control-flow.tig", { on_line = 4, text = "true", indent = 4 }, "if alternative") - runner:new_line("control-flow.tig", { on_line = 10, text = "start := 0", indent = 4 }, "for index start") - runner:new_line("control-flow.tig", { on_line = 12, text = "the_end", indent = 4 }, "for index end") - runner:new_line("control-flow.tig", { on_line = 14, text = "break", indent = 4 }, "for body") - runner:new_line("control-flow.tig", { on_line = 18, text = "true", indent = 4 }, "while condition") - runner:new_line("control-flow.tig", { on_line = 20, text = "break", indent = 4 }, "while body") + runner:new_line('control-flow.tig', { on_line = 2, text = 'true', indent = 4 }, 'if condition') + runner:new_line( + 'control-flow.tig', + { on_line = 4, text = 'true', indent = 4 }, + 'if consequence' + ) + runner:new_line( + 'control-flow.tig', + { on_line = 4, text = 'true', indent = 4 }, + 'if alternative' + ) + runner:new_line( + 'control-flow.tig', + { on_line = 10, text = 'start := 0', indent = 4 }, + 'for index start' + ) + runner:new_line( + 'control-flow.tig', + { on_line = 12, text = 'the_end', indent = 4 }, + 'for index end' + ) + runner:new_line('control-flow.tig', { on_line = 14, text = 'break', indent = 4 }, 'for body') + runner:new_line( + 'control-flow.tig', + { on_line = 18, text = 'true', indent = 4 }, + 'while condition' + ) + runner:new_line('control-flow.tig', { on_line = 20, text = 'break', indent = 4 }, 'while body') - runner:new_line("functions.tig", { on_line = 1, text = "parameter: int,", indent = 2 }, "parameter list beginning") - runner:new_line("functions.tig", { on_line = 2, text = "parameter: int,", indent = 2 }, "parameter list middle") - runner:new_line("functions.tig", { on_line = 4, text = ",parameter: int", indent = 2 }, "parameter list end") - runner:new_line("functions.tig", { on_line = 5, text = "var a := 0", indent = 0 }, "after parameter list") - runner:new_line("functions.tig", { on_line = 7, text = "print(a)", indent = 2 }, "function body") - runner:new_line("functions.tig", { on_line = 9, text = "a,", indent = 6 }, "function call beginning") - runner:new_line("functions.tig", { on_line = 10, text = "a,", indent = 6 }, "function call middle") - runner:new_line("functions.tig", { on_line = 12, text = ",a", indent = 6 }, "function call end") - runner:new_line("functions.tig", { on_line = 13, text = "; print(a)", indent = 4 }, "after function call") - runner:new_line("functions.tig", { on_line = 14, text = "var a := 12", indent = 0 }, "after function declaration") + runner:new_line( + 'functions.tig', + { on_line = 1, text = 'parameter: int,', indent = 2 }, + 'parameter list beginning' + ) + runner:new_line( + 'functions.tig', + { on_line = 2, text = 'parameter: int,', indent = 2 }, + 'parameter list middle' + ) + runner:new_line( + 'functions.tig', + { on_line = 4, text = ',parameter: int', indent = 2 }, + 'parameter list end' + ) + runner:new_line( + 'functions.tig', + { on_line = 5, text = 'var a := 0', indent = 0 }, + 'after parameter list' + ) + runner:new_line( + 'functions.tig', + { on_line = 7, text = 'print(a)', indent = 2 }, + 'function body' + ) + runner:new_line( + 'functions.tig', + { on_line = 9, text = 'a,', indent = 6 }, + 'function call beginning' + ) + runner:new_line( + 'functions.tig', + { on_line = 10, text = 'a,', indent = 6 }, + 'function call middle' + ) + runner:new_line('functions.tig', { on_line = 12, text = ',a', indent = 6 }, 'function call end') + runner:new_line( + 'functions.tig', + { on_line = 13, text = '; print(a)', indent = 4 }, + 'after function call' + ) + runner:new_line( + 'functions.tig', + { on_line = 14, text = 'var a := 12', indent = 0 }, + 'after function declaration' + ) - runner:new_line("groupings.tig", { on_line = 2, text = "var b := 0", indent = 2 }, "let declarations") - runner:new_line("groupings.tig", { on_line = 3, text = "a := a + 1", indent = 2 }, "after 'in'") - runner:new_line("groupings.tig", { on_line = 4, text = "a := a + 1;", indent = 4 }, "sequence") - runner:new_line("groupings.tig", { on_line = 8, text = "a := a + 1;", indent = 2 }, "after sequence") - runner:new_line("groupings.tig", { on_line = 10, text = "+ 1", indent = 0 }, "after 'end'") + runner:new_line( + 'groupings.tig', + { on_line = 2, text = 'var b := 0', indent = 2 }, + 'let declarations' + ) + runner:new_line('groupings.tig', { on_line = 3, text = 'a := a + 1', indent = 2 }, "after 'in'") + runner:new_line('groupings.tig', { on_line = 4, text = 'a := a + 1;', indent = 4 }, 'sequence') + runner:new_line( + 'groupings.tig', + { on_line = 8, text = 'a := a + 1;', indent = 2 }, + 'after sequence' + ) + runner:new_line('groupings.tig', { on_line = 10, text = '+ 1', indent = 0 }, "after 'end'") runner:new_line( - "values-and-expressions.tig", - { on_line = 4, text = "field: record,", indent = 4 }, - "record type beginning" + 'values-and-expressions.tig', + { on_line = 4, text = 'field: record,', indent = 4 }, + 'record type beginning' + ) + runner:new_line( + 'values-and-expressions.tig', + { on_line = 5, text = 'field: record,', indent = 4 }, + 'record type middle' + ) + runner:new_line( + 'values-and-expressions.tig', + { on_line = 7, text = ',field: record', indent = 4 }, + 'record type end' + ) + runner:new_line( + 'values-and-expressions.tig', + { on_line = 8, text = 'var a := 0', indent = 2 }, + 'after record type' + ) + runner:new_line( + 'values-and-expressions.tig', + { on_line = 10, text = '0', indent = 4 }, + 'variable declaration init value' + ) + runner:new_line( + 'values-and-expressions.tig', + { on_line = 11, text = '+ a', indent = 4 }, + 'variable declaration init follow-up' ) runner:new_line( - "values-and-expressions.tig", - { on_line = 5, text = "field: record,", indent = 4 }, - "record type middle" + 'values-and-expressions.tig', + { on_line = 13, text = 'a', indent = 4 }, + 'array index' ) runner:new_line( - "values-and-expressions.tig", - { on_line = 7, text = ",field: record", indent = 4 }, - "record type end" + 'values-and-expressions.tig', + { on_line = 14, text = '+ a', indent = 4 }, + 'array index follow-up' ) - runner:new_line("values-and-expressions.tig", { on_line = 8, text = "var a := 0", indent = 2 }, "after record type") runner:new_line( - "values-and-expressions.tig", - { on_line = 10, text = "0", indent = 4 }, - "variable declaration init value" + 'values-and-expressions.tig', + { on_line = 15, text = '+ a', indent = 2 }, + 'after array value' ) runner:new_line( - "values-and-expressions.tig", - { on_line = 11, text = "+ a", indent = 4 }, - "variable declaration init follow-up" + 'values-and-expressions.tig', + { on_line = 18, text = 'a', indent = 4 }, + 'array expression size' ) - runner:new_line("values-and-expressions.tig", { on_line = 13, text = "a", indent = 4 }, "array index") - runner:new_line("values-and-expressions.tig", { on_line = 14, text = "+ a", indent = 4 }, "array index follow-up") - runner:new_line("values-and-expressions.tig", { on_line = 15, text = "+ a", indent = 2 }, "after array value") - runner:new_line("values-and-expressions.tig", { on_line = 18, text = "a", indent = 4 }, "array expression size") runner:new_line( - "values-and-expressions.tig", - { on_line = 20, text = "of", indent = 4 }, - "array expression after size" + 'values-and-expressions.tig', + { on_line = 20, text = 'of', indent = 4 }, + 'array expression after size' ) runner:new_line( - "values-and-expressions.tig", - { on_line = 21, text = "a", indent = 4 }, - "array expression init value" + 'values-and-expressions.tig', + { on_line = 21, text = 'a', indent = 4 }, + 'array expression init value' ) runner:new_line( - "values-and-expressions.tig", - { on_line = 25, text = "field = 0,", indent = 4 }, - "record expression beginning" + 'values-and-expressions.tig', + { on_line = 25, text = 'field = 0,', indent = 4 }, + 'record expression beginning' ) runner:new_line( - "values-and-expressions.tig", - { on_line = 26, text = "field = 0,", indent = 4 }, - "record expression middle" + 'values-and-expressions.tig', + { on_line = 26, text = 'field = 0,', indent = 4 }, + 'record expression middle' ) runner:new_line( - "values-and-expressions.tig", - { on_line = 28, text = ",field = 0", indent = 4 }, - "record expression end" + 'values-and-expressions.tig', + { on_line = 28, text = ',field = 0', indent = 4 }, + 'record expression end' ) runner:new_line( - "values-and-expressions.tig", - { on_line = 29, text = "a := 0", indent = 2 }, - "after record expression" + 'values-and-expressions.tig', + { on_line = 29, text = 'a := 0', indent = 2 }, + 'after record expression' ) end) end) diff --git a/tests/indent/usd_spec.lua b/tests/indent/usd_spec.lua index c4e8198aa..85e9b9f78 100644 --- a/tests/indent/usd_spec.lua +++ b/tests/indent/usd_spec.lua @@ -1,21 +1,21 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner -local run = Runner:new(it, "tests/indent/usd", { +local run = Runner:new(it, 'tests/indent/usd', { tabstop = 4, shiftwidth = 4, softtabstop = 4, expandtab = true, }) -describe("indent USD:", function() - describe("whole file:", function() - run:whole_file(".", { +describe('indent USD:', function() + describe('whole file:', function() + run:whole_file('.', { expected_failures = {}, }) end) - describe("new line:", function() - run:new_line("prim.usd", { on_line = 3, text = "active = false", indent = 4 }) - run:new_line("prim.usd", { on_line = 5, text = "custom int foo = 10", indent = 4 }) + describe('new line:', function() + run:new_line('prim.usd', { on_line = 3, text = 'active = false', indent = 4 }) + run:new_line('prim.usd', { on_line = 5, text = 'custom int foo = 10', indent = 4 }) end) end) diff --git a/tests/indent/vue_spec.lua b/tests/indent/vue_spec.lua index 09527e4b0..ec9466d5e 100644 --- a/tests/indent/vue_spec.lua +++ b/tests/indent/vue_spec.lua @@ -1,24 +1,29 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner -- local XFAIL = require("tests.indent.common").XFAIL -local run = Runner:new(it, "tests/indent", { +local run = Runner:new(it, 'tests/indent', { tabstop = 2, shiftwidth = 2, softtabstop = 0, expandtab = true, }) -describe("indent Vue:", function() - describe("whole file:", function() - run:whole_file({ "vue/" }, {}) +describe('indent Vue:', function() + describe('whole file:', function() + run:whole_file({ 'vue/' }, {}) end) - describe("new line:", function() - for _, info in ipairs { + describe('new line:', function() + for _, info in ipairs({ { 1, 2 }, { 3, 0 }, - } do - run:new_line("vue/template_indent.vue", { on_line = info[1], text = "Foo", indent = info[2] }, info[3], info[4]) + }) do + run:new_line( + 'vue/template_indent.vue', + { on_line = info[1], text = 'Foo', indent = info[2] }, + info[3], + info[4] + ) end end) end) diff --git a/tests/indent/wgsl_spec.lua b/tests/indent/wgsl_spec.lua index e1bf618f8..9a30cff4b 100644 --- a/tests/indent/wgsl_spec.lua +++ b/tests/indent/wgsl_spec.lua @@ -1,43 +1,43 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner --local XFAIL = require("tests.indent.common").XFAIL -local run = Runner:new(it, "tests/indent/wgsl", { +local run = Runner:new(it, 'tests/indent/wgsl', { tabstop = 2, shiftwidth = 2, softtabstop = 0, expandtab = true, }) -describe("indent WGSL:", function() - describe("whole file:", function() - run:whole_file(".", { +describe('indent WGSL:', function() + describe('whole file:', function() + run:whole_file('.', { expected_failures = {}, }) end) - describe("new line:", function() - run:new_line("basic.wgsl", { on_line = 47, text = "c: u32,", indent = 2 }) - run:new_line("basic.wgsl", { on_line = 52, text = "c: u32,", indent = 2 }) - run:new_line("basic.wgsl", { on_line = 56, text = "c: u32,", indent = 2 }) - run:new_line("basic.wgsl", { on_line = 59, text = "c: u32,", indent = 2 }) - run:new_line("type_constructor_or_function_call_expression.wgsl", { + describe('new line:', function() + run:new_line('basic.wgsl', { on_line = 47, text = 'c: u32,', indent = 2 }) + run:new_line('basic.wgsl', { on_line = 52, text = 'c: u32,', indent = 2 }) + run:new_line('basic.wgsl', { on_line = 56, text = 'c: u32,', indent = 2 }) + run:new_line('basic.wgsl', { on_line = 59, text = 'c: u32,', indent = 2 }) + run:new_line('type_constructor_or_function_call_expression.wgsl', { on_line = 3, - text = "b", + text = 'b', indent = 4, }) - run:new_line("type_constructor_or_function_call_expression.wgsl", { + run:new_line('type_constructor_or_function_call_expression.wgsl', { on_line = 4, - text = "c", + text = 'c', indent = 4, }) - run:new_line("type_constructor_or_function_call_expression.wgsl", { + run:new_line('type_constructor_or_function_call_expression.wgsl', { on_line = 8, - text = "b", + text = 'b', indent = 4, }) - run:new_line("type_constructor_or_function_call_expression.wgsl", { + run:new_line('type_constructor_or_function_call_expression.wgsl', { on_line = 9, - text = "c", + text = 'c', indent = 4, }) end) diff --git a/tests/indent/yaml_spec.lua b/tests/indent/yaml_spec.lua index 91c60c227..001bc01f1 100644 --- a/tests/indent/yaml_spec.lua +++ b/tests/indent/yaml_spec.lua @@ -1,20 +1,20 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner --local XFAIL = require("tests.indent.common").XFAIL -local run = Runner:new(it, "tests/indent/yaml", { +local run = Runner:new(it, 'tests/indent/yaml', { shiftwidth = 2, expandtab = true, }) -describe("indent YAML:", function() - describe("whole file:", function() - run:whole_file(".", { +describe('indent YAML:', function() + describe('whole file:', function() + run:whole_file('.', { expected_failures = {}, }) end) - describe("new line:", function() - run:new_line("indent-sequence-items.yaml", { on_line = 2, text = "key3: value3", indent = 2 }) - run:new_line("autoindent-mapping-pair.yaml", { on_line = 1, text = "key3: value3", indent = 2 }) + describe('new line:', function() + run:new_line('indent-sequence-items.yaml', { on_line = 2, text = 'key3: value3', indent = 2 }) + run:new_line('autoindent-mapping-pair.yaml', { on_line = 1, text = 'key3: value3', indent = 2 }) end) end) diff --git a/tests/indent/yang_spec.lua b/tests/indent/yang_spec.lua index 618d260c6..44e1dbce5 100644 --- a/tests/indent/yang_spec.lua +++ b/tests/indent/yang_spec.lua @@ -1,23 +1,23 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner -local run = Runner:new(it, "tests/indent/yang", { +local run = Runner:new(it, 'tests/indent/yang', { tabstop = 2, shiftwidth = 2, softtabstop = 0, expandtab = true, }) -describe("indent YANG:", function() - describe("whole file:", function() - run:whole_file(".", { +describe('indent YANG:', function() + describe('whole file:', function() + run:whole_file('.', { expected_failures = {}, }) end) - describe("new line:", function() - run:new_line("module.yang", { on_line = 12, text = "// Aligned indentation ended", indent = 2 }) - run:new_line("module.yang", { on_line = 37, text = "// Test", indent = 4 }) - run:new_line("module.yang", { on_line = 40, text = "// Test", indent = 4 }) - run:new_line("module.yang", { on_line = 52, text = "Aligned string!", indent = 11 }) + describe('new line:', function() + run:new_line('module.yang', { on_line = 12, text = '// Aligned indentation ended', indent = 2 }) + run:new_line('module.yang', { on_line = 37, text = '// Test', indent = 4 }) + run:new_line('module.yang', { on_line = 40, text = '// Test', indent = 4 }) + run:new_line('module.yang', { on_line = 52, text = 'Aligned string!', indent = 11 }) end) end) diff --git a/tests/indent/yuck_spec.lua b/tests/indent/yuck_spec.lua index 6ce15de6f..b20ac8dac 100644 --- a/tests/indent/yuck_spec.lua +++ b/tests/indent/yuck_spec.lua @@ -1,19 +1,19 @@ -local Runner = require("tests.indent.common").Runner -local run = Runner:new(it, "tests/indent/yuck", { +local Runner = require('tests.indent.common').Runner +local run = Runner:new(it, 'tests/indent/yuck', { tabstop = 2, shiftwidth = 2, expandtab = true, }) -describe("indent yuck", function() - describe("whole file:", function() - run:whole_file(".", { +describe('indent yuck', function() + describe('whole file:', function() + run:whole_file('.', { expected_failures = {}, }) end) - describe("new line:", function() - run:new_line("indent.yuck", { on_line = 13, text = ":box1 parameter", indent = 4 }) - run:new_line("indent.yuck", { on_line = 17, text = ")", indent = 0 }) + describe('new line:', function() + run:new_line('indent.yuck', { on_line = 13, text = ':box1 parameter', indent = 4 }) + run:new_line('indent.yuck', { on_line = 17, text = ')', indent = 0 }) end) end) diff --git a/tests/indent/zig_spec.lua b/tests/indent/zig_spec.lua index c064d9ab9..4ad17446f 100644 --- a/tests/indent/zig_spec.lua +++ b/tests/indent/zig_spec.lua @@ -1,22 +1,22 @@ -local Runner = require("tests.indent.common").Runner +local Runner = require('tests.indent.common').Runner --local XFAIL = require("tests.indent.common").XFAIL -local run = Runner:new(it, "tests/indent/zig", { +local run = Runner:new(it, 'tests/indent/zig', { tabstop = 4, shiftwidth = 4, softtabstop = 4, expandtab = true, }) -describe("indent Zig:", function() - describe("whole file:", function() - run:whole_file(".", { +describe('indent Zig:', function() + describe('whole file:', function() + run:whole_file('.', { expected_failures = {}, }) end) - describe("new lines:", function() - run:new_line("pr-3269.zig", { on_line = 5, text = "return;", indent = 4 }) - run:new_line("pr-3269.zig", { on_line = 6, text = "", indent = 0 }) + describe('new lines:', function() + run:new_line('pr-3269.zig', { on_line = 5, text = 'return;', indent = 4 }) + run:new_line('pr-3269.zig', { on_line = 6, text = '', indent = 0 }) end) end) |
