refactor: apply stylua formatting to new preset code
This commit is contained in:
parent
4665deee6c
commit
f408136d5a
2 changed files with 4 additions and 12 deletions
|
|
@ -98,8 +98,7 @@ end
|
||||||
local function parse_asciidoctor(output)
|
local function parse_asciidoctor(output)
|
||||||
local diagnostics = {}
|
local diagnostics = {}
|
||||||
for line in output:gmatch('[^\r\n]+') do
|
for line in output:gmatch('[^\r\n]+') do
|
||||||
local severity, _, lnum, msg =
|
local severity, _, lnum, msg = line:match('^asciidoctor: (%u+): (.+): line (%d+): (.+)$')
|
||||||
line:match('^asciidoctor: (%u+): (.+): line (%d+): (.+)$')
|
|
||||||
if lnum then
|
if lnum then
|
||||||
local sev = vim.diagnostic.severity.ERROR
|
local sev = vim.diagnostic.severity.ERROR
|
||||||
if severity == 'WARNING' then
|
if severity == 'WARNING' then
|
||||||
|
|
|
||||||
|
|
@ -477,10 +477,7 @@ describe('presets', function()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('returns clean command', function()
|
it('returns clean command', function()
|
||||||
assert.are.same(
|
assert.are.same({ 'rm', '-f', '/tmp/document.html' }, presets.asciidoctor.clean(adoc_ctx))
|
||||||
{ 'rm', '-f', '/tmp/document.html' },
|
|
||||||
presets.asciidoctor.clean(adoc_ctx)
|
|
||||||
)
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('has open enabled', function()
|
it('has open enabled', function()
|
||||||
|
|
@ -498,16 +495,12 @@ describe('presets', function()
|
||||||
assert.are.equal(1, #diagnostics)
|
assert.are.equal(1, #diagnostics)
|
||||||
assert.are.equal(7, diagnostics[1].lnum)
|
assert.are.equal(7, diagnostics[1].lnum)
|
||||||
assert.are.equal(0, diagnostics[1].col)
|
assert.are.equal(0, diagnostics[1].col)
|
||||||
assert.are.equal(
|
assert.are.equal('invalid part, must have at least one section', diagnostics[1].message)
|
||||||
'invalid part, must have at least one section',
|
|
||||||
diagnostics[1].message
|
|
||||||
)
|
|
||||||
assert.are.equal(vim.diagnostic.severity.ERROR, diagnostics[1].severity)
|
assert.are.equal(vim.diagnostic.severity.ERROR, diagnostics[1].severity)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('parses warning messages', function()
|
it('parses warning messages', function()
|
||||||
local output =
|
local output = 'asciidoctor: WARNING: document.adoc: line 52: section title out of sequence'
|
||||||
'asciidoctor: WARNING: document.adoc: line 52: section title out of sequence'
|
|
||||||
local diagnostics = presets.asciidoctor.error_parser(output, adoc_ctx)
|
local diagnostics = presets.asciidoctor.error_parser(output, adoc_ctx)
|
||||||
assert.are.equal(1, #diagnostics)
|
assert.are.equal(1, #diagnostics)
|
||||||
assert.are.equal(51, diagnostics[1].lnum)
|
assert.are.equal(51, diagnostics[1].lnum)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue