diff options
Diffstat (limited to 'test/command_callback')
76 files changed, 1267 insertions, 141 deletions
diff --git a/test/command_callback/alex-node-modules-2/node_modules/alex/cli.js b/test/command_callback/alex-node-modules-2/node_modules/alex/cli.js new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/command_callback/alex-node-modules-2/node_modules/alex/cli.js diff --git a/test/command_callback/alex-node-modules/node_modules/.bin/alex b/test/command_callback/alex-node-modules/node_modules/.bin/alex new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/command_callback/alex-node-modules/node_modules/.bin/alex diff --git a/test/command_callback/fecs_paths/fecs b/test/command_callback/fecs_paths/fecs new file mode 100755 index 00000000..e69de29b --- /dev/null +++ b/test/command_callback/fecs_paths/fecs diff --git a/test/command_callback/fecs_paths/fecs.exe b/test/command_callback/fecs_paths/fecs.exe new file mode 100755 index 00000000..e69de29b --- /dev/null +++ b/test/command_callback/fecs_paths/fecs.exe diff --git a/test/command_callback/java_paths_no_main/src/test/java/com/something/dummy b/test/command_callback/java_paths_no_main/src/test/java/com/something/dummy new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/command_callback/java_paths_no_main/src/test/java/com/something/dummy diff --git a/test/command_callback/php-langserver-project/with-composer/composer.json b/test/command_callback/php-langserver-project/with-composer/composer.json new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/command_callback/php-langserver-project/with-composer/composer.json diff --git a/test/command_callback/php-langserver-project/with-composer/vendor/bin/php-language-server.php b/test/command_callback/php-langserver-project/with-composer/vendor/bin/php-language-server.php new file mode 100755 index 00000000..e69de29b --- /dev/null +++ b/test/command_callback/php-langserver-project/with-composer/vendor/bin/php-language-server.php diff --git a/test/command_callback/php-langserver-project/with-git/vendor/bin/php-language-server.php b/test/command_callback/php-langserver-project/with-git/vendor/bin/php-language-server.php new file mode 100755 index 00000000..e69de29b --- /dev/null +++ b/test/command_callback/php-langserver-project/with-git/vendor/bin/php-language-server.php diff --git a/test/command_callback/python_paths/with_bandit/.bandit b/test/command_callback/python_paths/with_bandit/.bandit new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/command_callback/python_paths/with_bandit/.bandit diff --git a/test/command_callback/python_paths/with_bandit/namespace/foo/__init__.py b/test/command_callback/python_paths/with_bandit/namespace/foo/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/command_callback/python_paths/with_bandit/namespace/foo/__init__.py diff --git a/test/command_callback/python_paths/with_bandit/namespace/foo/bar.py b/test/command_callback/python_paths/with_bandit/namespace/foo/bar.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/command_callback/python_paths/with_bandit/namespace/foo/bar.py diff --git a/test/command_callback/python_paths/with_virtualenv/env/Scripts/pylama.exe b/test/command_callback/python_paths/with_virtualenv/env/Scripts/pylama.exe new file mode 100755 index 00000000..e69de29b --- /dev/null +++ b/test/command_callback/python_paths/with_virtualenv/env/Scripts/pylama.exe diff --git a/test/command_callback/python_paths/with_virtualenv/env/Scripts/vulture.exe b/test/command_callback/python_paths/with_virtualenv/env/Scripts/vulture.exe new file mode 100755 index 00000000..e69de29b --- /dev/null +++ b/test/command_callback/python_paths/with_virtualenv/env/Scripts/vulture.exe diff --git a/test/command_callback/python_paths/with_virtualenv/env/bin/pylama b/test/command_callback/python_paths/with_virtualenv/env/bin/pylama new file mode 100755 index 00000000..e69de29b --- /dev/null +++ b/test/command_callback/python_paths/with_virtualenv/env/bin/pylama diff --git a/test/command_callback/python_paths/with_virtualenv/env/bin/vulture b/test/command_callback/python_paths/with_virtualenv/env/bin/vulture new file mode 100755 index 00000000..e69de29b --- /dev/null +++ b/test/command_callback/python_paths/with_virtualenv/env/bin/vulture diff --git a/test/command_callback/ruby_paths/with_config/.standard.yml b/test/command_callback/ruby_paths/with_config/.standard.yml new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/command_callback/ruby_paths/with_config/.standard.yml diff --git a/test/command_callback/test_alex_command_callback.vader b/test/command_callback/test_alex_command_callback.vader new file mode 100644 index 00000000..98769e0b --- /dev/null +++ b/test/command_callback/test_alex_command_callback.vader @@ -0,0 +1,34 @@ +Before: + call ale#assert#SetUpLinterTest('tex', 'alex') + call ale#test#SetFilename('test_file.tex') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The global executable should be used when the local one cannot be found): + AssertLinter 'alex', + \ ale#Escape('alex') . ' %s --text', + +Execute(Should use the node_modules/.bin executable, if available): + call ale#test#SetFilename('alex-node-modules/test_file.tex') + + AssertLinter ale#path#Simplify(g:dir . '/alex-node-modules/node_modules/.bin/alex'), + \ ale#Escape(ale#path#Simplify(g:dir . '/alex-node-modules/node_modules/.bin/alex')) + \ . ' %s --text', + +Execute(Should use the node_modules/alex executable, if available): + call ale#test#SetFilename('alex-node-modules-2/test_file.tex') + + AssertLinter ale#path#Simplify(g:dir . '/alex-node-modules-2/node_modules/alex/cli.js'), + \ (has('win32') ? 'node.exe ' : '') + \ . ale#Escape(ale#path#Simplify(g:dir . '/alex-node-modules-2/node_modules/alex/cli.js')) + \ . ' %s --text', + +Execute(Should let users configure a global executable and override local paths): + call ale#test#SetFilename('write-good-node-modules-2/test_file.tex') + + let g:ale_alex_executable = '/path/to/custom/alex' + let g:ale_alex_use_global = 1 + + AssertLinter '/path/to/custom/alex', + \ ale#Escape('/path/to/custom/alex') . ' %s --text' diff --git a/test/command_callback/test_ameba_command_callback.vader b/test/command_callback/test_ameba_command_callback.vader new file mode 100644 index 00000000..7746b44f --- /dev/null +++ b/test/command_callback/test_ameba_command_callback.vader @@ -0,0 +1,20 @@ +Before: + call ale#assert#SetUpLinterTest('crystal', 'ameba') + call ale#test#SetFilename('dummy.cr') + + let g:ale_crystal_ameba_executable = 'bin/ameba' + +After: + call ale#assert#TearDownLinterTest() + +Execute(Executable should default to bin/ameba): + AssertLinter 'bin/ameba', ale#Escape('bin/ameba') + \ . ' --format json ' + \ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.cr')) + +Execute(Should be able to set a custom executable): + let g:ale_crystal_ameba_executable = 'ameba' + + AssertLinter 'ameba' , ale#Escape('ameba') + \ . ' --format json ' + \ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.cr')) diff --git a/test/command_callback/test_asciidoc_textlint_command_callbacks.vader b/test/command_callback/test_asciidoc_textlint_command_callbacks.vader new file mode 100644 index 00000000..623833b2 --- /dev/null +++ b/test/command_callback/test_asciidoc_textlint_command_callbacks.vader @@ -0,0 +1,65 @@ +" Author: januswel, w0rp + +Before: + " This is just one language for the linter. + call ale#assert#SetUpLinterTest('asciidoc', 'textlint') + + " The configuration is shared between many languages. + Save g:ale_textlint_executable + Save g:ale_textlint_use_global + Save g:ale_textlint_options + + let g:ale_textlint_executable = 'textlint' + let g:ale_textlint_use_global = 0 + let g:ale_textlint_options = '' + + unlet! b:ale_textlint_executable + unlet! b:ale_textlint_use_global + unlet! b:ale_textlint_options + +After: + unlet! b:command_tail + unlet! b:ale_textlint_executable + unlet! b:ale_textlint_use_global + unlet! b:ale_textlint_options + + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'textlint', + \ ale#Escape('textlint') . ' -f json --stdin --stdin-filename %s' + +Execute(The executable should be configurable): + let b:ale_textlint_executable = 'foobar' + + AssertLinter 'foobar', + \ ale#Escape('foobar') . ' -f json --stdin --stdin-filename %s' + +Execute(The options should be configurable): + let b:ale_textlint_options = '--something' + + AssertLinter 'textlint', + \ ale#Escape('textlint') . ' --something -f json --stdin --stdin-filename %s' + +Execute(The local executable from .bin should be used if available): + call ale#test#SetFilename('textlint_paths/with_bin_path/foo.txt') + + AssertLinter + \ ale#path#Simplify(g:dir . '/textlint_paths/with_bin_path/node_modules/.bin/textlint'), + \ ale#Escape(ale#path#Simplify(g:dir . '/textlint_paths/with_bin_path/node_modules/.bin/textlint')) + \ . ' -f json --stdin --stdin-filename %s' + +Execute(The local executable from textlint/bin should be used if available): + call ale#test#SetFilename('textlint_paths/with_textlint_bin_path/foo.txt') + + if has('win32') + AssertLinter + \ ale#path#Simplify(g:dir . '/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'), + \ ale#Escape('node.exe') . ' ' . ale#Escape(ale#path#Simplify(g:dir . '/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js')) + \ . ' -f json --stdin --stdin-filename %s' + else + AssertLinter + \ ale#path#Simplify(g:dir . '/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'), + \ ale#Escape(ale#path#Simplify(g:dir . '/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js')) + \ . ' -f json --stdin --stdin-filename %s' + endif diff --git a/test/command_callback/test_bandit_command_callback.vader b/test/command_callback/test_bandit_command_callback.vader new file mode 100644 index 00000000..274ce901 --- /dev/null +++ b/test/command_callback/test_bandit_command_callback.vader @@ -0,0 +1,71 @@ +Before: + call ale#assert#SetUpLinterTest('python', 'bandit') + let b:bandit_flags = ' --format custom ' + \ . '--msg-template "{line}:{test_id}:{severity}:{msg}" ' + +After: + call ale#assert#TearDownLinterTest() + unlet! b:bandit_flags + +Execute(The bandit command callback should return default string): + AssertLinter 'bandit', + \ ale#Escape('bandit') + \ . b:bandit_flags + \ . ' -' + +Execute(The bandit command callback should allow options): + let g:ale_python_bandit_options = '--configfile bandit.yaml' + + AssertLinter 'bandit', + \ ale#Escape('bandit') + \ . b:bandit_flags + \ . ' --configfile bandit.yaml -' + +Execute(The bandit executable should be configurable): + let g:ale_python_bandit_executable = '~/.local/bin/bandit' + + AssertLinter '~/.local/bin/bandit', + \ ale#Escape('~/.local/bin/bandit') + \ . b:bandit_flags + \ . ' -' + +Execute(Setting executable to 'pipenv' appends 'run bandit'): + let g:ale_python_bandit_executable = 'path/to/pipenv' + + AssertLinter 'path/to/pipenv', + \ ale#Escape('path/to/pipenv') + \ . ' run bandit' + \ . b:bandit_flags + \ . ' -' + +Execute(Pipenv is detected when python_bandit_auto_pipenv is set): + let g:ale_python_bandit_auto_pipenv = 1 + call ale#test#SetFilename('/testplugin/test/python_fixtures/pipenv/whatever.py') + + AssertLinter 'pipenv', + \ ale#Escape('pipenv') + \ . ' run bandit' + \ . b:bandit_flags + \ . ' -' + +Execute(The bandit command callback should add .bandit by default): + silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_bandit/namespace/foo/bar.py') + + let b:config_path = ale#path#Simplify( + \ g:dir . '/python_paths/with_bandit/.bandit' + \) + + AssertLinter 'bandit', + \ ale#Escape('bandit') + \ . ' --ini ' . ale#Escape(b:config_path) + \ . b:bandit_flags + \ . ' -' + +Execute(The bandit command callback should support not using .bandit): + silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_bandit/subdir/foo/bar.py') + let g:ale_python_bandit_use_config = 0 + + AssertLinter 'bandit', + \ ale#Escape('bandit') + \ . b:bandit_flags + \ . ' -' diff --git a/test/command_callback/test_bingo_command_callback.vader b/test/command_callback/test_bingo_command_callback.vader new file mode 100644 index 00000000..f4cb3231 --- /dev/null +++ b/test/command_callback/test_bingo_command_callback.vader @@ -0,0 +1,46 @@ +Before: + call ale#assert#SetUpLinterTest('go', 'bingo') + +After: + Restore + + if isdirectory(g:dir . '/.git') + call delete(g:dir . '/.git', 'd') + endif + + unlet! b:ale_completion_enabled + + call ale#assert#TearDownLinterTest() + +Execute(should set correct defaults): + AssertLinter 'bingo', ale#Escape('bingo') . ' --mode stdio' + +Execute(should configure bingo callback executable): + let b:ale_go_bingo_executable = 'boo' + let b:ale_go_bingo_options = '' + + AssertLinter 'boo', ale#Escape('boo') + +Execute(should set bingo options): + call ale#test#SetFilename('go_paths/go1/prj1/file.go') + " let b:ale_completion_enabled = 1 + let b:ale_go_bingo_options = '' + + AssertLinter 'bingo', + \ ale#Escape('bingo') . '' + + let b:ale_go_bingo_options = '--mode stdio --trace' + + AssertLinter 'bingo', + \ ale#Escape('bingo') . ' --mode stdio --trace' + +Execute(Should return directory for 'go.mod' if found in parent directory): + call ale#test#SetFilename('../go_files/test.go') + + AssertLSPProject ale#path#Simplify(g:dir . '/../go_files') + +Execute(Should return nearest directory with '.git' if found in parent directory): + call ale#test#SetFilename('test.go') + call mkdir(g:dir . '/.git') + + AssertLSPProject g:dir diff --git a/test/command_callback/test_c_clang_command_callbacks.vader b/test/command_callback/test_c_clang_command_callbacks.vader index 7d2ff0bf..b8c02e4d 100644 --- a/test/command_callback/test_c_clang_command_callbacks.vader +++ b/test/command_callback/test_c_clang_command_callbacks.vader @@ -13,8 +13,8 @@ After: call ale#assert#TearDownLinterTest() Execute(The executable should be configurable): - AssertLinter 'clang', ['', ale#Escape('clang') . b:command_tail] + AssertLinter 'clang', [ale#Escape('clang') . b:command_tail] let b:ale_c_clang_executable = 'foobar' - AssertLinter 'foobar', ['', ale#Escape('foobar') . b:command_tail] + AssertLinter 'foobar', [ale#Escape('foobar') . b:command_tail] diff --git a/test/command_callback/test_c_gcc_command_callbacks.vader b/test/command_callback/test_c_gcc_command_callbacks.vader index 1f51c3bc..c5b316c8 100644 --- a/test/command_callback/test_c_gcc_command_callbacks.vader +++ b/test/command_callback/test_c_gcc_command_callbacks.vader @@ -14,8 +14,8 @@ After: unlet! b:command_tail Execute(The executable should be configurable): - AssertLinter 'gcc', ['', ale#Escape('gcc') . b:command_tail] + AssertLinter 'gcc', [ale#Escape('gcc') . b:command_tail] let b:ale_c_gcc_executable = 'foobar' - AssertLinter 'foobar', ['', ale#Escape('foobar') . b:command_tail] + AssertLinter 'foobar', [ale#Escape('foobar') . b:command_tail] diff --git a/test/command_callback/test_cargo_command_callbacks.vader b/test/command_callback/test_cargo_command_callbacks.vader index f0afbc91..438c97db 100644 --- a/test/command_callback/test_cargo_command_callbacks.vader +++ b/test/command_callback/test_cargo_command_callbacks.vader @@ -1,106 +1,113 @@ Before: call ale#assert#SetUpLinterTest('rust', 'cargo') + call ale#test#SetFilename('cargo_paths/test.rs') + let g:cd = 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/cargo_paths')) . ' && ' let g:suffix = ' --frozen --message-format=json -q' + let g:ale_rust_cargo_avoid_whole_workspace = 0 " Test with version 0.22.0 by default. - WithChainResults ['cargo 0.22.0 (3423351a5 2017-10-06)'] + GivenCommandOutput ['cargo 0.22.0 (3423351a5 2017-10-06)'] After: call ale#assert#TearDownLinterTest() + unlet! g:cd unlet! g:suffix Execute(The linter should not be executed when there's no Cargo.toml file): + call ale#test#SetFilename('../foo.rs') AssertLinterNotExecuted Execute(The linter should be executed when there is a Cargo.toml file): - call ale#test#SetFilename('cargo_paths/test.rs') - - WithChainResults [] - AssertLinter 'cargo', - \ 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/cargo_paths')) . ' && ' - \ . 'cargo build --frozen --message-format=json -q' - -Execute(The default command should be correct): - WithChainResults [] - AssertLinter '', ['cargo --version', 'cargo build' . g:suffix] + GivenCommandOutput [] + AssertLinter 'cargo', 'cargo build --frozen --message-format=json -q' Execute(`cargo check` should be used when the version is new enough): - WithChainResults ['cargo 0.17.0 (3423351a5 2017-10-06)'] - AssertLinter '', ['cargo --version', 'cargo check' . g:suffix] + GivenCommandOutput ['cargo 0.17.0 (3423351a5 2017-10-06)'] + AssertLinter 'cargo', [ + \ ale#Escape('cargo') . ' --version', + \ 'cargo check' . g:suffix, + \] " We should cache the version check - WithChainResults [] - AssertLinter '', ['', 'cargo check' . g:suffix] + GivenCommandOutput [] + AssertLinter 'cargo', ['cargo check' . g:suffix] Execute(`cargo build` should be used when cargo is too old): - WithChainResults ['cargo 0.16.0 (3423351a5 2017-10-06)'] - AssertLinter '', ['cargo --version', 'cargo build' . g:suffix] + GivenCommandOutput ['cargo 0.16.0 (3423351a5 2017-10-06)'] + AssertLinter 'cargo', [ + \ ale#Escape('cargo') . ' --version', + \ 'cargo build' . g:suffix, + \] - WithChainResults [] - AssertLinter '', ['', 'cargo build' . g:suffix] + GivenCommandOutput [] + AssertLinter 'cargo', ['cargo build' . g:suffix] Execute(`cargo build` should be used when g:ale_rust_cargo_use_check is set to 0): let g:ale_rust_cargo_use_check = 0 - WithChainResults ['cargo 0.24.0 (3423351a5 2017-10-06)'] - AssertLinter '', ['cargo --version', 'cargo build' . g:suffix] + GivenCommandOutput ['cargo 0.24.0 (3423351a5 2017-10-06)'] + AssertLinter 'cargo', [ + \ ale#Escape('cargo') . ' --version', + \ 'cargo build' . g:suffix, + \] " We should cache the version check - WithChainResults [] - AssertLinter '', ['', 'cargo build' . g:suffix] + GivenCommandOutput [] + AssertLinter 'cargo', ['cargo build' . g:suffix] Execute(`cargo check` should be used when the version is new enough): - AssertLinter '', ['cargo --version', 'cargo check' . g:suffix] + AssertLinter 'cargo', [ + \ ale#Escape('cargo') . ' --version', + \ 'cargo check' . g:suffix, + \] " We should cache the version check - WithChainResults [] - AssertLinter '', ['', 'cargo check' . g:suffix] + GivenCommandOutput [] + AssertLinter 'cargo', ['cargo check' . g:suffix] Execute(--all-targets should be used when g:ale_rust_cargo_check_all_targets is set to 1): let g:ale_rust_cargo_check_all_targets = 1 - AssertLinter '', ['cargo --version', 'cargo check --all-targets' . g:suffix] - + AssertLinter 'cargo', [ale#Escape('cargo') . ' --version', 'cargo check --all-targets' . g:suffix] " We should cache the version check - WithChainResults [] - AssertLinter '', ['', 'cargo check --all-targets' . g:suffix] + AssertLinter 'cargo', ['cargo check --all-targets' . g:suffix] Execute(--tests should be used when g:ale_rust_cargo_check_tests is set to 1): let g:ale_rust_cargo_check_tests = 1 - AssertLinter '', ['cargo --version', 'cargo check --tests' . g:suffix] + AssertLinter 'cargo', [ale#Escape('cargo') . ' --version', 'cargo check --tests' . g:suffix] " We should cache the version check - WithChainResults [] - AssertLinter '', ['', 'cargo check --tests' . g:suffix] + GivenCommandOutput [] + AssertLinter 'cargo', ['cargo check --tests' . g:suffix] Execute(--examples should be used when g:ale_rust_cargo_check_examples is set to 1): let g:ale_rust_cargo_check_examples = 1 - AssertLinter '', ['cargo --version', 'cargo check --examples' . g:suffix] + AssertLinter 'cargo', [ale#Escape('cargo') . ' --version', 'cargo check --examples' . g:suffix] " We should cache the version check - WithChainResults [] - AssertLinter '', ['', 'cargo check --examples' . g:suffix] + GivenCommandOutput [] + AssertLinter 'cargo', ['cargo check --examples' . g:suffix] Execute(--no-default-features should be used when g:ale_rust_cargo_default_feature_behavior is none): let b:ale_rust_cargo_default_feature_behavior = 'none' - AssertLinter '', ['cargo --version', 'cargo check --frozen --message-format=json -q --no-default-features'] + AssertLinter 'cargo', [ale#Escape('cargo') . ' --version', 'cargo check --frozen --message-format=json -q --no-default-features'] Execute(g:ale_rust_cargo_include_features added when g:ale_rust_cargo_default_feature_behavior is none): let b:ale_rust_cargo_default_feature_behavior = 'none' let b:ale_rust_cargo_include_features = 'foo bar' - AssertLinter '', ['cargo --version', 'cargo check --frozen --message-format=json -q --no-default-features --features ' . ale#Escape('foo bar')] + AssertLinter 'cargo', [ale#Escape('cargo') . ' --version', 'cargo check --frozen --message-format=json -q --no-default-features --features ' . ale#Escape('foo bar')] Execute(g:ale_rust_cargo_include_features added and escaped): let b:ale_rust_cargo_default_feature_behavior = 'default' let b:ale_rust_cargo_include_features = "foo bar baz" - AssertLinter '', ['cargo --version', 'cargo check --frozen --message-format=json -q --features ' . ale#Escape('foo bar baz')] + AssertLinter 'cargo', [ale#Escape('cargo') . ' --version', 'cargo check --frozen --message-format=json -q --features ' . ale#Escape('foo bar baz')] Execute(--all-features should be used when g:ale_rust_cargo_default_feature_behavior is all): let b:ale_rust_cargo_default_feature_behavior = 'all' @@ -108,14 +115,15 @@ Execute(--all-features should be used when g:ale_rust_cargo_default_feature_beha " since it won't do anything let b:ale_rust_cargo_include_features = 'foo bar' - WithChainResults ['cargo 0.22.0 (3423351a5 2017-10-06)'] - AssertLinter '', ['cargo --version', 'cargo check --frozen --message-format=json -q --all-features'] + GivenCommandOutput ['cargo 0.22.0 (3423351a5 2017-10-06)'] + AssertLinter 'cargo', [ale#Escape('cargo') . ' --version', 'cargo check --frozen --message-format=json -q --all-features'] Execute(When a crate belongs to a workspace we should cd into the crate): + let g:ale_rust_cargo_avoid_whole_workspace = 1 call ale#test#SetFilename('cargo_workspace_paths/subpath/test.rs') AssertLinter 'cargo', [ - \ 'cargo --version', + \ ale#Escape('cargo') . ' --version', \ 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/cargo_workspace_paths/subpath')) . ' && ' \ . 'cargo check --frozen --message-format=json -q', \] @@ -125,22 +133,22 @@ Execute(When a crate belongs to a workspace we chdir into the crate, unless we d call ale#test#SetFilename('cargo_workspace_paths/subpath/test.rs') AssertLinter 'cargo', [ - \ 'cargo --version', + \ ale#Escape('cargo') . ' --version', \ 'cargo check --frozen --message-format=json -q', \] Execute(When ale_rust_cargo_use_clippy is set, cargo-clippy is used as linter): let b:ale_rust_cargo_use_clippy = 1 - AssertLinter '', [ - \ 'cargo --version', + AssertLinter 'cargo', [ + \ ale#Escape('cargo') . ' --version', \ 'cargo clippy --frozen --message-format=json -q ', \] Execute(When ale_rust_cargo_clippy_options is set, cargo-clippy appends it to commandline): let b:ale_rust_cargo_use_clippy = 1 let b:ale_rust_cargo_clippy_options = '-- -D warnings' - AssertLinter '', [ - \ 'cargo --version', + AssertLinter 'cargo', [ + \ ale#Escape('cargo') . ' --version', \ 'cargo clippy --frozen --message-format=json -q -- -D warnings', \] @@ -148,7 +156,7 @@ Execute(cargo-check does not refer ale_rust_cargo_clippy_options): let b:ale_rust_cargo_use_clippy = 0 let b:ale_rust_cargo_use_check = 1 let b:ale_rust_cargo_clippy_options = '-- -D warnings' - AssertLinter '', [ - \ 'cargo --version', + AssertLinter 'cargo', [ + \ ale#Escape('cargo') . ' --version', \ 'cargo check --frozen --message-format=json -q', \] diff --git a/test/command_callback/test_cookstyle_command_callback.vader b/test/command_callback/test_cookstyle_command_callback.vader new file mode 100644 index 00000000..ad7391cc --- /dev/null +++ b/test/command_callback/test_cookstyle_command_callback.vader @@ -0,0 +1,19 @@ +Before: + call ale#assert#SetUpLinterTest('chef', 'cookstyle') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'cookstyle', ale#Escape('cookstyle') . ' --force-exclusion --format json --stdin %s' + +Execute(The executable path should be configurable): + let b:ale_chef_cookstyle_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . ' --force-exclusion --format json --stdin %s' + +Execute(The linter options should be configurable): + let b:ale_chef_cookstyle_options = '--parallel' + + AssertLinter 'cookstyle', ale#Escape('cookstyle') . ' --parallel --force-exclusion --format json --stdin %s' + diff --git a/test/command_callback/test_cypher_cypher_lint_command_callback.vader b/test/command_callback/test_cypher_cypher_lint_command_callback.vader new file mode 100644 index 00000000..6b64dc1f --- /dev/null +++ b/test/command_callback/test_cypher_cypher_lint_command_callback.vader @@ -0,0 +1,8 @@ +Before: + call ale#assert#SetUpLinterTest('cypher', 'cypher_lint') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command and executable should be correct): + AssertLinter 'cypher-lint', 'cypher-lint' diff --git a/test/command_callback/test_eclipselsp_command_callback.vader b/test/command_callback/test_eclipselsp_command_callback.vader new file mode 100644 index 00000000..c0ad89a5 --- /dev/null +++ b/test/command_callback/test_eclipselsp_command_callback.vader @@ -0,0 +1,87 @@ +Before: + call ale#assert#SetUpLinterTest('java', 'eclipselsp') + let b:ale_java_eclipselsp_path = '/home/user/eclipse.dst.ls' + call ale#test#SetFilename('dummy.java') + + let b:cfg = '/testplugin/test/config_linux' + + if has('win32') + let b:cfg = 'C:\testplugin\test\config_win' + elseif has('macunix') + let b:cfg = '/testplugin/test/config_mac' + endif + + +After: + unlet b:ale_java_eclipselsp_path + call ale#assert#TearDownLinterTest() + +Execute(VersionCheck should return correct version): + + " OpenJDK Java 1.8 + AssertEqual [1, 8, 0], ale_linters#java#eclipselsp#VersionCheck([ + \ 'openjdk version "1.8.0_191"', + \ 'OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-0ubuntu0.18.04.1-b12)', + \ 'OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)' + \]) + + " OpenJDK Java 10 + AssertEqual [10, 0, 2], ale_linters#java#eclipselsp#VersionCheck([ + \ 'openjdk version "10.0.2" 2018-07-17', + \ 'OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4)', + \ 'OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4, mixed mode)' + \]) + + " Oracle Java 1.8 + AssertEqual [1, 8, 0], ale_linters#java#eclipselsp#VersionCheck([ + \ 'java version "1.8.0_161"', + \ 'Java(TM) SE Runtime Environment (build 1.8.0_161-b12)', + \ 'Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)' + \]) + + " Oracle Java 10 + AssertEqual [10, 0, 1], ale_linters#java#eclipselsp#VersionCheck([ + \ 'java version "10.0.1" 2018-04-17', + \ 'Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)', + \ 'Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)' + \]) + + AssertEqual [], ale_linters#java#eclipselsp#VersionCheck(['x']) + + AssertEqual [], ale_linters#java#eclipselsp#VersionCheck([]) + +Execute(The eclipselsp callback should return the correct default value): + let cmd = [ ale#Escape('java'), + \ '-Declipse.application=org.eclipse.jdt.ls.core.id1', + \ '-Dosgi.bundles.defaultStartLevel=4', + \ '-Declipse.product=org.eclipse.jdt.ls.core.product', + \ '-Dlog.level=ALL', + \ '-noverify', + \ '-Xmx1G', + \ '-jar', + \ '', + \ '-configuration', + \ b:cfg, + \ '-data', + \ '' + \] + AssertLinter 'java', join(cmd, ' ') + +Execute(The eclipselsp callback should allow custom executable): + let b:ale_java_eclipselsp_executable='/bin/foobar' + let cmd = [ ale#Escape('/bin/foobar'), + \ '-Declipse.application=org.eclipse.jdt.ls.core.id1', + \ '-Dosgi.bundles.defaultStartLevel=4', + \ '-Declipse.product=org.eclipse.jdt.ls.core.product', + \ '-Dlog.level=ALL', + \ '-noverify', + \ '-Xmx1G', + \ '-jar', + \ '', + \ '-configuration', + \ b:cfg, + \ '-data', + \ '' + \] + AssertLinter '/bin/foobar', join(cmd, ' ') + diff --git a/test/command_callback/test_elixir_credo.vader b/test/command_callback/test_elixir_credo.vader new file mode 100644 index 00000000..1a146db8 --- /dev/null +++ b/test/command_callback/test_elixir_credo.vader @@ -0,0 +1,28 @@ +Before: + call ale#assert#SetUpLinterTest('elixir', 'credo') + call ale#test#SetFilename('elixir_paths/mix_project/lib/app.ex') + + +After: + unlet! g:ale_elixir_credo_strict + + call ale#assert#TearDownLinterTest() + +Execute(Builds credo command with --strict mode when set to 1): + let g:ale_elixir_credo_strict = 1 + + AssertLinter 'mix', + \ ale#path#CdString(ale#path#Simplify(g:dir . '/elixir_paths/mix_project')) + \ . 'mix help credo && mix credo --strict --format=flycheck --read-from-stdin %s' + +Execute(Builds credo command with suggest mode by default): + AssertLinter 'mix', + \ ale#path#CdString(ale#path#Simplify(g:dir . '/elixir_paths/mix_project')) + \ . 'mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s' + +Execute(Builds credo command with suggest mode when set to 0): + let g:ale_elixir_credo_strict = 0 + + AssertLinter 'mix', + \ ale#path#CdString(ale#path#Simplify(g:dir . '/elixir_paths/mix_project')) + \ . 'mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s' diff --git a/test/command_callback/test_elixir_ls_command_callbacks.vader b/test/command_callback/test_elixir_ls_command_callbacks.vader index ca785054..41a5bc34 100644 --- a/test/command_callback/test_elixir_ls_command_callbacks.vader +++ b/test/command_callback/test_elixir_ls_command_callbacks.vader @@ -1,25 +1,24 @@ Before: call ale#assert#SetUpLinterTest('elixir', 'elixir_ls') - let g:ale_has_override['win32'] = 0 - After: - let g:ale_has_override = {} - call ale#assert#TearDownLinterTest() -Execute(should set correct defaults (unix)): - AssertLinter 'elixir-ls/language_server.sh', 'elixir-ls/language_server.sh' - -Execute(should set correct defaults (win32)): - let g:ale_has_override['win32'] = 1 - - AssertLinter 'elixir-ls\language_server.bat', 'elixir-ls\language_server.bat' +Execute(should set correct defaults): + if has('win32') + AssertLinter 'elixir-ls\language_server.bat', 'elixir-ls\language_server.bat' + else + AssertLinter 'elixir-ls/language_server.sh', 'elixir-ls/language_server.sh' + endif Execute(should configure elixir-ls release location): let b:ale_elixir_elixir_ls_release = 'boo' - AssertLinter 'boo/language_server.sh', 'boo/language_server.sh' + if has('win32') + AssertLinter 'boo\language_server.bat', 'boo\language_server.bat' + else + AssertLinter 'boo/language_server.sh', 'boo/language_server.sh' + endif Execute(should set correct LSP values): call ale#test#SetFilename('elixir_paths/umbrella_project/apps/app1/lib/app.ex') diff --git a/test/command_callback/test_elm_lsp_command_callbacks.vader b/test/command_callback/test_elm_lsp_command_callbacks.vader new file mode 100644 index 00000000..d06ef134 --- /dev/null +++ b/test/command_callback/test_elm_lsp_command_callbacks.vader @@ -0,0 +1,29 @@ +Before: + call ale#assert#SetUpLinterTest('elm', 'elm_lsp') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default executable path should be correct): + call ale#test#SetFilename('../elm-test-files/newapp/src/Main.elm') + + AssertLinter 'elm-lsp', ale#Escape('elm-lsp') . ' --stdio' + +Execute(The project root should be detected correctly): + AssertLSPProject '' + + call ale#test#SetFilename('../elm-test-files/newapp/src/Main.elm') + + AssertLSPProject ale#path#Simplify(g:dir . '/../elm-test-files/newapp') + +Execute(Should let users configure a global executable and override local paths): + call ale#test#SetFilename('../elm-test-files/newapp/src/Main.elm') + + let g:ale_elm_lsp_executable = '/path/to/custom/elm-lsp' + let g:ale_elm_lsp_use_global = 1 + + AssertLinter '/path/to/custom/elm-lsp', + \ ale#Escape('/path/to/custom/elm-lsp') . ' --stdio' + +Execute(The language should be correct): + AssertLSPLanguage 'elm' diff --git a/test/command_callback/test_elm_make_command_callback.vader b/test/command_callback/test_elm_make_command_callback.vader index 6d95676f..7ad439f9 100644 --- a/test/command_callback/test_elm_make_command_callback.vader +++ b/test/command_callback/test_elm_make_command_callback.vader @@ -7,26 +7,57 @@ After: call ale#assert#TearDownLinterTest() Execute(should get valid executable with default params): - call ale#test#SetFilename('../elm-test-files/app/testfile.elm') + call ale#test#SetFilename('../elm-test-files/newapp/src/Main.elm') - let g:executable = ale#path#Simplify(g:dir . '/../elm-test-files/app/node_modules/.bin/elm') + let g:executable = ale#path#Simplify(g:dir . '/../elm-test-files/newapp/node_modules/.bin/elm') AssertLinter g:executable, - \ ale#Escape(g:executable) . ' make --report=json --output=/dev/null %t' + \ 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/../elm-test-files/newapp')) . ' && ' + \ . ale#Escape(g:executable) . ' make --report=json --output=/dev/null %t' + +Execute(should get elm-test executable for test code with elm >= 0.19): + call ale#test#SetFilename('../elm-test-files/newapp/tests/TestSuite.elm') + + let g:executable = ale#path#Simplify(g:dir . '/../elm-test-files/newapp/node_modules/.bin/elm-test') + + AssertLinter g:executable, + \ 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/../elm-test-files/newapp')) . ' && ' + \ . ale#Escape(g:executable) . ' make --report=json --output=/dev/null --compiler ' + \ . ale#path#Simplify(g:dir . '/../elm-test-files/newapp/node_modules/.bin/elm') . ' %t' + +Execute(should fallback to elm executable with elm >= 0.19): + call ale#test#SetFilename('../elm-test-files/newapp-notests/tests/TestMain.elm') + + let g:executable = ale#path#Simplify(g:dir . '/../elm-test-files/newapp-notests/node_modules/.bin/elm') + + AssertLinter g:executable, + \ 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/../elm-test-files/newapp-notests')) . ' && ' + \ . ale#Escape(g:executable) . ' make --report=json --output=/dev/null %t' + +Execute(should get plain elm executable for test code with elm < 0.19): + call ale#test#SetFilename('../elm-test-files/oldapp/tests/TestSuite.elm') + + let g:executable = ale#path#Simplify(g:dir . '/../elm-test-files/oldapp/node_modules/.bin/elm') + + AssertLinter g:executable, + \ 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/../elm-test-files/oldapp')) . ' && ' + \ . ale#Escape(g:executable) . ' make --report=json --output=/dev/null %t' Execute(should get valid executable with 'use_global' params): let g:ale_elm_make_use_global = 1 - call ale#test#SetFilename('../elm-test-files/app/testfile.elm') + call ale#test#SetFilename('../elm-test-files/newapp/src/Main.elm') AssertLinter 'elm', - \ ale#Escape('elm') . ' make --report=json --output=/dev/null %t' + \ 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/../elm-test-files/newapp')) . ' && ' + \ . ale#Escape('elm') . ' make --report=json --output=/dev/null %t' Execute(should get valid executable with 'use_global' and 'executable' params): let g:ale_elm_make_executable = 'other-elm' let g:ale_elm_make_use_global = 1 - call ale#test#SetFilename('../elm-test-files/app/testfile.elm') + call ale#test#SetFilename('../elm-test-files/newapp/src/Main.elm') AssertLinter 'other-elm', - \ ale#Escape('other-elm') . ' make --report=json --output=/dev/null %t' + \ 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/../elm-test-files/newapp')) . ' && ' + \ . ale#Escape('other-elm') . ' make --report=json --output=/dev/null %t' diff --git a/test/command_callback/test_erlang_syntaxerl_command_callback.vader b/test/command_callback/test_erlang_syntaxerl_command_callback.vader index 28cff9b9..e7cc26ea 100644 --- a/test/command_callback/test_erlang_syntaxerl_command_callback.vader +++ b/test/command_callback/test_erlang_syntaxerl_command_callback.vader @@ -19,7 +19,7 @@ Execute (The executable should be configurable): \] Execute (The -b option should be used when available): - WithChainResults [ + GivenCommandOutput [ \ 'Syntax checker for Erlang (0.14.0)', \ 'Usage: syntaxerl [-d | --debug] <FILENAME>', \ ' syntaxerl <-h | --help>', @@ -31,7 +31,7 @@ Execute (The -b option should be used when available): \ ale#Escape('syntaxerl') . ' %t', \] - WithChainResults [ + GivenCommandOutput [ \ '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_erubi_command_callback.vader b/test/command_callback/test_erubi_command_callback.vader index 0643efc2..0d88ff93 100644 --- a/test/command_callback/test_erubi_command_callback.vader +++ b/test/command_callback/test_erubi_command_callback.vader @@ -21,7 +21,7 @@ Execute(Executable should filter invalid eRuby when inside a Rails project): \] Execute(Command should be blank if the first command in the chain returns output): - WithChainResults [ + GivenCommandOutput [ \ "/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- erubi/capture_end (LoadError)", \ " from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'", \] diff --git a/test/command_callback/test_fecs_command_callback.vader b/test/command_callback/test_fecs_command_callback.vader new file mode 100644 index 00000000..f70ad084 --- /dev/null +++ b/test/command_callback/test_fecs_command_callback.vader @@ -0,0 +1,8 @@ +Before: + call ale#assert#SetUpLinterTest('javascript', 'fecs') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'fecs', ale#Escape('fecs') . ' check --colors=false --rule=true %t' diff --git a/test/command_callback/test_flake8_command_callback.vader b/test/command_callback/test_flake8_command_callback.vader index ede511e0..f082a63a 100644 --- a/test/command_callback/test_flake8_command_callback.vader +++ b/test/command_callback/test_flake8_command_callback.vader @@ -3,7 +3,7 @@ Before: let b:bin_dir = has('win32') ? 'Scripts' : 'bin' - WithChainResults ['3.0.0'] + GivenCommandOutput ['3.0.0'] After: unlet! b:executable @@ -18,16 +18,15 @@ Execute(The flake8 callbacks should return the correct default values): \] " The version check should be cached. - WithChainResults [] + GivenCommandOutput [] AssertLinter 'flake8', [ - \ '', \ ale#path#BufferCdString(bufnr('')) \ . ale#Escape('flake8') . ' --format=default --stdin-display-name %s -', \] " Try with older versions. call ale#semver#ResetVersionCache() - WithChainResults ['2.9.9'] + GivenCommandOutput ['2.9.9'] AssertLinter 'flake8', [ \ ale#Escape('flake8') . ' --version', \ ale#path#BufferCdString(bufnr('')) @@ -45,7 +44,7 @@ Execute(The option for disabling changing directories should work): Execute(The flake8 command callback should let you set options): let g:ale_python_flake8_options = '--some-option' - WithChainResults ['3.0.4'] + GivenCommandOutput ['3.0.4'] AssertLinter 'flake8', [ \ ale#Escape('flake8') . ' --version', \ ale#path#BufferCdString(bufnr('')) @@ -54,7 +53,7 @@ Execute(The flake8 command callback should let you set options): \] call ale#semver#ResetVersionCache() - WithChainResults ['2.9.9'] + GivenCommandOutput ['2.9.9'] AssertLinter 'flake8', [ \ ale#Escape('flake8') . ' --version', \ ale#path#BufferCdString(bufnr('')) @@ -129,7 +128,7 @@ Execute(Using `python -m flake8` should be supported for running flake8): let g:ale_python_flake8_executable = 'python' let g:ale_python_flake8_options = '-m flake8 --some-option' - WithChainResults ['2.9.9'] + GivenCommandOutput ['2.9.9'] AssertLinter 'python', [ \ ale#Escape('python') . ' -m flake8 --version', \ ale#path#BufferCdString(bufnr('')) @@ -142,7 +141,7 @@ Execute(Using `python -m flake8` should be supported for running flake8): " Leading spaces shouldn't matter let g:ale_python_flake8_options = ' -m flake8 --some-option' - WithChainResults ['2.9.9'] + GivenCommandOutput ['2.9.9'] AssertLinter 'python', [ \ ale#Escape('python') . ' -m flake8 --version', \ ale#path#BufferCdString(bufnr('')) @@ -154,14 +153,14 @@ Execute(Setting executable to 'pipenv' should append 'run flake8'): let g:ale_python_flake8_executable = 'path/to/pipenv' " FIXME: pipenv should check the version with flake8. - WithChainResults [] + GivenCommandOutput [] AssertLinter 'path/to/pipenv', \ ale#path#BufferCdString(bufnr('')) \ . ale#Escape('path/to/pipenv') . ' run flake8 --format=default -' Execute(Pipenv is detected when python_flake8_auto_pipenv is set): let g:ale_python_flake8_auto_pipenv = 1 - call ale#test#SetFilename('/testplugin/test/python_fixtures/pipenv/whatever.py') + call ale#test#SetFilename('../python_fixtures/pipenv/whatever.py') AssertLinter 'pipenv', \ ale#path#BufferCdString(bufnr('')) diff --git a/test/command_callback/test_ghdl_command_callbacks.vader b/test/command_callback/test_ghdl_command_callbacks.vader new file mode 100644 index 00000000..f254e11f --- /dev/null +++ b/test/command_callback/test_ghdl_command_callbacks.vader @@ -0,0 +1,19 @@ +Before: + call ale#assert#SetUpLinterTest('vhdl', 'ghdl') + +After: + unlet! b:command_tail + + call ale#assert#TearDownLinterTest() + +Execute(The executable should be configurable): + AssertLinter 'ghdl', ale#Escape('ghdl') . ' -s --std=08 %t' + + let b:ale_vhdl_ghdl_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . ' -s --std=08 %t' + +Execute(The options should be configurable): + let b:ale_vhdl_ghdl_options = '--something' + + AssertLinter 'ghdl', ale#Escape('ghdl') . ' -s --something %t' diff --git a/test/command_callback/test_gobuild_command_callback.vader b/test/command_callback/test_gobuild_command_callback.vader index c6e324f2..79015b75 100644 --- a/test/command_callback/test_gobuild_command_callback.vader +++ b/test/command_callback/test_gobuild_command_callback.vader @@ -3,7 +3,7 @@ Before: call ale#assert#SetUpLinterTest('go', 'gobuild') - WithChainResults ['/foo/bar', '/foo/baz'] + GivenCommandOutput ['/foo/bar', '/foo/baz'] After: Restore diff --git a/test/command_callback/test_gopls_command_callback.vader b/test/command_callback/test_gopls_command_callback.vader new file mode 100644 index 00000000..0e079a73 --- /dev/null +++ b/test/command_callback/test_gopls_command_callback.vader @@ -0,0 +1,46 @@ +Before: + call ale#assert#SetUpLinterTest('go', 'gopls') + +After: + Restore + + if isdirectory(g:dir . '/.git') + call delete(g:dir . '/.git', 'd') + endif + + unlet! b:ale_completion_enabled + + call ale#assert#TearDownLinterTest() + +Execute(should set correct defaults): + AssertLinter 'gopls', ale#Escape('gopls') . ' --mode stdio' + +Execute(should configure gopls callback executable): + let b:ale_go_gopls_executable = 'boo' + let b:ale_go_gopls_options = '' + + AssertLinter 'boo', ale#Escape('boo') + +Execute(should set gopls options): + call ale#test#SetFilename('go_paths/go1/prj1/file.go') + " let b:ale_completion_enabled = 1 + let b:ale_go_gopls_options = '' + + AssertLinter 'gopls', + \ ale#Escape('gopls') . '' + + let b:ale_go_gopls_options = '--mode stdio --trace' + + AssertLinter 'gopls', + \ ale#Escape('gopls') . ' --mode stdio --trace' + +Execute(Should return directory for 'go.mod' if found in parent directory): + call ale#test#SetFilename('../go_files/test.go') + + AssertLSPProject ale#path#Simplify(g:dir . '/../go_files') + +Execute(Should return nearest directory with '.git' if found in parent directory): + call ale#test#SetFilename('test.go') + call mkdir(g:dir . '/.git') + + AssertLSPProject g:dir diff --git a/test/command_callback/test_gotype_command_callback.vader b/test/command_callback/test_gotype_command_callback.vader index 1898a0cb..113f4823 100644 --- a/test/command_callback/test_gotype_command_callback.vader +++ b/test/command_callback/test_gotype_command_callback.vader @@ -7,7 +7,7 @@ After: Execute(The default gotype command should be correct): AssertLinter 'gotype', - \ ale#path#CdString(expand('%:p:h')) . ' gotype .' + \ ale#path#CdString(expand('%:p:h')) . ' gotype -e .' Execute(The gotype callback should ignore test files): call ale#test#SetFilename('bla_test.go') diff --git a/test/command_callback/test_graphql_gqlint_command_callbacks.vader b/test/command_callback/test_graphql_gqlint_command_callbacks.vader new file mode 100644 index 00000000..0f4e9770 --- /dev/null +++ b/test/command_callback/test_graphql_gqlint_command_callbacks.vader @@ -0,0 +1,11 @@ +Before: + call ale#assert#SetUpLinterTest('graphql', 'gqlint') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The linter should run from the directory of the file in the buffer): + AssertLinter 'gqlint', + \ ale#path#CdString(expand('%:p:h')) + \ . 'gqlint --reporter=simple' + \ . ' %t' diff --git a/test/command_callback/test_haskell_cabal_ghc_command_callbacks.vader b/test/command_callback/test_haskell_cabal_ghc_command_callbacks.vader index 650aefa3..9e3712d6 100644 --- a/test/command_callback/test_haskell_cabal_ghc_command_callbacks.vader +++ b/test/command_callback/test_haskell_cabal_ghc_command_callbacks.vader @@ -13,11 +13,11 @@ After: Execute(The options should be used in the command): AssertEqual - \ 'cabal exec -- ghc -fno-code -v0 %t', + \ ale#path#BufferCdString(bufnr('')) . 'cabal exec -- ghc -fno-code -v0 %t', \ ale_linters#haskell#cabal_ghc#GetCommand(bufnr('')) let b:ale_haskell_cabal_ghc_options = 'foobar' AssertEqual - \ 'cabal exec -- ghc foobar %t', + \ ale#path#BufferCdString(bufnr('')) . 'cabal exec -- ghc foobar %t', \ ale_linters#haskell#cabal_ghc#GetCommand(bufnr('')) diff --git a/test/command_callback/test_haskell_stack_ghc_command_callback.vader b/test/command_callback/test_haskell_stack_ghc_command_callback.vader index 4adab583..aa13fb2b 100644 --- a/test/command_callback/test_haskell_stack_ghc_command_callback.vader +++ b/test/command_callback/test_haskell_stack_ghc_command_callback.vader @@ -10,5 +10,8 @@ Execute(The linter should not be executed when there's no stack.yaml file): Execute(The linter should be executed when there is a stack.yaml file): call ale#test#SetFilename('stack_ghc_paths/test.hs') - AssertLinter 'stack', 'stack ghc -- -fno-code -v0 %t' + AssertLinter 'stack', ale#path#BufferCdString(bufnr('')) . 'stack ghc -- -fno-code -v0 %t' + let b:ale_haskell_stack_ghc_options = 'foobar' + + AssertLinter 'stack', ale#path#BufferCdString(bufnr('')) . 'stack ghc -- foobar %t' diff --git a/test/command_callback/test_javac_command_callback.vader b/test/command_callback/test_javac_command_callback.vader index 2dcb6a1b..42c64e54 100644 --- a/test/command_callback/test_javac_command_callback.vader +++ b/test/command_callback/test_javac_command_callback.vader @@ -48,30 +48,30 @@ Execute(The executable should be configurable): \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t' Execute(The javac callback should include discovered classpaths): - WithChainResults [ + let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [ \ '[DEBUG] Ignore this.', \ '[INFO] Something we should ignore.', \ '/foo/bar.jar', \ '/xyz/abc.jar', - \] + \], {}) - AssertLinter 'javac', + AssertEqual \ g:prefix \ . ' -cp ' \ . ale#Escape(join(['/foo/bar.jar', '/xyz/abc.jar'], g:cp_sep)) - \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t' + \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t', + \ substitute(b:command, '%e', '\=ale#Escape(''javac'')', 'g') Execute(The javac callback should combine discovered classpaths and manual ones): let g:ale_java_javac_classpath = 'configured.jar' - - WithChainResults [ + let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [ \ '[DEBUG] Ignore this.', \ '[INFO] Something we should ignore.', \ '/foo/bar.jar', \ '/xyz/abc.jar', - \] + \], {}) - AssertLinter 'javac', + AssertEqual \ g:prefix \ . ' -cp ' \ . ale#Escape(join( @@ -82,11 +82,18 @@ Execute(The javac callback should combine discovered classpaths and manual ones) \ ], \ g:cp_sep \ )) - \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t' + \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t', + \ substitute(b:command, '%e', '\=ale#Escape(''javac'')', 'g') let g:ale_java_javac_classpath = 'configured.jar' . g:cp_sep . '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', + \], {}) - AssertLinter 'javac', + AssertEqual \ g:prefix \ . ' -cp ' \ . ale#Escape(join( @@ -98,7 +105,8 @@ Execute(The javac callback should combine discovered classpaths and manual ones) \ ], \ g:cp_sep \ )) - \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t' + \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t', + \ substitute(b:command, '%e', '\=ale#Escape(''javac'')', 'g') Execute(The javac callback should detect source directories): call ale#engine#Cleanup(bufnr('')) @@ -117,25 +125,25 @@ Execute(The javac callback should combine detected source directories and classp call ale#test#SetFilename('java_paths/src/main/java/com/something/dummy.java') call ale#engine#InitBufferInfo(bufnr('')) - WithChainResults [ + let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [ \ '[DEBUG] Ignore this.', \ '[INFO] Something we should ignore.', \ '/foo/bar.jar', \ '/xyz/abc.jar', - \] - AssertLinter 'javac', + \], {}) + + AssertEqual \ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint' \ . ' -cp ' . ale#Escape(join(['/foo/bar.jar', '/xyz/abc.jar'], g:cp_sep)) \ . ' -sourcepath ' . ale#Escape( \ ale#path#Simplify(g:dir . '/java_paths/src/main/java/') \ ) - \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t' + \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t', + \ substitute(b:command, '%e', '\=ale#Escape(''javac'')', 'g') 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(''), []) - AssertLinter 'javac', \ g:prefix . ' -d ' . ale#Escape('TEMP_DIR') . ' --anything --else %t' @@ -166,3 +174,15 @@ Execute(The javac callback should include src/main/jaxb when available): \ ale#path#Simplify(g:dir . '/java_paths_with_jaxb/src/main/jaxb/'), \ ], g:cp_sep)) \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t' + +Execute(The javac callback should add -sourcepath even if src/java/main doesn't exist): + call ale#engine#Cleanup(bufnr('')) + call ale#test#SetFilename('java_paths_no_main/src/test/java/com/something/dummy.java') + call ale#engine#InitBufferInfo(bufnr('')) + + AssertLinter 'javac', + \ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint' + \ . ' -sourcepath ' . ale#Escape(join([ + \ ale#path#Simplify(g:dir . '/java_paths_no_main/src/test/java/'), + \ ], g:cp_sep)) + \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t' diff --git a/test/command_callback/test_javalsp_command_callback.vader b/test/command_callback/test_javalsp_command_callback.vader index aedb4a4b..8bfaa8ee 100644 --- a/test/command_callback/test_javalsp_command_callback.vader +++ b/test/command_callback/test_javalsp_command_callback.vader @@ -6,9 +6,9 @@ After: call ale#assert#TearDownLinterTest() Execute(The javalsp callback should return the correct default value): - AssertLinter 'java', ale#Escape('java') . ' -cp javacs.jar -Xverify:none org.javacs.Main' + AssertLinter 'java', ale#Escape('java') . ' -Xverify:none -m javacs/org.javacs.Main' Execute(The javalsp java executable should be configurable): let b:ale_java_javalsp_executable = '/bin/foobar' - AssertLinter '/bin/foobar', ale#Escape('/bin/foobar') . ' -cp javacs.jar -Xverify:none org.javacs.Main' + AssertLinter '/bin/foobar', ale#Escape('/bin/foobar') . ' -Xverify:none -m javacs/org.javacs.Main' diff --git a/test/command_callback/test_javascript_tsserver_command_callback.vader b/test/command_callback/test_javascript_tsserver_command_callback.vader index 638dd873..04230238 100644 --- a/test/command_callback/test_javascript_tsserver_command_callback.vader +++ b/test/command_callback/test_javascript_tsserver_command_callback.vader @@ -6,3 +6,11 @@ After: Execute(The default command should be correct): AssertLinter 'tsserver', ale#Escape('tsserver') + +Execute(should resolve correct path when nested 1): + call ale#test#SetFilename('tsserver_paths/src/level-1/level-2/file3.ts') + AssertLSPProject ale#path#Simplify(g:dir . '/tsserver_paths/src/level-1') + +Execute(should resolve correct path when nested 2): + call ale#test#SetFilename('tsserver_paths/src/file1.ts') + AssertLSPProject ale#path#Simplify(g:dir . '/tsserver_paths') diff --git a/test/command_callback/test_kotlinc_command_callback.vader b/test/command_callback/test_kotlinc_command_callback.vader new file mode 100644 index 00000000..fe94bffa --- /dev/null +++ b/test/command_callback/test_kotlinc_command_callback.vader @@ -0,0 +1,9 @@ +Before: + call ale#assert#SetUpLinterTest('kotlin', 'kotlinc') + call ale#test#SetFilename('test.kt') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'kotlinc', 'kotlinc ' . ale#Escape(expand('%:p')) diff --git a/test/command_callback/test_languagetool_command_callback.vader b/test/command_callback/test_languagetool_command_callback.vader new file mode 100644 index 00000000..a79662b9 --- /dev/null +++ b/test/command_callback/test_languagetool_command_callback.vader @@ -0,0 +1,15 @@ +Before: + call ale#assert#SetUpLinterTest('text', 'languagetool') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'languagetool', ale#Escape('languagetool') + \ . ' --autoDetect %s' + +Execute(Should be able to set a custom executable): + let g:ale_languagetool_executable = 'foobar' + + AssertLinter 'foobar' , ale#Escape('foobar') + \ . ' --autoDetect %s' diff --git a/test/command_callback/test_php_langserver_callbacks.vader b/test/command_callback/test_php_langserver_callbacks.vader index 3b0a427e..59c3fe6c 100644 --- a/test/command_callback/test_php_langserver_callbacks.vader +++ b/test/command_callback/test_php_langserver_callbacks.vader @@ -2,10 +2,6 @@ Before: call ale#assert#SetUpLinterTest('php', 'langserver') After: - if isdirectory(g:dir . '/.git') - call delete(g:dir . '/.git', 'd') - endif - call ale#assert#TearDownLinterTest() Execute(The default executable path should be correct): @@ -23,7 +19,12 @@ Execute(Vendor executables should be detected): \ )) Execute(The project path should be correct for .git directories): - call ale#test#SetFilename('php-langserver-project/test.php') - call mkdir(g:dir . '/.git') + call ale#test#SetFilename('php-langserver-project/with-git/test.php') + silent! call mkdir('php-langserver-project/with-git/.git') + + AssertLSPProject ale#path#Simplify(g:dir . '/php-langserver-project/with-git') + +Execute(The project path should be correct for composer.json file): + call ale#test#SetFilename('php-langserver-project/with-composer/test.php') - AssertLSPProject g:dir + AssertLSPProject ale#path#Simplify(g:dir . '/php-langserver-project/with-composer') diff --git a/test/command_callback/test_phpstan_command_callbacks.vader b/test/command_callback/test_phpstan_command_callbacks.vader index 665661a3..3714fc64 100644 --- a/test/command_callback/test_phpstan_command_callbacks.vader +++ b/test/command_callback/test_phpstan_command_callbacks.vader @@ -1,34 +1,66 @@ Before: + call delete('./phpstan.neon') call ale#assert#SetUpLinterTest('php', 'phpstan') - WithChainResults ['0.10.2'] + GivenCommandOutput ['0.10.2'] After: + call delete('./phpstan.neon') call ale#assert#TearDownLinterTest() Execute(Custom executables should be used for the executable and command): let g:ale_php_phpstan_executable = 'phpstan_test' AssertLinter 'phpstan_test', - \ ale#Escape('phpstan_test') . ' analyze -l4 --errorFormat raw %s' + \ ale#Escape('phpstan_test') . ' analyze --no-progress --errorFormat raw -l ' . ale#Escape('4') . ' %s' Execute(project with level set to 3): call ale#test#SetFilename('phpstan-test-files/foo/test.php') let g:ale_php_phpstan_level = 3 AssertLinter 'phpstan', - \ ale#Escape('phpstan') . ' analyze -l3 --errorFormat raw %s' + \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat raw -l ' . ale#Escape('3') . ' %s' Execute(Custom phpstan configuration file): let g:ale_php_phpstan_configuration = 'phpstan_config' AssertLinter 'phpstan', - \ ale#Escape('phpstan') . ' analyze -l4 --errorFormat raw -c phpstan_config %s' + \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat raw -c ' . ale#Escape('phpstan_config') . ' -l ' . ale#Escape('4') . ' %s' Execute(Choose the right format for error format param): - WithChainResults ['0.10.3'] + GivenCommandOutput ['0.10.3'] AssertLinter 'phpstan', [ \ ale#Escape('phpstan') . ' --version', - \ ale#Escape('phpstan') . ' analyze -l4 --error-format raw %s' + \ ale#Escape('phpstan') . ' analyze --no-progress --error-format raw -l ' . ale#Escape('4') . ' %s' + \ ] + +Execute(Configuration file exists in current directory): + call writefile(['parameters:', ' level: 7'], './phpstan.neon') + let g:ale_php_phpstan_level = '' + let g:ale_php_phpstan_configuration = '' + + AssertLinter 'phpstan', [ + \ ale#Escape('phpstan') . ' --version', + \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat raw %s' + \ ] + +Execute(Configuration file exists in current directory, but force phpstan level): + call writefile(['parameters:', ' level: 7'], './phpstan.neon') + let g:ale_php_phpstan_configuration = '' + let g:ale_php_phpstan_level = '7' + + AssertLinter 'phpstan', [ + \ ale#Escape('phpstan') . ' --version', + \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat raw -l ' . ale#Escape('7') . ' %s' + \ ] + +Execute(Configuration file exists in current directory, but force phpstan configuration): + call writefile(['parameters:', ' level: 7'], './phpstan.neon') + let g:ale_php_phpstan_level = '' + let g:ale_php_phpstan_configuration = 'phpstan.custom.neon' + + AssertLinter 'phpstan', [ + \ ale#Escape('phpstan') . ' --version', + \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat raw -c ' . ale#Escape('phpstan.custom.neon') . ' %s' \ ] diff --git a/test/command_callback/test_psalm_command_callbacks.vader b/test/command_callback/test_psalm_command_callbacks.vader index d731054f..33d770c2 100644 --- a/test/command_callback/test_psalm_command_callbacks.vader +++ b/test/command_callback/test_psalm_command_callbacks.vader @@ -24,6 +24,9 @@ Execute(Vendor executables should be detected): Execute(The project path should be correct for .git directories): call ale#test#SetFilename('psalm-project/test.php') - call mkdir(g:dir . '/.git') - AssertLSPProject g:dir
\ No newline at end of file + if !isdirectory(g:dir . '/.git') + call mkdir(g:dir . '/.git') + endif + + AssertLSPProject g:dir diff --git a/test/command_callback/test_pylama_command_callback.vader b/test/command_callback/test_pylama_command_callback.vader new file mode 100644 index 00000000..417cb5c9 --- /dev/null +++ b/test/command_callback/test_pylama_command_callback.vader @@ -0,0 +1,85 @@ +Before: + call ale#assert#SetUpLinterTest('python', 'pylama') + call ale#test#SetFilename('test.py') + + let b:bin_dir = has('win32') ? 'Scripts' : 'bin' + let b:command_tail = ' %s' + +After: + unlet! b:bin_dir + unlet! b:executable + unlet! b:command_tail + + call ale#assert#TearDownLinterTest() + +Execute(The pylama command callback should return a default): + AssertLinter 'pylama', + \ ale#path#BufferCdString(bufnr('')) + \ . ale#Escape('pylama') . b:command_tail + +Execute(The option for disabling changing directories should work): + let g:ale_python_pylama_change_directory = 0 + + AssertLinter 'pylama', ale#Escape('pylama') . b:command_tail + +Execute(The pylama executable should be configurable, and escaped properly): + let g:ale_python_pylama_executable = 'executable with spaces' + + AssertLinter 'executable with spaces', + \ ale#path#BufferCdString(bufnr('')) + \ . ale#Escape('executable with spaces') . b:command_tail + +Execute(The pylama command callback should let you set options): + let g:ale_python_pylama_options = '--some-option' + + AssertLinter 'pylama', + \ ale#path#BufferCdString(bufnr('')) + \ . ale#Escape('pylama') . ' --some-option' . b:command_tail + +Execute(The pylama command callback should switch directories to the detected project root): + silent execute 'file ' . fnameescape(g:dir . '/python_paths/no_virtualenv/subdir/foo/bar.py') + + AssertLinter 'pylama', + \ ale#path#CdString(ale#path#Simplify(g:dir . '/python_paths/no_virtualenv/subdir')) + \ . ale#Escape('pylama') . b:command_tail + +Execute(The pylama command callback shouldn't detect virtualenv directories where they don't exist): + silent execute 'file ' . fnameescape(g:dir . '/python_paths/no_virtualenv/subdir/foo/bar.py') + + AssertLinter 'pylama', + \ ale#path#CdString(ale#path#Simplify(g:dir . '/python_paths/no_virtualenv/subdir')) + \ . ale#Escape('pylama') . b:command_tail + +Execute(The pylama command callback 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#Simplify( + \ g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/pylama' + \) + + AssertLinter b:executable, + \ ale#path#CdString(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/subdir')) + \ . ale#Escape(b:executable) . b:command_tail + +Execute(You should able able to use the global pylama instead): + silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py') + let g:ale_python_pylama_use_global = 1 + + AssertLinter 'pylama', + \ ale#path#CdString(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/subdir')) + \ . ale#Escape('pylama') . b:command_tail + +Execute(Setting executable to 'pipenv' appends 'run pylama'): + let g:ale_python_pylama_executable = 'path/to/pipenv' + + AssertLinter 'path/to/pipenv', + \ ale#path#BufferCdString(bufnr('')) + \ . ale#Escape('path/to/pipenv') . ' run pylama' . b:command_tail + +Execute(Pipenv is detected when python_pylama_auto_pipenv is set): + let g:ale_python_pylama_auto_pipenv = 1 + call ale#test#SetFilename('/testplugin/test/python_fixtures/pipenv/whatever.py') + + AssertLinter 'pipenv', + \ ale#path#BufferCdString(bufnr('')) + \ . ale#Escape('pipenv') . ' run pylama' . b:command_tail diff --git a/test/command_callback/test_pylint_command_callback.vader b/test/command_callback/test_pylint_command_callback.vader index 6b21b127..c41c8398 100644 --- a/test/command_callback/test_pylint_command_callback.vader +++ b/test/command_callback/test_pylint_command_callback.vader @@ -39,7 +39,7 @@ Execute(The pylint callbacks shouldn't detect virtualenv directories where they silent execute 'file ' . fnameescape(g:dir . '/python_paths/no_virtualenv/subdir/foo/bar.py') AssertLinter 'pylint', - \ ale#path#BufferCdString(bufnr('')) + \ ale#path#CdString(ale#path#Simplify(g:dir . '/python_paths/no_virtualenv/subdir')) \ . ale#Escape('pylint') . ' ' . b:command_tail Execute(The pylint callbacks should detect virtualenv directories): @@ -50,7 +50,7 @@ Execute(The pylint callbacks should detect virtualenv directories): \) AssertLinter b:executable, - \ ale#path#BufferCdString(bufnr('')) + \ ale#path#CdString(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/subdir')) \ . ale#Escape(b:executable) . ' ' . b:command_tail Execute(You should able able to use the global pylint instead): @@ -58,7 +58,7 @@ Execute(You should able able to use the global pylint instead): let g:ale_python_pylint_use_global = 1 AssertLinter 'pylint', - \ ale#path#BufferCdString(bufnr('')) + \ ale#path#CdString(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/subdir')) \ . ale#Escape('pylint') . ' ' . b:command_tail Execute(Setting executable to 'pipenv' appends 'run pylint'): diff --git a/test/command_callback/test_pyls_command_callback.vader b/test/command_callback/test_pyls_command_callback.vader index 531b5b3b..aff2fcd7 100644 --- a/test/command_callback/test_pyls_command_callback.vader +++ b/test/command_callback/test_pyls_command_callback.vader @@ -45,3 +45,8 @@ Execute(Pipenv is detected when python_pyls_auto_pipenv is set): AssertLinter 'pipenv', \ ale#Escape('pipenv') . ' run pyls' + +Execute(Should accept configuration settings): + AssertLSPConfig {} + let b:ale_python_pyls_config = {'pyls': {'plugins': {'preload': {'enabled': v:false}}}} + AssertLSPConfig {'pyls': {'plugins': {'preload': {'enabled': v:false}}}} diff --git a/test/command_callback/test_racket_raco_command_callback.vader b/test/command_callback/test_racket_raco_command_callback.vader new file mode 100644 index 00000000..fb83ffa1 --- /dev/null +++ b/test/command_callback/test_racket_raco_command_callback.vader @@ -0,0 +1,10 @@ +Before: + call ale#assert#SetUpLinterTest('racket', 'raco') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command and executable should be correct): + AssertLinter 'raco', 'raco expand %s' + + diff --git a/test/command_callback/test_reek_command_callback.vader b/test/command_callback/test_reek_command_callback.vader index a7cb7fb9..798c3314 100644 --- a/test/command_callback/test_reek_command_callback.vader +++ b/test/command_callback/test_reek_command_callback.vader @@ -5,7 +5,7 @@ After: call ale#assert#TearDownLinterTest() Execute(The reek callbacks should return the correct default values): - WithChainResults ['reek 5.0.0'] + GivenCommandOutput ['reek 5.0.0'] AssertLinter 'reek', [ \ ale#Escape('reek') . ' --version', \ ale#Escape('reek') . ' -f json --no-progress --no-color --force-exclusion --stdin-filename %s', @@ -14,7 +14,7 @@ Execute(The reek callbacks should return the correct default values): " Try with older versions. call ale#semver#ResetVersionCache() - WithChainResults ['reek 4.8.2'] + GivenCommandOutput ['reek 4.8.2'] AssertLinter 'reek', [ \ ale#Escape('reek') . ' --version', \ ale#Escape('reek') . ' -f json --no-progress --no-color --force-exclusion', @@ -23,7 +23,7 @@ Execute(The reek callbacks should return the correct default values): Execute(Setting bundle appends 'exec reek'): let g:ale_ruby_reek_executable = 'bundle' - WithChainResults ['reek 5.0.0'] + GivenCommandOutput ['reek 5.0.0'] AssertLinter 'bundle', ale#Escape('bundle') \ . ' exec reek' \ . ' -f json --no-progress --no-color --force-exclusion --stdin-filename %s', @@ -31,20 +31,19 @@ Execute(Setting bundle appends 'exec reek'): " Try with older versions. call ale#semver#ResetVersionCache() - WithChainResults ['reek 4.8.2'] + GivenCommandOutput ['reek 4.8.2'] AssertLinter 'bundle', ale#Escape('bundle') \ . ' exec reek' \ . ' -f json --no-progress --no-color --force-exclusion' Execute(The reek version check should be cached): - WithChainResults ['reek 5.0.0'] + GivenCommandOutput ['reek 5.0.0'] AssertLinter 'reek', [ \ ale#Escape('reek') . ' --version', \ ale#Escape('reek') . ' -f json --no-progress --no-color --force-exclusion --stdin-filename %s', \] - WithChainResults [] + GivenCommandOutput [] AssertLinter 'reek', [ - \ '', \ ale#Escape('reek') . ' -f json --no-progress --no-color --force-exclusion --stdin-filename %s', \] diff --git a/test/command_callback/test_rst_textlint_command_callbacks.vader b/test/command_callback/test_rst_textlint_command_callbacks.vader new file mode 100644 index 00000000..9bc4c5c2 --- /dev/null +++ b/test/command_callback/test_rst_textlint_command_callbacks.vader @@ -0,0 +1,65 @@ +" Author: januswel, w0rp + +Before: + " This is just one language for the linter. + call ale#assert#SetUpLinterTest('rst', 'textlint') + + " The configuration is shared between many languages. + Save g:ale_textlint_executable + Save g:ale_textlint_use_global + Save g:ale_textlint_options + + let g:ale_textlint_executable = 'textlint' + let g:ale_textlint_use_global = 0 + let g:ale_textlint_options = '' + + unlet! b:ale_textlint_executable + unlet! b:ale_textlint_use_global + unlet! b:ale_textlint_options + +After: + unlet! b:command_tail + unlet! b:ale_textlint_executable + unlet! b:ale_textlint_use_global + unlet! b:ale_textlint_options + + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'textlint', + \ ale#Escape('textlint') . ' -f json --stdin --stdin-filename %s' + +Execute(The executable should be configurable): + let b:ale_textlint_executable = 'foobar' + + AssertLinter 'foobar', + \ ale#Escape('foobar') . ' -f json --stdin --stdin-filename %s' + +Execute(The options should be configurable): + let b:ale_textlint_options = '--something' + + AssertLinter 'textlint', + \ ale#Escape('textlint') . ' --something -f json --stdin --stdin-filename %s' + +Execute(The local executable from .bin should be used if available): + call ale#test#SetFilename('textlint_paths/with_bin_path/foo.txt') + + AssertLinter + \ ale#path#Simplify(g:dir . '/textlint_paths/with_bin_path/node_modules/.bin/textlint'), + \ ale#Escape(ale#path#Simplify(g:dir . '/textlint_paths/with_bin_path/node_modules/.bin/textlint')) + \ . ' -f json --stdin --stdin-filename %s' + +Execute(The local executable from textlint/bin should be used if available): + call ale#test#SetFilename('textlint_paths/with_textlint_bin_path/foo.txt') + + if has('win32') + AssertLinter + \ ale#path#Simplify(g:dir . '/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'), + \ ale#Escape('node.exe') . ' ' . ale#Escape(ale#path#Simplify(g:dir . '/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js')) + \ . ' -f json --stdin --stdin-filename %s' + else + AssertLinter + \ ale#path#Simplify(g:dir . '/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'), + \ ale#Escape(ale#path#Simplify(g:dir . '/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js')) + \ . ' -f json --stdin --stdin-filename %s' + endif diff --git a/test/command_callback/test_rust_rls_callbacks.vader b/test/command_callback/test_rust_rls_callbacks.vader index a710161d..ec8c8811 100644 --- a/test/command_callback/test_rust_rls_callbacks.vader +++ b/test/command_callback/test_rust_rls_callbacks.vader @@ -5,7 +5,7 @@ After: call ale#assert#TearDownLinterTest() Execute(The default executable path should be correct): - AssertLinter 'rls', ale#Escape('rls') . ' +' . ale#Escape('nightly') + AssertLinter 'rls', ale#Escape('rls') Execute(The toolchain should be configurable): let g:ale_rust_rls_toolchain = 'stable' @@ -23,3 +23,8 @@ Execute(The project root should be detected correctly): call ale#test#SetFilename('rust-rls-project/test.rs') AssertLSPProject ale#path#Simplify(g:dir . '/rust-rls-project') + +Execute(Should accept configuration settings): + AssertLSPConfig {} + let b:ale_rust_rls_config = {'rust': {'clippy_preference': 'on'}} + AssertLSPConfig {'rust': {'clippy_preference': 'on'}} diff --git a/test/command_callback/test_shellcheck_command_callback.vader b/test/command_callback/test_shellcheck_command_callback.vader index 22a9ccb5..1d5b056b 100644 --- a/test/command_callback/test_shellcheck_command_callback.vader +++ b/test/command_callback/test_shellcheck_command_callback.vader @@ -14,6 +14,11 @@ After: Execute(The default shellcheck command should be correct): AssertLinter 'shellcheck', b:prefix . ale#Escape('shellcheck') . b:suffix +Execute(The option disabling changing directories should work): + let g:ale_sh_shellcheck_change_directory = 0 + + AssertLinter 'shellcheck', ale#Escape('shellcheck') . b:suffix + Execute(The shellcheck command should accept options): let b:ale_sh_shellcheck_options = '--foobar' @@ -33,6 +38,18 @@ Execute(The shellcheck command should include the dialect): AssertLinter 'shellcheck', \ b:prefix . ale#Escape('shellcheck') . ' -s bash' . b:suffix +Execute(The shellcheck command should use ale_sh_shellcheck_dialect): + let b:ale_sh_shellcheck_dialect = 'ksh93' + + AssertLinter 'shellcheck', + \ b:prefix . ale#Escape('shellcheck') . ' -s ksh93' . b:suffix + +Execute(The shellcheck command should allow unspecified dialect): + let b:ale_sh_shellcheck_dialect = '' + + AssertLinter 'shellcheck', + \ b:prefix . ale#Escape('shellcheck') . b:suffix + Execute(The shellcheck command should include the dialect before options and exclusions): let b:is_bash = 1 let b:ale_sh_shellcheck_options = '--foobar' @@ -48,7 +65,7 @@ Execute(The -x option should be added when the version is new enough): \ b:prefix . ale#Escape('shellcheck') . b:suffix, \] - WithChainResults [ + GivenCommandOutput [ \ 'ShellCheck - shell script analysis tool', \ 'version: 0.4.4', \ 'license: GNU General Public License, version 3', @@ -60,14 +77,13 @@ Execute(The -x option should be added when the version is new enough): \] " We should cache the version check - WithChainResults [] + GivenCommandOutput [] AssertLinter 'shellcheck', [ - \ '', \ b:prefix . ale#Escape('shellcheck') . ' -x' . b:suffix, \] Execute(The -x option should not be added when the version is too old): - WithChainResults [ + GivenCommandOutput [ \ 'ShellCheck - shell script analysis tool', \ 'version: 0.3.9', \ 'license: GNU General Public License, version 3', @@ -79,7 +95,7 @@ Execute(The -x option should not be added when the version is too old): \] Execute(The version check shouldn't be run again for old versions): - WithChainResults [ + GivenCommandOutput [ \ 'ShellCheck - shell script analysis tool', \ 'version: 0.3.9', \ 'license: GNU General Public License, version 3', @@ -90,6 +106,5 @@ Execute(The version check shouldn't be run again for old versions): \ b:prefix . ale#Escape('shellcheck') . b:suffix, \] AssertLinter 'shellcheck', [ - \ '', \ b:prefix . ale#Escape('shellcheck') . b:suffix, \] diff --git a/test/command_callback/test_standardrb_command_callback.vader b/test/command_callback/test_standardrb_command_callback.vader new file mode 100644 index 00000000..7bc1c976 --- /dev/null +++ b/test/command_callback/test_standardrb_command_callback.vader @@ -0,0 +1,29 @@ +Before: + call ale#assert#SetUpLinterTest('ruby', 'standardrb') + call ale#test#SetFilename('dummy.rb') + + let g:ale_ruby_standardrb_executable = 'standardrb' + let g:ale_ruby_standardrb_options = '' + +After: + call ale#assert#TearDownLinterTest() + +Execute(Executable should default to standardrb): + AssertLinter 'standardrb', ale#Escape('standardrb') + \ . ' --format json --force-exclusion --stdin ' + \ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.rb')) + +Execute(Should be able to set a custom executable): + let g:ale_ruby_standardrb_executable = 'bin/standardrb' + + AssertLinter 'bin/standardrb' , ale#Escape('bin/standardrb') + \ . ' --format json --force-exclusion --stdin ' + \ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.rb')) + +Execute(Setting bundle appends 'exec standardrb'): + let g:ale_ruby_standardrb_executable = 'path to/bundle' + + AssertLinter 'path to/bundle', ale#Escape('path to/bundle') + \ . ' exec standardrb' + \ . ' --format json --force-exclusion --stdin ' + \ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.rb')) diff --git a/test/command_callback/test_sugarss_stylelint_command_callback.vader b/test/command_callback/test_sugarss_stylelint_command_callback.vader new file mode 100644 index 00000000..448436fb --- /dev/null +++ b/test/command_callback/test_sugarss_stylelint_command_callback.vader @@ -0,0 +1,31 @@ +Before: + call ale#assert#SetUpLinterTest('sugarss', 'stylelint') + unlet! b:executable + +After: + unlet! b:executable + call ale#assert#TearDownLinterTest() + +Execute(node_modules directories should be discovered): + call ale#test#SetFilename('stylelint_paths/nested/testfile.sss') + + let b:executable = ale#path#Simplify( + \ g:dir + \ . '/stylelint_paths/node_modules/.bin/stylelint' + \) + + AssertLinter b:executable, ale#Escape(b:executable) . ' --syntax=sugarss --stdin-filename %s' + +Execute(The global override should work): + let b:ale_sugarss_stylelint_executable = 'foobar' + let b:ale_sugarss_stylelint_use_global = 1 + + call ale#test#SetFilename('stylelint_paths/nested/testfile.sss') + + AssertLinter 'foobar', ale#Escape('foobar') . ' --syntax=sugarss --stdin-filename %s' + +Execute(Extra options should be configurable): + let b:ale_sugarss_stylelint_options = '--configFile ''/absolute/path/to/file''' + + AssertLinter 'stylelint', + \ ale#Escape('stylelint') . ' --configFile ''/absolute/path/to/file'' --syntax=sugarss --stdin-filename %s' diff --git a/test/command_callback/test_swift_sourcekitlsp_command_callbacks.vader b/test/command_callback/test_swift_sourcekitlsp_command_callbacks.vader new file mode 100644 index 00000000..4611c6de --- /dev/null +++ b/test/command_callback/test_swift_sourcekitlsp_command_callbacks.vader @@ -0,0 +1,21 @@ +Before: + call ale#assert#SetUpLinterTest('swift', 'sourcekitlsp') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default executable path should be correct): + call ale#test#SetFilename('../swift-test-files/swift-package-project/src/folder/dummy.swift') + + AssertLinter 'sourcekit-lsp', ale#Escape('sourcekit-lsp') + +Execute(Should let users configure a global executable and override local paths): + call ale#test#SetFilename('../swift-test-files/swift-package-project/src/folder/dummy.swift') + + let g:ale_sourcekit_lsp_executable = '/path/to/custom/sourcekitlsp' + + AssertLinter '/path/to/custom/sourcekitlsp', + \ ale#Escape('/path/to/custom/sourcekitlsp') + +Execute(The language should be correct): + AssertLSPLanguage 'swift' diff --git a/test/command_callback/test_tex_lacheck_command_callback.vader b/test/command_callback/test_tex_lacheck_command_callback.vader new file mode 100644 index 00000000..b404cc78 --- /dev/null +++ b/test/command_callback/test_tex_lacheck_command_callback.vader @@ -0,0 +1,13 @@ +Before: + call ale#assert#SetUpLinterTest('tex', 'lacheck') + +After: + call ale#assert#TearDownLinterTest() + +Execute(Executable should default to lacheck): + AssertLinter 'lacheck', ale#Escape('lacheck') . ' %t' + +Execute(Should be able to set a custom executable): + let g:ale_tex_lacheck_executable = 'bin/foo' + + AssertLinter 'bin/foo' , ale#Escape('bin/foo') . ' %t' diff --git a/test/command_callback/test_tex_textlint_command_callbacks.vader b/test/command_callback/test_tex_textlint_command_callbacks.vader new file mode 100644 index 00000000..d1e2ab91 --- /dev/null +++ b/test/command_callback/test_tex_textlint_command_callbacks.vader @@ -0,0 +1,65 @@ +" Author: januswel, w0rp + +Before: + " This is just one language for the linter. + call ale#assert#SetUpLinterTest('tex', 'textlint') + + " The configuration is shared between many languages. + Save g:ale_textlint_executable + Save g:ale_textlint_use_global + Save g:ale_textlint_options + + let g:ale_textlint_executable = 'textlint' + let g:ale_textlint_use_global = 0 + let g:ale_textlint_options = '' + + unlet! b:ale_textlint_executable + unlet! b:ale_textlint_use_global + unlet! b:ale_textlint_options + +After: + unlet! b:command_tail + unlet! b:ale_textlint_executable + unlet! b:ale_textlint_use_global + unlet! b:ale_textlint_options + + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'textlint', + \ ale#Escape('textlint') . ' -f json --stdin --stdin-filename %s' + +Execute(The executable should be configurable): + let b:ale_textlint_executable = 'foobar' + + AssertLinter 'foobar', + \ ale#Escape('foobar') . ' -f json --stdin --stdin-filename %s' + +Execute(The options should be configurable): + let b:ale_textlint_options = '--something' + + AssertLinter 'textlint', + \ ale#Escape('textlint') . ' --something -f json --stdin --stdin-filename %s' + +Execute(The local executable from .bin should be used if available): + call ale#test#SetFilename('textlint_paths/with_bin_path/foo.txt') + + AssertLinter + \ ale#path#Simplify(g:dir . '/textlint_paths/with_bin_path/node_modules/.bin/textlint'), + \ ale#Escape(ale#path#Simplify(g:dir . '/textlint_paths/with_bin_path/node_modules/.bin/textlint')) + \ . ' -f json --stdin --stdin-filename %s' + +Execute(The local executable from textlint/bin should be used if available): + call ale#test#SetFilename('textlint_paths/with_textlint_bin_path/foo.txt') + + if has('win32') + AssertLinter + \ ale#path#Simplify(g:dir . '/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'), + \ ale#Escape('node.exe') . ' ' . ale#Escape(ale#path#Simplify(g:dir . '/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js')) + \ . ' -f json --stdin --stdin-filename %s' + else + AssertLinter + \ ale#path#Simplify(g:dir . '/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'), + \ ale#Escape(ale#path#Simplify(g:dir . '/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js')) + \ . ' -f json --stdin --stdin-filename %s' + endif diff --git a/test/command_callback/test_vcom_command_callbacks.vader b/test/command_callback/test_vcom_command_callbacks.vader new file mode 100644 index 00000000..77218f74 --- /dev/null +++ b/test/command_callback/test_vcom_command_callbacks.vader @@ -0,0 +1,19 @@ +Before: + call ale#assert#SetUpLinterTest('vhdl', 'vcom') + +After: + unlet! b:command_tail + + call ale#assert#TearDownLinterTest() + +Execute(The executable should be configurable): + AssertLinter 'vcom', ale#Escape('vcom') . ' -2008 -quiet -lint %t' + + let b:ale_vhdl_vcom_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . ' -2008 -quiet -lint %t' + +Execute(The options should be configurable): + let b:ale_vhdl_vcom_options = '--something' + + AssertLinter 'vcom', ale#Escape('vcom') . ' --something %t' diff --git a/test/command_callback/test_vlog_command_callbacks.vader b/test/command_callback/test_vlog_command_callbacks.vader new file mode 100644 index 00000000..a07944f7 --- /dev/null +++ b/test/command_callback/test_vlog_command_callbacks.vader @@ -0,0 +1,19 @@ +Before: + call ale#assert#SetUpLinterTest('verilog', 'vlog') + +After: + unlet! b:command_tail + + call ale#assert#TearDownLinterTest() + +Execute(The executable should be configurable): + AssertLinter 'vlog', ale#Escape('vlog') . ' -quiet -lint %t' + + let b:ale_verilog_vlog_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . ' -quiet -lint %t' + +Execute(The options should be configurable): + let b:ale_verilog_vlog_options = '--something' + + AssertLinter 'vlog', ale#Escape('vlog') . ' --something %t' diff --git a/test/command_callback/test_vulture_command_callback.vader b/test/command_callback/test_vulture_command_callback.vader new file mode 100644 index 00000000..d6c866b9 --- /dev/null +++ b/test/command_callback/test_vulture_command_callback.vader @@ -0,0 +1,68 @@ +Before: + call ale#assert#SetUpLinterTest('python', 'vulture') + call ale#test#SetFilename('test.py') + + let b:bin_dir = has('win32') ? 'Scripts' : 'bin' + +After: + unlet! b:bin_dir + unlet! b:executable + + call ale#assert#TearDownLinterTest() + +Execute(The vulture command callback should lint file directory by default): + AssertLinter 'vulture', + \ ale#path#BufferCdString(bufnr('')) + \ . ale#Escape('vulture') . ' .' + +Execute(The vulture command callback should lint project root, when present): + silent execute 'file ' . fnameescape(g:dir . '/python_paths/no_virtualenv/subdir/foo/bar.py') + + AssertLinter 'vulture', + \ ale#path#CdString(ale#path#Simplify(g:dir . '/python_paths/no_virtualenv/subdir')) + \ . ale#Escape('vulture') . ' .' + +Execute(The option for disabling change directory works and only lints file): + let g:ale_python_vulture_change_directory = 0 + + AssertLinter 'vulture', ale#Escape('vulture') . ' %s' + +Execute(The vulture executable should be configurable, and escaped properly): + let g:ale_python_vulture_executable = 'executable with spaces' + + AssertLinter 'executable with spaces', + \ ale#path#BufferCdString(bufnr('')) + \ . ale#Escape('executable with spaces') . ' .' + +Execute(The vulture command callback should let you set options): + let g:ale_python_vulture_options = '--some-option' + + AssertLinter 'vulture', + \ ale#path#BufferCdString(bufnr('')) + \ . ale#Escape('vulture') . ' --some-option .' + +Execute(The vulture command callback 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#Simplify( + \ g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/vulture' + \) + + AssertLinter b:executable, + \ ale#path#CdString(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/subdir')) + \ . ale#Escape(b:executable) . ' .' + +Execute(You should able able to use the global vulture instead): + silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py') + let g:ale_python_vulture_use_global = 1 + + AssertLinter 'vulture', + \ ale#path#CdString(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/subdir')) + \ . ale#Escape('vulture') . ' .' + +Execute(Setting executable to 'pipenv' appends 'run vulture'): + let g:ale_python_vulture_executable = 'path/to/pipenv' + + AssertLinter 'path/to/pipenv', + \ ale#path#BufferCdString(bufnr('')) + \ . ale#Escape('path/to/pipenv') . ' run vulture' . ' .' diff --git a/test/command_callback/test_xo_command_callback.vader b/test/command_callback/test_xo_command_callback.vader new file mode 100644 index 00000000..12de595d --- /dev/null +++ b/test/command_callback/test_xo_command_callback.vader @@ -0,0 +1,20 @@ +Before: + call ale#assert#SetUpLinterTest('typescript', 'xo') + call ale#test#SetFilename('testfile.ts') + unlet! b:executable + +After: + call ale#assert#TearDownLinterTest() + +Execute(The XO executable should be called): + AssertLinter 'xo', ale#Escape('xo') . ' --reporter unix --stdin --stdin-filename %s' + +Execute(The XO executable should be configurable): + let b:ale_typescript_xo_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . ' --reporter unix --stdin --stdin-filename %s' + +Execute(The XO options should be configurable): + let b:ale_typescript_xo_options = '--wat' + + AssertLinter 'xo', ale#Escape('xo') . ' --wat --reporter unix --stdin --stdin-filename %s' diff --git a/test/command_callback/test_xvhdl_command_callbacks.vader b/test/command_callback/test_xvhdl_command_callbacks.vader new file mode 100644 index 00000000..86f9a32d --- /dev/null +++ b/test/command_callback/test_xvhdl_command_callbacks.vader @@ -0,0 +1,19 @@ +Before: + call ale#assert#SetUpLinterTest('vhdl', 'xvhdl') + +After: + unlet! b:command_tail + + call ale#assert#TearDownLinterTest() + +Execute(The executable should be configurable): + AssertLinter 'xvhdl', ale#Escape('xvhdl') . ' --2008 %t' + + let b:ale_vhdl_xvhdl_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . ' --2008 %t' + +Execute(The options should be configurable): + let b:ale_vhdl_xvhdl_options = '--something' + + AssertLinter 'xvhdl', ale#Escape('xvhdl') . ' --something %t' diff --git a/test/command_callback/test_xvlog_command_callbacks.vader b/test/command_callback/test_xvlog_command_callbacks.vader new file mode 100644 index 00000000..564ac979 --- /dev/null +++ b/test/command_callback/test_xvlog_command_callbacks.vader @@ -0,0 +1,19 @@ +Before: + call ale#assert#SetUpLinterTest('verilog', 'xvlog') + +After: + unlet! b:command_tail + + call ale#assert#TearDownLinterTest() + +Execute(The executable should be configurable): + AssertLinter 'xvlog', ale#Escape('xvlog') . ' %t' + + let b:ale_verilog_xvlog_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . ' %t' + +Execute(The options should be configurable): + let b:ale_verilog_xvlog_options = '--something' + + AssertLinter 'xvlog', ale#Escape('xvlog') . ' --something %t' diff --git a/test/command_callback/tex_paths/sample1.tex b/test/command_callback/tex_paths/sample1.tex new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/command_callback/tex_paths/sample1.tex diff --git a/test/command_callback/tex_paths/sample2.tex b/test/command_callback/tex_paths/sample2.tex new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/command_callback/tex_paths/sample2.tex diff --git a/test/command_callback/tsserver_paths/src/file1.ts b/test/command_callback/tsserver_paths/src/file1.ts new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/command_callback/tsserver_paths/src/file1.ts diff --git a/test/command_callback/tsserver_paths/src/level-1/file2.ts b/test/command_callback/tsserver_paths/src/level-1/file2.ts new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/command_callback/tsserver_paths/src/level-1/file2.ts diff --git a/test/command_callback/tsserver_paths/src/level-1/level-2/file3.ts b/test/command_callback/tsserver_paths/src/level-1/level-2/file3.ts new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/command_callback/tsserver_paths/src/level-1/level-2/file3.ts diff --git a/test/command_callback/tsserver_paths/src/level-1/tsconfig.json b/test/command_callback/tsserver_paths/src/level-1/tsconfig.json new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/command_callback/tsserver_paths/src/level-1/tsconfig.json diff --git a/test/command_callback/tsserver_paths/tsconfig.json b/test/command_callback/tsserver_paths/tsconfig.json new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/command_callback/tsserver_paths/tsconfig.json |