mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 12:44:23 +08:00
tombi: support its LSP (#5022)
* tombi: support its LSP * tombi: support linting and formatting
This commit is contained in:
33
test/fixers/test_tombi_format_fixer_callback.vader
Normal file
33
test/fixers/test_tombi_format_fixer_callback.vader
Normal file
@@ -0,0 +1,33 @@
|
||||
Before:
|
||||
Save g:ale_toml_tombi_executable
|
||||
Save g:ale_toml_tombi_format_options
|
||||
|
||||
" Use an invalid global executable, so we don't match it.
|
||||
let g:ale_toml_tombi_executable = 'xxxinvalid'
|
||||
let g:ale_toml_tombi_format_options = ''
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test/fixers')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
|
||||
Execute(The tombi format callback should return the correct default values):
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape('xxxinvalid') . ' format',
|
||||
\ },
|
||||
\ ale#fixers#tombi_format#Fix(bufnr(''))
|
||||
|
||||
Execute(The tombi format callback should include custom options):
|
||||
let g:ale_toml_tombi_format_options = "--offline"
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape('xxxinvalid')
|
||||
\ . ' format'
|
||||
\ . ' ' . g:ale_toml_tombi_format_options
|
||||
\ },
|
||||
\ ale#fixers#tombi_format#Fix(bufnr(''))
|
||||
33
test/fixers/test_tombi_lint_fixer_callback.vader
Normal file
33
test/fixers/test_tombi_lint_fixer_callback.vader
Normal file
@@ -0,0 +1,33 @@
|
||||
Before:
|
||||
Save g:ale_toml_tombi_executable
|
||||
Save g:ale_toml_tombi_lint_options
|
||||
|
||||
" Use an invalid global executable, so we don't match it.
|
||||
let g:ale_toml_tombi_executable = 'xxxinvalid'
|
||||
let g:ale_toml_tombi_lint_options = ''
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test/fixers')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
|
||||
Execute(The tombi lint callback should return the correct default values):
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape('xxxinvalid') . ' lint',
|
||||
\ },
|
||||
\ ale#fixers#tombi_lint#Fix(bufnr(''))
|
||||
|
||||
Execute(The tombi lint callback should include custom options):
|
||||
let g:ale_toml_tombi_lint_options = "--offline"
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape('xxxinvalid')
|
||||
\ . ' lint'
|
||||
\ . ' ' . g:ale_toml_tombi_lint_options
|
||||
\ },
|
||||
\ ale#fixers#tombi_lint#Fix(bufnr(''))
|
||||
23
test/linter/test_toml_tombi.vader
Normal file
23
test/linter/test_toml_tombi.vader
Normal file
@@ -0,0 +1,23 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('toml', 'tombi')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default executable path should be correct):
|
||||
AssertLinter 'tombi', ale#Escape('tombi') . ' lsp'
|
||||
|
||||
Execute(The project root should be detected correctly with a configuration file):
|
||||
call ale#test#SetFilename('../test-files/toml/tombi/tombitoml/subdir/file.ext')
|
||||
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/toml/tombi/tombitoml')
|
||||
|
||||
Execute(The project root should be detected correctly in Python projects):
|
||||
call ale#test#SetFilename('../test-files/toml/tombi/pyprojecttoml/subdir/file.ext')
|
||||
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/toml/tombi/pyprojecttoml')
|
||||
|
||||
Execute(The project root should be empty when no project files can be detected):
|
||||
call ale#test#SetFilename('../test-files/dummy')
|
||||
|
||||
AssertLSPProject ''
|
||||
0
test/test-files/toml/tombi/tombitoml/tombi.toml
Normal file
0
test/test-files/toml/tombi/tombitoml/tombi.toml
Normal file
Reference in New Issue
Block a user