summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHoracio Sanson <horacio@allm.net>2018-11-07 17:33:14 +0900
committerHoracio Sanson <horacio@allm.net>2018-12-01 15:05:18 +0900
commit9e97a6914e1f7f5ab4ac80c33150c42f733d3a1b (patch)
treecaf7a8965dfcc5d6fd4483959e170d64863aaaab /test
parent1d4f98553852499e0f8ebd951db6ada2b1d973e3 (diff)
downloadale-9e97a6914e1f7f5ab4ac80c33150c42f733d3a1b.zip
Add bibclen fixer support
Closes #1910
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/bib_paths/dummy.bib0
-rw-r--r--test/command_callback/test_bib_bibclean_command_callback.vader24
-rw-r--r--test/fixers/test_bibclean_fixer_callback.vader30
-rw-r--r--test/fixers/test_rufo_fixer_callback.vader4
-rw-r--r--test/handler/test_bibclean_handler.vader35
-rwxr-xr-xtest/script/check-toc1
6 files changed, 91 insertions, 3 deletions
diff --git a/test/command_callback/bib_paths/dummy.bib b/test/command_callback/bib_paths/dummy.bib
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/bib_paths/dummy.bib
diff --git a/test/command_callback/test_bib_bibclean_command_callback.vader b/test/command_callback/test_bib_bibclean_command_callback.vader
new file mode 100644
index 00000000..fa6f7d33
--- /dev/null
+++ b/test/command_callback/test_bib_bibclean_command_callback.vader
@@ -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 '
diff --git a/test/fixers/test_bibclean_fixer_callback.vader b/test/fixers/test_bibclean_fixer_callback.vader
new file mode 100644
index 00000000..8d3081e3
--- /dev/null
+++ b/test/fixers/test_bibclean_fixer_callback.vader
@@ -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(''))
+
diff --git a/test/fixers/test_rufo_fixer_callback.vader b/test/fixers/test_rufo_fixer_callback.vader
index a0828406..98108efc 100644
--- a/test/fixers/test_rufo_fixer_callback.vader
+++ b/test/fixers/test_rufo_fixer_callback.vader
@@ -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:
diff --git a/test/handler/test_bibclean_handler.vader b/test/handler/test_bibclean_handler.vader
new file mode 100644
index 00000000..6179d7f5
--- /dev/null
+++ b/test/handler/test_bibclean_handler.vader
@@ -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"
+ \ ])
diff --git a/test/script/check-toc b/test/script/check-toc
index 8e411589..09d794ee 100755
--- a/test/script/check-toc
+++ b/test/script/check-toc
@@ -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:]' \