#3325 - ale#path#BufferCdString now generates %s:h

This commit is contained in:
w0rp
2020-08-28 17:46:43 +01:00
parent 34e409ea21
commit 3d5a2690ce
24 changed files with 117 additions and 89 deletions

View File

@@ -4,6 +4,7 @@ Before:
" Use an invalid global executable, so we don't match it.
let g:ale_python_isort_executable = 'xxxinvalid'
let g:ale_python_isort_options = ''
call ale#test#SetDirectory('/testplugin/test/fixers')
silent cd ..
@@ -27,7 +28,7 @@ Execute(The isort callback should return the correct default values):
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
AssertEqual
\ {
\ 'command': ale#path#CdString(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/subdir/foo'))
\ 'command': ale#path#BufferCdString(bufnr(''))
\ . ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/isort')) . ' -',
\ },
\ ale#fixers#isort#Fix(bufnr(''))
@@ -42,7 +43,7 @@ Execute(The isort callback should respect custom options):
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
AssertEqual
\ {
\ 'command': ale#path#CdString(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/subdir/foo'))
\ 'command': ale#path#BufferCdString(bufnr(''))
\ . ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/isort'))
\ . ' --multi-line=3 --trailing-comma -',
\ },

View File

@@ -73,7 +73,7 @@ Execute(The new --stdin-filepath option should be used when the version is new e
GivenCommandOutput ['4.4.0']
AssertFixer
\ {
\ 'command': ale#path#CdString(expand('%:p:h'))
\ 'command': ale#path#BufferCdString(bufnr(''))
\ . 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',
@@ -83,7 +83,7 @@ Execute(The version number should be cached):
GivenCommandOutput ['4.4.0']
AssertFixer
\ {
\ 'command': ale#path#CdString(expand('%:p:h'))
\ 'command': ale#path#BufferCdString(bufnr(''))
\ . ale#Escape('prettier-eslint')
\ . ' --stdin-filepath %s --stdin',
\ }
@@ -91,7 +91,7 @@ Execute(The version number should be cached):
GivenCommandOutput []
AssertFixer
\ {
\ 'command': ale#path#CdString(expand('%:p:h'))
\ 'command': ale#path#BufferCdString(bufnr(''))
\ . ale#Escape('prettier-eslint')
\ . ' --stdin-filepath %s --stdin',
\ }

View File

@@ -1,4 +1,8 @@
Before:
Save g:ale_stylelint_options
let g:ale_stylelint_options = ''
call ale#assert#SetUpFixerTest('css', 'stylelint')
After:
@@ -10,7 +14,7 @@ Execute(The stylelint callback should return the correct default values):
AssertFixer
\ {
\ 'read_temporary_file': 1,
\ 'command': ale#path#CdString(expand('%:p:h'))
\ 'command': ale#path#BufferCdString(bufnr(''))
\ . (has('win32') ? 'node.exe ' : '')
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/stylelint/bin/stylelint.js'))
\ . ' %t'
@@ -24,7 +28,7 @@ Execute(The stylelint callback should include custom stylelint options):
AssertFixer
\ {
\ 'read_temporary_file': 1,
\ 'command': ale#path#CdString(expand('%:p:h'))
\ 'command': ale#path#BufferCdString(bufnr(''))
\ . (has('win32') ? 'node.exe ' : '')
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/stylelint/bin/stylelint.js'))
\ . ' %t'