summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-07-07 10:47:09 +0100
committerw0rp <devw0rp@gmail.com>2017-07-07 10:47:09 +0100
commit7ce960ae519e97e26e3c99c4faebe9d5290b487f (patch)
treedf02d56cb66d3b2d4b82d0692a13d666f64ac332 /test
parent130928590b3b0afac75a15393ff4d30278e3df15 (diff)
downloadale-7ce960ae519e97e26e3c99c4faebe9d5290b487f.zip
Fix #735 - Support old versions of Flow by only adding --respect-pragma for supported versions
Diffstat (limited to 'test')
-rw-r--r--test/test_flow_command.vader15
-rw-r--r--test/test_linter_retrieval.vader8
2 files changed, 17 insertions, 6 deletions
diff --git a/test/test_flow_command.vader b/test/test_flow_command.vader
index f7754f66..f45c93c2 100644
--- a/test/test_flow_command.vader
+++ b/test/test_flow_command.vader
@@ -8,10 +8,21 @@ Execute(flow should return a command to run if a .flowconfig file exists):
silent! cd /testplugin/test
:e! flow/a/sub/dummy
- AssertEqual '''flow'' check-contents --respect-pragma --json --from ale %s', ale_linters#javascript#flow#GetCommand(bufnr('%'))
+ AssertEqual '''flow'' check-contents --respect-pragma --json --from ale %s', ale_linters#javascript#flow#GetCommand(bufnr('%'), [])
+
+Execute(flow should should not use --respect-pragma for old versions):
+ silent! cd /testplugin/test
+ :e! flow/a/sub/dummy
+
+ AssertEqual
+ \ '''flow'' check-contents --json --from ale %s',
+ \ ale_linters#javascript#flow#GetCommand(bufnr('%'), [
+ \ 'Warning: `flow --version` is deprecated in favor of `flow version`',
+ \ 'Flow, a static type checker for JavaScript, version 0.27.0',
+ \ ])
Execute(flow should not return a command to run if no .flowconfig file exists):
silent! cd /testplugin/test
:e! flow/b/sub/dummy
- AssertEqual '', ale_linters#javascript#flow#GetCommand(bufnr('%'))
+ AssertEqual '', ale_linters#javascript#flow#GetCommand(bufnr('%'), [])
diff --git a/test/test_linter_retrieval.vader b/test/test_linter_retrieval.vader
index d7012340..afb540d6 100644
--- a/test/test_linter_retrieval.vader
+++ b/test/test_linter_retrieval.vader
@@ -1,8 +1,8 @@
Before:
Save g:ale_linters, g:ale_linter_aliases
- let g:testlinter1 = {'name': 'testlinter1', 'executable': 'testlinter1', 'command': 'testlinter1', 'callback': 'testCB1', 'output_stream': 'stdout', 'read_buffer': 1, 'lint_file': 0, 'aliases': [], 'lsp': ''}
- let g:testlinter2 = {'name': 'testlinter2', 'executable': 'testlinter2', 'command': 'testlinter2', 'callback': 'testCB2', 'output_stream': 'stdout', 'read_buffer': 0, 'lint_file': 1, 'aliases': [], 'lsp': ''}
+ let g:testlinter1 = {'name': 'testlinter1', 'executable': 'testlinter1', 'command': 'testlinter1', 'callback': 'testCB1', 'output_stream': 'stdout', 'read_buffer': 1, 'lint_file': 0, 'aliases': [], 'lsp': '', 'add_newline': 0}
+ let g:testlinter2 = {'name': 'testlinter2', 'executable': 'testlinter2', 'command': 'testlinter2', 'callback': 'testCB2', 'output_stream': 'stdout', 'read_buffer': 0, 'lint_file': 1, 'aliases': [], 'lsp': '', 'add_newline': 0}
call ale#linter#Reset()
After:
@@ -105,7 +105,7 @@ Execute (The local alias option shouldn't completely replace the global one):
AssertEqual [g:testlinter1, g:testlinter2], ale#linter#Get('testft1')
Execute (Linters should be loaded from disk appropriately):
- AssertEqual [{'name': 'testlinter', 'output_stream': 'stdout', 'executable': 'testlinter', 'command': 'testlinter', 'callback': 'testCB', 'read_buffer': 1, 'lint_file': 0, 'aliases': [], 'lsp': ''}], ale#linter#Get('testft')
+ AssertEqual [{'name': 'testlinter', 'output_stream': 'stdout', 'executable': 'testlinter', 'command': 'testlinter', 'callback': 'testCB', 'read_buffer': 1, 'lint_file': 0, 'aliases': [], 'lsp': '', 'add_newline': 0}], ale#linter#Get('testft')
Execute (Linters for later filetypes should replace the former ones):
@@ -123,5 +123,5 @@ Execute (Linters for later filetypes should replace the former ones):
\})
AssertEqual [
- \ {'output_stream': 'stdout', 'lint_file': 0, 'read_buffer': 1, 'name': 'eslint', 'executable': 'x', 'lsp': '', 'aliases': [], 'command': 'x', 'callback': 'x'}
+ \ {'output_stream': 'stdout', 'lint_file': 0, 'read_buffer': 1, 'name': 'eslint', 'executable': 'x', 'lsp': '', 'aliases': [], 'command': 'x', 'callback': 'x', 'add_newline': 0}
\], ale#linter#Get('javascript.typescript')