diff options
author | w0rp <devw0rp@gmail.com> | 2017-11-14 19:55:28 +0000 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-11-14 19:55:46 +0000 |
commit | 6b2c61a5cc59d61270266dbe399d5dc55cfad5b4 (patch) | |
tree | 1eca19b412753868059467df9043d737b155d680 /test | |
parent | 2e9cd978a23c60d061b4b4dd7fb46d2d2949e08e (diff) | |
download | ale-6b2c61a5cc59d61270266dbe399d5dc55cfad5b4.zip |
Fix #1128 - Add g:ale_linters_explicit for only enabling linters explicitly
Diffstat (limited to 'test')
-rw-r--r-- | test/test_filetype_linter_defaults.vader | 68 | ||||
-rw-r--r-- | test/test_linter_retrieval.vader | 3 |
2 files changed, 70 insertions, 1 deletions
diff --git a/test/test_filetype_linter_defaults.vader b/test/test_filetype_linter_defaults.vader new file mode 100644 index 00000000..ea4a05fb --- /dev/null +++ b/test/test_filetype_linter_defaults.vader @@ -0,0 +1,68 @@ +Before: + Save g:ale_linters + Save g:ale_linters_explicit + + let g:ale_linters_explicit = 0 + let g:ale_linters = {} + + function! GetLinterNames(filetype) abort + return map(ale#linter#Get(a:filetype), 'v:val.name') + endfunction + +After: + Restore + + call ale#linter#Reset() + +Execute(The defaults for the csh filetype should be correct): + AssertEqual ['shell'], GetLinterNames('csh') + + let g:ale_linters_explicit = 1 + + AssertEqual [], GetLinterNames('csh') + +Execute(The defaults for the go filetype should be correct): + AssertEqual ['gofmt', 'golint', 'go vet'], GetLinterNames('go') + + let g:ale_linters_explicit = 1 + + AssertEqual [], GetLinterNames('go') + +Execute(The defaults for the help filetype should be correct): + AssertEqual [], GetLinterNames('help') + +Execute(The defaults for the python filetype should be correct): + AssertEqual ['flake8', 'mypy', 'pylint'], GetLinterNames('python') + + let g:ale_linters_explicit = 1 + + AssertEqual [], GetLinterNames('python') + +Execute(The defaults for the rust filetype should be correct): + AssertEqual ['cargo'], GetLinterNames('rust') + + let g:ale_linters_explicit = 1 + + AssertEqual [], GetLinterNames('rust') + +Execute(The defaults for the spec filetype should be correct): + AssertEqual [], GetLinterNames('spec') + +Execute(The defaults for the text filetype should be correct): + AssertEqual [], GetLinterNames('text') + +Execute(The defaults for the zsh filetype should be correct): + AssertEqual ['shell'], GetLinterNames('zsh') + + let g:ale_linters_explicit = 1 + + AssertEqual [], GetLinterNames('zsh') + +Execute(The defaults for the verilog filetype should be correct): + " This filetype isn't configured with default, so we can test loading all + " available linters with this. + AssertEqual ['iverilog', 'verilator'], GetLinterNames('verilog') + + let g:ale_linters_explicit = 1 + + AssertEqual [], GetLinterNames('verilog') diff --git a/test/test_linter_retrieval.vader b/test/test_linter_retrieval.vader index 5d5b582d..5d1ee451 100644 --- a/test/test_linter_retrieval.vader +++ b/test/test_linter_retrieval.vader @@ -1,5 +1,6 @@ Before: - Save g:ale_linters, g:ale_linter_aliases + Save g:ale_linters + Save 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': '', '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} |