summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/python_paths/with_virtualenv/env/Scripts/activate0
-rwxr-xr-xtest/command_callback/python_paths/with_virtualenv/env/Scripts/autopep80
-rwxr-xr-xtest/command_callback/python_paths/with_virtualenv/env/Scripts/flake80
-rwxr-xr-xtest/command_callback/python_paths/with_virtualenv/env/Scripts/isort0
-rwxr-xr-xtest/command_callback/python_paths/with_virtualenv/env/Scripts/mypy0
-rwxr-xr-xtest/command_callback/python_paths/with_virtualenv/env/Scripts/pylint0
-rwxr-xr-xtest/command_callback/python_paths/with_virtualenv/env/Scripts/yapf0
-rw-r--r--test/command_callback/test_erlang_syntaxerl_command_callback.vader24
-rw-r--r--test/command_callback/test_flake8_command_callback.vader56
-rw-r--r--test/command_callback/test_fusionlint_command_callback.vader20
-rw-r--r--test/command_callback/test_javac_command_callback.vader170
-rw-r--r--test/command_callback/test_jscs_command_callback.vader16
-rw-r--r--test/command_callback/test_llc_command_callback.vader39
-rw-r--r--test/command_callback/test_luacheck_command_callback.vader6
-rw-r--r--test/command_callback/test_mypy_command_callback.vader46
-rw-r--r--test/command_callback/test_php_langserver_callbacks.vader6
-rw-r--r--test/command_callback/test_phpstan_command_callbacks.vader9
-rw-r--r--test/command_callback/test_puglint_command_callback.vader22
-rw-r--r--test/command_callback/test_pycodestyle_command_callback.vader8
-rw-r--r--test/command_callback/test_pylint_command_callback.vader37
-rw-r--r--test/command_callback/test_rails_best_practices_command_callback.vader31
-rw-r--r--test/command_callback/test_rubocop_command_callback.vader18
-rw-r--r--test/command_callback/test_rust_rls_callbacks.vader2
-rw-r--r--test/command_callback/test_scalastyle_command_callback.vader19
-rw-r--r--test/command_callback/test_slimlint_command_callback.vader32
-rw-r--r--test/command_callback/test_standard_command_callback.vader37
-rw-r--r--test/command_callback/test_swaglint_command_callback.vader9
-rw-r--r--test/command_callback/test_thrift_command_callback.vader51
-rw-r--r--test/command_callback/test_tslint_command_callback.vader5
-rw-r--r--test/command_callback/test_xmllint_command_callback.vader6
-rw-r--r--test/fixers/test_autopep8_fixer_callback.vader8
-rw-r--r--test/fixers/test_elm_format_fixer_callback.vader7
-rw-r--r--test/fixers/test_eslint_fixer_callback.vader25
-rw-r--r--test/fixers/test_gofmt_fixer_callback.vader40
-rw-r--r--test/fixers/test_isort_fixer_callback.vader6
-rw-r--r--test/fixers/test_phpcbf_fixer_callback.vader62
-rw-r--r--test/fixers/test_prettier_eslint_fixer.callback.vader2
-rw-r--r--test/fixers/test_prettier_fixer_callback.vader4
-rw-r--r--test/fixers/test_puppetlint_fixer_callback.vader2
-rw-r--r--test/fixers/test_rubocop_fixer_callback.vader4
-rw-r--r--test/fixers/test_standard_fixer_callback.vader21
-rw-r--r--test/fixers/test_stylelint_fixer_callback.vader21
-rw-r--r--test/fixers/test_trim_whitespace.vader28
-rw-r--r--test/fixers/test_yapf_fixer_callback.vader10
-rw-r--r--test/go_files/testfile.go0
-rw-r--r--test/handler/test_flow_handler.vader8
-rw-r--r--test/handler/test_idris_handler.vader46
-rw-r--r--test/handler/test_llc_handler.vader56
-rw-r--r--test/handler/test_mcsc_handler.vader6
-rw-r--r--test/sign/test_sign_placement.vader11
-rw-r--r--test/test_lint_error_delay.vader4
-rw-r--r--test/test_linter_retrieval.vader2
-rw-r--r--test/test_python_virtualenv.vader12
-rw-r--r--test/test_statusline.vader2
54 files changed, 735 insertions, 321 deletions
diff --git a/test/command_callback/python_paths/with_virtualenv/env/Scripts/activate b/test/command_callback/python_paths/with_virtualenv/env/Scripts/activate
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/python_paths/with_virtualenv/env/Scripts/activate
diff --git a/test/command_callback/python_paths/with_virtualenv/env/Scripts/autopep8 b/test/command_callback/python_paths/with_virtualenv/env/Scripts/autopep8
new file mode 100755
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/python_paths/with_virtualenv/env/Scripts/autopep8
diff --git a/test/command_callback/python_paths/with_virtualenv/env/Scripts/flake8 b/test/command_callback/python_paths/with_virtualenv/env/Scripts/flake8
new file mode 100755
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/python_paths/with_virtualenv/env/Scripts/flake8
diff --git a/test/command_callback/python_paths/with_virtualenv/env/Scripts/isort b/test/command_callback/python_paths/with_virtualenv/env/Scripts/isort
new file mode 100755
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/python_paths/with_virtualenv/env/Scripts/isort
diff --git a/test/command_callback/python_paths/with_virtualenv/env/Scripts/mypy b/test/command_callback/python_paths/with_virtualenv/env/Scripts/mypy
new file mode 100755
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/python_paths/with_virtualenv/env/Scripts/mypy
diff --git a/test/command_callback/python_paths/with_virtualenv/env/Scripts/pylint b/test/command_callback/python_paths/with_virtualenv/env/Scripts/pylint
new file mode 100755
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/python_paths/with_virtualenv/env/Scripts/pylint
diff --git a/test/command_callback/python_paths/with_virtualenv/env/Scripts/yapf b/test/command_callback/python_paths/with_virtualenv/env/Scripts/yapf
new file mode 100755
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/python_paths/with_virtualenv/env/Scripts/yapf
diff --git a/test/command_callback/test_erlang_syntaxerl_command_callback.vader b/test/command_callback/test_erlang_syntaxerl_command_callback.vader
index 1df2be39..a9a1a500 100644
--- a/test/command_callback/test_erlang_syntaxerl_command_callback.vader
+++ b/test/command_callback/test_erlang_syntaxerl_command_callback.vader
@@ -6,13 +6,11 @@ Before:
runtime ale_linters/erlang/syntaxerl.vim
-
After:
Restore
call ale#linter#Reset()
-
Execute (The executable should be correct):
AssertEqual 'syntaxerl', ale_linters#erlang#syntaxerl#GetExecutable(bufnr(''))
@@ -25,22 +23,32 @@ Execute (The executable should be correct):
Execute (The executable should be presented in the feature check command):
let g:ale_erlang_syntaxerl_executable = '/some/other/syntaxerl'
- AssertEqual "'/some/other/syntaxerl' -h", ale_linters#erlang#syntaxerl#FeatureCheck(bufnr(''))
+
+ AssertEqual
+ \ ale#Escape('/some/other/syntaxerl') . ' -h',
+ \ ale_linters#erlang#syntaxerl#FeatureCheck(bufnr(''))
let b:ale_erlang_syntaxerl_executable = '/yet/another/syntaxerl'
- AssertEqual "'/yet/another/syntaxerl' -h", ale_linters#erlang#syntaxerl#FeatureCheck(bufnr(''))
+ AssertEqual
+ \ ale#Escape('/yet/another/syntaxerl') . ' -h',
+ \ ale_linters#erlang#syntaxerl#FeatureCheck(bufnr(''))
Execute (The executable should be presented in the command):
let g:ale_erlang_syntaxerl_executable = '/some/other/syntaxerl'
- AssertEqual "'/some/other/syntaxerl' %t", ale_linters#erlang#syntaxerl#GetCommand(bufnr(''), [])
+
+ AssertEqual
+ \ ale#Escape('/some/other/syntaxerl') . ' %t',
+ \ ale_linters#erlang#syntaxerl#GetCommand(bufnr(''), [])
let b:ale_erlang_syntaxerl_executable = '/yet/another/syntaxerl'
- AssertEqual "'/yet/another/syntaxerl' %t", ale_linters#erlang#syntaxerl#GetCommand(bufnr(''), [])
+ AssertEqual
+ \ ale#Escape('/yet/another/syntaxerl') . ' %t',
+ \ ale_linters#erlang#syntaxerl#GetCommand(bufnr(''), [])
Execute (The -b option should be used when available):
- AssertEqual "'syntaxerl' %t", ale_linters#erlang#syntaxerl#GetCommand(bufnr(''), [
+ AssertEqual ale#Escape('syntaxerl') . ' %t', ale_linters#erlang#syntaxerl#GetCommand(bufnr(''), [
\ 'Syntax checker for Erlang (0.14.0)',
\ 'Usage: syntaxerl [-d | --debug] <FILENAME>',
\ ' syntaxerl <-h | --help>',
@@ -48,7 +56,7 @@ Execute (The -b option should be used when available):
\ ' -h, --help Show this message',
\ ])
- AssertEqual "'syntaxerl' -b %s %t", ale_linters#erlang#syntaxerl#GetCommand(bufnr(''), [
+ AssertEqual ale#Escape('syntaxerl') . ' -b %s %t', ale_linters#erlang#syntaxerl#GetCommand(bufnr(''), [
\ 'Syntax checker for Erlang (0.14.0)',
\ 'Usage: syntaxerl [-b | --base <FILENAME>] [-d | --debug] <FILENAME>',
\ ' syntaxerl <-h | --help>',
diff --git a/test/command_callback/test_flake8_command_callback.vader b/test/command_callback/test_flake8_command_callback.vader
index c564b54f..a510f4c1 100644
--- a/test/command_callback/test_flake8_command_callback.vader
+++ b/test/command_callback/test_flake8_command_callback.vader
@@ -8,6 +8,8 @@ Before:
unlet! g:ale_python_flake8_options
unlet! g:ale_python_flake8_use_global
+ let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
+
runtime ale_linters/python/flake8.vim
call ale#test#SetDirectory('/testplugin/test/command_callback')
@@ -16,6 +18,9 @@ After:
unlet! g:ale_python_flake8_args
+ unlet! b:bin_dir
+ unlet! b:executable
+
call ale#test#RestoreDirectory()
call ale#linter#Reset()
call ale_linters#python#flake8#ClearVersionCache()
@@ -25,26 +30,29 @@ Execute(The flake8 callbacks should return the correct default values):
\ 'flake8',
\ ale_linters#python#flake8#GetExecutable(bufnr(''))
AssertEqual
- \ '''flake8'' --version',
+ \ ale#Escape('flake8') . ' --version',
\ ale_linters#python#flake8#VersionCheck(bufnr(''))
AssertEqual
- \ '''flake8'' --format=default --stdin-display-name %s -',
+ \ ale#Escape('flake8') . ' --format=default --stdin-display-name %s -',
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['3.0.0'])
" Try with older versions.
call ale_linters#python#flake8#ClearVersionCache()
AssertEqual
- \ '''flake8'' --format=default -',
+ \ ale#Escape('flake8') . ' --format=default -',
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['2.9.9'])
Execute(The flake8 command callback should let you set options):
let g:ale_python_flake8_options = '--some-option'
AssertEqual
- \ '''flake8'' --some-option --format=default --stdin-display-name %s -',
+ \ ale#Escape('flake8')
+ \ . ' --some-option --format=default'
+ \ . ' --stdin-display-name %s -',
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['3.0.4'])
call ale_linters#python#flake8#ClearVersionCache()
AssertEqual
- \ '''flake8'' --some-option --format=default -',
+ \ ale#Escape('flake8')
+ \ . ' --some-option --format=default -',
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['2.9.9'])
Execute(You should be able to set a custom executable and it should be escaped):
@@ -54,23 +62,29 @@ Execute(You should be able to set a custom executable and it should be escaped):
\ 'executable with spaces',
\ ale_linters#python#flake8#GetExecutable(bufnr(''))
AssertEqual
- \ '''executable with spaces'' --version',
+ \ ale#Escape('executable with spaces') . ' --version',
\ ale_linters#python#flake8#VersionCheck(bufnr(''))
AssertEqual
- \ '''executable with spaces'' --format=default --stdin-display-name %s -',
+ \ ale#Escape('executable with spaces')
+ \ . ' --format=default'
+ \ . ' --stdin-display-name %s -',
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['3.0.0'])
Execute(The flake8 callbacks should detect virtualenv directories):
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
+ let b:executable = ale#path#Winify(
+ \ g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/flake8'
+ \)
+
AssertEqual
- \ g:dir . '/python_paths/with_virtualenv/env/bin/flake8',
+ \ b:executable,
\ ale_linters#python#flake8#GetExecutable(bufnr(''))
AssertEqual
- \ '''' . g:dir . '/python_paths/with_virtualenv/env/bin/flake8'' --version',
+ \ ale#Escape(b:executable) . ' --version',
\ ale_linters#python#flake8#VersionCheck(bufnr(''))
AssertEqual
- \ '''' . g:dir . '/python_paths/with_virtualenv/env/bin/flake8'''
+ \ ale#Escape(b:executable)
\ . ' --format=default --stdin-display-name %s -',
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['3.0.0'])
@@ -78,35 +92,35 @@ Execute(The FindProjectRoot should detect the project root directory for namespa
silent execute 'file ' . fnameescape(g:dir . '/python_paths/namespace_package_manifest/namespace/foo/bar.py')
AssertEqual
- \ fnameescape(g:dir . '/python_paths/namespace_package_manifest'),
+ \ ale#path#Winify(g:dir . '/python_paths/namespace_package_manifest'),
\ ale#python#FindProjectRoot(bufnr(''))
Execute(The FindProjectRoot should detect the project root directory for namespace package via setup.cf):
silent execute 'file ' . fnameescape(g:dir . '/python_paths/namespace_package_setup/namespace/foo/bar.py')
AssertEqual
- \ fnameescape(g:dir . '/python_paths/namespace_package_setup'),
+ \ ale#path#Winify(g:dir . '/python_paths/namespace_package_setup'),
\ ale#python#FindProjectRoot(bufnr(''))
Execute(The FindProjectRoot should detect the project root directory for namespace package via pytest.ini):
silent execute 'file ' . fnameescape(g:dir . '/python_paths/namespace_package_pytest/namespace/foo/bar.py')
AssertEqual
- \ fnameescape(g:dir . '/python_paths/namespace_package_pytest'),
+ \ ale#path#Winify(g:dir . '/python_paths/namespace_package_pytest'),
\ ale#python#FindProjectRoot(bufnr(''))
Execute(The FindProjectRoot should detect the project root directory for namespace package via tox.ini):
silent execute 'file ' . fnameescape(g:dir . '/python_paths/namespace_package_tox/namespace/foo/bar.py')
AssertEqual
- \ fnameescape(g:dir . '/python_paths/namespace_package_tox'),
+ \ ale#path#Winify(g:dir . '/python_paths/namespace_package_tox'),
\ ale#python#FindProjectRoot(bufnr(''))
Execute(The FindProjectRoot should detect the project root directory for non-namespace package):
silent execute 'file ' . fnameescape(g:dir . '/python_paths/no_virtualenv/subdir/foo/bar.py')
AssertEqual
- \ fnameescape(g:dir . '/python_paths/no_virtualenv/subdir'),
+ \ ale#path#Winify(g:dir . '/python_paths/no_virtualenv/subdir'),
\ ale#python#FindProjectRoot(bufnr(''))
" Some users currently run flake8 this way, so we should support it.
@@ -120,10 +134,10 @@ Execute(Using `python -m flake8` should be supported for running flake8):
\ 'python',
\ ale_linters#python#flake8#GetExecutable(bufnr(''))
AssertEqual
- \ '''python'' -m flake8 --version',
+ \ ale#Escape('python') . ' -m flake8 --version',
\ ale_linters#python#flake8#VersionCheck(bufnr(''))
AssertEqual
- \ '''python'' -m flake8 --some-option --format=default -',
+ \ ale#Escape('python') . ' -m flake8 --some-option --format=default -',
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['2.9.9'])
call ale_linters#python#flake8#ClearVersionCache()
@@ -135,10 +149,10 @@ Execute(Using `python -m flake8` should be supported for running flake8):
\ 'python',
\ ale_linters#python#flake8#GetExecutable(bufnr(''))
AssertEqual
- \ '''python'' -m flake8 --version',
+ \ ale#Escape('python') . ' -m flake8 --version',
\ ale_linters#python#flake8#VersionCheck(bufnr(''))
AssertEqual
- \ '''python'' -m flake8 --some-option --format=default -',
+ \ ale#Escape('python') . ' -m flake8 --some-option --format=default -',
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['2.9.9'])
Execute(Using `python2 -m flake8` should be use with the old args option):
@@ -157,8 +171,8 @@ Execute(Using `python2 -m flake8` should be use with the old args option):
\ 'python2',
\ ale_linters#python#flake8#GetExecutable(bufnr(''))
AssertEqual
- \ '''python2'' -m flake8 --version',
+ \ ale#Escape('python2') . ' -m flake8 --version',
\ ale_linters#python#flake8#VersionCheck(bufnr(''))
AssertEqual
- \ '''python2'' -m flake8 --format=default -',
+ \ ale#Escape('python2') . ' -m flake8 --format=default -',
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['2.9.9'])
diff --git a/test/command_callback/test_fusionlint_command_callback.vader b/test/command_callback/test_fusionlint_command_callback.vader
index 5398066c..34a44133 100644
--- a/test/command_callback/test_fusionlint_command_callback.vader
+++ b/test/command_callback/test_fusionlint_command_callback.vader
@@ -1,24 +1,34 @@
Before:
+ Save g:ale_fuse_fusionlint_options
+ Save g:ale_fuse_fusionlint_executable
+
+ unlet! g:ale_fuse_fusionlint_options
+ unlet! g:ale_fuse_fusionlint_executable
+
runtime ale_linters/fuse/fusionlint.vim
After:
+ Restore
+
call ale#linter#Reset()
- let g:ale_fuse_fusionlint_options = ''
- let g:ale_fuse_fusionlint_executable = 'fusion-lint'
Execute(The fuse fusionlint command callback should return the correct default string):
- AssertEqual '''fusion-lint'' --filename %s -i',
+ AssertEqual ale#Escape('fusion-lint') . ' --filename %s -i',
\ join(split(ale_linters#fuse#fusionlint#GetCommand(1)))
Execute(The fuse fusionlint command callback should let you set options):
let g:ale_fuse_fusionlint_options = '--example-option argument'
- AssertEqual '''fusion-lint'' --example-option argument --filename %s -i',
+ AssertEqual
+ \ ale#Escape('fusion-lint')
+ \ . ' --example-option argument --filename %s -i',
\ join(split(ale_linters#fuse#fusionlint#GetCommand(1)))
Execute(The fusionlint executable should be configurable):
let g:ale_fuse_fusionlint_executable = 'util/linter.fuse'
AssertEqual 'util/linter.fuse', ale_linters#fuse#fusionlint#GetExecutable(1)
- AssertEqual '''util/linter.fuse'' --filename %s -i',
+ AssertEqual
+ \ ale#Escape('util/linter.fuse')
+ \ . ' --filename %s -i',
\ join(split(ale_linters#fuse#fusionlint#GetCommand(1)))
diff --git a/test/command_callback/test_javac_command_callback.vader b/test/command_callback/test_javac_command_callback.vader
index 706839e4..8033e4f6 100644
--- a/test/command_callback/test_javac_command_callback.vader
+++ b/test/command_callback/test_javac_command_callback.vader
@@ -1,97 +1,151 @@
Before:
+ call ale#test#SetDirectory('/testplugin/test/command_callback')
+
+ Save g:ale_java_javac_options
+ Save g:ale_java_javac_classpath
+
+ unlet! g:ale_java_javac_options
+ unlet! g:ale_java_javac_classpath
+
+ let g:cp_sep = has('unix') ? ':' : ';'
+
+ function! GetCommand(previous_output) abort
+ let l:command = ale_linters#java#javac#GetCommand(
+ \ bufnr(''),
+ \ a:previous_output
+ \)
+
+ let l:split_command = split(l:command)
+ let l:index = index(l:split_command, '-d')
+
+ let l:split_command[l:index + 1] = 'TEMP'
+
+ return join(l:split_command)
+ endfunction
+
runtime ale_linters/java/javac.vim
call ale#engine#InitBufferInfo(bufnr(''))
- silent! cd /testplugin/test/command_callback
+ call ale#test#SetFilename('dummy.java')
After:
+ call ale#test#RestoreDirectory()
+
+ Restore
+
+ unlet! g:cp_sep
+
+ delfunction GetCommand
+
call ale#linter#Reset()
" We need to clean up the buffer to remove the temporary directories created
" for the command.
call ale#engine#Cleanup(bufnr(''))
- let g:ale_java_javac_options = ''
- let g:ale_java_javac_classpath = ''
Execute(The javac callback should return the correct default value):
- let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [])
-
- Assert match(b:command, '\v^javac +-Xlint +-d +''/tmp/[0-9a-zA-Z/]+'' +\%t$') >= 0,
- \ 'Invalid command string: ' . b:command
+ AssertEqual 'javac -Xlint -d TEMP %t', GetCommand([])
Execute(The javac callback should use g:ale_java_javac_classpath correctly):
let g:ale_java_javac_classpath = 'foo.jar'
- let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [])
-
- Assert match(b:command, '\v^javac +-Xlint +-cp ''+foo\.jar'' +-d ''+/tmp/[0-9a-zA-Z/]+'' +\%t$') >= 0,
- \ 'Invalid command string: ' . b:command
+ AssertEqual
+ \ 'javac -Xlint'
+ \ . ' -cp ' . ale#Escape('foo.jar')
+ \ . ' -d TEMP %t',
+ \ GetCommand([])
Execute(The javac callback should include discovered classpaths):
- let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [
- \ '[DEBUG] Ignore this.',
- \ '[INFO] Something we should ignore.',
- \ '/foo/bar.jar',
- \ '/xyz/abc.jar',
- \])
-
- Assert match(b:command, '\v^javac +-Xlint +-cp ''+/foo/bar\.jar:/xyz/abc\.jar'' +-d +''/tmp/[0-9a-zA-Z/]+'' +\%t$') >= 0,
- \ 'Invalid command string: ' . b:command
+ AssertEqual
+ \ 'javac -Xlint -cp '
+ \ . ale#Escape(join(['/foo/bar.jar', '/xyz/abc.jar'], g:cp_sep))
+ \ . ' -d TEMP %t',
+ \ GetCommand([
+ \ '[DEBUG] Ignore this.',
+ \ '[INFO] Something we should ignore.',
+ \ '/foo/bar.jar',
+ \ '/xyz/abc.jar',
+ \ ])
Execute(The javac callback should combine discovered classpaths and manual ones):
let g:ale_java_javac_classpath = 'configured.jar'
- let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [
- \ '[DEBUG] Ignore this.',
- \ '[INFO] Something we should ignore.',
- \ '/foo/bar.jar',
- \ '/xyz/abc.jar',
- \])
-
- Assert match(b:command, '\v^javac +-Xlint +-cp +''/foo/bar\.jar:/xyz/abc\.jar:configured\.jar'' +-d ''+/tmp/[0-9a-zA-Z/]+'' +\%t$') >= 0,
- \ 'Invalid command string: ' . b:command
-
- let g:ale_java_javac_classpath = 'configured.jar:configured2.jar'
-
- let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [
- \ '[DEBUG] Ignore this.',
- \ '[INFO] Something we should ignore.',
- \ '/foo/bar.jar',
- \ '/xyz/abc.jar',
- \])
-
- Assert match(b:command, '\v^javac +-Xlint +-cp +''/foo/bar\.jar:/xyz/abc\.jar:configured\.jar:configured2\.jar'' +-d +''/tmp/[0-9a-zA-Z/]+'' +\%t$') >= 0,
- \ 'Invalid command string: ' . b:command
+ AssertEqual
+ \ 'javac -Xlint -cp '
+ \ . ale#Escape(join(
+ \ [
+ \ '/foo/bar.jar',
+ \ '/xyz/abc.jar',
+ \ 'configured.jar',
+ \ ],
+ \ g:cp_sep
+ \ ))
+ \ . ' -d TEMP %t',
+ \ GetCommand([
+ \ '[DEBUG] Ignore this.',
+ \ '[INFO] Something we should ignore.',
+ \ '/foo/bar.jar',
+ \ '/xyz/abc.jar',
+ \ ])
+
+ let g:ale_java_javac_classpath = 'configured.jar' . g:cp_sep . 'configured2.jar'
+
+ AssertEqual
+ \ 'javac -Xlint -cp '
+ \ . ale#Escape(join(
+ \ [
+ \ '/foo/bar.jar',
+ \ '/xyz/abc.jar',
+ \ 'configured.jar',
+ \ 'configured2.jar',
+ \ ],
+ \ g:cp_sep
+ \ ))
+ \ . ' -d TEMP %t',
+ \ GetCommand([
+ \ '[DEBUG] Ignore this.',
+ \ '[INFO] Something we should ignore.',
+ \ '/foo/bar.jar',
+ \ '/xyz/abc.jar',
+ \ ])
Execute(The javac callback should detect source directories):
call ale#engine#Cleanup(bufnr(''))
:e! java_paths/src/main/java/com/something/dummy
call ale#engine#InitBufferInfo(bufnr(''))
- let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [])
-
- Assert match(b:command, '\v^javac +-Xlint +-sourcepath ''/.*java_paths/src/main/java/'' +-d +''/tmp/[0-9a-zA-Z/]+'' +\%t$') >= 0,
- \ 'Invalid command string: ' . b:command
+ AssertEqual
+ \ 'javac -Xlint'
+ \ . ' -sourcepath ' . ale#Escape(
+ \ ale#path#Winify(g:dir . '/java_paths/src/main/java/')
+ \ )
+ \ . ' -d TEMP %t',
+ \ GetCommand([])
Execute(The javac callback should combine detected source directories and classpaths):
call ale#engine#Cleanup(bufnr(''))
- :e! java_paths/src/main/java/com/something/dummy
+ call ale#test#SetFilename('java_paths/src/main/java/com/something/dummy.java')
call ale#engine#InitBufferInfo(bufnr(''))
- let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [
- \ '[DEBUG] Ignore this.',
- \ '[INFO] Something we should ignore.',
- \ '/foo/bar.jar',
- \ '/xyz/abc.jar',
- \])
-
- Assert match(b:command, '\v^javac +-Xlint +-cp +''/foo/bar\.jar:/xyz/abc\.jar'' +-sourcepath ''/.*java_paths/src/main/java/'' +-d +''/tmp/[0-9a-zA-Z/]+'' +\%t$') >= 0,
- \ 'Invalid command string: ' . b:command
+ AssertEqual
+ \ 'javac -Xlint'
+ \ . ' -cp ' . ale#Escape(join(['/foo/bar.jar', '/xyz/abc.jar'], g:cp_sep))
+ \ . ' -sourcepath ' . ale#Escape(
+ \ ale#path#Winify(g:dir . '/java_paths/src/main/java/')
+ \ )
+ \ . ' -d TEMP %t',
+ \ GetCommand([
+ \ '[DEBUG] Ignore this.',
+ \ '[INFO] Something we should ignore.',
+ \ '/foo/bar.jar',
+ \ '/xyz/abc.jar',
+ \ ])
Execute(The javac callback should use g:ale_java_javac_options correctly):
-
let g:ale_java_javac_options = '--anything --else'
let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [])
- Assert match(b:command, '\v^javac +-Xlint +-d +''/tmp/[0-9a-zA-Z/]+'' --anything --else +\%t$') >= 0,
- \ 'Invalid command string: ' . b:command
+ AssertEqual
+ \ 'javac -Xlint'
+ \ . ' -d TEMP --anything --else %t',
+ \ GetCommand([])
diff --git a/test/command_callback/test_jscs_command_callback.vader b/test/command_callback/test_jscs_command_callback.vader
index 8245337e..f118c039 100644
--- a/test/command_callback/test_jscs_command_callback.vader
+++ b/test/command_callback/test_jscs_command_callback.vader
@@ -7,19 +7,19 @@ After:
Execute(Should return the correct default values):
AssertEqual
- \ 'jscs',
- \ ale_linters#javascript#jscs#GetExecutable(bufnr(''))
+ \ 'jscs',
+ \ ale_linters#javascript#jscs#GetExecutable(bufnr(''))
AssertEqual
- \ '''jscs'' --reporter inline --no-colors -',
- \ ale_linters#javascript#jscs#GetCommand(bufnr(''))
+ \ ale#Escape('jscs') . ' --reporter inline --no-colors -',
+ \ ale_linters#javascript#jscs#GetCommand(bufnr(''))
Execute(Should allow using a custom executable):
let g:ale_javascript_jscs_executable = 'foobar'
AssertEqual
- \ 'foobar',
- \ ale_linters#javascript#jscs#GetExecutable(bufnr(''))
+ \ 'foobar',
+ \ ale_linters#javascript#jscs#GetExecutable(bufnr(''))
AssertEqual
- \ '''foobar'' --reporter inline --no-colors -',
- \ ale_linters#javascript#jscs#GetCommand(bufnr(''))
+ \ ale#Escape('foobar') . ' --reporter inline --no-colors -',
+ \ ale_linters#javascript#jscs#GetCommand(bufnr(''))
diff --git a/test/command_callback/test_llc_command_callback.vader b/test/command_callback/test_llc_command_callback.vader
new file mode 100644
index 00000000..296b277a
--- /dev/null
+++ b/test/command_callback/test_llc_command_callback.vader
@@ -0,0 +1,39 @@
+Before:
+ Save g:ale_llvm_llc_executable
+
+ unlet! g:ale_llvm_llc_executable
+ unlet! b:ale_llvm_llc_executable
+
+ runtime ale_linters/llvm/llc.vim
+
+ function! AssertHasPrefix(str, prefix) abort
+ let msg = printf("'%s' is expected to be prefixed with '%s'", a:str, a:prefix)
+ AssertEqual stridx(a:str, a:prefix), 0, msg
+ endfunction
+
+After:
+ unlet! g:ale_llvm_llc_executable
+ unlet! b:ale_llvm_llc_executable
+ delfunction AssertHasPrefix
+ Restore
+
+Execute(llc command is customizable):
+ let cmd = ale_linters#llvm#llc#GetCommand(bufnr(''))
+ call AssertHasPrefix(cmd, ale#Escape('llc'))
+
+ let g:ale_llvm_llc_executable = 'llc-5.0'
+ let cmd = ale_linters#llvm#llc#GetCommand(bufnr(''))
+ call AssertHasPrefix(cmd, ale#Escape('llc-5.0'))
+
+ let b:ale_llvm_llc_executable = 'llc-4.0'
+ let cmd = ale_linters#llvm#llc#GetCommand(bufnr(''))
+ call AssertHasPrefix(cmd, ale#Escape('llc-4.0'))
+
+Execute(GetCommand() escapes the returned path):
+ let b:ale_llvm_llc_executable = '/path/space contained/llc'
+ let cmd = ale_linters#llvm#llc#GetCommand(bufnr(''))
+ call AssertHasPrefix(cmd, ale#Escape('/path/space contained/llc'))
+
+Execute(GetExecutable() does not escape the returned path):
+ let b:ale_llvm_llc_executable = '/path/space contained/llc'
+ AssertEqual ale_linters#llvm#llc#GetExecutable(bufnr('')), '/path/space contained/llc'
diff --git a/test/command_callback/test_luacheck_command_callback.vader b/test/command_callback/test_luacheck_command_callback.vader
index c4ee98a8..6f7f3a00 100644
--- a/test/command_callback/test_luacheck_command_callback.vader
+++ b/test/command_callback/test_luacheck_command_callback.vader
@@ -7,18 +7,18 @@ After:
let g:ale_lua_luacheck_executable = 'luacheck'
Execute(The lua luacheck command callback should return the correct default string):
- AssertEqual '''luacheck'' --formatter plain --codes --filename %s -',
+ AssertEqual ale#Escape('luacheck') . ' --formatter plain --codes --filename %s -',
\ join(split(ale_linters#lua#luacheck#GetCommand(1)))
Execute(The lua luacheck command callback should let you set options):
let g:ale_lua_luacheck_options = '--config filename'
- AssertEqual '''luacheck'' --config filename --formatter plain --codes --filename %s -',
+ AssertEqual ale#Escape('luacheck') . ' --config filename --formatter plain --codes --filename %s -',
\ join(split(ale_linters#lua#luacheck#GetCommand(1)))
Execute(The luacheck executable should be configurable):
let g:ale_lua_luacheck_executable = 'luacheck.sh'
AssertEqual 'luacheck.sh', ale_linters#lua#luacheck#GetExecutable(1)
- AssertEqual '''luacheck.sh'' --formatter plain --codes --filename %s -',
+ AssertEqual ale#Escape('luacheck.sh') . ' --formatter plain --codes --filename %s -',
\ join(split(ale_linters#lua#luacheck#GetCommand(1)))
diff --git a/test/command_callback/test_mypy_command_callback.vader b/test/command_callback/test_mypy_command_callback.vader
index 8df7193d..4ccc008e 100644
--- a/test/command_callback/test_mypy_command_callback.vader
+++ b/test/command_callback/test_mypy_command_callback.vader
@@ -1,20 +1,35 @@
Before:
+ Save g:ale_python_mypy_executable
+ Save g:ale_python_mypy_options
+ Save g:ale_python_mypy_use_global
+
+ unlet! g:ale_python_mypy_executable
+ unlet! g:ale_python_mypy_options
+ unlet! g:ale_python_mypy_use_global
+
+ let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
+
runtime ale_linters/python/mypy.vim
+
call ale#test#SetDirectory('/testplugin/test/command_callback')
+ call ale#test#SetFilename('test.py')
After:
+ Restore
+
+ unlet! b:bin_dir
+ unlet! b:executable
+
call ale#test#RestoreDirectory()
call ale#linter#Reset()
- let g:ale_python_mypy_executable = 'mypy'
- let g:ale_python_mypy_options = ''
- let g:ale_python_mypy_use_global = 0
Execute(The mypy callbacks should return the correct default values):
AssertEqual
\ 'mypy',
\ ale_linters#python#mypy#GetExecutable(bufnr(''))
AssertEqual
- \ 'cd ''' . g:dir . ''' && ''mypy'' --show-column-numbers '
+ \ 'cd ' . ale#Escape(g:dir) . ' && ' . ale#Escape('mypy')
+ \ . ' --show-column-numbers '
\ . '--shadow-file %s %t %s',
\ ale_linters#python#mypy#GetCommand(bufnr(''))
@@ -25,7 +40,8 @@ Execute(The mypy executable should be configurable, and escaped properly):
\ 'executable with spaces',
\ ale_linters#python#mypy#GetExecutable(bufnr(''))
AssertEqual
- \ 'cd ''' . g:dir . ''' && ''executable with spaces'' --show-column-numbers '
+ \ 'cd ' . ale#Escape(g:dir) . ' && ' . ale#Escape('executable with spaces')
+ \ . ' --show-column-numbers '
\ . '--shadow-file %s %t %s',
\ ale_linters#python#mypy#GetCommand(bufnr(''))
@@ -33,7 +49,8 @@ Execute(The mypy command callback should let you set options):
let g:ale_python_mypy_options = '--some-option'
AssertEqual
- \ 'cd ''' . g:dir . ''' && ''mypy'' --show-column-numbers --some-option '
+ \ 'cd ' . ale#Escape(g:dir) . ' && ' . ale#Escape('mypy')
+ \ . ' --show-column-numbers --some-option '
\ . '--shadow-file %s %t %s',
\ ale_linters#python#mypy#GetCommand(bufnr(''))
@@ -44,19 +61,24 @@ Execute(The mypy command should switch directories to the detected project root)
\ 'mypy',
\ ale_linters#python#mypy#GetExecutable(bufnr(''))
AssertEqual
- \ 'cd ''' . g:dir . '/python_paths/no_virtualenv/subdir'' && ''mypy'' --show-column-numbers '
+ \ 'cd ' . ale#Escape(ale#path#Winify(g:dir . '/python_paths/no_virtualenv/subdir'))
+ \ . ' && ' . ale#Escape('mypy')
+ \ . ' --show-column-numbers '
\ . '--shadow-file %s %t %s',
\ ale_linters#python#mypy#GetCommand(bufnr(''))
Execute(The mypy callbacks should detect virtualenv directories and switch to the project root):
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
+ let b:executable = ale#path#Winify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/mypy')
+
AssertEqual
- \ g:dir . '/python_paths/with_virtualenv/env/bin/mypy',
+ \ b:executable,
\ ale_linters#python#mypy#GetExecutable(bufnr(''))
AssertEqual
- \ 'cd ''' . g:dir . '/python_paths/with_virtualenv/subdir'' && '''
- \ . g:dir . '/python_paths/with_virtualenv/env/bin/mypy'' --show-column-numbers '
+ \ 'cd ' . ale#Escape(ale#path#Winify(g:dir . '/python_paths/with_virtualenv/subdir'))
+ \ . ' && ' . ale#Escape(b:executable)
+ \ . ' --show-column-numbers '
\ . '--shadow-file %s %t %s',
\ ale_linters#python#mypy#GetCommand(bufnr(''))
@@ -68,6 +90,8 @@ Execute(You should able able to use the global mypy instead):
\ 'mypy',
\ ale_linters#python#mypy#GetExecutable(bufnr(''))
AssertEqual
- \ 'cd ''' . g:dir . '/python_paths/with_virtualenv/subdir'' && ''mypy'' --show-column-numbers '
+ \ 'cd ' . ale#Escape(ale#path#Winify(g:dir . '/python_paths/with_virtualenv/subdir'))
+ \ . ' && ' . ale#Escape('mypy')
+ \ . ' --show-column-numbers '
\ . '--shadow-file %s %t %s',
\ ale_linters#python#mypy#GetCommand(bufnr(''))
diff --git a/test/command_callback/test_php_langserver_callbacks.vader b/test/command_callback/test_php_langserver_callbacks.vader
index 38630f4b..0c7e69ef 100644
--- a/test/command_callback/test_php_langserver_callbacks.vader
+++ b/test/command_callback/test_php_langserver_callbacks.vader
@@ -33,13 +33,13 @@ Execute(Vendor executables should be detected):
call ale#test#SetFilename('php-langserver-project/test.php')
AssertEqual
- \ g:dir . '/php-langserver-project/vendor/bin/php-language-server.php',
+ \ ale#path#Winify(g:dir . '/php-langserver-project/vendor/bin/php-language-server.php'),
\ ale_linters#php#langserver#GetExecutable(bufnr(''))
AssertEqual
- \ 'php ' . ale#Escape(
+ \ 'php ' . ale#Escape(ale#path#Winify(
\ g:dir
\ . '/php-langserver-project/vendor/bin/php-language-server.php'
- \ ),
+ \ )),
\ ale_linters#php#langserver#GetCommand(bufnr(''))
Execute(The language string should be correct):
diff --git a/test/command_callback/test_phpstan_command_callbacks.vader b/test/command_callback/test_phpstan_command_callbacks.vader
index 7366df8b..169c5bb7 100644
--- a/test/command_callback/test_phpstan_command_callbacks.vader
+++ b/test/command_callback/test_phpstan_command_callbacks.vader
@@ -1,9 +1,11 @@
Before:
Save g:ale_php_phpstan_executable
Save g:ale_php_phpstan_level
+ Save g:ale_php_phpstan_configuration
unlet! g:ale_php_phpstan_executable
unlet! g:ale_php_phpstan_level
+ unlet! g:ale_php_phpstan_configuration
runtime ale_linters/php/phpstan.vim
@@ -27,3 +29,10 @@ Execute(project with level set to 3):
AssertEqual
\ ale#Escape('phpstan') . ' analyze -l3 --errorFormat raw %s',
\ ale_linters#php#phpstan#GetCommand(bufnr(''))
+
+Execute(Custom phpstan configuration file):
+ let g:ale_php_phpstan_configuration = 'phpstan_config'
+
+ AssertEqual
+ \ ale#Escape('phpstan') . ' analyze -l4 --errorFormat raw -c phpstan_config %s',
+ \ ale_linters#php#phpstan#GetCommand(bufnr(''))
diff --git a/test/command_callback/test_puglint_command_callback.vader b/test/command_callback/test_puglint_command_callback.vader
index 6d189899..11946582 100644
--- a/test/command_callback/test_puglint_command_callback.vader
+++ b/test/command_callback/test_puglint_command_callback.vader
@@ -21,11 +21,12 @@ Execute(puglint should detect local executables and package.json):
call ale#test#SetFilename('puglint_project/test.pug')
AssertEqual
- \ g:dir . '/puglint_project/node_modules/.bin/pug-lint',
+ \ ale#path#Winify(g:dir . '/puglint_project/node_modules/.bin/pug-lint'),
\ ale_linters#pug#puglint#GetExecutable(bufnr(''))
+
AssertEqual
- \ ale#Escape(g:dir . '/puglint_project/node_modules/.bin/pug-lint')
- \ . ' -c ' . ale#Escape(g:dir . '/puglint_project/package.json')
+ \ ale#Escape(ale#path#Winify(g:dir . '/puglint_project/node_modules/.bin/pug-lint'))
+ \ . ' -c ' . ale#Escape(ale#path#Winify(g:dir . '/puglint_project/package.json'))
\ . ' -r inline %t',
\ ale_linters#pug#puglint#GetCommand(bufnr(''))
@@ -35,9 +36,10 @@ Execute(puglint should use global executables if configured):
call ale#test#SetFilename('puglint_project/test.pug')
AssertEqual 'pug-lint', ale_linters#pug#puglint#GetExecutable(bufnr(''))
+
AssertEqual
\ ale#Escape('pug-lint')
- \ . ' -c ' . ale#Escape(g:dir . '/puglint_project/package.json')
+ \ . ' -c ' . ale#Escape(ale#path#Winify(g:dir . '/puglint_project/package.json'))
\ . ' -r inline %t',
\ ale_linters#pug#puglint#GetCommand(bufnr(''))
@@ -45,8 +47,8 @@ Execute(puglint should detect .pug-lintrc):
call ale#test#SetFilename('puglint_project/puglint_rc_dir/subdir/test.pug')
AssertEqual
- \ ale#Escape(g:dir . '/puglint_project/node_modules/.bin/pug-lint')
- \ . ' -c ' . ale#Escape(g:dir . '/puglint_project/puglint_rc_dir/.pug-lintrc')
+ \ ale#Escape(ale#path#Winify(g:dir . '/puglint_project/node_modules/.bin/pug-lint'))
+ \ . ' -c ' . ale#Escape(ale#path#Winify(g:dir . '/puglint_project/puglint_rc_dir/.pug-lintrc'))
\ . ' -r inline %t',
\ ale_linters#pug#puglint#GetCommand(bufnr(''))
@@ -54,8 +56,8 @@ Execute(puglint should detect .pug-lintrc.js):
call ale#test#SetFilename('puglint_project/puglint_rc_js_dir/subdir/test.pug')
AssertEqual
- \ ale#Escape(g:dir . '/puglint_project/node_modules/.bin/pug-lint')
- \ . ' -c ' . ale#Escape(g:dir . '/puglint_project/puglint_rc_js_dir/.pug-lintrc.js')
+ \ ale#Escape(ale#path#Winify(g:dir . '/puglint_project/node_modules/.bin/pug-lint'))
+ \ . ' -c ' . ale#Escape(ale#path#Winify(g:dir . '/puglint_project/puglint_rc_js_dir/.pug-lintrc.js'))
\ . ' -r inline %t',
\ ale_linters#pug#puglint#GetCommand(bufnr(''))
@@ -63,7 +65,7 @@ Execute(puglint should detect .pug-lintrc.json):
call ale#test#SetFilename('puglint_project/puglint_rc_json_dir/subdir/test.pug')
AssertEqual
- \ ale#Escape(g:dir . '/puglint_project/node_modules/.bin/pug-lint')
- \ . ' -c ' . ale#Escape(g:dir . '/puglint_project/puglint_rc_json_dir/.pug-lintrc.json')
+ \ ale#Escape(ale#path#Winify(g:dir . '/puglint_project/node_modules/.bin/pug-lint'))
+ \ . ' -c ' . ale#Escape(ale#path#Winify(g:dir . '/puglint_project/puglint_rc_json_dir/.pug-lintrc.json'))
\ . ' -r inline %t',
\ ale_linters#pug#puglint#GetCommand(bufnr(''))
diff --git a/test/command_callback/test_pycodestyle_command_callback.vader b/test/command_callback/test_pycodestyle_command_callback.vader
index a5163461..58aefa20 100644
--- a/test/command_callback/test_pycodestyle_command_callback.vader
+++ b/test/command_callback/test_pycodestyle_command_callback.vader
@@ -9,15 +9,17 @@ After:
Restore
Execute(The pycodestyle command callback should return default string):
- AssertEqual '''pycodestyle'' -',
+ AssertEqual ale#Escape('pycodestyle') . ' -',
\ ale_linters#python#pycodestyle#GetCommand(bufnr(''))
Execute(The pycodestyle command callback should allow options):
let g:ale_python_pycodestyle_options = '--exclude=test*.py'
- AssertEqual '''pycodestyle'' --exclude=test*.py -',
+
+ AssertEqual ale#Escape('pycodestyle') . ' --exclude=test*.py -',
\ ale_linters#python#pycodestyle#GetCommand(bufnr(''))
Execute(The pycodestyle executable should be configurable):
let g:ale_python_pycodestyle_executable = '~/.local/bin/pycodestyle'
- AssertEqual '''~/.local/bin/pycodestyle'' -',
+
+ AssertEqual ale#Escape('~/.local/bin/pycodestyle') . ' -',
\ ale_linters#python#pycodestyle#GetCommand(bufnr(''))
diff --git a/test/command_callback/test_pylint_command_callback.vader b/test/command_callback/test_pylint_command_callback.vader
index f8f44ab6..447409b2 100644
--- a/test/command_callback/test_pylint_command_callback.vader
+++ b/test/command_callback/test_pylint_command_callback.vader
@@ -1,22 +1,34 @@
Before:
+ Save g:ale_python_pylint_executable
+ Save g:ale_python_pylint_options
+ Save g:ale_python_pylint_use_global
+
+ unlet! g:ale_python_pylint_executable
+ unlet! g:ale_python_pylint_options
+ unlet! g:ale_python_pylint_use_global
+
runtime ale_linters/python/pylint.vim
call ale#test#SetDirectory('/testplugin/test/command_callback')
+ let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
+
let b:command_tail = ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s'
After:
+ Restore
+
call ale#test#RestoreDirectory()
call ale#linter#Reset()
- let g:ale_python_pylint_executable = 'pylint'
- let g:ale_python_pylint_options = ''
- let g:ale_python_pylint_use_global = 0
+
+ unlet! b:bin_dir
+ unlet! b:executable
Execute(The pylint callbacks should return the correct default values):
AssertEqual
\ 'pylint',
\ ale_linters#python#pylint#GetExecutable(bufnr(''))
AssertEqual
- \ '''pylint'' ' . b:command_tail,
+ \ ale#Escape('pylint') . ' ' . b:command_tail,
\ ale_linters#python#pylint#GetCommand(bufnr(''))
Execute(The pylint executable should be configurable, and escaped properly):
@@ -26,14 +38,14 @@ Execute(The pylint executable should be configurable, and escaped properly):
\ 'executable with spaces',
\ ale_linters#python#pylint#GetExecutable(bufnr(''))
AssertEqual
- \ '''executable with spaces'' ' . b:command_tail,
+ \ ale#Escape('executable with spaces') . ' ' . b:command_tail,
\ ale_linters#python#pylint#GetCommand(bufnr(''))
Execute(The pylint command callback should let you set options):
let g:ale_python_pylint_options = '--some-option'
AssertEqual
- \ '''pylint'' --some-option' . b:command_tail,
+ \ ale#Escape('pylint') . ' --some-option' . b:command_tail,
\ ale_linters#python#pylint#GetCommand(bufnr(''))
Execute(The pylint callbacks shouldn't detect virtualenv directories where they don't exist):
@@ -43,17 +55,22 @@ Execute(The pylint callbacks shouldn't detect virtualenv directories where they
\ 'pylint',
\ ale_linters#python#pylint#GetExecutable(bufnr(''))
AssertEqual
- \ '''pylint'' ' . b:command_tail,
+ \ ale#Escape('pylint') . ' ' . b:command_tail,
\ ale_linters#python#pylint#GetCommand(bufnr(''))
Execute(The pylint callbacks should detect virtualenv directories):
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
+ let b:executable = ale#path#Winify(
+ \ g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/pylint'
+ \)
+
AssertEqual
- \ g:dir . '/python_paths/with_virtualenv/env/bin/pylint',
+ \ b:executable,
\ ale_linters#python#pylint#GetExecutable(bufnr(''))
+
AssertEqual
- \ ''''. g:dir . '/python_paths/with_virtualenv/env/bin/pylint'' ' . b:command_tail,
+ \ ale#Escape(b:executable) . ' ' . b:command_tail,
\ ale_linters#python#pylint#GetCommand(bufnr(''))
Execute(You should able able to use the global pylint instead):
@@ -64,5 +81,5 @@ Execute(You should able able to use the global pylint instead):
\ 'pylint',
\ ale_linters#python#pylint#GetExecutable(bufnr(''))
AssertEqual
- \ '''pylint'' ' . b:command_tail,
+ \ ale#Escape('pylint') . ' ' . b:command_tail,
\ ale_linters#python#pylint#GetCommand(bufnr(''))
diff --git a/test/command_callback/test_rails_best_practices_command_callback.vader b/test/command_callback/test_rails_best_practices_command_callback.vader
index 09436be0..7305f4a6 100644
--- a/test/command_callback/test_rails_best_practices_command_callback.vader
+++ b/test/command_callback/test_rails_best_practices_command_callback.vader
@@ -7,36 +7,51 @@ Before:
call ale#test#SetDirectory('/testplugin/test/command_callback')
call ale#test#SetFilename('../ruby_fixtures/valid_rails_app/db/test.rb')
+ let b:args = '--silent -f json'
+ \ . ' --output-file ' . (has('win32') ? '%t' : '/dev/stdout')
+ let b:app_path = ale#path#Winify(g:dir . '/../ruby_fixtures/valid_rails_app')
+ let b:suffix = has('win32') ? '; type %t' : ''
+
After:
Restore
+ unlet! b:args
+ unlet! b:app_path
+ unlet! b:suffix
+
call ale#test#RestoreDirectory()
Execute(Executable should default to rails_best_practices):
AssertEqual
- \ '''rails_best_practices'' --silent -f json --output-file /dev/stdout '
- \ . ale#Escape(simplify(g:dir . '/../ruby_fixtures/valid_rails_app')),
+ \ ale#Escape('rails_best_practices')
+ \ . ' ' . b:args
+ \ . ' ' . ale#Escape(b:app_path)
+ \ . b:suffix,
\ ale_linters#ruby#rails_best_practices#GetCommand(bufnr(''))
Execute(Should be able to set a custom executable):
let g:ale_ruby_rails_best_practices_executable = 'bin/rails_best_practices'
AssertEqual
- \ '''bin/rails_best_practices'' --silent -f json --output-file /dev/stdout '
- \ . ale#Escape(simplify(g:dir . '/../ruby_fixtures/valid_rails_app')),
+ \ ale#Escape('bin/rails_best_practices')
+ \ . ' ' . b:args
+ \ . ' ' . ale#Escape(b:app_path)
+ \ . b:suffix,
\ ale_linters#ruby#rails_best_practices#GetCommand(bufnr(''))
Execute(Setting bundle appends 'exec rails_best_practices'):
let g:ale_ruby_rails_best_practices_executable = 'path to/bundle'
AssertEqual
- \ '''path to/bundle'' exec rails_best_practices --silent -f json --output-file /dev/stdout '
- \ . ale#Escape(simplify(g:dir . '/../ruby_fixtures/valid_rails_app')),
+ \ ale#Escape('path to/bundle') . ' exec rails_best_practices'
+ \ . ' ' . b:args
+ \ . ' ' . ale#Escape(b:app_path)
+ \ . b:suffix,
\ ale_linters#ruby#rails_best_practices#GetCommand(bufnr(''))
Execute(Command callback should be empty when not in a valid Rails app):
call ale#test#SetFilename('../ruby_fixtures/not_a_rails_app/test.rb')
AssertEqual
- \ '',
- \ ale_linters#ruby#rails_best_practices#GetCommand(bufnr(''))
+ \ '',
+ \ ale_linters#ruby#rails_best_practices#GetCommand(bufnr(''))
diff --git a/test/command_callback/test_rubocop_command_callback.vader b/test/command_callback/test_rubocop_command_callback.vader
index a88d453c..fddf7145 100644
--- a/test/command_callback/test_rubocop_command_callback.vader
+++ b/test/command_callback/test_rubocop_command_callback.vader
@@ -10,24 +10,30 @@ Before:
After:
Restore
+ call ale#linter#Reset()
call ale#test#RestoreDirectory()
Execute(Executable should default to rubocop):
AssertEqual
- \ '''rubocop'' --format json --force-exclusion --stdin '
- \ . ale#Escape(g:dir . '/dummy.rb'),
+ \ ale#Escape('rubocop')
+ \ . ' --format json --force-exclusion --stdin '
+ \ . ale#Escape(ale#path#Winify(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 '
- \ . ale#Escape(g:dir . '/dummy.rb'),
+ \ ale#Escape('bin/rubocop')
+ \ . ' --format json --force-exclusion --stdin '
+ \ . ale#Escape(ale#path#Winify(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 '
- \ . ale#Escape(g:dir . '/dummy.rb'),
+ \ ale#Escape('path to/bundle') . ' exec rubocop'
+ \ . ' --format json --force-exclusion --stdin '
+ \ . ale#Escape(ale#path#Winify(g:dir . '/dummy.rb')),
\ ale_linters#ruby#rubocop#GetCommand(bufnr(''))
diff --git a/test/command_callback/test_rust_rls_callbacks.vader b/test/command_callback/test_rust_rls_callbacks.vader
index 76e69927..b01f8f06 100644
--- a/test/command_callback/test_rust_rls_callbacks.vader
+++ b/test/command_callback/test_rust_rls_callbacks.vader
@@ -28,5 +28,5 @@ Execute(The project root should be detected correctly):
call ale#test#SetFilename('rust-rls-project/test.rs')
AssertEqual
- \ g:dir . '/rust-rls-project',
+ \ ale#path#Winify(g:dir . '/rust-rls-project'),
\ ale_linters#rust#rls#GetProjectRoot(bufnr(''))
diff --git a/test/command_callback/test_scalastyle_command_callback.vader b/test/command_callback/test_scalastyle_command_callback.vader
index f051b025..953d57b3 100644
--- a/test/command_callback/test_scalastyle_command_callback.vader
+++ b/test/command_callback/test_scalastyle_command_callback.vader
@@ -1,10 +1,16 @@
Before:
+ Save g:ale_scala_scalastyle_options
+ Save g:ale_scalastyle_config_loc
+
+ unlet! g:ale_scala_scalastyle_options
+ unlet! g:ale_scalastyle_config_loc
+
runtime ale_linters/scala/scalastyle.vim
After:
+ Restore
+
call ale#linter#Reset()
- let g:ale_scala_scalastyle_options = ''
- let g:ale_scalastyle_conf_loc = ''
Execute(Should return the correct default command):
AssertEqual
@@ -15,13 +21,16 @@ Execute(Should allow using a custom config file):
let g:ale_scalastyle_config_loc = '/dooper/config.xml'
AssertEqual
- \ 'scalastyle --config ''/dooper/config.xml'' %t',
+ \ 'scalastyle'
+ \ . ' --config ' . ale#Escape('/dooper/config.xml')
+ \ . ' %t',
\ ale_linters#scala#scalastyle#GetCommand(bufnr(''))
Execute(Should allow using custom options):
let g:ale_scala_scalastyle_options = '--warnings false --quiet true'
AssertEqual
- \ 'scalastyle --config ''/dooper/config.xml'' --warnings false --quiet true %t',
+ \ 'scalastyle'
+ \ . ' --warnings false --quiet true'
+ \ . ' %t',
\ ale_linters#scala#scalastyle#GetCommand(bufnr(''))
-
diff --git a/test/command_callback/test_slimlint_command_callback.vader b/test/command_callback/test_slimlint_command_callback.vader
index 98fd9a83..d4dad4c4 100644
--- a/test/command_callback/test_slimlint_command_callback.vader
+++ b/test/command_callback/test_slimlint_command_callback.vader
@@ -9,8 +9,7 @@ After:
Restore
unlet! g:default_command
-
- let g:ale_has_override = {}
+ unlet! b:conf
call ale#linter#Reset()
call ale#test#RestoreDirectory()
@@ -21,15 +20,20 @@ Execute(The default command should be correct):
Execute(The command should have the .rubocop.yml prepended as an env var if one exists):
call ale#test#SetFilename('../slimlint-test-files/subdir/file.slim')
- AssertEqual
- \ 'SLIM_LINT_RUBOCOP_CONF=''/testplugin/test/slimlint-test-files/.rubocop.yml'' ' . g:default_command,
- \ ale_linters#slim#slimlint#GetCommand(bufnr(''))
-
-Execute(The command should have the .rubocop.yml prepended as an env var if one exists on win32):
- call ale#test#SetFilename('../slimlint-test-files/subdir/file.slim')
-
- let g:ale_has_override['win32'] = 1
-
- AssertEqual
- \ 'set SLIM_LINT_RUBOCOP_CONF=''/testplugin/test/slimlint-test-files/.rubocop.yml'' && ' . g:default_command,
- \ ale_linters#slim#slimlint#GetCommand(bufnr(''))
+ let b:conf = ale#path#Winify(g:dir . '/../slimlint-test-files/.rubocop.yml')
+
+ if has('win32')
+ " Windows uses 'set var=... && command'
+ AssertEqual
+ \ 'set SLIM_LINT_RUBOCOP_CONF='
+ \ . ale#Escape(b:conf)
+ \ . ' && ' . g:default_command,
+ \ ale_linters#slim#slimlint#GetCommand(bufnr(''))
+ else
+ " Unix uses 'var=... command'
+ AssertEqual
+ \ 'SLIM_LINT_RUBOCOP_CONF='
+ \ . ale#Escape(b:conf)
+ \ . ' ' . g:default_command,
+ \ ale_linters#slim#slimlint#GetCommand(bufnr(''))
+ endif
diff --git a/test/command_callback/test_standard_command_callback.vader b/test/command_callback/test_standard_command_callback.vader
index 193ead83..279109e0 100644
--- a/test/command_callback/test_standard_command_callback.vader
+++ b/test/command_callback/test_standard_command_callback.vader
@@ -19,8 +19,6 @@ After:
unlet! b:executable
- let g:ale_has_override = {}
-
call ale#test#SetFilename('test.txt')
call ale#test#RestoreDirectory()
@@ -29,45 +27,36 @@ After:
Execute(bin/cmd.js paths should be preferred):
call ale#test#SetFilename('standard-test-files/with-cmd/testfile.js')
- let b:executable = g:dir
- \ . '/standard-test-files/with-cmd/node_modules/standard/bin/cmd.js'
+ let b:executable = ale#path#Winify(
+ \ g:dir
+ \ . '/standard-test-files/with-cmd/node_modules/standard/bin/cmd.js'
+ \)
AssertEqual
\ b:executable,
\ ale_linters#javascript#standard#GetExecutable(bufnr(''))
AssertEqual
- \ ale#Escape(b:executable) . ' --stdin %s',
+ \ (has('win32') ? 'node.exe ' : '')
+ \ . ale#Escape(b:executable)
+ \ . ' --stdin %s',
\ ale_linters#javascript#standard#GetCommand(bufnr(''))
Execute(.bin directories should be used too):
call ale#test#SetFilename('standard-test-files/with-bin/testfile.js')
- let b:executable = g:dir
- \ . '/standard-test-files/with-bin/node_modules/.bin/standard'
-
- AssertEqual
- \ b:executable,
- \ ale_linters#javascript#standard#GetExecutable(bufnr(''))
-
- AssertEqual
- \ ale#Escape(b:executable) . ' --stdin %s',
- \ ale_linters#javascript#standard#GetCommand(bufnr(''))
-
-Execute(.js files should be executed with node on Windows):
- let g:ale_has_override['win32'] = 1
-
- call ale#test#SetFilename('standard-test-files/with-cmd/testfile.js')
-
- let b:executable = g:dir
- \ . '/standard-test-files/with-cmd/node_modules/standard/bin/cmd.js'
+ let b:executable = ale#path#Winify(
+ \ g:dir
+ \ . '/standard-test-files/with-bin/node_modules/.bin/standard'
+ \)
AssertEqual
\ b:executable,
\ ale_linters#javascript#standard#GetExecutable(bufnr(''))
AssertEqual
- \ ale#Escape('node.exe') . ' ' . ale#Escape(b:executable) . ' --stdin %s',
+ \ ale#Escape(b:executable)
+ \ . ' --stdin %s',
\ ale_linters#javascript#standard#GetCommand(bufnr(''))
Execute(The global executable should be used otherwise):
diff --git a/test/command_callback/test_swaglint_command_callback.vader b/test/command_callback/test_swaglint_command_callback.vader
index 5d04e923..379aa0cc 100644
--- a/test/command_callback/test_swaglint_command_callback.vader
+++ b/test/command_callback/test_swaglint_command_callback.vader
@@ -30,7 +30,12 @@ Execute(The yaml swaglint command callback should allow a global installation to
Execute(The yaml swaglint command callback should allow a local installation to be used):
call ale#test#SetFilename('swaglint_paths/docs/swagger.yaml')
- AssertEqual g:dir . '/swaglint_paths/node_modules/.bin/swaglint',
+
+ AssertEqual
+ \ ale#path#Winify(g:dir . '/swaglint_paths/node_modules/.bin/swaglint'),
\ ale_linters#yaml#swaglint#GetExecutable(bufnr(''))
- AssertEqual g:dir . '/swaglint_paths/node_modules/.bin/swaglint -r compact --stdin',
+
+ AssertEqual
+ \ ale#path#Winify(g:dir . '/swaglint_paths/node_modules/.bin/swaglint')
+ \ . ' -r compact --stdin',
\ ale_linters#yaml#swaglint#GetCommand(bufnr(''))
diff --git a/test/command_callback/test_thrift_command_callback.vader b/test/command_callback/test_thrift_command_callback.vader
index 43487f42..67008919 100644
--- a/test/command_callback/test_thrift_command_callback.vader
+++ b/test/command_callback/test_thrift_command_callback.vader
@@ -11,9 +11,17 @@ Before:
function! GetCommand(buffer) abort
call ale#engine#InitBufferInfo(a:buffer)
- let l:result = ale_linters#thrift#thrift#GetCommand(a:buffer)
+ let l:command = ale_linters#thrift#thrift#GetCommand(a:buffer)
call ale#engine#Cleanup(a:buffer)
- return l:result
+
+ let l:split_command = split(l:command)
+ let l:index = index(l:split_command, '-out')
+
+ if l:index >= 0
+ let l:split_command[l:index + 1] = 'TEMP'
+ endif
+
+ return join(l:split_command)
endfunction
runtime ale_linters/thrift/thrift.vim
@@ -34,28 +42,43 @@ Execute(The executable should be configurable):
AssertEqual 'foobar', ale_linters#thrift#thrift#GetExecutable(bufnr(''))
Execute(The executable should be used in the command):
- Assert GetCommand(bufnr('%')) =~# "^'thrift'"
+ AssertEqual
+ \ ale#Escape('thrift') . ' --gen cpp -strict -out TEMP %t',
+ \ GetCommand(bufnr('%'))
let b:ale_thrift_thrift_executable = 'foobar'
- Assert GetCommand(bufnr('%')) =~# "^'foobar'"
+ AssertEqual
+ \ ale#Escape('foobar') . ' --gen cpp -strict -out TEMP %t',
+ \ GetCommand(bufnr('%'))
Execute(The list of generators should be configurable):
- Assert GetCommand(bufnr('%')) =~# '--gen cpp'
-
let b:ale_thrift_thrift_generators = ['java', 'py:dynamic']
- Assert GetCommand(bufnr('%')) =~# '--gen java --gen py:dynamic'
+
+ AssertEqual
+ \ ale#Escape('thrift') . ' --gen java --gen py:dynamic -strict -out TEMP %t',
+ \ GetCommand(bufnr('%'))
let b:ale_thrift_thrift_generators = []
- Assert GetCommand(bufnr('%')) =~# '--gen cpp'
-Execute(The list of include paths should be configurable):
- Assert GetCommand(bufnr('%')) !~# '-I'
+ AssertEqual
+ \ ale#Escape('thrift') . ' --gen cpp -strict -out TEMP %t',
+ \ GetCommand(bufnr('%'))
+Execute(The list of include paths should be configurable):
let b:ale_thrift_thrift_includes = ['included/path']
- Assert GetCommand(bufnr('%')) =~# '-I included/path'
-Execute(The string of compiler options should be configurable):
- Assert GetCommand(bufnr('%')) =~# '-strict'
+ AssertEqual
+ \ ale#Escape('thrift')
+ \ . ' --gen cpp'
+ \ . ' -I included/path'
+ \ . ' -strict -out TEMP %t',
+ \ GetCommand(bufnr('%'))
+Execute(The string of compiler options should be configurable):
let b:ale_thrift_thrift_options = '-strict --allow-64bit-consts'
- Assert GetCommand(bufnr('%')) =~# '-strict --allow-64bit-consts'
+
+ AssertEqual
+ \ ale#Escape('thrift')
+ \ . ' --gen cpp -strict --allow-64bit-consts'
+ \ . ' -out TEMP %t',
+ \ GetCommand(bufnr('%'))
diff --git a/test/command_callback/test_tslint_command_callback.vader b/test/command_callback/test_tslint_command_callback.vader
index 51567951..4ad42fa5 100644
--- a/test/command_callback/test_tslint_command_callback.vader
+++ b/test/command_callback/test_tslint_command_callback.vader
@@ -12,6 +12,7 @@ Before:
runtime ale_linters/typescript/tslint.vim
call ale#test#SetDirectory('/testplugin/test/command_callback')
+ call ale#test#SetFilename('test.ts')
After:
Restore
@@ -23,7 +24,7 @@ After:
Execute(The default tslint command should be correct):
AssertEqual
- \ 'cd ''' . expand('%:p:h') . ''' && '
+ \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
\ . 'tslint --format json %t',
\ ale_linters#typescript#tslint#GetCommand(bufnr(''))
@@ -31,7 +32,7 @@ Execute(The rules directory option should be included if set):
let b:ale_typescript_tslint_rules_dir = '/foo/bar'
AssertEqual
- \ 'cd ''' . expand('%:p:h') . ''' && '
+ \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
\ . 'tslint --format json'
\ . ' -r ' . ale#Escape('/foo/bar')
\ . ' %t',
diff --git a/test/command_callback/test_xmllint_command_callback.vader b/test/command_callback/test_xmllint_command_callback.vader
index 7c0b1963..3cffde88 100644
--- a/test/command_callback/test_xmllint_command_callback.vader
+++ b/test/command_callback/test_xmllint_command_callback.vader
@@ -7,19 +7,19 @@ After:
let g:ale_xml_xmllint_executable = 'xmllint'
Execute(The xml xmllint command callback should return the correct default string):
- AssertEqual '''xmllint'' --noout -',
+ AssertEqual ale#Escape('xmllint') . ' --noout -',
\ join(split(ale_linters#xml#xmllint#GetCommand(1)))
Execute(The xml xmllint command callback should let you set options):
let g:ale_xml_xmllint_options = '--xinclude --postvalid'
- AssertEqual '''xmllint'' --xinclude --postvalid --noout -',
+ AssertEqual ale#Escape('xmllint') . ' --xinclude --postvalid --noout -',
\ join(split(ale_linters#xml#xmllint#GetCommand(1)))
Execute(The xmllint executable should be configurable):
let g:ale_xml_xmllint_executable = '~/.local/bin/xmllint'
AssertEqual '~/.local/bin/xmllint', ale_linters#xml#xmllint#GetExecutable(1)
- AssertEqual '''~/.local/bin/xmllint'' --noout -',
+ AssertEqual ale#Escape('~/.local/bin/xmllint') . ' --noout -',
\ join(split(ale_linters#xml#xmllint#GetCommand(1)))
diff --git a/test/fixers/test_autopep8_fixer_callback.vader b/test/fixers/test_autopep8_fixer_callback.vader
index c8c0bd46..600fb194 100644
--- a/test/fixers/test_autopep8_fixer_callback.vader
+++ b/test/fixers/test_autopep8_fixer_callback.vader
@@ -11,9 +11,13 @@ Before:
silent cd command_callback
let g:dir = getcwd()
+ let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
+
After:
Restore
+ unlet! b:bin_dir
+
call ale#test#RestoreDirectory()
Execute(The autopep8 callback should return the correct default values):
@@ -23,7 +27,7 @@ Execute(The autopep8 callback should return the correct default values):
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
AssertEqual
- \ {'command': "'" . g:dir . "/python_paths/with_virtualenv/env/bin/autopep8' -" },
+ \ {'command': ale#Escape(ale#path#Winify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/autopep8')) . ' -'},
\ ale#fixers#autopep8#Fix(bufnr(''))
Execute(The autopep8 callback should include options):
@@ -31,5 +35,5 @@ Execute(The autopep8 callback should include options):
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
AssertEqual
- \ {'command': "'" . g:dir . "/python_paths/with_virtualenv/env/bin/autopep8' --some-option -" },
+ \ {'command': ale#Escape(ale#path#Winify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/autopep8')) . ' --some-option -' },
\ ale#fixers#autopep8#Fix(bufnr(''))
diff --git a/test/fixers/test_elm_format_fixer_callback.vader b/test/fixers/test_elm_format_fixer_callback.vader
index b8b9ed00..8552c5d5 100644
--- a/test/fixers/test_elm_format_fixer_callback.vader
+++ b/test/fixers/test_elm_format_fixer_callback.vader
@@ -15,7 +15,7 @@ Execute(The elm-format command should have default params):
\ {
\ 'read_temporary_file': 1,
\ 'command':
- \ ale#Escape(simplify(g:dir . '/../elm-test-files/node_modules/.bin/elm-format'))
+ \ ale#Escape(ale#path#Winify(g:dir . '/../elm-test-files/node_modules/.bin/elm-format'))
\ . ' %t --yes',
\ },
\ ale#fixers#format#Fix(bufnr(''))
@@ -55,7 +55,7 @@ Execute(The elm-format command should manage empty options):
\ {
\ 'read_temporary_file': 1,
\ 'command':
- \ ale#Escape(simplify(g:dir . '/../elm-test-files/node_modules/.bin/elm-format'))
+ \ ale#Escape(ale#path#Winify(g:dir . '/../elm-test-files/node_modules/.bin/elm-format'))
\ . ' %t',
\ },
\ ale#fixers#format#Fix(bufnr(''))
@@ -68,8 +68,7 @@ Execute(The elm-format command should manage custom options):
\ {
\ 'read_temporary_file': 1,
\ 'command':
- \ ale#Escape(simplify(g:dir . '/../elm-test-files/node_modules/.bin/elm-format'))
+ \ ale#Escape(ale#path#Winify(g:dir . '/../elm-test-files/node_modules/.bin/elm-format'))
\ . ' %t --param1 --param2',
\ },
\ ale#fixers#format#Fix(bufnr(''))
-
diff --git a/test/fixers/test_eslint_fixer_callback.vader b/test/fixers/test_eslint_fixer_callback.vader
index 21eb450d..d4783fc7 100644
--- a/test/fixers/test_eslint_fixer_callback.vader
+++ b/test/fixers/test_eslint_fixer_callback.vader
@@ -2,18 +2,17 @@ Before:
call ale#test#SetDirectory('/testplugin/test/fixers')
After:
- let g:ale_has_override = {}
call ale#test#RestoreDirectory()
-Execute(The path to eslint.js should be run on Unix):
+Execute(The executable path should be correct):
call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.js')
AssertEqual
\ {
\ 'read_temporary_file': 1,
- \ 'command':
- \ ale#Escape(simplify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
- \ . ' -c ' . ale#Escape(simplify(g:dir . '/../eslint-test-files/react-app/.eslintrc.js'))
+ \ 'command': (has('win32') ? 'node.exe ' : '')
+ \ . ale#Escape(ale#path#Winify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
+ \ . ' -c ' . ale#Escape(ale#path#Winify(g:dir . '/../eslint-test-files/react-app/.eslintrc.js'))
\ . ' --fix %t',
\ },
\ ale#fixers#eslint#Fix(bufnr(''))
@@ -24,9 +23,9 @@ Execute(The lower priority configuration file in a nested directory should be pr
AssertEqual
\ {
\ 'read_temporary_file': 1,
- \ 'command':
- \ ale#Escape(simplify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
- \ . ' -c ' . ale#Escape(simplify(g:dir . '/../eslint-test-files/react-app/subdir-with-config/.eslintrc'))
+ \ 'command': (has('win32') ? 'node.exe ' : '')
+ \ . ale#Escape(ale#path#Winify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
+ \ . ' -c ' . ale#Escape(ale#path#Winify(g:dir . '/../eslint-test-files/react-app/subdir-with-config/.eslintrc'))
\ . ' --fix %t',
\ },
\ ale#fixers#eslint#Fix(bufnr(''))
@@ -37,9 +36,9 @@ Execute(package.json should be used as a last resort):
AssertEqual
\ {
\ 'read_temporary_file': 1,
- \ 'command':
- \ ale#Escape(simplify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
- \ . ' -c ' . ale#Escape(simplify(g:dir . '/../eslint-test-files/react-app/.eslintrc.js'))
+ \ 'command': (has('win32') ? 'node.exe ' : '')
+ \ . ale#Escape(ale#path#Winify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
+ \ . ' -c ' . ale#Escape(ale#path#Winify(g:dir . '/../eslint-test-files/react-app/.eslintrc.js'))
\ . ' --fix %t',
\ },
\ ale#fixers#eslint#Fix(bufnr(''))
@@ -50,8 +49,8 @@ Execute(package.json should be used as a last resort):
\ {
\ 'read_temporary_file': 1,
\ 'command':
- \ ale#Escape(simplify(g:dir . '/../eslint-test-files/node_modules/.bin/eslint'))
- \ . ' -c ' . ale#Escape(simplify(g:dir . '/../eslint-test-files/package.json'))
+ \ ale#Escape(ale#path#Winify(g:dir . '/../eslint-test-files/node_modules/.bin/eslint'))
+ \ . ' -c ' . ale#Escape(ale#path#Winify(g:dir . '/../eslint-test-files/package.json'))
\ . ' --fix %t',
\ },
\ ale#fixers#eslint#Fix(bufnr(''))
diff --git a/test/fixers/test_gofmt_fixer_callback.vader b/test/fixers/test_gofmt_fixer_callback.vader
new file mode 100644
index 00000000..14e6e063
--- /dev/null
+++ b/test/fixers/test_gofmt_fixer_callback.vader
@@ -0,0 +1,40 @@
+Before:
+ Save g:ale_go_gofmt_executable
+ Save g:ale_go_gofmt_options
+
+ " Use an invalid global executable, so we don't match it.
+ let g:ale_go_gofmt_executable = 'xxxinvalid'
+ let g:ale_go_gofmt_options = ''
+
+ call ale#test#SetDirectory('/testplugin/test/fixers')
+
+After:
+ Restore
+
+ call ale#test#RestoreDirectory()
+
+Execute(The gofmt callback should return the correct default values):
+ call ale#test#SetFilename('../go_files/testfile.go')
+
+ AssertEqual
+ \ {
+ \ 'read_temporary_file': 1,
+ \ 'command': ale#Escape('xxxinvalid')
+ \ . ' -l -w'
+ \ . ' %t',
+ \ },
+ \ ale#fixers#gofmt#Fix(bufnr(''))
+
+Execute(The gofmt callback should include custom gofmt options):
+ let g:ale_go_gofmt_options = "-r '(a) -> a'"
+ call ale#test#SetFilename('../go_files/testfile.go')
+
+ AssertEqual
+ \ {
+ \ 'read_temporary_file': 1,
+ \ 'command': ale#Escape('xxxinvalid')
+ \ . ' -l -w'
+ \ . ' ' . g:ale_go_gofmt_options
+ \ . ' %t',
+ \ },
+ \ ale#fixers#gofmt#Fix(bufnr(''))
diff --git a/test/fixers/test_isort_fixer_callback.vader b/test/fixers/test_isort_fixer_callback.vader
index 437e2764..ea4426d1 100644
--- a/test/fixers/test_isort_fixer_callback.vader
+++ b/test/fixers/test_isort_fixer_callback.vader
@@ -9,9 +9,13 @@ Before:
silent cd command_callback
let g:dir = getcwd()
+ let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
+
After:
Restore
+ unlet! b:bin_dir
+
call ale#test#RestoreDirectory()
Execute(The isort callback should return the correct default values):
@@ -21,5 +25,5 @@ Execute(The isort callback should return the correct default values):
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
AssertEqual
- \ {'command': "'" . g:dir . "/python_paths/with_virtualenv/env/bin/isort' -" },
+ \ {'command': ale#Escape(ale#path#Winify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/isort')) . ' -' },
\ ale#fixers#isort#Fix(bufnr(''))
diff --git a/test/fixers/test_phpcbf_fixer_callback.vader b/test/fixers/test_phpcbf_fixer_callback.vader
index c2fe3a66..cf02a0b5 100644
--- a/test/fixers/test_phpcbf_fixer_callback.vader
+++ b/test/fixers/test_phpcbf_fixer_callback.vader
@@ -21,7 +21,7 @@ Execute(project with phpcbf should use local by default):
call ale#test#SetFilename('php_paths/project-with-phpcbf/foo/test.php')
AssertEqual
- \ g:dir . '/php_paths/project-with-phpcbf/vendor/bin/phpcbf',
+ \ ale#path#Winify(g:dir . '/php_paths/project-with-phpcbf/vendor/bin/phpcbf'),
\ ale#fixers#phpcbf#GetExecutable(bufnr(''))
Execute(use-global should override local detection):
@@ -43,7 +43,7 @@ Execute(The phpcbf callback should return the correct default values):
call ale#test#SetFilename('php_paths/project-with-phpcbf/foo/test.php')
AssertEqual
- \ {'command': ale#Escape(g:dir . '/php_paths/project-with-phpcbf/vendor/bin/phpcbf') . ' --stdin-path=%s ' },
+ \ {'command': ale#Escape(ale#path#Winify(g:dir . '/php_paths/project-with-phpcbf/vendor/bin/phpcbf')) . ' --stdin-path=%s ' },
\ ale#fixers#phpcbf#Fix(bufnr(''))
Execute(The phpcbf callback should include the phpcbf_standard option):
@@ -51,6 +51,62 @@ Execute(The phpcbf callback should include the phpcbf_standard option):
call ale#test#SetFilename('php_paths/project-with-phpcbf/foo/test.php')
AssertEqual
- \ {'command': ale#Escape(g:dir . '/php_paths/project-with-phpcbf/vendor/bin/phpcbf') . ' --stdin-path=%s ' . '--standard=phpcbf_ruleset.xml'},
+ \ {'command': ale#Escape(ale#path#Winify(g:dir . '/php_paths/project-with-phpcbf/vendor/bin/phpcbf')) . ' --stdin-path=%s ' . '--standard=phpcbf_ruleset.xml'},
+ \ ale#fixers#phpcbf#Fix(bufnr(''))
+
+Before:
+ Save g:ale_php_phpcbf_executable
+ Save g:ale_php_phpcbf_standard
+ Save g:ale_php_phpcbf_use_global
+
+ let g:ale_php_phpcbf_executable = 'phpcbf_test'
+ let g:ale_php_phpcbf_standard = ''
+ let g:ale_php_phpcbf_use_global = 0
+
+ call ale#test#SetDirectory('/testplugin/test/fixers')
+ silent cd ..
+ silent cd command_callback
+ let g:dir = getcwd()
+
+After:
+ Restore
+
+ call ale#test#RestoreDirectory()
+
+Execute(project with phpcbf should use local by default):
+ call ale#test#SetFilename('php_paths/project-with-phpcbf/foo/test.php')
+
+ AssertEqual
+ \ ale#path#Winify(g:dir . '/php_paths/project-with-phpcbf/vendor/bin/phpcbf'),
+ \ ale#fixers#phpcbf#GetExecutable(bufnr(''))
+
+Execute(use-global should override local detection):
+ let g:ale_php_phpcbf_use_global = 1
+ call ale#test#SetFilename('php_paths/project-with-phpcbf/foo/test.php')
+
+ AssertEqual
+ \ 'phpcbf_test',
+ \ ale#fixers#phpcbf#GetExecutable(bufnr(''))
+
+Execute(project without phpcbf should use global):
+ call ale#test#SetFilename('php_paths/project-without-phpcbf/foo/test.php')
+
+ AssertEqual
+ \ 'phpcbf_test',
+ \ ale#fixers#phpcbf#GetExecutable(bufnr(''))
+
+Execute(The phpcbf callback should return the correct default values):
+ call ale#test#SetFilename('php_paths/project-with-phpcbf/foo/test.php')
+
+ AssertEqual
+ \ {'command': ale#Escape(ale#path#Winify(g:dir . '/php_paths/project-with-phpcbf/vendor/bin/phpcbf')) . ' --stdin-path=%s ' },
+ \ ale#fixers#phpcbf#Fix(bufnr(''))
+
+Execute(The phpcbf callback should include the phpcbf_standard option):
+ let g:ale_php_phpcbf_standard = 'phpcbf_ruleset.xml'
+ call ale#test#SetFilename('php_paths/project-with-phpcbf/foo/test.php')
+
+ AssertEqual
+ \ {'command': ale#Escape(ale#path#Winify(g:dir . '/php_paths/project-with-phpcbf/vendor/bin/phpcbf')) . ' --stdin-path=%s ' . '--standard=phpcbf_ruleset.xml'},
\ ale#fixers#phpcbf#Fix(bufnr(''))
diff --git a/test/fixers/test_prettier_eslint_fixer.callback.vader b/test/fixers/test_prettier_eslint_fixer.callback.vader
index 56daf93f..b48a7085 100644
--- a/test/fixers/test_prettier_eslint_fixer.callback.vader
+++ b/test/fixers/test_prettier_eslint_fixer.callback.vader
@@ -56,7 +56,7 @@ Execute(Configuration files should be detected):
\ 'command':
\ ale#Escape('prettier-eslint')
\ . ' %t'
- \ . ' --eslint-config-path ' . ale#Escape(g:dir . '/eslint-test-files/react-app/.eslintrc.js')
+ \ . ' --eslint-config-path ' . ale#Escape(ale#path#Winify(g:dir . '/eslint-test-files/react-app/.eslintrc.js'))
\ . ' --write'
\ },
\ ale#fixers#prettier_eslint#Fix(bufnr(''))
diff --git a/test/fixers/test_prettier_fixer_callback.vader b/test/fixers/test_prettier_fixer_callback.vader
index a684ad02..cc7d34d0 100644
--- a/test/fixers/test_prettier_fixer_callback.vader
+++ b/test/fixers/test_prettier_fixer_callback.vader
@@ -39,7 +39,7 @@ Execute(The prettier callback should include configuration files when the option
\ 'command': ale#Escape(g:ale_javascript_prettier_executable)
\ . ' %t'
\ . ' --parser babylon'
- \ . ' --config ' . ale#Escape(simplify(g:dir . '/../prettier-test-files/with_config/.prettierrc'))
+ \ . ' --config ' . ale#Escape(ale#path#Winify(g:dir . '/../prettier-test-files/with_config/.prettierrc'))
\ . ' --write',
\ },
\ ale#fixers#prettier#Fix(bufnr(''))
@@ -54,7 +54,7 @@ Execute(The prettier callback should include custom prettier options):
\ 'command': ale#Escape(g:ale_javascript_prettier_executable)
\ . ' %t'
\ . ' --no-semi --parser babylon'
- \ . ' --config ' . ale#Escape(simplify(g:dir . '/../prettier-test-files/with_config/.prettierrc'))
+ \ . ' --config ' . ale#Escape(ale#path#Winify(g:dir . '/../prettier-test-files/with_config/.prettierrc'))
\ . ' --write',
\ },
\ ale#fixers#prettier#Fix(bufnr(''))
diff --git a/test/fixers/test_puppetlint_fixer_callback.vader b/test/fixers/test_puppetlint_fixer_callback.vader
index 04a85e56..224d72ab 100644
--- a/test/fixers/test_puppetlint_fixer_callback.vader
+++ b/test/fixers/test_puppetlint_fixer_callback.vader
@@ -21,7 +21,7 @@ Execute(The puppetlint callback should return the correct default values):
AssertEqual
\ {'read_temporary_file': 1,
- \ 'command': "'" . g:ale_puppet_puppetlint_executable . "'"
+ \ 'command': ale#Escape(g:ale_puppet_puppetlint_executable)
\ . ' ' . g:ale_puppet_puppetlint_options
\ . ' --fix %t' },
\ ale#fixers#puppetlint#Fix(bufnr(''))
diff --git a/test/fixers/test_rubocop_fixer_callback.vader b/test/fixers/test_rubocop_fixer_callback.vader
index 87d56d07..ff2ca965 100644
--- a/test/fixers/test_rubocop_fixer_callback.vader
+++ b/test/fixers/test_rubocop_fixer_callback.vader
@@ -34,7 +34,7 @@ Execute(The rubocop callback should include configuration files):
\ {
\ 'read_temporary_file': 1,
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
- \ . ' --config ' . ale#Escape(g:dir . '/ruby_paths/with_config/.rubocop.yml')
+ \ . ' --config ' . ale#Escape(ale#path#Winify(g:dir . '/ruby_paths/with_config/.rubocop.yml'))
\ . ' --auto-correct %t',
\ },
\ ale#fixers#rubocop#Fix(bufnr(''))
@@ -47,7 +47,7 @@ Execute(The rubocop callback should include custom rubocop options):
\ {
\ 'read_temporary_file': 1,
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
- \ . ' --config ' . ale#Escape(g:dir . '/ruby_paths/with_config/.rubocop.yml')
+ \ . ' --config ' . ale#Escape(ale#path#Winify(g:dir . '/ruby_paths/with_config/.rubocop.yml'))
\ . ' --except Lint/Debugger'
\ . ' --auto-correct %t',
\ },
diff --git a/test/fixers/test_standard_fixer_callback.vader b/test/fixers/test_standard_fixer_callback.vader
index 88169bbb..34c752db 100644
--- a/test/fixers/test_standard_fixer_callback.vader
+++ b/test/fixers/test_standard_fixer_callback.vader
@@ -2,31 +2,16 @@ Before:
call ale#test#SetDirectory('/testplugin/test/fixers')
After:
- let g:ale_has_override = {}
call ale#test#RestoreDirectory()
-Execute(The path to standard.js should be run on Unix):
+Execute(The executable path should be correct):
call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.js')
AssertEqual
\ {
\ 'read_temporary_file': 1,
- \ 'command':
- \ ale#Escape(simplify(g:dir . '/../eslint-test-files/react-app/node_modules/standard/bin/cmd.js'))
- \ . ' --fix %t',
- \ },
- \ ale#fixers#standard#Fix(bufnr(''))
-
-Execute(The standard fixer with standard.js should be run with node on Windows):
- call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.js')
- let g:ale_has_override['win32'] = 1
-
- " We have to execute the file with node.
- AssertEqual
- \ {
- \ 'read_temporary_file': 1,
- \ 'command': ale#Escape('node.exe') . ' '
- \ . ale#Escape(simplify(g:dir . '/../eslint-test-files/react-app/node_modules/standard/bin/cmd.js'))
+ \ 'command': (has('win32') ? 'node.exe ' : '')
+ \ . ale#Escape(ale#path#Winify(g:dir . '/../eslint-test-files/react-app/node_modules/standard/bin/cmd.js'))
\ . ' --fix %t',
\ },
\ ale#fixers#standard#Fix(bufnr(''))
diff --git a/test/fixers/test_stylelint_fixer_callback.vader b/test/fixers/test_stylelint_fixer_callback.vader
index 482704d4..a0fc6ff4 100644
--- a/test/fixers/test_stylelint_fixer_callback.vader
+++ b/test/fixers/test_stylelint_fixer_callback.vader
@@ -2,31 +2,16 @@ Before:
call ale#test#SetDirectory('/testplugin/test/fixers')
After:
- let g:ale_has_override = {}
call ale#test#RestoreDirectory()
-Execute(The path to stylelint.js should be run on Unix):
+Execute(The executable path should be correct):
call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.css')
AssertEqual
\ {
\ 'read_temporary_file': 1,
- \ 'command':
- \ ale#Escape(simplify(g:dir . '/../eslint-test-files/react-app/node_modules/stylelint/bin/stylelint.js'))
- \ . ' --fix %t',
- \ },
- \ ale#fixers#stylelint#Fix(bufnr(''))
-
-Execute(The stylelint fixer with stylelint.js should be run with node on Windows):
- call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.css')
- let g:ale_has_override['win32'] = 1
-
- " We have to execute the file with node.
- AssertEqual
- \ {
- \ 'read_temporary_file': 1,
- \ 'command': ale#Escape('node.exe') . ' '
- \ . ale#Escape(simplify(g:dir . '/../eslint-test-files/react-app/node_modules/stylelint/bin/stylelint.js'))
+ \ 'command': (has('win32') ? 'node.exe ' : '')
+ \ . ale#Escape(ale#path#Winify(g:dir . '/../eslint-test-files/react-app/node_modules/stylelint/bin/stylelint.js'))
\ . ' --fix %t',
\ },
\ ale#fixers#stylelint#Fix(bufnr(''))
diff --git a/test/fixers/test_trim_whitespace.vader b/test/fixers/test_trim_whitespace.vader
new file mode 100644
index 00000000..2ffbcb04
--- /dev/null
+++ b/test/fixers/test_trim_whitespace.vader
@@ -0,0 +1,28 @@
+Before:
+ call ale#test#SetDirectory('/testplugin/test/fixers')
+
+After:
+ call ale#test#RestoreDirectory()
+
+Execute(Should delete all whitespace at the end of different lines):
+ AssertEqual
+ \ [
+ \ 'def foo():',
+ \ ' some_variable = this_is_a_longer_function(',
+ \ 'first_argument,',
+ \ ' second_argument,',
+ \ ' third_with_function_call(',
+ \ 'foo,',
+ \ ' bar,',
+ \ '))',
+ \ ],
+ \ ale#fixers#generic#TrimWhitespace(bufnr(''), [
+ \ 'def foo():',
+ \ ' some_variable = this_is_a_longer_function(',
+ \ 'first_argument,',
+ \ ' second_argument,',
+ \ ' third_with_function_call(',
+ \ 'foo,',
+ \ ' bar,',
+ \ '))',
+ \ ])
diff --git a/test/fixers/test_yapf_fixer_callback.vader b/test/fixers/test_yapf_fixer_callback.vader
index 6edc2678..e6075568 100644
--- a/test/fixers/test_yapf_fixer_callback.vader
+++ b/test/fixers/test_yapf_fixer_callback.vader
@@ -9,9 +9,13 @@ Before:
silent cd command_callback
let g:dir = getcwd()
+ let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
+
After:
Restore
+ unlet! b:bin_dir
+
call ale#test#RestoreDirectory()
Execute(The yapf callback should return the correct default values):
@@ -22,7 +26,7 @@ Execute(The yapf callback should return the correct default values):
call ale#test#SetFilename('python_paths/with_virtualenv/subdir/foo/bar.py')
AssertEqual
- \ {'command': ale#Escape(g:dir . '/python_paths/with_virtualenv/env/bin/yapf')},
+ \ {'command': ale#Escape(ale#path#Winify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/yapf'))},
\ ale#fixers#yapf#Fix(bufnr(''))
\
Execute(The yapf should include the .style.yapf file if present):
@@ -31,8 +35,8 @@ Execute(The yapf should include the .style.yapf file if present):
AssertEqual
\ {
\ 'command':
- \ ale#Escape(g:dir . '/python_paths/with_virtualenv/env/bin/yapf')
+ \ ale#Escape(ale#path#Winify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/yapf'))
\ . ' --no-local-style'
- \ . ' --style ' . ale#Escape(g:dir . '/python_paths/with_virtualenv/dir_with_yapf_config/.style.yapf'),
+ \ . ' --style ' . ale#Escape(ale#path#Winify(g:dir . '/python_paths/with_virtualenv/dir_with_yapf_config/.style.yapf')),
\ },
\ ale#fixers#yapf#Fix(bufnr(''))
diff --git a/test/go_files/testfile.go b/test/go_files/testfile.go
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/go_files/testfile.go
diff --git a/test/handler/test_flow_handler.vader b/test/handler/test_flow_handler.vader
index 5037fcb1..47efc30d 100644
--- a/test/handler/test_flow_handler.vader
+++ b/test/handler/test_flow_handler.vader
@@ -260,7 +260,7 @@ Execute(The flow handler should handle relative paths):
\ "descr": "React element `Foo`",
\ "type": "Blame",
\ "loc": {
- \ "source": "vim-ale-flow/index.js",
+ \ "source": expand('%:p'),
\ "type": "SourceFile",
\ "start": {
\ "line": 6,
@@ -273,7 +273,7 @@ Execute(The flow handler should handle relative paths):
\ "offset": 108
\ }
\ },
- \ "path": "vim-ale-flow/index.js",
+ \ "path": expand('%:p'),
\ "line": 6,
\ "endline": 6,
\ "start": 3,
@@ -318,7 +318,7 @@ Execute(The flow handler should handle relative paths):
\ "descr": "props of React element `Foo`",
\ "type": "Blame",
\ "loc": {
- \ "source": "vim-ale-flow/index.js",
+ \ "source": expand('%:p'),
\ "type": "SourceFile",
\ "start": {
\ "line": 6,
@@ -331,7 +331,7 @@ Execute(The flow handler should handle relative paths):
\ "offset": 108
\ }
\ },
- \ "path": "vim-ale-flow/index.js",
+ \ "path": expand('%:p'),
\ "line": 6,
\ "endline": 6,
\ "start": 3,
diff --git a/test/handler/test_idris_handler.vader b/test/handler/test_idris_handler.vader
index b1fb2a01..6a032ea6 100644
--- a/test/handler/test_idris_handler.vader
+++ b/test/handler/test_idris_handler.vader
@@ -12,7 +12,11 @@ After:
call ale#linter#Reset()
Execute(The idris handler should parse messages that reference a single column):
- call ale#test#SetFilename('/tmp/foo.idr')
+ if has('win32')
+ call ale#test#SetFilename($TEMP . '\foo.idr')
+ else
+ call ale#test#SetFilename('/tmp/foo.idr')
+ endif
AssertEqual
\ [
@@ -24,21 +28,21 @@ Execute(The idris handler should parse messages that reference a single column):
\ }
\ ],
\ ale_linters#idris#idris#Handle(bufnr(''), [
- \ '/tmp/foo.idr:4:5:',
- \ 'When checking right hand side of main with expected type',
- \ ' IO ()',
- \ '',
- \ 'When checking an application of function Prelude.Monad.>>=:',
- \ ' Type mismatch between',
- \ ' IO () (Type of putStrLn _)',
- \ ' and',
- \ ' _ -> _ (Is putStrLn _ applied to too many arguments?)',
- \ '',
- \ ' Specifically:',
- \ ' Type mismatch between',
- \ ' IO',
- \ ' and',
- \ ' \uv => _ -> uv',
+ \ expand('%:p') . ':4:5:',
+ \ 'When checking right hand side of main with expected type',
+ \ ' IO ()',
+ \ '',
+ \ 'When checking an application of function Prelude.Monad.>>=:',
+ \ ' Type mismatch between',
+ \ ' IO () (Type of putStrLn _)',
+ \ ' and',
+ \ ' _ -> _ (Is putStrLn _ applied to too many arguments?)',
+ \ '',
+ \ ' Specifically:',
+ \ ' Type mismatch between',
+ \ ' IO',
+ \ ' and',
+ \ ' \uv => _ -> uv',
\ ])
Execute(The idris handler should parse messages that reference a column range):
@@ -54,9 +58,9 @@ Execute(The idris handler should parse messages that reference a column range):
\ }
\ ],
\ ale_linters#idris#idris#Handle(bufnr(''), [
- \ '/tmp/foo.idr:11:11-13:',
- \ 'When checking right hand side of Main.case block in main at /tmp/foo.idr:10:10 with expected type',
- \ ' IO ()',
- \ '',
- \ 'Last statement in do block must be an expression',
+ \ expand('%:p') . ':11:11-13:',
+ \ 'When checking right hand side of Main.case block in main at /tmp/foo.idr:10:10 with expected type',
+ \ ' IO ()',
+ \ '',
+ \ 'Last statement in do block must be an expression',
\ ])
diff --git a/test/handler/test_llc_handler.vader b/test/handler/test_llc_handler.vader
new file mode 100644
index 00000000..edea2337
--- /dev/null
+++ b/test/handler/test_llc_handler.vader
@@ -0,0 +1,56 @@
+Before:
+ runtime! ale_linters/llvm/llc.vim
+
+Execute(llc handler should parse errors output for STDIN):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 10,
+ \ 'col': 7,
+ \ 'text': "error: value doesn't match function result type 'i32'",
+ \ 'type': 'E',
+ \ },
+ \ {
+ \ 'lnum': 10,
+ \ 'col': 13,
+ \ 'text': "error: use of undefined value '@foo'",
+ \ 'type': 'E',
+ \ },
+ \ ],
+ \ ale_linters#llvm#llc#HandleErrors(bufnr(''), [
+ \ "llc: <stdin>:10:7: error: value doesn't match function result type 'i32'",
+ \ 'ret i64 0',
+ \ ' ^',
+ \ '',
+ \ "llc: <stdin>:10:13: error: use of undefined value '@foo'",
+ \ 'call void @foo(i64 %0)',
+ \ ' ^',
+ \ ])
+
+Execute(llc handler should parse errors output for some file):
+ call ale#test#SetFilename('test.ll')
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 10,
+ \ 'col': 7,
+ \ 'text': "error: value doesn't match function result type 'i32'",
+ \ 'type': 'E',
+ \ },
+ \ {
+ \ 'lnum': 10,
+ \ 'col': 13,
+ \ 'text': "error: use of undefined value '@foo'",
+ \ 'type': 'E',
+ \ },
+ \ ],
+ \ ale_linters#llvm#llc#HandleErrors(bufnr(''), [
+ \ "llc: /path/to/test.ll:10:7: error: value doesn't match function result type 'i32'",
+ \ 'ret i64 0',
+ \ ' ^',
+ \ '',
+ \ "llc: /path/to/test.ll:10:13: error: use of undefined value '@foo'",
+ \ 'call void @foo(i64 %0)',
+ \ ' ^',
+ \ ])
+
diff --git a/test/handler/test_mcsc_handler.vader b/test/handler/test_mcsc_handler.vader
index a65185ca..5f4c133c 100644
--- a/test/handler/test_mcsc_handler.vader
+++ b/test/handler/test_mcsc_handler.vader
@@ -19,21 +19,21 @@ Execute(The mcs handler should handle cannot find symbol errors):
\ 'col' : 29,
\ 'text': 'error CS1001: ; expected',
\ 'type': 'E',
- \ 'filename': '/home/foo/project/bar/Test.cs'
+ \ 'filename': ale#path#Winify('/home/foo/project/bar/Test.cs', 'add_drive'),
\ },
\ {
\ 'lnum': 101,
\ 'col': 0,
\ 'text': 'error CS1028: Unexpected processor directive (no #if for this #endif)',
\ 'type': 'E',
- \ 'filename': '/home/foo/project/bar/Test.cs'
+ \ 'filename': ale#path#Winify('/home/foo/project/bar/Test.cs', 'add_drive'),
\ },
\ {
\ 'lnum': 10,
\ 'col': 12,
\ 'text': 'warning CS0123: some warning',
\ 'type': 'W',
- \ 'filename': '/home/foo/project/bar/Test.cs'
+ \ 'filename': ale#path#Winify('/home/foo/project/bar/Test.cs', 'add_drive'),
\ },
\ ],
\ ale_linters#cs#mcsc#Handle(347, [
diff --git a/test/sign/test_sign_placement.vader b/test/sign/test_sign_placement.vader
index 69ae91ce..36f34e16 100644
--- a/test/sign/test_sign_placement.vader
+++ b/test/sign/test_sign_placement.vader
@@ -269,3 +269,14 @@ Execute(It should be possible to clear signs with empty lists):
Execute(No exceptions should be thrown when setting signs for invalid buffers):
call ale#sign#SetSigns(123456789, [{'lnum': 15, 'col': 2, 'type': 'W', 'text': 'e'}])
+
+Execute(Signs should be removed when lines have multiple sign IDs on them):
+ " We can fail to remove signs if there are multiple signs on one line,
+ " say after deleting lines in Vim, etc.
+ exec 'sign place 1000347 line=3 name=ALEErrorSign buffer=' . bufnr('')
+ exec 'sign place 1000348 line=3 name=ALEWarningSign buffer=' . bufnr('')
+ exec 'sign place 1000349 line=10 name=ALEErrorSign buffer=' . bufnr('')
+ exec 'sign place 1000350 line=10 name=ALEWarningSign buffer=' . bufnr('')
+
+ call ale#sign#SetSigns(bufnr(''), [])
+ AssertEqual [], ParseSigns()
diff --git a/test/test_lint_error_delay.vader b/test/test_lint_error_delay.vader
index 4c7f0947..7f081794 100644
--- a/test/test_lint_error_delay.vader
+++ b/test/test_lint_error_delay.vader
@@ -17,10 +17,6 @@ Execute(ALE should stop linting for a while after exceptions are thrown):
AssertThrows call ale#Lint()
call ale#Lint()
-Execute(ALE should stop queuing echo messages for a while after exceptions are thrown):
- AssertThrows call ale#cursor#EchoCursorWarningWithDelay()
- call ale#cursor#EchoCursorWarningWithDelay()
-
Execute(ALE should stop echoing messages for a while after exceptions are thrown):
AssertThrows call ale#cursor#EchoCursorWarning()
call ale#cursor#EchoCursorWarning()
diff --git a/test/test_linter_retrieval.vader b/test/test_linter_retrieval.vader
index afb540d6..1a1e2580 100644
--- a/test/test_linter_retrieval.vader
+++ b/test/test_linter_retrieval.vader
@@ -97,7 +97,7 @@ Execute (The local alias option shouldn't completely replace the global one):
call ale#linter#Define('testft1', g:testlinter1)
call ale#linter#Define('testft2', g:testlinter2)
let g:ale_linter_aliases = {'testft1': ['testft1', 'testft2']}
- " This is a key set for a differnt filetype.
+ " This is a key set for a different filetype.
" We should look for a key in this Dictionary first, and then check the
" global Dictionary.
let b:ale_linter_aliases = {'testft3': ['testft1']}
diff --git a/test/test_python_virtualenv.vader b/test/test_python_virtualenv.vader
new file mode 100644
index 00000000..b44c5fa2
--- /dev/null
+++ b/test/test_python_virtualenv.vader
@@ -0,0 +1,12 @@
+Before:
+ Save $VIRTUAL_ENV
+ let $VIRTUAL_ENV = "/opt/example/"
+
+After:
+ Restore
+
+Execute(ale#python#FindVirtualenv falls back to $VIRTUAL_ENV when no directories match):
+ AssertEqual
+ \ ale#python#FindVirtualenv(bufnr('%')),
+ \ '/opt/example/',
+ \ 'Expected VIRTUAL_ENV environment variable to be used, but it was not'
diff --git a/test/test_statusline.vader b/test/test_statusline.vader
index 7978a509..0ce1d36f 100644
--- a/test/test_statusline.vader
+++ b/test/test_statusline.vader
@@ -88,7 +88,7 @@ Execute (Count should be match the loclist):
\ 'total': 15,
\}, ale#statusline#Count(bufnr(''))
-Execute (Output should be empty for non-existant buffer):
+Execute (Output should be empty for non-existent buffer):
AssertEqual Counts({}), ale#statusline#Count(9001)
Execute (Status() should return just errors for the old format):