diff options
| author | Jędrzej Boczar <yendreij@gmail.com> | 2021-04-23 00:41:44 +0200 |
|---|---|---|
| committer | Kiyan <yazdani.kiyan@protonmail.com> | 2021-04-23 21:21:38 +0200 |
| commit | af3537fbe57a2a37ab2b620c9ecc487e31b4da64 (patch) | |
| tree | 1142bbbe292ff58f19bf5db9732a20550c4c0206 /tests | |
| parent | tests/indent: move common code out of main lua/ directory (diff) | |
| download | nvim-treesitter-af3537fbe57a2a37ab2b620c9ecc487e31b4da64.tar nvim-treesitter-af3537fbe57a2a37ab2b620c9ecc487e31b4da64.tar.gz nvim-treesitter-af3537fbe57a2a37ab2b620c9ecc487e31b4da64.tar.bz2 nvim-treesitter-af3537fbe57a2a37ab2b620c9ecc487e31b4da64.tar.lz nvim-treesitter-af3537fbe57a2a37ab2b620c9ecc487e31b4da64.tar.xz nvim-treesitter-af3537fbe57a2a37ab2b620c9ecc487e31b4da64.tar.zst nvim-treesitter-af3537fbe57a2a37ab2b620c9ecc487e31b4da64.zip | |
tests/indent: factor out most of the code into common.lua
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/indent/c_spec.lua | 56 | ||||
| -rw-r--r-- | tests/indent/common.lua | 45 | ||||
| -rw-r--r-- | tests/indent/cpp_spec.lua | 71 | ||||
| -rw-r--r-- | tests/indent/lua_spec.lua | 53 | ||||
| -rw-r--r-- | tests/indent/python_spec.lua | 64 | ||||
| -rw-r--r-- | tests/indent/rust_spec.lua | 94 |
6 files changed, 175 insertions, 208 deletions
diff --git a/tests/indent/c_spec.lua b/tests/indent/c_spec.lua index f93d7ee22..94f3d739a 100644 --- a/tests/indent/c_spec.lua +++ b/tests/indent/c_spec.lua @@ -1,49 +1,35 @@ -local whole_file = require('tests.indent.common').indent_whole_file -local new_line = require('tests.indent.common').indent_new_line -local scan_dir = require('plenary.scandir').scan_dir +local Runner = require('tests.indent.common').Runner -local opts = { +local runner = Runner:new(it, 'tests/indent/c', { tabstop = 4, shiftwidth = 4, softtabstop = 0, expandtab = true, -} - -local run = function(file, spec, title) - title = title and title or tostring(spec.on_line) - it(string.format('%s[%s]', file, title), function() - new_line('tests/indent/c/' .. file, spec, opts) - end) -end +}) describe('indent C:', function() describe('whole file:', function() - local files = scan_dir('tests/indent/c'); - for _, file in ipairs(files) do - it(vim.fn.fnamemodify(file, ':t'), function() - whole_file(file, opts) - end) - end + runner:whole_file('.') end) describe('new line:', function() - run('array.c', { on_line = 2, text = '0,', indent = 4 }) - run('cond.c', { on_line = 3, text = 'x++;', indent = 8 }) - run('cond.c', { on_line = 8, text = 'x++;', indent = 8 }) - run('expr.c', { on_line = 10, text = '2 *', indent = 8 }) - run('func.c', { on_line = 17, text = 'int z,', indent = 4 }) - run('label.c', { on_line = 3, text = 'normal:', indent = 0 }) - run('loop.c', { on_line = 3, text = 'x++;', indent = 8 }) - run('preproc_cond.c', { on_line = 5, text = 'x++;', indent = 4 }) - run('preproc_func.c', { on_line = 3, text = 'x++; \\', indent = 8 }) - run('string.c', { on_line = 1, text = 'brave new \\', indent = 0 }) - run('string.c', { on_line = 4, text = '"brave new "', indent = 4 }) - run('struct.c', { on_line = 4, text = 'int y;', indent = 8 }) - run('switch.c', { on_line = 3, text = 'x++;', indent = 12 }) - run('ternary.c', { on_line = 4, text = ': (x == 0) : 0', indent = 8 }) + runner:new_line('array.c', { on_line = 2, text = '0,', indent = 4 }) + runner:new_line('cond.c', { on_line = 3, text = 'x++;', indent = 8 }) + runner:new_line('cond.c', { on_line = 8, text = 'x++;', indent = 8 }) + 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 }) + 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 }) -- the line after inserted one will be left with wrong indent but we only care about the inserted one - run('no_braces.c', { on_line = 4, text = 'x++;', indent = 8 }) - run('no_braces.c', { on_line = 7, text = 'x++;', indent = 8 }) - run('no_braces.c', { on_line = 10, text = 'x++;', indent = 8 }) + runner:new_line('no_braces.c', { on_line = 4, text = 'x++;', indent = 8 }) + runner:new_line('no_braces.c', { on_line = 7, text = 'x++;', indent = 8 }) + runner:new_line('no_braces.c', { on_line = 10, text = 'x++;', indent = 8 }) end) end) diff --git a/tests/indent/common.lua b/tests/indent/common.lua index 96caf17f9..ff30b5a5d 100644 --- a/tests/indent/common.lua +++ b/tests/indent/common.lua @@ -2,6 +2,8 @@ local M = {} local assert = require('luassert') local say = require('say') +local scan_dir = require('plenary.scandir').scan_dir +local Path = require('plenary.path') local function same_indent(state, arguments) local before = arguments[1] @@ -73,7 +75,7 @@ local function set_buf_indent_opts(opts) end function M.run_indent_test(file, runner, opts) - assert.are.same(1, vim.fn.filereadable(file)) + 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)) @@ -122,4 +124,45 @@ function M.indent_new_line(file, spec, opts) compare_indent(before, after) end +local Runner = {} +Runner.__index = Runner + +-- Helper to avoid boilerplate when defining tests +-- @param it the "it" function that busted defines globally in spec files +-- @param base_dir all other paths will be resolved relative to this directory +-- @param buf_opts buffer options passed to set_buf_indent_opts +function Runner:new(it, base_dir, buf_opts) + local runner = {} + runner.it = it + runner.base_dir = Path:new(base_dir) + runner.buf_opts = buf_opts + return setmetatable(runner, self) +end + +function Runner:whole_file(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 = vim.tbl_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() + M.indent_whole_file(file, self.buf_opts) + end) + end +end + +function Runner:new_line(file, spec, title) + title = title and title or tostring(spec.on_line) + 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) + end) +end + +M.Runner = Runner + return M diff --git a/tests/indent/cpp_spec.lua b/tests/indent/cpp_spec.lua index b3a7e7454..81e9a0a58 100644 --- a/tests/indent/cpp_spec.lua +++ b/tests/indent/cpp_spec.lua @@ -1,63 +1,42 @@ -local whole_file = require('tests.indent.common').indent_whole_file -local new_line = require('tests.indent.common').indent_new_line -local scan_dir = require('plenary.scandir').scan_dir -local Path = require('plenary.path') +local Runner = require('tests.indent.common').Runner -local opts = { +-- will use both c/ and cpp/ +local run = Runner:new(it, 'tests/indent', { tabstop = 4, shiftwidth = 4, softtabstop = 0, expandtab = true, filetype = 'cpp', -} - -local get_name = function(file) - return Path:new(file):make_relative('tests/indent') -end - -local run = function(file, spec, title) - title = title and title or tostring(spec.on_line) - it(string.format('%s[%s]', get_name(file), title), function() - new_line(file, spec, opts) - end) -end +}) describe('indent C++:', function() describe('whole file:', function() - local files = vim.tbl_flatten(vim.tbl_map(scan_dir, { - 'tests/indent/c', 'tests/indent/cpp', - })) - - for _, file in ipairs(files) do - it(get_name(file), function() - whole_file(file, opts) - end) - end + run:whole_file({'c/', 'cpp/'}) end) describe('new line:', function() - run('tests/indent/cpp/access.cpp', { on_line = 3, text = 'protected:', indent = 0 }) - run('tests/indent/cpp/class.cpp', { on_line = 2, text = 'using T = int;', indent = 4 }) - run('tests/indent/cpp/stream.cpp', { on_line = 5, text = '<< x + 3', indent = 8 }) + 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('tests/indent/c/array.c', { on_line = 2, text = '0,', indent = 4 }) - run('tests/indent/c/cond.c', { on_line = 3, text = 'x++;', indent = 8 }) - run('tests/indent/c/cond.c', { on_line = 8, text = 'x++;', indent = 8 }) - run('tests/indent/c/expr.c', { on_line = 10, text = '2 *', indent = 8 }) - run('tests/indent/c/func.c', { on_line = 17, text = 'int z,', indent = 4 }) - run('tests/indent/c/label.c', { on_line = 3, text = 'normal:', indent = 0 }) - run('tests/indent/c/loop.c', { on_line = 3, text = 'x++;', indent = 8 }) - run('tests/indent/c/preproc_cond.c', { on_line = 5, text = 'x++;', indent = 4 }) - run('tests/indent/c/preproc_func.c', { on_line = 3, text = 'x++; \\', indent = 8 }) - run('tests/indent/c/string.c', { on_line = 1, text = 'brave new \\', indent = 0 }) - run('tests/indent/c/string.c', { on_line = 4, text = '"brave new "', indent = 4 }) - run('tests/indent/c/struct.c', { on_line = 4, text = 'int y;', indent = 8 }) - run('tests/indent/c/switch.c', { on_line = 3, text = 'x++;', indent = 12 }) - run('tests/indent/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 = 8, text = 'x++;', indent = 8 }) + 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 }) + 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('tests/indent/c/no_braces.c', { on_line = 4, text = 'x++;', indent = 8 }) - run('tests/indent/c/no_braces.c', { on_line = 7, text = 'x++;', indent = 8 }) - run('tests/indent/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/lua_spec.lua b/tests/indent/lua_spec.lua index b1d3bfae2..bb975c595 100644 --- a/tests/indent/lua_spec.lua +++ b/tests/indent/lua_spec.lua @@ -1,48 +1,35 @@ -local whole_file = require('tests.indent.common').indent_whole_file -local new_line = require('tests.indent.common').indent_new_line -local scan_dir = require('plenary.scandir').scan_dir +local Runner = require('tests.indent.common').Runner -local opts = { +local run = Runner:new(it, 'tests/indent/lua', { tabstop = 2, shiftwidth = 2, softtabstop = 0, expandtab = true, -} +}) -local run = function(file, spec, title) - title = title and title or tostring(spec.on_line) - it(string.format('%s[%s]', file, title), function() - new_line('tests/indent/lua/' .. file, spec, opts) - end) -end describe('indent Lua:', function() describe('whole file:', function() - local files = scan_dir('tests/indent/lua'); - for _, file in ipairs(files) do - it(vim.fn.fnamemodify(file, ':t'), function() - whole_file(file, opts) - end) - end + run:whole_file('.') end) describe('new line:', function() - run('comment.lua', { on_line = 1, text = 'line', indent = '-- ' }) - run('comment.lua', { on_line = 5, text = 'multiline', indent = ' ' }) - run('func.lua', { on_line = 1, text = 'x = x + 1', indent = 2 }) - run('func.lua', { on_line = 2, text = 'y = y + 1', indent = 4 }) - run('func.lua', { on_line = 5, text = '3,', indent = 4 }) - run('string.lua', { on_line = 1, text = 'x', indent = 0 }) - run('string.lua', { on_line = 2, text = 'x', indent = 0 }) - run('string.lua', { on_line = 3, text = 'x', indent = 2 }) - run('string.lua', { on_line = 4, text = 'x', indent = 4 }) - run('table.lua', { on_line = 1, text = 'b = 0,', indent = 2 }) - run('table.lua', { on_line = 5, text = '4,', indent = 4 }) - run('table.lua', { on_line = 7, text = '4,', indent = 4 }) - run('loop.lua', { on_line = 4, text = 'x = x + 1', indent = 2 }) - run('cond.lua', { on_line = 5, text = 'x = x + 1', indent = 2 }) - run('cond.lua', { on_line = 7, text = 'x = x + 1', indent = 2 }) - run('cond.lua', { on_line = 8, text = 'x = x + 1', indent = 4 }) + 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 = 5, text = '3,', indent = 4 }) + 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('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 }) end) end) diff --git a/tests/indent/python_spec.lua b/tests/indent/python_spec.lua index 9bb80c2b2..6bff4d6d6 100644 --- a/tests/indent/python_spec.lua +++ b/tests/indent/python_spec.lua @@ -1,52 +1,38 @@ -local whole_file = require('tests.indent.common').indent_whole_file -local new_line = require('tests.indent.common').indent_new_line -local scan_dir = require('plenary.scandir').scan_dir +local Runner = require('tests.indent.common').Runner -local opts = { +local run = Runner:new(it, 'tests/indent/python', { tabstop = 4, shiftwidth = 4, softtabstop = 0, expandtab = true, -} - -local run = function(file, spec, title) - title = title and title or tostring(spec.on_line) - it(string.format('%s[%s]', file, title), function() - new_line('tests/indent/python/' .. file, spec, opts) - end) -end +}) describe('indent Python:', function() describe('whole file:', function() - local files = scan_dir('tests/indent/python'); - for _, file in ipairs(files) do - it(vim.fn.fnamemodify(file, ':t'), function() - whole_file(file, opts) - end) - end + run:whole_file('.') end) describe('new line:', function() - run('aligned_indent.py', { on_line = 1, text = 'arg3,', indent = 19 }) - run('basic_blocks.py', { on_line = 1, text = 'wait,', indent = 4 }) - run('basic_blocks.py', { on_line = 6, text = 'x += 1', indent = 4 }) - run('basic_blocks.py', { on_line = 10, text = 'x += 1', indent = 8 }) - run('basic_blocks.py', { on_line = 7, text = 'x += 1', indent = 4 }, '7, after last line of a block') - run('basic_blocks.py', { on_line = 11, text = 'x += 1', indent = 8 }, '11, after last line of a block') - run('basic_collections.py', { on_line = 3, text = '4,', indent = 4 }) - run('comprehensions.py', { on_line = 8, text = 'if x != 2', indent = 4 }) - run('control_flow.py', { on_line = 23, text = 'x = 4', indent = 4 }) - run('hanging_indent.py', { on_line = 1, text = 'arg0,', indent = 8 }) - run('hanging_indent.py', { on_line = 5, text = '0,', indent = 4 }) - run('join_lines.py', { on_line = 1, text = '+ 1 \\', indent = 4 }) - run('join_lines.py', { on_line = 4, text = '+ 1 \\', indent = 4 }) - run('join_lines.py', { on_line = 7, text = '+ 1 \\', indent = 4 }) - run('nested_collections.py', { on_line = 5, text = '0,', indent = 12 }) - run('nested_collections.py', { on_line = 6, text = ',0', indent = 12 }) - run('nested_collections.py', { on_line = 29, text = '[1, 2],', indent = 12 }) - run('nested_collections.py', { on_line = 39, text = '0,', indent = 5 }) - run('strings.py', { on_line = 14, text = 'x', indent = 4 }) - run('strings.py', { on_line = 15, text = 'x', indent = 0 }) - run('strings.py', { on_line = 16, text = 'x', indent = 8 }) + run:new_line('aligned_indent.py', { on_line = 1, text = 'arg3,', indent = 19 }) + 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 = 10, text = 'x += 1', indent = 8 }) + run:new_line('basic_blocks.py', { on_line = 7, text = 'x += 1', indent = 4 }, '7, after last line of a block') + run:new_line('basic_blocks.py', { on_line = 11, text = 'x += 1', indent = 8 }, '11, after last line of a block') + 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 = 23, text = 'x = 4', indent = 4 }) + run:new_line('hanging_indent.py', { on_line = 1, text = 'arg0,', indent = 8 }) + run:new_line('hanging_indent.py', { on_line = 5, text = '0,', indent = 4 }) + run:new_line('join_lines.py', { on_line = 1, text = '+ 1 \\', indent = 4 }) + run:new_line('join_lines.py', { on_line = 4, text = '+ 1 \\', indent = 4 }) + 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 }) end) end) diff --git a/tests/indent/rust_spec.lua b/tests/indent/rust_spec.lua index 468abe004..d9163dee3 100644 --- a/tests/indent/rust_spec.lua +++ b/tests/indent/rust_spec.lua @@ -1,67 +1,53 @@ -local whole_file = require('tests.indent.common').indent_whole_file -local new_line = require('tests.indent.common').indent_new_line -local scan_dir = require('plenary.scandir').scan_dir +local Runner = require('tests.indent.common').Runner -local opts = { +local run = Runner:new(it, 'tests/indent/rust', { tabstop = 4, shiftwidth = 4, softtabstop = 0, expandtab = true, -} - -local run = function(file, spec, title) - title = title and title or tostring(spec.on_line) - it(string.format('%s[%s]', file, title), function() - new_line('tests/indent/rust/' .. file, spec, opts) - end) -end +}) describe('indent Rust:', function() describe('whole file:', function() - local files = scan_dir('tests/indent/rust'); - for _, file in ipairs(files) do - it(vim.fn.fnamemodify(file, ':t'), function() - whole_file(file, opts) - end) - end + run:whole_file('.') end) describe('new line:', function() - run('array.rs', { on_line = 2, text = '0,', indent = 4 }) - run('array.rs', { on_line = 8, text = '0,', indent = 8 }) - run('comment.rs', { on_line = 3, text = 'a', indent = '/// ' }) - run('cond.rs', { on_line = 11, text = 'x += 1;', indent = 12 }) - run('cond.rs', { on_line = 2, text = 'x += 1;', indent = 8 }) - run('cond.rs', { on_line = 4, text = 'x += 1;', indent = 8 }) - run('cond.rs', { on_line = 6, text = 'x += 1;', indent = 8 }) - run('enum.rs', { on_line = 2, text = 'Q,', indent = 4 }) - run('enum.rs', { on_line = 4, text = 'i32,', indent = 8 }) - run('enum.rs', { on_line = 8, text = 'z: u32,', indent = 8 }) - run('func.rs', { on_line = 1, text = 'let _x = 1;', indent = 4 }) - run('func.rs', { on_line = 6, text = 'z: i32,', indent = 4 }) - run('impl.rs', { on_line = 3, text = 'const FOO: u32 = 1;', indent = 4 }) - run('impl.rs', { on_line = 4, text = 'let _x = 1;', indent = 8 }) - run('loop.rs', { on_line = 10, text = 'x += 1;', indent = 8 }) - run('loop.rs', { on_line = 2, text = 'x += 1;', indent = 8 }) - run('loop.rs', { on_line = 6, text = 'x += 1;', indent = 8 }) - run('macro.rs', { on_line = 1, text = '() => {},', indent = 4 }) - run('macro.rs', { on_line = 12, text = 'B C', indent = 4 }) - run('macro.rs', { on_line = 2, text = 'struct $c;', indent = 8 }) - run('match.rs', { on_line = 2, text = '-1 => -1,', indent = 8 }) - run('match.rs', { on_line = 7, text = 'let y = 1;', indent = 12 }) - run('mod.rs', { on_line = 1, text = 'const Z: i32 = 1;', indent = 4 }) - run('mod.rs', { on_line = 2, text = 'const Z: i32 = 1;', indent = 4 }) - run('mod.rs', { on_line = 6, text = 'const Z: i32 = 1;', indent = 8 }) - run('string.rs', { on_line = 2, text = 'brave new', indent = 0 }) - run('string.rs', { on_line = 5, text = 'brave new \\', indent = 8 }) - run('string.rs', { on_line = 9, text = 'brave new \\', indent = 8 }) - run('struct.rs', { on_line = 1, text = 'z: i32,', indent = 4 }) - run('struct.rs', { on_line = 2, text = 'z: i32,', indent = 4 }) - run('trait.rs', { on_line = 4, text = 'fn baz();', indent = 4 }) - run('trait.rs', { on_line = 7, text = 'fn baz();', indent = 4 }) - run('trait.rs', { on_line = 8, text = '()', indent = 8 }) - run('where.rs', { on_line = 17, text = 'T: Debug,', indent = 4 }) - run('where.rs', { on_line = 2, text = 'T: Debug,', indent = 4 }) - run('where.rs', { on_line = 9, text = 'T: Debug,', indent = 4 }) + 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('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('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('func.rs', { on_line = 1, text = 'let _x = 1;', indent = 4 }) + 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('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('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('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('trait.rs', { on_line = 4, text = 'fn baz();', indent = 4 }) + 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) |
