]> git.madduck.net Git - etc/vim.git/blob - 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:

Squashed '.vim/bundle/ale/' content from commit 22185c4c
[etc/vim.git] / test / linter / test_cspell.vader
1 Before:
2   call ale#assert#SetUpLinterTest('tex', 'cspell')
3
4   " We have to manually do our own variable reset because SetUpLinterTest calls
5   "  ale#assert#ResetVariables, which specifically only resets variables that
6   "  begin with ale_<filetype>_, per https://github.com/dense-analysis/ale/blob/76c2293e68a6cad3b192062743d25b8daa082205/autoload/ale/assert.vim#L256
7   "
8   " Took a lot of debugging and reading both junegunn/vader.vim and most ALE
9   "  files to find this behavior
10
11   Save g:ale_cspell_executable
12   Save g:ale_cspell_use_global
13   Save g:ale_cspell_options
14
15   unlet! g:ale_cspell_executable
16   unlet! g:ale_cspell_use_global
17   unlet! g:ale_cspell_options
18
19   let g:ale_cspell_executable = 'cspell'
20   let g:ale_cspell_use_global = 0
21   let g:ale_cspell_options = ''
22
23   set filetype=tex
24
25 After:
26   call ale#assert#TearDownLinterTest()
27
28 Execute(The global executable should be used when the local one cannot be found):
29   AssertLinter
30   \  'cspell',
31   \  ale#Escape('cspell')
32   \  . ' lint --no-color --no-progress --no-summary --language-id="latex" -- stdin'
33
34 Execute(Should use the node_modules/.bin executable if available):
35   call ale#test#SetFilename('../test-files/cspell/node-modules/test.tex')
36
37   AssertLinter
38   \  ale#path#Simplify(g:dir
39   \    . '/../test-files/cspell/node-modules/node_modules/.bin/cspell'),
40   \  ale#Escape(ale#path#Simplify(g:dir
41   \    . '/../test-files/cspell/node-modules/node_modules/.bin/cspell'))
42   \  . ' lint --no-color --no-progress --no-summary --language-id="latex" -- stdin'
43
44 Execute(Should use the node_modules/cspell executable if available):
45   call ale#test#SetFilename('../test-files/cspell/node-modules-2/test.tex')
46
47   AssertLinter
48   \  ale#path#Simplify(g:dir
49   \    . '/../test-files/cspell/node-modules-2/node_modules/cspell/bin.js'),
50   \  (has('win32') ? 'node.exe ': '')
51   \  . ale#Escape(ale#path#Simplify(g:dir
52   \    . '/../test-files/cspell/node-modules-2/node_modules/cspell/bin.js'))
53   \  . ' lint --no-color --no-progress --no-summary --language-id="latex" -- stdin'
54
55 Execute(Should let users configure a global executable and override local paths):
56   let g:ale_cspell_executable = '/path/to/custom/cspell'
57   let g:ale_cspell_use_global = 1
58
59   AssertLinter
60   \  '/path/to/custom/cspell',
61   \  ale#Escape('/path/to/custom/cspell')
62   \  . ' lint --no-color --no-progress --no-summary --language-id="latex" -- stdin'
63
64 Execute(Additional cspell options should be configurable):
65   call ale#test#SetFilename('../test-files/dummy')
66
67   let g:ale_cspell_options = '--foobar'
68
69   AssertLinter
70   \  'cspell',
71   \  ale#Escape('cspell')
72   \  . ' lint --no-color --no-progress --no-summary --language-id="latex" --foobar -- stdin'
73
74 Execute(The language id should be tex when filetype is plaintex):
75   set filetype=plaintex
76
77   AssertLinter
78   \  'cspell',
79   \  ale#Escape('cspell')
80   \  . ' lint --no-color --no-progress --no-summary --language-id="tex" -- stdin'
81
82 Execute(The language id should be equal to filetype when not tex or plaintex):
83   set filetype=markdown
84
85   AssertLinter
86   \  'cspell',
87   \  ale#Escape('cspell')
88   \  . ' lint --no-color --no-progress --no-summary --language-id="markdown" -- stdin'
89
90   set filetype=asciidoc
91
92   AssertLinter
93   \  'cspell',
94   \  ale#Escape('cspell')
95   \  . ' lint --no-color --no-progress --no-summary --language-id="asciidoc" -- stdin'
96
97   set filetype=html
98
99   AssertLinter
100   \  'cspell',
101   \  ale#Escape('cspell')
102   \  . ' lint --no-color --no-progress --no-summary --language-id="html" -- stdin'
103
104 Execute(The language id should not specified when filetype is empty):
105   set filetype=
106
107   AssertLinter
108   \  'cspell',
109   \  ale#Escape('cspell')
110   \  . ' lint --no-color --no-progress --no-summary -- stdin'