mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-03 01:53:30 +08:00
Add support for llvm-mc as an assembly linter (#4446)
This commit is contained in:
28
test/handler/test_llvm_mc_handler.vader
Normal file
28
test/handler/test_llvm_mc_handler.vader
Normal file
@@ -0,0 +1,28 @@
|
||||
Before:
|
||||
runtime ale_linters/asm/llvm_mc.vim
|
||||
|
||||
After:
|
||||
call ale#linter#Reset()
|
||||
|
||||
Execute(The asm llvm-mc handler should parse lines correctly):
|
||||
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'lnum': 10,
|
||||
\ 'col' : 15,
|
||||
\ 'text': "invalid operand for instruction",
|
||||
\ 'type': 'E',
|
||||
\ },
|
||||
\ {
|
||||
\ 'lnum': 11,
|
||||
\ 'col' : 2,
|
||||
\ 'text': "invalid instruction mnemonic 'lpaq'",
|
||||
\ 'type': 'E',
|
||||
\ },
|
||||
\ ],
|
||||
\ ale_linters#asm#llvm_mc#Handle(357, [
|
||||
\ "xorq %rbp, %rbp",
|
||||
\ "{standard_input}:10:15: error: invalid operand for instruction",
|
||||
\ "{standard input}:11:2: error: invalid instruction mnemonic 'lpaq'",
|
||||
\ ])
|
||||
19
test/linter/test_llvm_mc.vader
Normal file
19
test/linter/test_llvm_mc.vader
Normal file
@@ -0,0 +1,19 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('asm', 'llvm_mc')
|
||||
call ale#test#SetFilename('test.cpp')
|
||||
let b:command_tail = ' --assemble'
|
||||
\ . ' --filetype=asm'
|
||||
\ . ' -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||
\ . ' '
|
||||
|
||||
After:
|
||||
unlet! b:command_tail
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
AssertLinter 'llvm-mc', ale#Escape('llvm-mc') . b:command_tail
|
||||
|
||||
let b:ale_asm_llvm_mc_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . b:command_tail
|
||||
Reference in New Issue
Block a user