]> git.madduck.net Git - etc/vim.git/blobdiff - .vim/bundle/ale/test/linter/test_cspell.vader

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge commit '76265755a1add77121c8f9dabb3e9bb70fe9a972' as '.vim/bundle/ale'
[etc/vim.git] / .vim / bundle / ale / test / linter / test_cspell.vader
diff --git a/.vim/bundle/ale/test/linter/test_cspell.vader b/.vim/bundle/ale/test/linter/test_cspell.vader
new file mode 100644 (file)
index 0000000..2987aa7
--- /dev/null
@@ -0,0 +1,110 @@
+Before:
+  call ale#assert#SetUpLinterTest('tex', 'cspell')
+
+  " We have to manually do our own variable reset because SetUpLinterTest calls
+  "  ale#assert#ResetVariables, which specifically only resets variables that
+  "  begin with ale_<filetype>_, per https://github.com/dense-analysis/ale/blob/76c2293e68a6cad3b192062743d25b8daa082205/autoload/ale/assert.vim#L256
+  "
+  " Took a lot of debugging and reading both junegunn/vader.vim and most ALE
+  "  files to find this behavior
+
+  Save g:ale_cspell_executable
+  Save g:ale_cspell_use_global
+  Save g:ale_cspell_options
+
+  unlet! g:ale_cspell_executable
+  unlet! g:ale_cspell_use_global
+  unlet! g:ale_cspell_options
+
+  let g:ale_cspell_executable = 'cspell'
+  let g:ale_cspell_use_global = 0
+  let g:ale_cspell_options = ''
+
+  set filetype=tex
+
+After:
+  call ale#assert#TearDownLinterTest()
+
+Execute(The global executable should be used when the local one cannot be found):
+  AssertLinter
+  \  'cspell',
+  \  ale#Escape('cspell')
+  \  . ' lint --no-color --no-progress --no-summary --language-id="latex" -- stdin'
+
+Execute(Should use the node_modules/.bin executable if available):
+  call ale#test#SetFilename('../test-files/cspell/node-modules/test.tex')
+
+  AssertLinter
+  \  ale#path#Simplify(g:dir
+  \    . '/../test-files/cspell/node-modules/node_modules/.bin/cspell'),
+  \  ale#Escape(ale#path#Simplify(g:dir
+  \    . '/../test-files/cspell/node-modules/node_modules/.bin/cspell'))
+  \  . ' lint --no-color --no-progress --no-summary --language-id="latex" -- stdin'
+
+Execute(Should use the node_modules/cspell executable if available):
+  call ale#test#SetFilename('../test-files/cspell/node-modules-2/test.tex')
+
+  AssertLinter
+  \  ale#path#Simplify(g:dir
+  \    . '/../test-files/cspell/node-modules-2/node_modules/cspell/bin.js'),
+  \  (has('win32') ? 'node.exe ': '')
+  \  . ale#Escape(ale#path#Simplify(g:dir
+  \    . '/../test-files/cspell/node-modules-2/node_modules/cspell/bin.js'))
+  \  . ' lint --no-color --no-progress --no-summary --language-id="latex" -- stdin'
+
+Execute(Should let users configure a global executable and override local paths):
+  let g:ale_cspell_executable = '/path/to/custom/cspell'
+  let g:ale_cspell_use_global = 1
+
+  AssertLinter
+  \  '/path/to/custom/cspell',
+  \  ale#Escape('/path/to/custom/cspell')
+  \  . ' lint --no-color --no-progress --no-summary --language-id="latex" -- stdin'
+
+Execute(Additional cspell options should be configurable):
+  call ale#test#SetFilename('../test-files/dummy')
+
+  let g:ale_cspell_options = '--foobar'
+
+  AssertLinter
+  \  'cspell',
+  \  ale#Escape('cspell')
+  \  . ' lint --no-color --no-progress --no-summary --language-id="latex" --foobar -- stdin'
+
+Execute(The language id should be tex when filetype is plaintex):
+  set filetype=plaintex
+
+  AssertLinter
+  \  'cspell',
+  \  ale#Escape('cspell')
+  \  . ' lint --no-color --no-progress --no-summary --language-id="tex" -- stdin'
+
+Execute(The language id should be equal to filetype when not tex or plaintex):
+  set filetype=markdown
+
+  AssertLinter
+  \  'cspell',
+  \  ale#Escape('cspell')
+  \  . ' lint --no-color --no-progress --no-summary --language-id="markdown" -- stdin'
+
+  set filetype=asciidoc
+
+  AssertLinter
+  \  'cspell',
+  \  ale#Escape('cspell')
+  \  . ' lint --no-color --no-progress --no-summary --language-id="asciidoc" -- stdin'
+
+  set filetype=html
+
+  AssertLinter
+  \  'cspell',
+  \  ale#Escape('cspell')
+  \  . ' lint --no-color --no-progress --no-summary --language-id="html" -- stdin'
+
+Execute(The language id should not specified when filetype is empty):
+  set filetype=
+
+  AssertLinter
+  \  'cspell',
+  \  ale#Escape('cspell')
+  \  . ' lint --no-color --no-progress --no-summary -- stdin'