mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-20 01:52:58 +08:00
#2132 - Replace command_chain and chain_with with ale#command#Run
This commit is contained in:
@@ -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]
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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',
|
||||
\]
|
||||
|
||||
@@ -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>',
|
||||
|
||||
@@ -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'",
|
||||
\]
|
||||
|
||||
@@ -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(''))
|
||||
|
||||
@@ -3,7 +3,7 @@ Before:
|
||||
|
||||
call ale#assert#SetUpLinterTest('go', 'gobuild')
|
||||
|
||||
WithChainResults ['/foo/bar', '/foo/baz']
|
||||
GivenCommandOutput ['/foo/bar', '/foo/baz']
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
@@ -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'
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('php', 'phpstan')
|
||||
|
||||
WithChainResults ['0.10.2']
|
||||
GivenCommandOutput ['0.10.2']
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
@@ -26,7 +26,7 @@ Execute(Custom phpstan configuration file):
|
||||
\ ale#Escape('phpstan') . ' analyze -l4 --errorFormat raw -c phpstan_config %s'
|
||||
|
||||
Execute(Choose the right format for error format param):
|
||||
WithChainResults ['0.10.3']
|
||||
GivenCommandOutput ['0.10.3']
|
||||
|
||||
AssertLinter 'phpstan', [
|
||||
\ ale#Escape('phpstan') . ' --version',
|
||||
|
||||
@@ -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',
|
||||
\]
|
||||
|
||||
@@ -60,7 +60,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',
|
||||
@@ -72,14 +72,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',
|
||||
@@ -91,7 +90,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',
|
||||
@@ -102,6 +101,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,
|
||||
\]
|
||||
|
||||
@@ -11,7 +11,6 @@ Before:
|
||||
let g:ale_enabled = 0
|
||||
let g:ale_echo_cursor = 0
|
||||
let g:ale_run_synchronously = 1
|
||||
unlet! g:ale_run_synchronously_callbacks
|
||||
let g:ale_set_lists_synchronously = 1
|
||||
let g:ale_fix_buffer_data = {}
|
||||
let g:ale_fixers = {
|
||||
|
||||
@@ -1,143 +1,129 @@
|
||||
Before:
|
||||
call ale#test#SetDirectory('/testplugin/test/fixers')
|
||||
call ale#assert#SetUpFixerTest('javascript', 'eslint')
|
||||
runtime autoload/ale/handlers/eslint.vim
|
||||
|
||||
After:
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#semver#ResetVersionCache()
|
||||
call ale#assert#TearDownFixerTest()
|
||||
|
||||
Execute(The executable path should be correct):
|
||||
call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.js')
|
||||
|
||||
" eslint_d output with an older eslint version is used here.
|
||||
AssertEqual
|
||||
GivenCommandOutput ['v4.4.1 (eslint_d v5.1.0)']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command': (has('win32') ? 'node.exe ' : '')
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
|
||||
\ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/.eslintrc.js'))
|
||||
\ . ' --fix %t',
|
||||
\ },
|
||||
\ ale#fixers#eslint#ApplyFixForVersion(bufnr(''), ['v4.4.1 (eslint_d v5.1.0)'])
|
||||
\ }
|
||||
|
||||
Execute(The lower priority configuration file in a nested directory should be preferred):
|
||||
call ale#test#SetFilename('../eslint-test-files/react-app/subdir-with-config/testfile.js')
|
||||
|
||||
AssertEqual
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command': (has('win32') ? 'node.exe ' : '')
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
|
||||
\ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/subdir-with-config/.eslintrc'))
|
||||
\ . ' --fix %t',
|
||||
\ },
|
||||
\ ale#fixers#eslint#ApplyFixForVersion(bufnr(''), [])
|
||||
\ }
|
||||
|
||||
Execute(package.json should be used as a last resort):
|
||||
call ale#test#SetFilename('../eslint-test-files/react-app/subdir-with-package-json/testfile.js')
|
||||
|
||||
AssertEqual
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command': (has('win32') ? 'node.exe ' : '')
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
|
||||
\ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/.eslintrc.js'))
|
||||
\ . ' --fix %t',
|
||||
\ },
|
||||
\ ale#fixers#eslint#ApplyFixForVersion(bufnr(''), [])
|
||||
\ }
|
||||
|
||||
call ale#test#SetFilename('../eslint-test-files/package.json')
|
||||
|
||||
AssertEqual
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command':
|
||||
\ ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/node_modules/.bin/eslint'))
|
||||
\ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/package.json'))
|
||||
\ . ' --fix %t',
|
||||
\ },
|
||||
\ ale#fixers#eslint#ApplyFixForVersion(bufnr(''), [])
|
||||
\ }
|
||||
|
||||
Execute(The version check should be correct):
|
||||
call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.js')
|
||||
call ale#test#SetFilename('../eslint-test-files/react-app/subdir-with-config/testfile.js')
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'chain_with': 'ale#fixers#eslint#ApplyFixForVersion',
|
||||
\ 'command': (has('win32') ? 'node.exe ' : '')
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
|
||||
\ . ' --version'
|
||||
\ },
|
||||
\ ale#fixers#eslint#Fix(bufnr(''))
|
||||
|
||||
Execute(--fix-dry-run should be used for 4.9.0 and up):
|
||||
call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.js')
|
||||
|
||||
AssertEqual
|
||||
" We should run the command to get the version the first time.
|
||||
GivenCommandOutput ['4.9.0']
|
||||
AssertFixer [
|
||||
\ (has('win32') ? 'node.exe ' : '')
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
|
||||
\ . ' --version',
|
||||
\ {
|
||||
\ 'command': (has('win32') ? 'node.exe ' : '')
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
|
||||
\ . ' --stdin-filename %s --stdin --fix-dry-run --format=json',
|
||||
\ 'process_with': 'ale#fixers#eslint#ProcessFixDryRunOutput',
|
||||
\ },
|
||||
\ ale#fixers#eslint#ApplyFixForVersion(bufnr(''), ['4.9.0'])
|
||||
\]
|
||||
|
||||
AssertFixer [
|
||||
\ {
|
||||
\ 'command': (has('win32') ? 'node.exe ' : '')
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
|
||||
\ . ' --stdin-filename %s --stdin --fix-dry-run --format=json',
|
||||
\ 'process_with': 'ale#fixers#eslint#ProcessFixDryRunOutput',
|
||||
\ },
|
||||
\]
|
||||
|
||||
Execute(--fix-dry-run should be used for 4.9.0 and up):
|
||||
call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.js')
|
||||
|
||||
GivenCommandOutput ['4.9.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': (has('win32') ? 'node.exe ' : '')
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
|
||||
\ . ' --stdin-filename %s --stdin --fix-dry-run --format=json',
|
||||
\ 'process_with': 'ale#fixers#eslint#ProcessFixDryRunOutput',
|
||||
\ }
|
||||
|
||||
Execute(--fix-to-stdout should be used for eslint_d):
|
||||
call ale#test#SetFilename('../eslint-test-files/app-with-eslint-d/testfile.js')
|
||||
|
||||
AssertEqual
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command':
|
||||
\ ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/app-with-eslint-d/node_modules/.bin/eslint_d'))
|
||||
\ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/package.json'))
|
||||
\ . ' --fix %t',
|
||||
\ },
|
||||
\ ale#fixers#eslint#ApplyFixForVersion(bufnr(''), [''])
|
||||
\ }
|
||||
|
||||
" The option should be used when eslint_d is new enough.
|
||||
" We look at the ESLint version instead of the eslint_d version.
|
||||
AssertEqual
|
||||
GivenCommandOutput ['v3.19.0 (eslint_d v4.2.0)']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command':
|
||||
\ ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/app-with-eslint-d/node_modules/.bin/eslint_d'))
|
||||
\ . ' --stdin-filename %s --stdin --fix-to-stdout',
|
||||
\ 'process_with': 'ale#fixers#eslint#ProcessEslintDOutput',
|
||||
\ },
|
||||
\ ale#fixers#eslint#ApplyFixForVersion(bufnr(''), ['v3.19.0 (eslint_d v4.2.0)'])
|
||||
\ }
|
||||
|
||||
" The option should be used for new versions too.
|
||||
AssertEqual
|
||||
GivenCommandOutput ['4.9.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command':
|
||||
\ ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/app-with-eslint-d/node_modules/.bin/eslint_d'))
|
||||
\ . ' --stdin-filename %s --stdin --fix-to-stdout',
|
||||
\ 'process_with': 'ale#fixers#eslint#ProcessEslintDOutput',
|
||||
\ },
|
||||
\ ale#fixers#eslint#ApplyFixForVersion(bufnr(''), ['4.9.0'])
|
||||
|
||||
Execute(The version number should be cached):
|
||||
call ale#test#SetFilename('../eslint-test-files/react-app/subdir-with-config/testfile.js')
|
||||
|
||||
" Call the second callback with the version output.
|
||||
call ale#fixers#eslint#ApplyFixForVersion(bufnr(''), ['4.9.0'])
|
||||
|
||||
" The version command should be skipped.
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'chain_with': 'ale#fixers#eslint#ApplyFixForVersion',
|
||||
\ 'command': '',
|
||||
\ },
|
||||
\ ale#fixers#eslint#Fix(bufnr(''))
|
||||
|
||||
" Call it again without the version output. We should use the newer command.
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': (has('win32') ? 'node.exe ' : '')
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
|
||||
\ . ' --stdin-filename %s --stdin --fix-dry-run --format=json',
|
||||
\ 'process_with': 'ale#fixers#eslint#ProcessFixDryRunOutput',
|
||||
\ },
|
||||
\ ale#fixers#eslint#ApplyFixForVersion(bufnr(''), [])
|
||||
\ }
|
||||
|
||||
Execute(The --fix-dry-run post-processor should handle JSON output correctly):
|
||||
AssertEqual
|
||||
|
||||
@@ -1,54 +1,36 @@
|
||||
Before:
|
||||
call ale#test#SetDirectory('/testplugin/test/fixers')
|
||||
|
||||
Save g:ale_javascript_prettier_eslint_executable
|
||||
Save g:ale_javascript_prettier_eslint_use_global
|
||||
Save g:ale_javascript_prettier_eslint_options
|
||||
|
||||
unlet! g:ale_javascript_prettier_eslint_executable
|
||||
unlet! g:ale_javascript_prettier_eslint_use_global
|
||||
unlet! g:ale_javascript_prettier_eslint_options
|
||||
|
||||
call ale#fixers#prettier_eslint#SetOptionDefaults()
|
||||
call ale#assert#SetUpFixerTest('javascript', 'prettier_eslint')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
unlet! b:ale_javascript_prettier_eslint_executable
|
||||
unlet! b:ale_javascript_prettier_eslint_use_global
|
||||
unlet! b:ale_javascript_prettier_eslint_options
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#semver#ResetVersionCache()
|
||||
call ale#assert#TearDownFixerTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertEqual
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command':
|
||||
\ ale#Escape('prettier-eslint')
|
||||
\ . ' %t'
|
||||
\ . ' --write'
|
||||
\ },
|
||||
\ ale#fixers#prettier_eslint#ApplyFixForVersion(bufnr(''), [])
|
||||
\ }
|
||||
|
||||
Execute(Additional options should be used when set):
|
||||
let b:ale_javascript_prettier_eslint_options = '--foobar'
|
||||
|
||||
AssertEqual
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command':
|
||||
\ ale#Escape('prettier-eslint')
|
||||
\ . ' %t'
|
||||
\ . ' --foobar --write'
|
||||
\ },
|
||||
\ ale#fixers#prettier_eslint#ApplyFixForVersion(bufnr(''), [])
|
||||
\ }
|
||||
|
||||
Execute(--eslint-config-path should be set for 4.2.0 and up):
|
||||
call ale#test#SetFilename('eslint-test-files/react-app/foo/bar.js')
|
||||
|
||||
AssertEqual
|
||||
GivenCommandOutput ['4.2.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command':
|
||||
@@ -56,58 +38,57 @@ Execute(--eslint-config-path should be set for 4.2.0 and up):
|
||||
\ . ' %t'
|
||||
\ . ' --eslint-config-path ' . ale#Escape(ale#path#Simplify(g:dir . '/eslint-test-files/react-app/.eslintrc.js'))
|
||||
\ . ' --write'
|
||||
\ },
|
||||
\ ale#fixers#prettier_eslint#ApplyFixForVersion(bufnr(''), ['4.2.0'])
|
||||
\ }
|
||||
|
||||
Execute(--eslint-config-path shouldn't be used for older versions):
|
||||
call ale#test#SetFilename('eslint-test-files/react-app/foo/bar.js')
|
||||
|
||||
AssertEqual
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command':
|
||||
\ ale#Escape('prettier-eslint')
|
||||
\ . ' %t'
|
||||
\ . ' --write'
|
||||
\ },
|
||||
\ ale#fixers#prettier_eslint#ApplyFixForVersion(bufnr(''), [])
|
||||
\ }
|
||||
|
||||
Execute(The version check should be correct):
|
||||
AssertEqual
|
||||
AssertFixer [
|
||||
\ ale#Escape('prettier-eslint') . ' --version',
|
||||
\ {
|
||||
\ 'chain_with': 'ale#fixers#prettier_eslint#ApplyFixForVersion',
|
||||
\ 'command': ale#Escape('prettier-eslint') . ' --version',
|
||||
\ },
|
||||
\ ale#fixers#prettier_eslint#Fix(bufnr(''))
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command':
|
||||
\ ale#Escape('prettier-eslint')
|
||||
\ . ' %t'
|
||||
\ . ' --write'
|
||||
\ }
|
||||
\]
|
||||
|
||||
Execute(The new --stdin-filepath option should be used when the version is new enough):
|
||||
call ale#test#SetFilename('eslint-test-files/react-app/foo/bar.js')
|
||||
|
||||
AssertEqual
|
||||
GivenCommandOutput ['4.4.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||
\ . ale#Escape('prettier-eslint')
|
||||
\ . ' --eslint-config-path ' . ale#Escape(ale#path#Simplify(g:dir . '/eslint-test-files/react-app/.eslintrc.js'))
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
\ },
|
||||
\ ale#fixers#prettier_eslint#ApplyFixForVersion(bufnr(''), ['4.4.0'])
|
||||
\ }
|
||||
|
||||
Execute(The version number should be cached):
|
||||
call ale#fixers#prettier_eslint#ApplyFixForVersion(bufnr(''), ['4.4.0'])
|
||||
|
||||
" The version command should be skipped.
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'chain_with': 'ale#fixers#prettier_eslint#ApplyFixForVersion',
|
||||
\ 'command': '',
|
||||
\ },
|
||||
\ ale#fixers#prettier_eslint#Fix(bufnr(''))
|
||||
|
||||
" The newer command should be used.
|
||||
AssertEqual
|
||||
GivenCommandOutput ['4.4.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||
\ . ale#Escape('prettier-eslint')
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
\ },
|
||||
\ ale#fixers#prettier_eslint#ApplyFixForVersion(bufnr(''), [])
|
||||
\ }
|
||||
|
||||
GivenCommandOutput []
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||
\ . ale#Escape('prettier-eslint')
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
\ }
|
||||
|
||||
@@ -1,296 +1,286 @@
|
||||
Before:
|
||||
call ale#test#SetDirectory('/testplugin/test/fixers')
|
||||
Save g:ale_javascript_prettier_executable
|
||||
Save g:ale_javascript_prettier_options
|
||||
call ale#assert#SetUpFixerTest('javascript', 'prettier')
|
||||
|
||||
" Use an invalid global executable, so we don't match it.
|
||||
let g:ale_javascript_prettier_executable = 'xxxinvalid'
|
||||
let g:ale_javascript_prettier_options = ''
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test/fixers')
|
||||
silent cd ..
|
||||
silent cd command_callback
|
||||
let g:dir = getcwd()
|
||||
|
||||
After:
|
||||
let g:ale_has_override = {}
|
||||
call ale#assert#TearDownFixerTest()
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#semver#ResetVersionCache()
|
||||
let g:ale_has_override = {}
|
||||
|
||||
Execute(The prettier callback should return the correct default values):
|
||||
call ale#test#SetFilename('../prettier-test-files/testfile.js')
|
||||
|
||||
AssertEqual
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command': ale#Escape(g:ale_javascript_prettier_executable)
|
||||
\ . ' %t'
|
||||
\ . ' --write',
|
||||
\ },
|
||||
\ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), [])
|
||||
\ }
|
||||
|
||||
Execute(The --config option should not be set automatically):
|
||||
let g:ale_javascript_prettier_use_local_config = 1
|
||||
call ale#test#SetFilename('../prettier-test-files/with_config/testfile.js')
|
||||
|
||||
AssertEqual
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command': ale#Escape(g:ale_javascript_prettier_executable)
|
||||
\ . ' %t'
|
||||
\ . ' --write',
|
||||
\ },
|
||||
\ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), [])
|
||||
\ }
|
||||
|
||||
Execute(The prettier callback should include custom prettier options):
|
||||
let g:ale_javascript_prettier_options = '--no-semi'
|
||||
call ale#test#SetFilename('../prettier-test-files/with_config/testfile.js')
|
||||
|
||||
AssertEqual
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command': ale#Escape(g:ale_javascript_prettier_executable)
|
||||
\ . ' %t'
|
||||
\ . ' --no-semi'
|
||||
\ . ' --write',
|
||||
\ },
|
||||
\ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), [])
|
||||
\ }
|
||||
|
||||
Execute(The version check should be correct):
|
||||
call ale#test#SetFilename('../prettier-test-files/testfile.js')
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'chain_with': 'ale#fixers#prettier#ApplyFixForVersion',
|
||||
\ 'command': ale#Escape(g:ale_javascript_prettier_executable)
|
||||
\ . ' --version',
|
||||
\ },
|
||||
\ ale#fixers#prettier#Fix(bufnr(''))
|
||||
AssertFixer [
|
||||
\ ale#Escape('prettier') . ' --version',
|
||||
\ {'read_temporary_file': 1, 'command': ale#Escape('prettier') . ' %t --write'}
|
||||
\]
|
||||
|
||||
Execute(--stdin-filepath should be used when prettier is new enough):
|
||||
let g:ale_javascript_prettier_options = '--no-semi'
|
||||
call ale#test#SetFilename('../prettier-test-files/with_config/testfile.js')
|
||||
|
||||
AssertEqual
|
||||
GivenCommandOutput ['1.6.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
||||
\ . ' --no-semi'
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
\ },
|
||||
\ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), ['1.6.0'])
|
||||
\ }
|
||||
|
||||
Execute(The version number should be cached):
|
||||
call ale#test#SetFilename('../prettier-test-files/with_config/testfile.js')
|
||||
|
||||
" Call the second callback with the version output.
|
||||
call ale#fixers#prettier#ApplyFixForVersion(bufnr(''), ['1.6.0'])
|
||||
|
||||
" Call it again without the version output. We should use the newer command.
|
||||
AssertEqual
|
||||
GivenCommandOutput ['1.6.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
\ },
|
||||
\ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), [])
|
||||
\ }
|
||||
|
||||
GivenCommandOutput []
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
\ }
|
||||
|
||||
Execute(Should set --parser to `babylon` by default, < 1.16.0):
|
||||
call ale#test#SetFilename('../prettier-test-files/testfile')
|
||||
|
||||
set filetype=javascript
|
||||
|
||||
AssertEqual
|
||||
GivenCommandOutput ['1.6.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
||||
\ . ' --parser babylon'
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
\ },
|
||||
\ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), ['1.6.0'])
|
||||
\ }
|
||||
|
||||
Execute(Should set --parser to `babel` by default, >= 1.16.0):
|
||||
call ale#test#SetFilename('../prettier-test-files/testfile')
|
||||
|
||||
set filetype=javascript
|
||||
|
||||
AssertEqual
|
||||
GivenCommandOutput ['1.16.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
||||
\ . ' --parser babel'
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
\ },
|
||||
\ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), ['1.16.0'])
|
||||
\ }
|
||||
|
||||
Execute(Should set --parser based on filetype, TypeScript):
|
||||
call ale#test#SetFilename('../prettier-test-files/testfile')
|
||||
|
||||
set filetype=typescript
|
||||
|
||||
AssertEqual
|
||||
GivenCommandOutput ['1.6.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
||||
\ . ' --parser typescript'
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
\ },
|
||||
\ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), ['1.6.0'])
|
||||
\ }
|
||||
|
||||
Execute(Should set --parser based on filetype, CSS):
|
||||
call ale#test#SetFilename('../prettier-test-files/testfile')
|
||||
|
||||
set filetype=css
|
||||
|
||||
AssertEqual
|
||||
GivenCommandOutput ['1.6.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
||||
\ . ' --parser css'
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
\ },
|
||||
\ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), ['1.6.0'])
|
||||
\ }
|
||||
|
||||
Execute(Should set --parser based on filetype, LESS):
|
||||
call ale#test#SetFilename('../prettier-test-files/testfile')
|
||||
|
||||
set filetype=less
|
||||
|
||||
AssertEqual
|
||||
GivenCommandOutput ['1.6.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
||||
\ . ' --parser less'
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
\ },
|
||||
\ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), ['1.6.0'])
|
||||
\ }
|
||||
|
||||
Execute(Should set --parser based on filetype, SCSS):
|
||||
call ale#test#SetFilename('../prettier-test-files/testfile')
|
||||
|
||||
set filetype=scss
|
||||
|
||||
AssertEqual
|
||||
GivenCommandOutput ['1.6.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
||||
\ . ' --parser scss'
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
\ },
|
||||
\ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), ['1.6.0'])
|
||||
\ }
|
||||
|
||||
Execute(Should set --parser based on filetype, JSON):
|
||||
call ale#test#SetFilename('../prettier-test-files/testfile')
|
||||
|
||||
set filetype=json
|
||||
|
||||
AssertEqual
|
||||
GivenCommandOutput ['1.6.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
||||
\ . ' --parser json'
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
\ },
|
||||
\ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), ['1.6.0'])
|
||||
\ }
|
||||
|
||||
Execute(Should set --parser based on filetype, JSON5):
|
||||
call ale#test#SetFilename('../prettier-test-files/testfile')
|
||||
|
||||
set filetype=json5
|
||||
|
||||
AssertEqual
|
||||
GivenCommandOutput ['1.6.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
||||
\ . ' --parser json5'
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
\ },
|
||||
\ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), ['1.6.0'])
|
||||
\ }
|
||||
|
||||
Execute(Should set --parser based on filetype, GraphQL):
|
||||
call ale#test#SetFilename('../prettier-test-files/testfile')
|
||||
|
||||
set filetype=graphql
|
||||
|
||||
AssertEqual
|
||||
GivenCommandOutput ['1.6.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
||||
\ . ' --parser graphql'
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
\ },
|
||||
\ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), ['1.6.0'])
|
||||
\ }
|
||||
|
||||
Execute(Should set --parser based on filetype, Markdown):
|
||||
call ale#test#SetFilename('../prettier-test-files/testfile')
|
||||
|
||||
set filetype=markdown
|
||||
|
||||
AssertEqual
|
||||
GivenCommandOutput ['1.6.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
||||
\ . ' --parser markdown'
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
\ },
|
||||
\ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), ['1.6.0'])
|
||||
\ }
|
||||
|
||||
Execute(Should set --parser based on filetype, Vue):
|
||||
call ale#test#SetFilename('../prettier-test-files/testfile')
|
||||
|
||||
set filetype=vue
|
||||
|
||||
AssertEqual
|
||||
GivenCommandOutput ['1.6.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
||||
\ . ' --parser vue'
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
\ },
|
||||
\ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), ['1.6.0'])
|
||||
\ }
|
||||
|
||||
Execute(Should set --parser based on filetype, YAML):
|
||||
call ale#test#SetFilename('../prettier-test-files/testfile')
|
||||
|
||||
set filetype=yaml
|
||||
|
||||
AssertEqual
|
||||
GivenCommandOutput ['1.6.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
||||
\ . ' --parser yaml'
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
\ },
|
||||
\ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), ['1.6.0'])
|
||||
\ }
|
||||
|
||||
Execute(Should set --parser based on filetype, HTML):
|
||||
call ale#test#SetFilename('../prettier-test-files/testfile')
|
||||
|
||||
set filetype=html
|
||||
|
||||
AssertEqual
|
||||
GivenCommandOutput ['1.6.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
||||
\ . ' --parser html'
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
\ },
|
||||
\ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), ['1.6.0'])
|
||||
\ }
|
||||
|
||||
Execute(Should set --parser based on first filetype of multiple filetypes):
|
||||
call ale#test#SetFilename('../prettier-test-files/testfile')
|
||||
|
||||
set filetype=css.scss
|
||||
|
||||
AssertEqual
|
||||
GivenCommandOutput ['1.6.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
||||
\ . ' --parser css'
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
\ },
|
||||
\ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), ['1.6.0'])
|
||||
\ }
|
||||
|
||||
Execute(The prettier_d post-processor should permit regular JavaScript content):
|
||||
AssertEqual
|
||||
|
||||
@@ -3,6 +3,7 @@ Before:
|
||||
|
||||
let g:ale_run_synchronously = 1
|
||||
unlet! g:ale_run_synchronously_callbacks
|
||||
unlet! g:ale_run_synchronously_emulate_commands
|
||||
|
||||
runtime autoload/ale/lsp.vim
|
||||
runtime autoload/ale/lsp_linter.vim
|
||||
@@ -234,6 +235,7 @@ After:
|
||||
call ale#linter#Reset()
|
||||
call ale#lsp#ResetConnections()
|
||||
|
||||
unlet! g:ale_run_synchronously_callbacks
|
||||
unlet! g:job_map
|
||||
unlet! g:emulate_job_failure
|
||||
unlet! g:next_job_id
|
||||
|
||||
@@ -13,6 +13,7 @@ Before:
|
||||
|
||||
let g:ale_buffer_info = {}
|
||||
let g:ale_run_synchronously = 1
|
||||
unlet! g:ale_run_synchronously_callbacks
|
||||
let g:ale_set_signs = 1
|
||||
" Disable features we don't need for these tests.
|
||||
let g:ale_set_quickfix = 0
|
||||
@@ -58,6 +59,7 @@ After:
|
||||
delfunction TestCallback
|
||||
delfunction CollectSigns
|
||||
|
||||
unlet! g:ale_run_synchronously_callbacks
|
||||
sign unplace *
|
||||
call ale#linter#Reset()
|
||||
|
||||
|
||||
@@ -87,6 +87,7 @@ Before:
|
||||
After:
|
||||
Restore
|
||||
|
||||
unlet! g:ale_run_synchronously_callbacks
|
||||
unlet! g:loclist
|
||||
delfunction GenerateResults
|
||||
delfunction ParseSigns
|
||||
|
||||
@@ -17,10 +17,14 @@ Before:
|
||||
\ 'read_buffer': 0,
|
||||
\})
|
||||
|
||||
" Run the test commands in the shell.
|
||||
let g:ale_run_synchronously_emulate_commands = 0
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
unlet! g:ale_run_synchronously_callbacks
|
||||
|
||||
Given foobar (Some imaginary filetype):
|
||||
Execute(It should be possible to compute an executable to check based on the result of commands):
|
||||
|
||||
@@ -54,11 +54,17 @@ Execute(eslint_d should be detected correctly):
|
||||
|
||||
Execute(eslint.js executables 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
|
||||
\ ale#Escape('node.exe') . ' '
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
|
||||
\ . ' -f unix --stdin --stdin-filename %s',
|
||||
\ ale#handlers#eslint#GetCommand(bufnr(''))
|
||||
if has('win32')
|
||||
AssertEqual
|
||||
\ ale#Escape('node.exe') . ' '
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
|
||||
\ . ' -f unix --stdin --stdin-filename %s',
|
||||
\ ale#handlers#eslint#GetCommand(bufnr(''))
|
||||
else
|
||||
AssertEqual
|
||||
\ ale#Escape(ale#path#Simplify(g:dir . '/eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
|
||||
\ . ' -f unix --stdin --stdin-filename %s',
|
||||
\ ale#handlers#eslint#GetCommand(bufnr(''))
|
||||
endif
|
||||
|
||||
@@ -1,48 +1,46 @@
|
||||
Before:
|
||||
runtime ale_linters/javascript/flow.vim
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test')
|
||||
call ale#assert#SetUpLinterTest('javascript', 'flow')
|
||||
call ale#test#SetDirectory('/testplugin/test/')
|
||||
|
||||
After:
|
||||
unlet! b:ale_javascript_flow_use_respect_pragma
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#linter#Reset()
|
||||
call ale#semver#ResetVersionCache()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(flow should return a command to run if a .flowconfig file exists):
|
||||
call ale#test#SetFilename('flow/a/sub/dummy')
|
||||
|
||||
AssertEqual
|
||||
AssertLinter 'flow',
|
||||
\ ale#Escape('flow')
|
||||
\ . ' check-contents --respect-pragma --json --from ale %s < %t'
|
||||
\ . (!has('win32') ? '; echo' : ''),
|
||||
\ ale_linters#javascript#flow#GetCommand(bufnr('%'), [])
|
||||
\ . (!has('win32') ? '; echo' : '')
|
||||
|
||||
Execute(flow should not use the respect pragma argument if the option is off):
|
||||
call ale#test#SetFilename('flow/a/sub/dummy')
|
||||
|
||||
let b:ale_javascript_flow_use_respect_pragma = 0
|
||||
|
||||
AssertEqual
|
||||
AssertLinter 'flow',
|
||||
\ ale#Escape('flow')
|
||||
\ . ' check-contents --json --from ale %s < %t'
|
||||
\ . (!has('win32') ? '; echo' : ''),
|
||||
\ ale_linters#javascript#flow#GetCommand(bufnr('%'), [])
|
||||
\ . (!has('win32') ? '; echo' : '')
|
||||
|
||||
Execute(flow should should not use --respect-pragma for old versions):
|
||||
call ale#test#SetFilename('flow/a/sub/dummy')
|
||||
|
||||
AssertEqual
|
||||
GivenCommandOutput [
|
||||
\ 'Warning: `flow --version` is deprecated in favor of `flow version`',
|
||||
\ 'Flow, a static type checker for JavaScript, version 0.27.0',
|
||||
\]
|
||||
AssertLinter 'flow', [
|
||||
\ ale#Escape('flow') . ' --version',
|
||||
\ ale#Escape('flow')
|
||||
\ . ' check-contents --json --from ale %s < %t'
|
||||
\ . (!has('win32') ? '; echo' : ''),
|
||||
\ ale_linters#javascript#flow#GetCommand(bufnr('%'), [
|
||||
\ 'Warning: `flow --version` is deprecated in favor of `flow version`',
|
||||
\ 'Flow, a static type checker for JavaScript, version 0.27.0',
|
||||
\ ])
|
||||
\]
|
||||
|
||||
Execute(flow should not return a command to run if no .flowconfig file exists):
|
||||
call ale#test#SetFilename('flow/b/sub/dummy')
|
||||
|
||||
AssertEqual '', ale_linters#javascript#flow#GetCommand(bufnr('%'), [])
|
||||
AssertLinterNotExecuted
|
||||
|
||||
@@ -1,32 +1,20 @@
|
||||
After:
|
||||
call ale#semver#ResetVersionCache()
|
||||
|
||||
Execute(GetVersion should return the version from the lines of output):
|
||||
Execute(ParseVersion should return the version from the lines of output):
|
||||
" We should be able to parse the semver string from flake8
|
||||
AssertEqual [3, 0, 4], ale#semver#GetVersion('dummy', [
|
||||
AssertEqual [3, 0, 4], ale#semver#ParseVersion([
|
||||
\ '3.0.4 (mccabe: 0.5.2, pyflakes: 1.2.3, pycodestyle: 2.0.0) CPython 2.7.12 on Linux',
|
||||
\ '1.2.3',
|
||||
\])
|
||||
|
||||
Execute(GetVersion should return an empty list when no vesrion can be found):
|
||||
AssertEqual [], ale#semver#GetVersion('dummy', ['x'])
|
||||
AssertEqual [], ale#semver#GetVersion('dummy', [])
|
||||
Execute(ParseVersion should return an empty list when no vesrion can be found):
|
||||
AssertEqual [], ale#semver#ParseVersion(['x'])
|
||||
AssertEqual [], ale#semver#ParseVersion([])
|
||||
|
||||
Execute(GetVersion should cache the version):
|
||||
AssertEqual [], ale#semver#GetVersion('dummy', [])
|
||||
AssertEqual [3, 4, 7], ale#semver#GetVersion('dummy', ['Version 3.4.7'])
|
||||
AssertEqual [3, 4, 17], ale#semver#GetVersion('dummy', ['Version 3.4.17'])
|
||||
AssertEqual [3, 4, 17], ale#semver#GetVersion('dummy', [])
|
||||
|
||||
Execute(GetVersion should tolerate missing patch numbers):
|
||||
Execute(ParseVersion should tolerate missing patch numbers):
|
||||
" This goes against the semver spec, but we handle it anyway.
|
||||
AssertEqual [3, 4, 0], ale#semver#GetVersion('dummy', ['Version 3.4'])
|
||||
|
||||
Execute(HasVersion should return 1 when the version has been cached):
|
||||
call ale#semver#GetVersion('dummy', [])
|
||||
AssertEqual 0, ale#semver#HasVersion('dummy')
|
||||
call ale#semver#GetVersion('dummy', ['3.4.7'])
|
||||
AssertEqual 1, ale#semver#HasVersion('dummy')
|
||||
AssertEqual [3, 4, 0], ale#semver#ParseVersion(['Version 3.4'])
|
||||
|
||||
Execute(GTE should compare triples correctly):
|
||||
Assert ale#semver#GTE([3, 0, 4], [3, 0, 0])
|
||||
|
||||
Reference in New Issue
Block a user