summaryrefslogtreecommitdiff
path: root/test/fixers
diff options
context:
space:
mode:
Diffstat (limited to 'test/fixers')
-rw-r--r--test/fixers/test_autoimport_fixer_callback.vader8
-rw-r--r--test/fixers/test_black_fixer_callback.vader22
-rw-r--r--test/fixers/test_dhall_format_fixer_callback.vader2
-rw-r--r--test/fixers/test_dhall_freeze_fixer_callback.vader2
-rw-r--r--test/fixers/test_dhall_lint_fixer_callback.vader2
-rw-r--r--test/fixers/test_eslint_fixer_callback.vader72
-rw-r--r--test/fixers/test_isort_fixer_callback.vader30
-rw-r--r--test/fixers/test_prettier_eslint_fixer.callback.vader12
-rw-r--r--test/fixers/test_prettier_fixer_callback.vader80
-rw-r--r--test/fixers/test_stylelint_fixer_callback.vader8
-rw-r--r--test/fixers/test_yamlfix_fixer_callback.vader25
11 files changed, 119 insertions, 144 deletions
diff --git a/test/fixers/test_autoimport_fixer_callback.vader b/test/fixers/test_autoimport_fixer_callback.vader
index 6952cbb8..bea448b5 100644
--- a/test/fixers/test_autoimport_fixer_callback.vader
+++ b/test/fixers/test_autoimport_fixer_callback.vader
@@ -28,8 +28,8 @@ Execute(The autoimport 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#BufferCdString(bufnr(''))
- \ . ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/autoimport')) . ' -',
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/autoimport')) . ' -',
\ },
\ ale#fixers#autoimport#Fix(bufnr(''))
@@ -43,8 +43,8 @@ Execute(The autoimport callback should respect custom options):
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
AssertEqual
\ {
- \ 'command': ale#path#BufferCdString(bufnr(''))
- \ . ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/autoimport'))
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/autoimport'))
\ . ' --multi-line=3 --trailing-comma -',
\ },
\ ale#fixers#autoimport#Fix(bufnr(''))
diff --git a/test/fixers/test_black_fixer_callback.vader b/test/fixers/test_black_fixer_callback.vader
index 75864479..055f8783 100644
--- a/test/fixers/test_black_fixer_callback.vader
+++ b/test/fixers/test_black_fixer_callback.vader
@@ -1,30 +1,23 @@
Before:
- Save g:ale_python_black_executable
- Save g:ale_python_black_options
+ call ale#assert#SetUpFixerTest('python', 'black')
- " Use an invalid global executable, so we don't match it.
- let g:ale_python_black_executable = 'xxxinvalid'
- let g:ale_python_black_options = ''
- let g:ale_python_black_auto_pipenv = 0
-
- call ale#test#SetDirectory('/testplugin/test/fixers')
silent cd ..
silent cd command_callback
let g:dir = getcwd()
-
let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
After:
- Restore
+ call ale#assert#TearDownFixerTest()
+ unlet! g:dir
unlet! b:bin_dir
- call ale#test#RestoreDirectory()
-
Execute(The black 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#BufferCdString(bufnr('')) . ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/black')) . ' -'},
+ \ {
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/black')) . ' -'},
\ ale#fixers#black#Fix(bufnr(''))
Execute(The black callback should include options):
@@ -40,6 +33,7 @@ Execute(The black callback should include --pyi for .pyi files):
let g:ale_python_black_change_directory = 0
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.pyi')
+
AssertEqual
\ {'command': ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/black')) . ' --pyi -' },
\ ale#fixers#black#Fix(bufnr(''))
@@ -48,7 +42,7 @@ Execute(Pipenv is detected when python_black_auto_pipenv is set):
let g:ale_python_black_auto_pipenv = 1
let g:ale_python_black_change_directory = 0
- call ale#test#SetFilename('/testplugin/test/python_fixtures/pipenv/whatever.py')
+ call ale#test#SetFilename('../python_fixtures/pipenv/whatever.py')
AssertEqual
\ {'command': ale#Escape('pipenv') . ' run black -'},
diff --git a/test/fixers/test_dhall_format_fixer_callback.vader b/test/fixers/test_dhall_format_fixer_callback.vader
index 9bc17f7e..8d6c7651 100644
--- a/test/fixers/test_dhall_format_fixer_callback.vader
+++ b/test/fixers/test_dhall_format_fixer_callback.vader
@@ -6,7 +6,7 @@ Before:
let g:ale_dhall_executable = 'odd-dhall'
let g:ale_dhall_options = '--ascii'
- call ale#assert#SetUpFixerTest('dhall-format', 'dhall-format')
+ call ale#assert#SetUpFixerTest('dhall', 'dhall-format')
After:
call ale#assert#TearDownFixerTest()
diff --git a/test/fixers/test_dhall_freeze_fixer_callback.vader b/test/fixers/test_dhall_freeze_fixer_callback.vader
index c8f820bb..c6e94ec1 100644
--- a/test/fixers/test_dhall_freeze_fixer_callback.vader
+++ b/test/fixers/test_dhall_freeze_fixer_callback.vader
@@ -7,7 +7,7 @@ Before:
let g:ale_dhall_options = '--ascii'
let g:ale_dhall_freeze_options = '--all'
- call ale#assert#SetUpFixerTest('dhall-freeze', 'dhall-freeze')
+ call ale#assert#SetUpFixerTest('dhall', 'dhall-freeze')
After:
call ale#assert#TearDownFixerTest()
diff --git a/test/fixers/test_dhall_lint_fixer_callback.vader b/test/fixers/test_dhall_lint_fixer_callback.vader
index 82229363..5a1d6488 100644
--- a/test/fixers/test_dhall_lint_fixer_callback.vader
+++ b/test/fixers/test_dhall_lint_fixer_callback.vader
@@ -6,7 +6,7 @@ Before:
let g:ale_dhall_executable = 'odd-dhall'
let g:ale_dhall_options = '--ascii'
- call ale#assert#SetUpFixerTest('dhall-lint', 'dhall-lint')
+ call ale#assert#SetUpFixerTest('dhall', 'dhall-lint')
After:
call ale#assert#TearDownFixerTest()
diff --git a/test/fixers/test_eslint_fixer_callback.vader b/test/fixers/test_eslint_fixer_callback.vader
index 50fc6672..48cafe78 100644
--- a/test/fixers/test_eslint_fixer_callback.vader
+++ b/test/fixers/test_eslint_fixer_callback.vader
@@ -17,9 +17,8 @@ Execute(The executable path should be correct):
AssertFixer
\ {
\ 'read_temporary_file': 1,
- \ 'command':
- \ ale#path#CdString(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app'))
- \ . (has('win32') ? 'node.exe ' : '')
+ \ 'cwd': ale#path#Simplify(g:dir . '/../eslint-test-files/react-app'),
+ \ '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',
@@ -36,6 +35,7 @@ Execute(The ESLint fixer should use a config file option if set for old versions
AssertFixer
\ {
\ 'read_temporary_file': 1,
+ \ 'cwd': '',
\ 'command': ale#Escape('eslint') . ' -c /foo.cfg --fix %t',
\ }
@@ -44,6 +44,7 @@ Execute(The ESLint fixer should use a config file option if set for old versions
AssertFixer
\ {
\ 'read_temporary_file': 1,
+ \ 'cwd': '',
\ 'command': ale#Escape('eslint') . ' --bar -c /foo.cfg --fix %t',
\ }
@@ -52,6 +53,7 @@ Execute(The ESLint fixer should use a config file option if set for old versions
AssertFixer
\ {
\ 'read_temporary_file': 1,
+ \ 'cwd': '',
\ 'command': ale#Escape('eslint') . ' --config /foo.cfg --fix %t',
\ }
@@ -60,6 +62,7 @@ Execute(The ESLint fixer should use a config file option if set for old versions
AssertFixer
\ {
\ 'read_temporary_file': 1,
+ \ 'cwd': '',
\ 'command': ale#Escape('eslint') . ' --bar --config /foo.cfg --fix %t',
\ }
@@ -72,6 +75,7 @@ Execute(The ESLint fixer should use a -c file option if set for eslint_d):
AssertFixer
\ {
\ 'process_with': 'ale#fixers#eslint#ProcessEslintDOutput',
+ \ 'cwd': '',
\ 'command': ale#Escape('/bin/eslint_d')
\ . ' -c /foo.cfg'
\ . ' --stdin-filename %s --stdin --fix-to-stdout'
@@ -82,6 +86,7 @@ Execute(The ESLint fixer should use a -c file option if set for eslint_d):
AssertFixer
\ {
\ 'process_with': 'ale#fixers#eslint#ProcessEslintDOutput',
+ \ 'cwd': '',
\ 'command': ale#Escape('/bin/eslint_d')
\ . ' --bar -c /foo.cfg'
\ . ' --stdin-filename %s --stdin --fix-to-stdout'
@@ -92,6 +97,7 @@ Execute(The ESLint fixer should use a -c file option if set for eslint_d):
AssertFixer
\ {
\ 'process_with': 'ale#fixers#eslint#ProcessEslintDOutput',
+ \ 'cwd': '',
\ 'command': ale#Escape('/bin/eslint_d')
\ . ' --config /foo.cfg'
\ . ' --stdin-filename %s --stdin --fix-to-stdout'
@@ -102,6 +108,7 @@ Execute(The ESLint fixer should use a -c file option if set for eslint_d):
AssertFixer
\ {
\ 'process_with': 'ale#fixers#eslint#ProcessEslintDOutput',
+ \ 'cwd': '',
\ 'command': ale#Escape('/bin/eslint_d')
\ . ' --bar --config /foo.cfg'
\ . ' --stdin-filename %s --stdin --fix-to-stdout'
@@ -115,6 +122,7 @@ Execute(The ESLint fixer should use a config file option if set for new versions
AssertFixer
\ {
\ 'process_with': 'ale#fixers#eslint#ProcessFixDryRunOutput',
+ \ 'cwd': '',
\ 'command': ale#Escape('eslint')
\ . ' -c /foo.cfg'
\ . ' --stdin-filename %s --stdin --fix-dry-run --format=json'
@@ -125,6 +133,7 @@ Execute(The ESLint fixer should use a config file option if set for new versions
AssertFixer
\ {
\ 'process_with': 'ale#fixers#eslint#ProcessFixDryRunOutput',
+ \ 'cwd': '',
\ 'command': ale#Escape('eslint')
\ . ' --bar -c /foo.cfg'
\ . ' --stdin-filename %s --stdin --fix-dry-run --format=json'
@@ -135,6 +144,7 @@ Execute(The ESLint fixer should use a config file option if set for new versions
AssertFixer
\ {
\ 'process_with': 'ale#fixers#eslint#ProcessFixDryRunOutput',
+ \ 'cwd': '',
\ 'command': ale#Escape('eslint')
\ . ' --config /foo.cfg'
\ . ' --stdin-filename %s --stdin --fix-dry-run --format=json'
@@ -145,6 +155,7 @@ Execute(The ESLint fixer should use a config file option if set for new versions
AssertFixer
\ {
\ 'process_with': 'ale#fixers#eslint#ProcessFixDryRunOutput',
+ \ 'cwd': '',
\ 'command': ale#Escape('eslint')
\ . ' --bar --config /foo.cfg'
\ . ' --stdin-filename %s --stdin --fix-dry-run --format=json'
@@ -156,9 +167,8 @@ Execute(The lower priority configuration file in a nested directory should be pr
AssertFixer
\ {
\ 'read_temporary_file': 1,
- \ 'command':
- \ ale#path#CdString(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app'))
- \ . (has('win32') ? 'node.exe ' : '')
+ \ 'cwd': ale#path#Simplify(g:dir . '/../eslint-test-files/react-app'),
+ \ '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',
@@ -172,9 +182,8 @@ Execute(--config in options should override configuration file detection for old
AssertFixer
\ {
\ 'read_temporary_file': 1,
- \ 'command':
- \ ale#path#CdString(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app'))
- \ . (has('win32') ? 'node.exe ' : '')
+ \ 'cwd': ale#path#Simplify(g:dir . '/../eslint-test-files/react-app'),
+ \ 'command': (has('win32') ? 'node.exe ' : '')
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
\ . ' --config /foo.cfg'
\ . ' --fix %t',
@@ -185,9 +194,8 @@ Execute(--config in options should override configuration file detection for old
AssertFixer
\ {
\ 'read_temporary_file': 1,
- \ 'command':
- \ ale#path#CdString(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app'))
- \ . (has('win32') ? 'node.exe ' : '')
+ \ 'cwd': ale#path#Simplify(g:dir . '/../eslint-test-files/react-app'),
+ \ 'command': (has('win32') ? 'node.exe ' : '')
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
\ . ' -c /foo.cfg'
\ . ' --fix %t',
@@ -199,9 +207,8 @@ Execute(package.json should be used as a last resort):
AssertFixer
\ {
\ 'read_temporary_file': 1,
- \ 'command':
- \ ale#path#CdString(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app'))
- \ . (has('win32') ? 'node.exe ' : '')
+ \ 'cwd': ale#path#Simplify(g:dir . '/../eslint-test-files/react-app'),
+ \ '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',
@@ -212,9 +219,8 @@ Execute(package.json should be used as a last resort):
AssertFixer
\ {
\ 'read_temporary_file': 1,
- \ 'command':
- \ ale#path#CdString(ale#path#Simplify(g:dir . '/../eslint-test-files'))
- \ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/node_modules/.bin/eslint'))
+ \ 'cwd': ale#path#Simplify(g:dir . '/../eslint-test-files'),
+ \ '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',
\ }
@@ -229,9 +235,8 @@ Execute(The version check should be correct):
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
\ . ' --version',
\ {
- \ 'command':
- \ ale#path#CdString(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app'))
- \ . (has('win32') ? 'node.exe ' : '')
+ \ 'cwd': ale#path#Simplify(g:dir . '/../eslint-test-files/react-app'),
+ \ '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',
@@ -240,9 +245,8 @@ Execute(The version check should be correct):
AssertFixer [
\ {
- \ 'command':
- \ ale#path#CdString(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app'))
- \ . (has('win32') ? 'node.exe ' : '')
+ \ 'cwd': ale#path#Simplify(g:dir . '/../eslint-test-files/react-app'),
+ \ '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',
@@ -255,9 +259,8 @@ Execute(--fix-dry-run should be used for 4.9.0 and up):
GivenCommandOutput ['4.9.0']
AssertFixer
\ {
- \ 'command':
- \ ale#path#CdString(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app'))
- \ . (has('win32') ? 'node.exe ' : '')
+ \ 'cwd': ale#path#Simplify(g:dir . '/../eslint-test-files/react-app'),
+ \ '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',
@@ -269,9 +272,8 @@ Execute(--fix-to-stdout should be used for eslint_d):
AssertFixer
\ {
\ 'read_temporary_file': 1,
- \ 'command':
- \ ale#path#CdString(ale#path#Simplify(g:dir . '/../eslint-test-files/app-with-eslint-d'))
- \ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/app-with-eslint-d/node_modules/.bin/eslint_d'))
+ \ 'cwd': ale#path#Simplify(g:dir . '/../eslint-test-files/app-with-eslint-d'),
+ \ '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',
\ }
@@ -281,9 +283,8 @@ Execute(--fix-to-stdout should be used for eslint_d):
GivenCommandOutput ['v3.19.0 (eslint_d v4.2.0)']
AssertFixer
\ {
- \ 'command':
- \ ale#path#CdString(ale#path#Simplify(g:dir . '/../eslint-test-files/app-with-eslint-d'))
- \ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/app-with-eslint-d/node_modules/.bin/eslint_d'))
+ \ 'cwd': ale#path#Simplify(g:dir . '/../eslint-test-files/app-with-eslint-d'),
+ \ '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',
\ }
@@ -292,9 +293,8 @@ Execute(--fix-to-stdout should be used for eslint_d):
GivenCommandOutput ['4.9.0']
AssertFixer
\ {
- \ 'command':
- \ ale#path#CdString(ale#path#Simplify(g:dir . '/../eslint-test-files/app-with-eslint-d'))
- \ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/app-with-eslint-d/node_modules/.bin/eslint_d'))
+ \ 'cwd': ale#path#Simplify(g:dir . '/../eslint-test-files/app-with-eslint-d'),
+ \ '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',
\ }
diff --git a/test/fixers/test_isort_fixer_callback.vader b/test/fixers/test_isort_fixer_callback.vader
index 3941f6dd..96632c8c 100644
--- a/test/fixers/test_isort_fixer_callback.vader
+++ b/test/fixers/test_isort_fixer_callback.vader
@@ -1,26 +1,17 @@
Before:
- Save g:ale_python_isort_executable
- Save g:ale_python_isort_options
+ call ale#assert#SetUpFixerTest('python', 'isort')
- " Use an invalid global executable, so we don't match it.
- let g:ale_python_isort_executable = 'xxxinvalid'
- let g:ale_python_isort_options = ''
- let g:ale_python_isort_auto_pipenv = 0
-
- call ale#test#SetDirectory('/testplugin/test/fixers')
silent cd ..
silent cd command_callback
let g:dir = getcwd()
-
let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
After:
- Restore
+ call ale#assert#TearDownFixerTest()
+ unlet! g:dir
unlet! b:bin_dir
- call ale#test#RestoreDirectory()
-
Execute(The isort callback should return the correct default values):
AssertEqual
\ 0,
@@ -29,8 +20,8 @@ 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#BufferCdString(bufnr(''))
- \ . ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/isort')) . ' -',
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/isort')) . ' -',
\ },
\ ale#fixers#isort#Fix(bufnr(''))
@@ -44,8 +35,8 @@ 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#BufferCdString(bufnr(''))
- \ . ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/isort'))
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/isort'))
\ . ' --multi-line=3 --trailing-comma -',
\ },
\ ale#fixers#isort#Fix(bufnr(''))
@@ -53,8 +44,11 @@ Execute(The isort callback should respect custom options):
Execute(Pipenv is detected when python_isort_auto_pipenv is set):
let g:ale_python_isort_auto_pipenv = 1
- call ale#test#SetFilename('/testplugin/test/python_fixtures/pipenv/whatever.py')
+ call ale#test#SetFilename('../python_fixtures/pipenv/whatever.py')
AssertEqual
- \ {'command': ale#path#BufferCdString(bufnr('')) . ale#Escape('pipenv') . ' run isort -'},
+ \ {
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape('pipenv') . ' run isort -'
+ \ },
\ ale#fixers#isort#Fix(bufnr(''))
diff --git a/test/fixers/test_prettier_eslint_fixer.callback.vader b/test/fixers/test_prettier_eslint_fixer.callback.vader
index be8f04e3..9bd6baf7 100644
--- a/test/fixers/test_prettier_eslint_fixer.callback.vader
+++ b/test/fixers/test_prettier_eslint_fixer.callback.vader
@@ -73,8 +73,8 @@ Execute(The new --stdin-filepath option should be used when the version is new e
GivenCommandOutput ['4.4.0']
AssertFixer
\ {
- \ 'command': ale#path#BufferCdString(bufnr(''))
- \ . ale#Escape('prettier-eslint')
+ \ 'cwd': '%s:h',
+ \ 'command': 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,15 +83,15 @@ Execute(The version number should be cached):
GivenCommandOutput ['4.4.0']
AssertFixer
\ {
- \ 'command': ale#path#BufferCdString(bufnr(''))
- \ . ale#Escape('prettier-eslint')
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape('prettier-eslint')
\ . ' --stdin-filepath %s --stdin',
\ }
GivenCommandOutput []
AssertFixer
\ {
- \ 'command': ale#path#BufferCdString(bufnr(''))
- \ . ale#Escape('prettier-eslint')
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape('prettier-eslint')
\ . ' --stdin-filepath %s --stdin',
\ }
diff --git a/test/fixers/test_prettier_fixer_callback.vader b/test/fixers/test_prettier_fixer_callback.vader
index b999071f..0857c4cb 100644
--- a/test/fixers/test_prettier_fixer_callback.vader
+++ b/test/fixers/test_prettier_fixer_callback.vader
@@ -62,8 +62,8 @@ Execute(--stdin-filepath should be used when prettier is new enough):
GivenCommandOutput ['1.6.0']
AssertFixer
\ {
- \ 'command': ale#path#CdString(expand('%:p:h'))
- \ . ale#Escape(g:ale_javascript_prettier_executable)
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --no-semi'
\ . ' --stdin-filepath %s --stdin',
\ }
@@ -74,16 +74,16 @@ Execute(The version number should be cached):
GivenCommandOutput ['1.6.0']
AssertFixer
\ {
- \ 'command': ale#path#CdString(expand('%:p:h'))
- \ . ale#Escape(g:ale_javascript_prettier_executable)
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --stdin-filepath %s --stdin',
\ }
GivenCommandOutput []
AssertFixer
\ {
- \ 'command': ale#path#CdString(expand('%:p:h'))
- \ . ale#Escape(g:ale_javascript_prettier_executable)
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --stdin-filepath %s --stdin',
\ }
@@ -95,8 +95,8 @@ Execute(Should set --parser to `babylon` by default, < 1.16.0):
GivenCommandOutput ['1.6.0']
AssertFixer
\ {
- \ 'command': ale#path#CdString(expand('%:p:h'))
- \ . ale#Escape(g:ale_javascript_prettier_executable)
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --parser babylon'
\ . ' --stdin-filepath %s --stdin',
\ }
@@ -109,8 +109,8 @@ Execute(Should set --parser to `babel` by default, >= 1.16.0):
GivenCommandOutput ['1.16.0']
AssertFixer
\ {
- \ 'command': ale#path#CdString(expand('%:p:h'))
- \ . ale#Escape(g:ale_javascript_prettier_executable)
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --parser babel'
\ . ' --stdin-filepath %s --stdin',
\ }
@@ -123,8 +123,8 @@ Execute(Should set --parser based on filetype, TypeScript):
GivenCommandOutput ['1.6.0']
AssertFixer
\ {
- \ 'command': ale#path#CdString(expand('%:p:h'))
- \ . ale#Escape(g:ale_javascript_prettier_executable)
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --parser typescript'
\ . ' --stdin-filepath %s --stdin',
\ }
@@ -137,8 +137,8 @@ Execute(Should set --parser based on filetype, CSS):
GivenCommandOutput ['1.6.0']
AssertFixer
\ {
- \ 'command': ale#path#CdString(expand('%:p:h'))
- \ . ale#Escape(g:ale_javascript_prettier_executable)
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --parser css'
\ . ' --stdin-filepath %s --stdin',
\ }
@@ -151,8 +151,8 @@ Execute(Should set --parser based on filetype, LESS):
GivenCommandOutput ['1.6.0']
AssertFixer
\ {
- \ 'command': ale#path#CdString(expand('%:p:h'))
- \ . ale#Escape(g:ale_javascript_prettier_executable)
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --parser less'
\ . ' --stdin-filepath %s --stdin',
\ }
@@ -165,8 +165,8 @@ Execute(Should set --parser based on filetype, SCSS):
GivenCommandOutput ['1.6.0']
AssertFixer
\ {
- \ 'command': ale#path#CdString(expand('%:p:h'))
- \ . ale#Escape(g:ale_javascript_prettier_executable)
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --parser scss'
\ . ' --stdin-filepath %s --stdin',
\ }
@@ -179,8 +179,8 @@ Execute(Should set --parser based on filetype, JSON):
GivenCommandOutput ['1.6.0']
AssertFixer
\ {
- \ 'command': ale#path#CdString(expand('%:p:h'))
- \ . ale#Escape(g:ale_javascript_prettier_executable)
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --parser json'
\ . ' --stdin-filepath %s --stdin',
\ }
@@ -193,8 +193,8 @@ Execute(Should set --parser based on filetype, JSON5):
GivenCommandOutput ['1.6.0']
AssertFixer
\ {
- \ 'command': ale#path#CdString(expand('%:p:h'))
- \ . ale#Escape(g:ale_javascript_prettier_executable)
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --parser json5'
\ . ' --stdin-filepath %s --stdin',
\ }
@@ -207,8 +207,8 @@ Execute(Should set --parser based on filetype, GraphQL):
GivenCommandOutput ['1.6.0']
AssertFixer
\ {
- \ 'command': ale#path#CdString(expand('%:p:h'))
- \ . ale#Escape(g:ale_javascript_prettier_executable)
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --parser graphql'
\ . ' --stdin-filepath %s --stdin',
\ }
@@ -221,8 +221,8 @@ Execute(Should set --parser based on filetype, Markdown):
GivenCommandOutput ['1.6.0']
AssertFixer
\ {
- \ 'command': ale#path#CdString(expand('%:p:h'))
- \ . ale#Escape(g:ale_javascript_prettier_executable)
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --parser markdown'
\ . ' --stdin-filepath %s --stdin',
\ }
@@ -235,8 +235,8 @@ Execute(Should set --parser based on filetype, Vue):
GivenCommandOutput ['1.6.0']
AssertFixer
\ {
- \ 'command': ale#path#CdString(expand('%:p:h'))
- \ . ale#Escape(g:ale_javascript_prettier_executable)
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --parser vue'
\ . ' --stdin-filepath %s --stdin',
\ }
@@ -249,8 +249,8 @@ Execute(Should set --parser based on filetype, YAML):
GivenCommandOutput ['1.6.0']
AssertFixer
\ {
- \ 'command': ale#path#CdString(expand('%:p:h'))
- \ . ale#Escape(g:ale_javascript_prettier_executable)
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --parser yaml'
\ . ' --stdin-filepath %s --stdin',
\ }
@@ -263,8 +263,8 @@ Execute(Should set --parser based on filetype, HTML):
GivenCommandOutput ['1.6.0']
AssertFixer
\ {
- \ 'command': ale#path#CdString(expand('%:p:h'))
- \ . ale#Escape(g:ale_javascript_prettier_executable)
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --parser html'
\ . ' --stdin-filepath %s --stdin',
\ }
@@ -277,8 +277,8 @@ Execute(Should set --parser based on filetype, Ruby):
GivenCommandOutput ['1.6.0']
AssertFixer
\ {
- \ 'command': ale#path#CdString(expand('%:p:h'))
- \ . ale#Escape(g:ale_javascript_prettier_executable)
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --parser ruby'
\ . ' --stdin-filepath %s --stdin',
\ }
@@ -291,8 +291,8 @@ Execute(Should set --parser based on first filetype of multiple filetypes):
GivenCommandOutput ['1.6.0']
AssertFixer
\ {
- \ 'command': ale#path#CdString(expand('%:p:h'))
- \ . ale#Escape(g:ale_javascript_prettier_executable)
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --parser css'
\ . ' --stdin-filepath %s --stdin',
\ }
@@ -305,8 +305,8 @@ Execute(Should set --parser for experimental language, Handlebars):
GivenCommandOutput ['1.6.0']
AssertFixer
\ {
- \ 'command': ale#path#CdString(expand('%:p:h'))
- \ . ale#Escape(g:ale_javascript_prettier_executable)
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --parser glimmer'
\ . ' --stdin-filepath %s --stdin',
\ }
@@ -317,8 +317,8 @@ Execute(Changes to directory where .prettierignore is found):
GivenCommandOutput ['1.6.0']
AssertFixer
\ {
- \ 'command': ale#path#CdString(expand('%:p:h:h'))
- \ . ale#Escape(g:ale_javascript_prettier_executable)
+ \ 'cwd': expand('%:p:h:h'),
+ \ 'command': ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --stdin-filepath %s --stdin',
\ }
diff --git a/test/fixers/test_stylelint_fixer_callback.vader b/test/fixers/test_stylelint_fixer_callback.vader
index 8fbd8a51..95f91f91 100644
--- a/test/fixers/test_stylelint_fixer_callback.vader
+++ b/test/fixers/test_stylelint_fixer_callback.vader
@@ -14,8 +14,8 @@ Execute(The stylelint callback should return the correct default values):
AssertFixer
\ {
\ 'read_temporary_file': 1,
- \ 'command': ale#path#BufferCdString(bufnr(''))
- \ . (has('win32') ? 'node.exe ' : '')
+ \ 'cwd': '%s:h',
+ \ 'command': (has('win32') ? 'node.exe ' : '')
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/stylelint/bin/stylelint.js'))
\ . ' %t'
\ . ' --fix',
@@ -28,8 +28,8 @@ Execute(The stylelint callback should include custom stylelint options):
AssertFixer
\ {
\ 'read_temporary_file': 1,
- \ 'command': ale#path#BufferCdString(bufnr(''))
- \ . (has('win32') ? 'node.exe ' : '')
+ \ 'cwd': '%s:h',
+ \ 'command': (has('win32') ? 'node.exe ' : '')
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/stylelint/bin/stylelint.js'))
\ . ' %t'
\ . ' --cache'
diff --git a/test/fixers/test_yamlfix_fixer_callback.vader b/test/fixers/test_yamlfix_fixer_callback.vader
index 3ffda91e..75b9f0ad 100644
--- a/test/fixers/test_yamlfix_fixer_callback.vader
+++ b/test/fixers/test_yamlfix_fixer_callback.vader
@@ -1,12 +1,6 @@
Before:
- Save g:ale_python_yamlfix_executable
- Save g:ale_python_yamlfix_options
+ call ale#assert#SetUpFixerTest('yaml', 'yamlfix')
- " Use an invalid global executable, so we don't match it.
- let g:ale_python_yamlfix_executable = 'xxxinvalid'
- let g:ale_python_yamlfix_options = ''
-
- call ale#test#SetDirectory('/testplugin/test/fixers')
silent cd ..
silent cd command_callback
let g:dir = getcwd()
@@ -14,11 +8,8 @@ Before:
let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
After:
- Restore
-
unlet! b:bin_dir
-
- call ale#test#RestoreDirectory()
+ call ale#assert#TearDownFixerTest()
Execute(The yamlfix callback should return the correct default values):
AssertEqual
@@ -28,23 +19,19 @@ Execute(The yamlfix callback should return the correct default values):
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.yaml')
AssertEqual
\ {
- \ 'command': ale#path#BufferCdString(bufnr(''))
- \ . ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/yamlfix')) . ' -',
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/yamlfix')) . ' -',
\ },
\ ale#fixers#yamlfix#Fix(bufnr(''))
Execute(The yamlfix callback should respect custom options):
let g:ale_yaml_yamlfix_options = '--multi-line=3 --trailing-comma'
- AssertEqual
- \ 0,
- \ ale#fixers#yamlfix#Fix(bufnr(''))
-
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.yaml')
AssertEqual
\ {
- \ 'command': ale#path#BufferCdString(bufnr(''))
- \ . ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/yamlfix'))
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/yamlfix'))
\ . ' --multi-line=3 --trailing-comma -',
\ },
\ ale#fixers#yamlfix#Fix(bufnr(''))