diff options
author | Martino Pilia <martino.pilia@gmail.com> | 2019-02-02 15:45:32 +0100 |
---|---|---|
committer | Martino Pilia <martino.pilia@gmail.com> | 2019-02-02 16:20:14 +0100 |
commit | 771581a945c677a96ccb33f17c8892de42a5e939 (patch) | |
tree | 5c81fd8e21eb45e1089c73696e1489d4bd5dba39 /test/command_callback | |
parent | 4d426bf2873c6e1cd2c71e478c756903307628d3 (diff) | |
download | ale-771581a945c677a96ccb33f17c8892de42a5e939.zip |
Add settings for the Alex linter
The executable for the Alex linter is currently hard-coded as 'alex',
which is an issue given the fact that it conflicts with the Haskell
lexer generator, whose executable is also called 'alex', has been around
a dozen years before the linter, and is packaged in the official
repositories of the major Linux distributions.
This commit adds options to use a local executable for the alex linter
(which is a node package), and an option to set a custom executable.
As side changes:
* The pattern in the alex handler is made more readable by turnig it
into a very-magic regex.
* Alex handles plain text, markdown, and HTML. Specific flags for HTML
and markdown are provided when instantiating the linters for the
respective filetypes, while before those formats were treated as plain
text.
Diffstat (limited to 'test/command_callback')
3 files changed, 34 insertions, 0 deletions
diff --git a/test/command_callback/alex-node-modules-2/node_modules/alex/cli.js b/test/command_callback/alex-node-modules-2/node_modules/alex/cli.js new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/command_callback/alex-node-modules-2/node_modules/alex/cli.js diff --git a/test/command_callback/alex-node-modules/node_modules/.bin/alex b/test/command_callback/alex-node-modules/node_modules/.bin/alex new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/command_callback/alex-node-modules/node_modules/.bin/alex diff --git a/test/command_callback/test_alex_command_callback.vader b/test/command_callback/test_alex_command_callback.vader new file mode 100644 index 00000000..98769e0b --- /dev/null +++ b/test/command_callback/test_alex_command_callback.vader @@ -0,0 +1,34 @@ +Before: + call ale#assert#SetUpLinterTest('tex', 'alex') + call ale#test#SetFilename('test_file.tex') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The global executable should be used when the local one cannot be found): + AssertLinter 'alex', + \ ale#Escape('alex') . ' %s --text', + +Execute(Should use the node_modules/.bin executable, if available): + call ale#test#SetFilename('alex-node-modules/test_file.tex') + + AssertLinter ale#path#Simplify(g:dir . '/alex-node-modules/node_modules/.bin/alex'), + \ ale#Escape(ale#path#Simplify(g:dir . '/alex-node-modules/node_modules/.bin/alex')) + \ . ' %s --text', + +Execute(Should use the node_modules/alex executable, if available): + call ale#test#SetFilename('alex-node-modules-2/test_file.tex') + + AssertLinter ale#path#Simplify(g:dir . '/alex-node-modules-2/node_modules/alex/cli.js'), + \ (has('win32') ? 'node.exe ' : '') + \ . ale#Escape(ale#path#Simplify(g:dir . '/alex-node-modules-2/node_modules/alex/cli.js')) + \ . ' %s --text', + +Execute(Should let users configure a global executable and override local paths): + call ale#test#SetFilename('write-good-node-modules-2/test_file.tex') + + let g:ale_alex_executable = '/path/to/custom/alex' + let g:ale_alex_use_global = 1 + + AssertLinter '/path/to/custom/alex', + \ ale#Escape('/path/to/custom/alex') . ' %s --text' |