summaryrefslogtreecommitdiff
path: root/test/command_callback
diff options
context:
space:
mode:
Diffstat (limited to 'test/command_callback')
-rw-r--r--test/command_callback/test_brakeman_command_callback.vader7
-rw-r--r--test/command_callback/test_flake8_command_callback.vader10
-rw-r--r--test/command_callback/test_gometalinter_command_callback.vader8
-rw-r--r--test/command_callback/test_mypy_command_callback.vader10
-rw-r--r--test/command_callback/test_puglint_command_callback.vader7
-rw-r--r--test/command_callback/test_pylint_command_callback.vader11
-rw-r--r--test/command_callback/test_rubocop_command_callback.vader20
7 files changed, 30 insertions, 43 deletions
diff --git a/test/command_callback/test_brakeman_command_callback.vader b/test/command_callback/test_brakeman_command_callback.vader
index 607aec64..b97c5809 100644
--- a/test/command_callback/test_brakeman_command_callback.vader
+++ b/test/command_callback/test_brakeman_command_callback.vader
@@ -5,15 +5,12 @@ Before:
let g:ale_ruby_brakeman_options = ''
- silent! cd /testplugin/test/command_callback
- let g:dir = getcwd()
+ call ale#test#SetDirectory('/testplugin/test/command_callback')
After:
Restore
- silent execute 'cd ' . fnameescape(g:dir)
- unlet! g:dir
-
+ call ale#test#RestoreDirectory()
call ale#linter#Reset()
Execute(The brakeman command callback should detect absence of a valid Rails app):
diff --git a/test/command_callback/test_flake8_command_callback.vader b/test/command_callback/test_flake8_command_callback.vader
index 7c1f8c78..42afe65a 100644
--- a/test/command_callback/test_flake8_command_callback.vader
+++ b/test/command_callback/test_flake8_command_callback.vader
@@ -1,15 +1,9 @@
Before:
runtime ale_linters/python/flake8.vim
- silent! execute 'cd /testplugin/test/command_callback'
- let g:dir = getcwd()
+ call ale#test#SetDirectory('/testplugin/test/command_callback')
After:
- silent execute 'cd ' . fnameescape(g:dir)
- " Set the file to something else,
- " or we'll cause issues when running other tests
- silent file 'dummy.py'
- unlet! g:dir
-
+ call ale#test#RestoreDirectory()
call ale#linter#Reset()
let g:ale_python_flake8_executable = 'flake8'
let g:ale_python_flake8_options = ''
diff --git a/test/command_callback/test_gometalinter_command_callback.vader b/test/command_callback/test_gometalinter_command_callback.vader
index dcaf03b0..24c85aba 100644
--- a/test/command_callback/test_gometalinter_command_callback.vader
+++ b/test/command_callback/test_gometalinter_command_callback.vader
@@ -7,17 +7,13 @@ Before:
runtime ale_linters/go/gometalinter.vim
- silent! cd /testplugin/test/command_callback
- let g:dir = getcwd()
-
+ call ale#test#SetDirectory('/testplugin/test/command_callback')
call ale#test#SetFilename('test.go')
After:
Restore
- silent execute 'cd ' . fnameescape(g:dir)
- unlet! g:dir
-
+ call ale#test#RestoreDirectory()
call ale#linter#Reset()
Execute(The gometalinter callback should return the right defaults):
diff --git a/test/command_callback/test_mypy_command_callback.vader b/test/command_callback/test_mypy_command_callback.vader
index 19141805..8df7193d 100644
--- a/test/command_callback/test_mypy_command_callback.vader
+++ b/test/command_callback/test_mypy_command_callback.vader
@@ -1,15 +1,9 @@
Before:
runtime ale_linters/python/mypy.vim
- silent! execute 'cd /testplugin/test/command_callback'
- let g:dir = getcwd()
+ call ale#test#SetDirectory('/testplugin/test/command_callback')
After:
- silent execute 'cd ' . fnameescape(g:dir)
- " Set the file to something else,
- " or we'll cause issues when running other tests
- silent file 'dummy.py'
- unlet! g:dir
-
+ call ale#test#RestoreDirectory()
call ale#linter#Reset()
let g:ale_python_mypy_executable = 'mypy'
let g:ale_python_mypy_options = ''
diff --git a/test/command_callback/test_puglint_command_callback.vader b/test/command_callback/test_puglint_command_callback.vader
index 830d63b3..6d189899 100644
--- a/test/command_callback/test_puglint_command_callback.vader
+++ b/test/command_callback/test_puglint_command_callback.vader
@@ -7,17 +7,14 @@ Before:
let g:ale_pug_puglint_executable = 'pug-lint'
let g:ale_pug_puglint_use_global = 0
- silent! cd /testplugin/test/command_callback
- let g:dir = getcwd()
+ call ale#test#SetDirectory('/testplugin/test/command_callback')
runtime ale_linters/pug/puglint.vim
After:
Restore
- silent execute 'cd ' . fnameescape(g:dir)
- unlet! g:dir
-
+ call ale#test#RestoreDirectory()
call ale#linter#Reset()
Execute(puglint should detect local executables and package.json):
diff --git a/test/command_callback/test_pylint_command_callback.vader b/test/command_callback/test_pylint_command_callback.vader
index 040c9ef0..f8f44ab6 100644
--- a/test/command_callback/test_pylint_command_callback.vader
+++ b/test/command_callback/test_pylint_command_callback.vader
@@ -1,16 +1,11 @@
Before:
runtime ale_linters/python/pylint.vim
- silent! execute 'cd /testplugin/test/command_callback'
- let g:dir = getcwd()
+ call ale#test#SetDirectory('/testplugin/test/command_callback')
+
let b:command_tail = ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s'
After:
- silent execute 'cd ' . fnameescape(g:dir)
- " Set the file to something else,
- " or we'll cause issues when running other tests
- silent file 'dummy.py'
- unlet! g:dir
-
+ call ale#test#RestoreDirectory()
call ale#linter#Reset()
let g:ale_python_pylint_executable = 'pylint'
let g:ale_python_pylint_options = ''
diff --git a/test/command_callback/test_rubocop_command_callback.vader b/test/command_callback/test_rubocop_command_callback.vader
index db151800..a88d453c 100644
--- a/test/command_callback/test_rubocop_command_callback.vader
+++ b/test/command_callback/test_rubocop_command_callback.vader
@@ -1,19 +1,33 @@
Before:
+ Save g:ale_ruby_rubocop_executable
+
+ let g:ale_ruby_rubocop_executable = 'rubocop'
+
runtime ale_linters/ruby/rubocop.vim
+ call ale#test#SetDirectory('/testplugin/test/command_callback')
+ call ale#test#SetFilename('dummy.rb')
+
+After:
+ Restore
+
+ call ale#test#RestoreDirectory()
Execute(Executable should default to rubocop):
AssertEqual
- \ '''rubocop'' --format json --force-exclusion --stdin ''dummy.py''',
+ \ '''rubocop'' --format json --force-exclusion --stdin '
+ \ . ale#Escape(g:dir . '/dummy.rb'),
\ ale_linters#ruby#rubocop#GetCommand(bufnr(''))
Execute(Should be able to set a custom executable):
let g:ale_ruby_rubocop_executable = 'bin/rubocop'
AssertEqual
- \ '''bin/rubocop'' --format json --force-exclusion --stdin ''dummy.py''',
+ \ '''bin/rubocop'' --format json --force-exclusion --stdin '
+ \ . ale#Escape(g:dir . '/dummy.rb'),
\ ale_linters#ruby#rubocop#GetCommand(bufnr(''))
Execute(Setting bundle appends 'exec rubocop'):
let g:ale_ruby_rubocop_executable = 'path to/bundle'
AssertEqual
- \ '''path to/bundle'' exec rubocop --format json --force-exclusion --stdin ''dummy.py''',
+ \ '''path to/bundle'' exec rubocop --format json --force-exclusion --stdin '
+ \ . ale#Escape(g:dir . '/dummy.rb'),
\ ale_linters#ruby#rubocop#GetCommand(bufnr(''))