mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-08 20:43:31 +08:00
0
test/command_callback/bib_paths/dummy.bib
Normal file
0
test/command_callback/bib_paths/dummy.bib
Normal file
@@ -0,0 +1,24 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('bib', 'bibclean')
|
||||
|
||||
let g:ale_ruby_rubocop_executable = 'bibclean'
|
||||
let g:ale_ruby_rubocop_options = ''
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(Executable should default to bibclean):
|
||||
AssertLinter 'bibclean', ale#Escape('bibclean')
|
||||
\ . ' -file-position '
|
||||
|
||||
Execute(Should be able to set a custom executable):
|
||||
let g:ale_bib_bibclean_executable = 'bin/bibclean'
|
||||
|
||||
AssertLinter 'bin/bibclean' , ale#Escape('bin/bibclean')
|
||||
\ . ' -file-position '
|
||||
|
||||
Execute(Should not include custom options):
|
||||
let g:ale_bib_bibclean_options = '-no-prettryprint'
|
||||
|
||||
AssertLinter 'bibclean' , ale#Escape('bibclean')
|
||||
\ . ' -file-position '
|
||||
30
test/fixers/test_bibclean_fixer_callback.vader
Normal file
30
test/fixers/test_bibclean_fixer_callback.vader
Normal file
@@ -0,0 +1,30 @@
|
||||
Before:
|
||||
Save g:ale_bib_bibclean_executable
|
||||
Save g:ale_bib_bibclean_options
|
||||
|
||||
let g:ale_bib_bibclean_executable = 'xxxinvalid'
|
||||
let g:ale_bib_bibclean_options = '-align-equals'
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test/fixers')
|
||||
|
||||
After:
|
||||
Restore
|
||||
call ale#test#RestoreDirectory()
|
||||
|
||||
Execute(The bibclean callback should return the correct default values):
|
||||
call ale#test#SetFilename('../command_callback/bib_paths/dummy.bib')
|
||||
|
||||
AssertEqual
|
||||
\ {'command': ale#Escape(g:ale_bib_bibclean_executable) . ' -align-equals'},
|
||||
\ ale#fixers#bibclean#Fix(bufnr(''))
|
||||
|
||||
Execute(The bibclean callback should include custom bibclean options):
|
||||
let g:ale_bib_bibclean_options = '-author -check-values'
|
||||
call ale#test#SetFilename('../command_callback/bib_paths/dummy.bib')
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape(g:ale_bib_bibclean_executable) . ' -author -check-values'
|
||||
\ },
|
||||
\ ale#fixers#bibclean#Fix(bufnr(''))
|
||||
|
||||
@@ -4,9 +4,7 @@ Before:
|
||||
" Use an invalid global executable, so we don't match it.
|
||||
let g:ale_ruby_rufo_executable = 'xxxinvalid'
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test/fixers')
|
||||
silent cd ..
|
||||
silent cd command_callback
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
let g:dir = getcwd()
|
||||
|
||||
After:
|
||||
|
||||
35
test/handler/test_bibclean_handler.vader
Normal file
35
test/handler/test_bibclean_handler.vader
Normal file
@@ -0,0 +1,35 @@
|
||||
Before:
|
||||
runtime ale_linters/bib/bibclean.vim
|
||||
|
||||
After:
|
||||
call ale#linter#Reset()
|
||||
|
||||
Execute(The bibclean handler should parse lines correctly):
|
||||
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'lnum': '60',
|
||||
\ 'type': 'W',
|
||||
\ 'text': 'Unexpected value in ``month = "09"''''.',
|
||||
\ 'col': '17'
|
||||
\ },
|
||||
\ {
|
||||
\ 'lnum': '63',
|
||||
\ 'type': 'E',
|
||||
\ 'text': 'Expected comma after last field ``keywords''''.',
|
||||
\ 'col': ' 1'
|
||||
\ }
|
||||
\ ],
|
||||
\ ale_linters#bib#bibclean#Handle(255, [
|
||||
\ "%% \"stdin\", line 60: Unexpected value in ``month = \"09\"''.",
|
||||
\ "%% File positions: input [main.bib] output [stdout]",
|
||||
\ "%% Entry input byte=1681 line=50 column= 1 output byte=1680 line=50 column= 0",
|
||||
\ "%% Value input byte=2137 line=60 column=17 output byte=2137 line=60 column=17",
|
||||
\ "%% Current input byte=2139 line=60 column=19 output byte=2137 line=60 column=17",
|
||||
\ "?? \"stdin\", line 71: Expected comma after last field ``keywords''.",
|
||||
\ "?? File positions: input [main.bib] output [stdout]",
|
||||
\ "?? Entry input byte=2145 line=63 column= 1 output byte=2146 line=63 column= 0",
|
||||
\ "?? Value input byte=2528 line=71 column= 2 output byte=2527 line=70 column=49",
|
||||
\ "?? Current input byte=2529 line=71 column= 3 output byte=2528 line=70 column=50"
|
||||
\ ])
|
||||
@@ -36,6 +36,7 @@ doc_files="$(/bin/ls -1v doc | grep ^ale- | sed 's/^/doc\//' | paste -sd ' ' -)"
|
||||
grep -h '\*ale-.*-options\|^[a-z].*\*ale-.*\*$' $doc_files \
|
||||
| sed 's/^/ /' \
|
||||
| sed 's/ALE Shell Integration/ALE sh Integration/' \
|
||||
| sed 's/ALE BibTeX Integration/ALE bib Integration/' \
|
||||
| sed 's/ ALE \(.*\) Integration/\1/' \
|
||||
| sed 's/ *\*\(..*\)\*$/, \1/' \
|
||||
| tr '[:upper:]' '[:lower:]' \
|
||||
|
||||
Reference in New Issue
Block a user