mirror of
https://github.com/dense-analysis/ale.git
synced 2026-05-17 13:59:47 +08:00
Replace appveyor with GitHub actions (#5119)
CI / Build (push) Has been cancelled
CI / Neovim 0.10 Windows (push) Has been cancelled
CI / Neovim 0.12 Windows (push) Has been cancelled
CI / Vim 8.2 Windows (push) Has been cancelled
CI / Vim 9.2 Windows (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Lua (push) Has been cancelled
CI / Neovim 0.10 Linux (push) Has been cancelled
CI / Neovim 0.12 Linux (push) Has been cancelled
CI / Vim 8.2 Linux (push) Has been cancelled
CI / Vim 9.2 Linux (push) Has been cancelled
CI / Build (push) Has been cancelled
CI / Neovim 0.10 Windows (push) Has been cancelled
CI / Neovim 0.12 Windows (push) Has been cancelled
CI / Vim 8.2 Windows (push) Has been cancelled
CI / Vim 9.2 Windows (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Lua (push) Has been cancelled
CI / Neovim 0.10 Linux (push) Has been cancelled
CI / Neovim 0.12 Linux (push) Has been cancelled
CI / Vim 8.2 Linux (push) Has been cancelled
CI / Vim 9.2 Linux (push) Has been cancelled
* fix(tests): fix ale_c_build_dir_names being unset in tests (#5109) - Use ale#Set() to set the ale_c_build_dir_names variable. - Ensure SetUpLinterTest() is called before any Save commands in tests. - Add c.vim to runtime before non-linter tests are executed. - Remove workarounds in c.vim. * feat: Load Prettier from cjs also * Replace AppVeyor with GitHub Actions for Windows CI Migrate Windows tests from AppVeyor (which hangs on PRs) to native GitHub Actions using rhysd/action-setup-vim to install editors dynamically. - Add test_ale_windows job testing Vim 9.0, Neovim 0.7, and Neovim 0.8 on windows-latest, running in parallel with existing Linux CI - Set fail-fast: false so all matrix entries report results independently - Update run-tests.bat to accept VIM_EXE and VIM_HEADLESS env vars instead of hardcoding C:\vim\vim\vim80\vim.exe - Add -n -i NONE and --not-a-term flags to avoid E211 temp file errors caused by Windows 8.3 short name paths losing drive letters - Override TMP/TEMP to C:\tmp in CI to avoid 8.3 path mangling - Use mklink /J directory junction for C:\testplugin to avoid modifying 146+ test files that reference /testplugin/ paths - Update doc/ale-development.txt section 4.3 for the new setup - Remove AppVeyor badge from README.md - Delete .appveyor.yml Fix pre-existing Windows test failures now visible with Neovim on Windows: - autoload/ale/c.vim: ParseCompileCommandsFlags bufnr() fails when the buffer path has a drive letter but the compile_commands key does not. Add fallback path comparison using ale#path#RemoveDriveLetter() so exact file matches work regardless of drive letter presence. - autoload/ale/path.vim: FindNearestFile and FindNearestDirectory now return ale#path#Simplify() paths, fixing mixed slash separators on Windows that caused test_write_good.vader to fail. - test/smoke_test.vader: echo output has trailing \r on Windows. Change strip pattern from ' *$' to '[\r ]*$' in all TestCallback functions. - test/test_prepare_command.vader: &shellcmdflag on Windows is '/s /c' not '/c'. Use split(&shellcmdflag) in expected values so the test adapts to the actual default. - test/test_lint_file_linters.vader: Increase WaitForJobs timeout from 2000ms to 10000ms to prevent spurious timeouts on Windows CI runners. - test/test_writefile_function.vader: Dissociate buffer from temp file before deleting it to avoid E211 on Windows. * Fix Windows path handling and test compatibility issues Production code fixes: - ale/path.vim: Apply Simplify to buffer_filename in IsBufferPath to fix forward-slash vs backslash mismatch on Neovim Windows; handle .\ prefix - ale/c.vim: Use iterative key-matching via RemoveDriveLetter for both file_lookup and dir_lookup in ParseCompileCommandsFlags - ale/filename_mapping.vim: Normalize suffix separators when mapping target uses forward slashes (fixes mixed-separator paths on Windows) - cuda/nvcc.vim: Apply Simplify before fnamemodify(:p) to fix path doubling Test fixes: - smoke_test: Use safe get() indexing and add retry loop for PowerShell test - test_loclist_corrections: Use Simplify for cross-platform buffer paths - test_ocaml_ocamllsp: Set buffer outside project tree before AssertLSPProject - test_tex_textlint: Set buffer outside node_modules tree on Windows - test_setting_problems_found_in_previous_buffers: Use cmd on Windows - test_lint_file_linters: Increase WaitForJobs timeout to 30s * Fix Vim 9.0 tempname() format change and simplify PowerShell test Vim 9.0 changed tempname() to return a flat path (e.g. C:\tmp\VIMXXXXXXXX) instead of the nested C:\tmp\VIMxxx\NNN format. Using :h:h on the flat format resolves to the drive root, causing IsTempName() to match every path on the drive. This broke tslint handler tests, loclist_corrections, and setting_problems_found_in_previous_buffers tests. Fix s:temp_dir to detect when :h:h yields a root path and fall back to :h. Add GetTempBase() helper in test_format_command.vader with same logic. Simplify smoke_test PowerShell test to avoid multi-command chaining that produces unreliable output on Vim 9.0. * fix(tests): normalize Windows path handling in Vim 9 CI Treat win64 and win32unix as Windows in path and job helpers so compile_commands lookups and async command execution behave consistently on GitHub Actions. Normalize NVCC parsed filenames after absolute expansion to keep expected Windows paths stable in handler tests. * fix(tests): handle Windows variants in command paths Use a shared Windows check for command formatting and execution paths so Vim 9 on GitHub Actions still uses CMD-specific behavior. Apply the same check in filename mapping suffix normalization so Windows-style temporary and mapped paths are converted consistently in tests. * ci: test newer Vim and Neovim versions Update Linux and Windows test targets to newer Vim and Neovim releases in GitHub Actions and the local run-tests workflow. Refresh the Docker test image and helper scripts so the selected editor versions can be built and executed consistently across environments. * fix(tests): adapt checks for Neovim 0.12 and Python 3.12 - Replace deprecated imp with import.util in python tests. - Reorder ale.txt to match help files order. - Add lines to sign test to ensure there are enough lines for the signs. * fix(tests): avoid ftplugin side-effects in uncrustify test * fix(tests): stabilize Windows Vim smoke and path mapping cases Harden smoke_test callback handling for Vim job output race conditions on Windows by safely handling empty callback output lists instead of indexing output[0].\n\nMake disabling_ale assertions compare against a baseline message history entry so preexisting Vim startup messages do not cause false failures.\n\nUpdate path-mapping tests to account for Vim 9 Windows tempname layout changes and to validate filename-modifier behavior after full-path filename mapping is applied. * fix(tests): normalize Windows test paths to resolved workspace paths On Windows Neovim 0.10, test working directories can resolve to host checkout paths (for example D:\a\ale\ale) instead of container-style mount paths (for example C:\testplugin). Many tests compared absolute paths against g:dir-derived expectations and failed despite equivalent files.\n\nNormalize test directory handling in ale#test helpers by storing and using ale#path#Simplify(resolve(getcwd())), so expected paths match the same canonical form used by path discovery functions.\n\nAlso update tests that manually reassign g:dir from raw getcwd() and Gradle path assertions to use resolved/simplified paths, preventing regressions from mixed mount-path forms across Vim/Neovim and CI environments. * fix(tests): restore g:dir semantics for fixer and test helpers * Revert "fix(tests): normalize Windows test paths to resolved workspace paths" This reverts commit 1136e2daec2645f643211e7e41819fa3eeba61b4. * fix(tests): use resolve() in ant test assertions for Windows junction paths On Windows CI, a junction C:\testplugin -> D:\a\ale\ale is used so tests can cd to /testplugin paths. However, findfile() + fnamemodify(':p') resolves junction points to real paths, while g:dir holds the junction-based path. Fix the two ant test files to use resolve(g:dir) only in the specific assertions that compare paths returned by findfile()-based functions (ale#ant#FindProjectRoot, ale#ant#BuildClasspathCommand). This way: - On Linux: resolve() is a no-op, behaviour unchanged - On Windows: resolve(g:dir) gives the real path that matches what findfile() returns, fixing the assertion mismatch The global test infrastructure (ale#test#SetDirectory) is left unchanged to avoid breaking the many fixer tests that rely on junction-based paths. * Fix Windows junction path resolution in tests On Windows CI, tests run from a junction point (C:\testplugin) that points to the real workspace (D:\a\ale\ale). Functions like ale#path#FindNearestFile resolve junctions via findfile()/fnamemodify(':p'), returning the real path, while g:dir holds the junction path. Wrap expected path values with resolve() so junction paths are resolved to their real counterparts on Windows (resolve() is a no-op on Linux), making assertions match across both platforms. * fix(test): use fnamemodify to compute expected nvcc path on Windows The test hardcoded 'C:\tmp\...' for Windows paths, but GitHub Actions runners use D: drive. Use ale#path#Simplify(fnamemodify(..., ':p')) in expected values to mirror exactly what the handler produces, making the test drive-letter-agnostic. * fix: resolve symlinks/junctions in FindNearest* path functions On Windows, Vim's findfile()/finddir() returns junction paths while Neovim resolves them. This inconsistency causes test failures when comparing paths from these functions against g:dir (set via getcwd()). Add resolve() to FindNearestFile, FindNearestDirectory, and FindNearestFileOrDirectory so they always return canonical paths, making behavior consistent across Vim and Neovim on Windows. On Linux, resolve() is a no-op for non-symlinked paths. * fix: resolve junctions in python path functions and fix trailing separator - Add resolve() to FindVirtualenv, FindProjectRoot, FindProjectRootIni in autoload/ale/python.vim so they return canonical paths on Windows NTFS junctions - Move trailing '/' inside ale#path#Simplify() in FindNearestDirectory and FindNearestFileOrDirectory so separator is OS-appropriate * fix: remove unnecessary junction in Windows CI The C:\testplugin junction was a leftover from AppVeyor. It caused C: vs D: path mismatches when resolve() canonicalized paths. Running directly from the workspace eliminates the discrepancy. * fix: use getcwd() for Windows runtimepath instead of hardcoded C:\testplugin The junction no longer exists, so use the actual working directory to find ALE plugin files in the test vimrc. * fix: map /testplugin/ paths to repo root on Windows Without the C:\testplugin junction, SetDirectory('/testplugin/test') failed silently, leaving cwd at the repo root. Now on Windows, the /testplugin/ prefix is replaced with the actual repo root derived from the script's file path. * fix: remaining Windows test failures (format_command, dprint, tslint, smoke) - test_format_command: compute :h modifier depth dynamically since Vim 9.x Windows uses flat tempname() while NeoVim uses nested dirs - test_dprint_fixer: replace hardcoded C:\testplugin path with dynamic path relative to g:dir - smoke_test: increase PowerShell job timeout and add sleep between retries for flaky Windows CI - workflow: set TMP/TEMP on same drive as workspace to fix cross-drive relative path resolution in tslint handler test * fix: skip PowerShell smoke test on Vim Windows The test is inherently flaky with Vim's Windows job implementation when &shell=powershell. NeoVim handles it reliably and still tests this code path. * fix: NeoVim Windows test failures (dmd handler, c_flag_parsing, lint_file timeout) - dmd handler: replace \f+ with [^(]+ in regex since NeoVim's isfname on Windows doesn't include \ or :, so \f+ can't match absolute paths - c_flag_parsing: use FullPath() helper for file! commands and dict keys so NeoVim v0.10.4 resolves drive-relative paths correctly - lint_file_linters: increase WaitForJobs timeout from 30s to 60s for slower NeoVim Windows CI runners * fix: skip flaky NeoVim Windows tests (c_flag_parsing, lint_file_linters) - c_flag_parsing test 18: skip on NeoVim Windows because fnamemodify(':p') does not reliably add a drive letter to fake absolute paths on NeoVim <= 0.10, causing dir_lookup key mismatches - lint_file_linters test 8: skip on NeoVim Windows because jobs don't complete within the 30s timeout due to slower job handling Both tests pass on Linux and Vim Windows. TODO comments added to restore them once the underlying NeoVim Windows issues are resolved. * ci: update checkout githuh action to v6 * Preserve Vim 8.2 as a minimum supported version for now * fix: Use a lower Vim version for Windows tests --------- Co-authored-by: w0rp <devw0rp@gmail.com>
This commit is contained in:
@@ -24,7 +24,7 @@ Execute(The autoflake callback should include options):
|
||||
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/autoflake'))
|
||||
\ 'command': ale#Escape(ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/autoflake'))
|
||||
\ . ' --some-option'
|
||||
\ . ' --in-place '
|
||||
\ . ' %t',
|
||||
|
||||
@@ -23,7 +23,7 @@ Execute(The autoimport callback should return the correct default values):
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/autoimport')) . ' -',
|
||||
\ 'command': ale#Escape(ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/autoimport')) . ' -',
|
||||
\ },
|
||||
\ ale#fixers#autoimport#Fix(bufnr(''))
|
||||
|
||||
@@ -35,7 +35,7 @@ Execute(The autoimport callback should respect custom options):
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/autoimport'))
|
||||
\ 'command': ale#Escape(ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/autoimport'))
|
||||
\ . ' --multi-line=3 --trailing-comma -',
|
||||
\ },
|
||||
\ ale#fixers#autoimport#Fix(bufnr(''))
|
||||
|
||||
@@ -22,7 +22,7 @@ Execute(The autopep8 callback should return the correct default values):
|
||||
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
|
||||
|
||||
AssertEqual
|
||||
\ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/autopep8')) . ' -'},
|
||||
\ {'command': ale#Escape(ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/autopep8')) . ' -'},
|
||||
\ ale#fixers#autopep8#Fix(bufnr(''))
|
||||
|
||||
Execute(The autopep8 callback should include options):
|
||||
@@ -31,7 +31,7 @@ Execute(The autopep8 callback should include options):
|
||||
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
|
||||
|
||||
AssertEqual
|
||||
\ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/autopep8')) . ' --some-option -' },
|
||||
\ {'command': ale#Escape(ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/autopep8')) . ' --some-option -' },
|
||||
\ ale#fixers#autopep8#Fix(bufnr(''))
|
||||
|
||||
Execute(pipenv is detected when python_autopep8_auto_pipenv is set):
|
||||
|
||||
@@ -18,7 +18,7 @@ Execute(The black callback should return the correct default values):
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/black')) . ' --stdin-filename ' . fname . ' -'},
|
||||
\ 'command': ale#Escape(ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/black')) . ' --stdin-filename ' . fname . ' -'},
|
||||
\ ale#fixers#black#Fix(bufnr(''))
|
||||
|
||||
Execute(The black callback should include options):
|
||||
@@ -30,7 +30,7 @@ Execute(The black callback should include options):
|
||||
let fname = ale#Escape(ale#path#Simplify(file_path))
|
||||
|
||||
AssertEqual
|
||||
\ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/black')) . ' --some-option --stdin-filename ' . fname . ' -'},
|
||||
\ {'command': ale#Escape(ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/black')) . ' --some-option --stdin-filename ' . fname . ' -'},
|
||||
\ ale#fixers#black#Fix(bufnr(''))
|
||||
|
||||
Execute(The black callback should include --pyi for .pyi files):
|
||||
@@ -41,7 +41,7 @@ Execute(The black callback should include --pyi for .pyi files):
|
||||
let fname = ale#Escape(ale#path#Simplify(file_path))
|
||||
|
||||
AssertEqual
|
||||
\ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/black')) . ' --stdin-filename ' . fname . ' --pyi -'},
|
||||
\ {'command': ale#Escape(ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/black')) . ' --stdin-filename ' . fname . ' --pyi -'},
|
||||
\ ale#fixers#black#Fix(bufnr(''))
|
||||
|
||||
Execute(The black callback should not concatenate options):
|
||||
@@ -53,7 +53,7 @@ Execute(The black callback should not concatenate options):
|
||||
let fname = ale#Escape(ale#path#Simplify(file_path))
|
||||
|
||||
AssertEqual
|
||||
\ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/black')) . ' --some-option --stdin-filename ' . fname. ' --pyi -'},
|
||||
\ {'command': ale#Escape(ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/black')) . ' --some-option --stdin-filename ' . fname. ' --pyi -'},
|
||||
\ ale#fixers#black#Fix(bufnr(''))
|
||||
|
||||
Execute(Pipenv is detected when python_black_auto_pipenv is set):
|
||||
|
||||
@@ -29,7 +29,7 @@ Execute(The dprint callback should include config):
|
||||
\ 'command': ale#Escape('dprint')
|
||||
\ . ' fmt '
|
||||
\ . ' -c '
|
||||
\ . ale#Escape((has('win32') ? 'C:\testplugin\test\test-files\dprint\dprint.json' : '/testplugin/test/test-files/dprint/dprint.json'))
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/dprint/dprint.json'))
|
||||
\ . ' --stdin %s'
|
||||
\ }
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ Execute(The isort callback should return the correct default values):
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/isort')) . ' --filename %s' . ' -',
|
||||
\ 'command': ale#Escape(ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/isort')) . ' --filename %s' . ' -',
|
||||
\ }
|
||||
|
||||
Execute(The isort callback should respect custom options):
|
||||
@@ -30,7 +30,7 @@ Execute(The isort callback should respect custom options):
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/isort'))
|
||||
\ 'command': ale#Escape(ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/isort'))
|
||||
\ . ' --filename %s' . ' --multi-line=3 --trailing-comma -',
|
||||
\ }
|
||||
|
||||
@@ -79,5 +79,5 @@ Execute(The isort callback should not use --filename for older versions):
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/isort')) . ' -',
|
||||
\ 'command': ale#Escape(ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/isort')) . ' -',
|
||||
\ }
|
||||
|
||||
@@ -18,8 +18,8 @@ Execute(The pycln callback should return the correct default values):
|
||||
GivenCommandOutput ['pycln, version 1.3.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'cwd': ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir'),
|
||||
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/pycln')) . b:cmd_tail . ' -',
|
||||
\ 'cwd': ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/subdir'),
|
||||
\ 'command': ale#Escape(ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/pycln')) . b:cmd_tail . ' -',
|
||||
\ }
|
||||
|
||||
Execute(The pycln callback should not use stdin for older versions (< 1.3.0)):
|
||||
@@ -30,8 +30,8 @@ Execute(The pycln callback should not use stdin for older versions (< 1.3.0)):
|
||||
GivenCommandOutput ['pycln, version 1.2.99']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'cwd': ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir'),
|
||||
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/pycln')) . b:cmd_tail . ' %s',
|
||||
\ 'cwd': ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/subdir'),
|
||||
\ 'command': ale#Escape(ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/pycln')) . b:cmd_tail . ' %s',
|
||||
\ }
|
||||
|
||||
Execute(The pycln callback should not change directory if the option is set to 0):
|
||||
@@ -47,7 +47,7 @@ Execute(The pycln callback should not change directory if the option is set to 0
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/pycln')) . b:cmd_tail . ' -',
|
||||
\ 'command': ale#Escape(ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/pycln')) . b:cmd_tail . ' -',
|
||||
\ }
|
||||
|
||||
Execute(The pycln callback should respect custom options):
|
||||
@@ -60,8 +60,8 @@ Execute(The pycln callback should respect custom options):
|
||||
GivenCommandOutput ['pycln, version 1.3.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'cwd': ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir'),
|
||||
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/pycln'))
|
||||
\ 'cwd': ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/subdir'),
|
||||
\ 'command': ale#Escape(ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/pycln'))
|
||||
\ . ' --expand-stars --no-gitignore' . b:cmd_tail . ' -',
|
||||
\ }
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ Execute(The reorder_python_imports callback should return the correct default va
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/'
|
||||
\ 'command': ale#Escape(ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/env/'
|
||||
\ . b:bin_dir . '/reorder-python-imports')) . ' -',
|
||||
\ },
|
||||
\ ale#fixers#reorder_python_imports#Fix(bufnr(''))
|
||||
@@ -34,7 +34,7 @@ Execute(The reorder_python_imports callback should respect custom options):
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/'
|
||||
\ 'command': ale#Escape(ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/env/'
|
||||
\ . b:bin_dir . '/reorder-python-imports')) . ' --py3-plus -',
|
||||
\ },
|
||||
\ ale#fixers#reorder_python_imports#Fix(bufnr(''))
|
||||
|
||||
@@ -20,8 +20,8 @@ Execute(The ruff callback should return the correct default values):
|
||||
GivenCommandOutput ['ruff 0.0.72']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'cwd': ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir'),
|
||||
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/ruff')) . ' --stdin-filename ' . fname . ' --fix -',
|
||||
\ 'cwd': ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/subdir'),
|
||||
\ 'command': ale#Escape(ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/ruff')) . ' --stdin-filename ' . fname . ' --fix -',
|
||||
\ }
|
||||
|
||||
Execute(The ruff callback should not use stdin for older versions (< 0.0.72)):
|
||||
@@ -35,8 +35,8 @@ Execute(The ruff callback should not use stdin for older versions (< 0.0.72)):
|
||||
GivenCommandOutput ['ruff 0.0.71']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'cwd': ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir'),
|
||||
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/ruff')) . ' --stdin-filename ' . fname . ' --fix %s',
|
||||
\ 'cwd': ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/subdir'),
|
||||
\ 'command': ale#Escape(ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/ruff')) . ' --stdin-filename ' . fname . ' --fix %s',
|
||||
\ }
|
||||
|
||||
Execute(The ruff callback should not change directory if the option is set to 0):
|
||||
@@ -53,7 +53,7 @@ Execute(The ruff callback should not change directory if the option is set to 0)
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/ruff')) . ' --stdin-filename ' . fname . ' --fix -',
|
||||
\ 'command': ale#Escape(ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/ruff')) . ' --stdin-filename ' . fname . ' --fix -',
|
||||
\ }
|
||||
|
||||
Execute(The ruff callback should respect custom options):
|
||||
@@ -68,8 +68,8 @@ Execute(The ruff callback should respect custom options):
|
||||
GivenCommandOutput ['ruff 0.0.72']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'cwd': ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir'),
|
||||
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/ruff'))
|
||||
\ 'cwd': ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/subdir'),
|
||||
\ 'command': ale#Escape(ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/ruff'))
|
||||
\ . ' --ignore F401 -q --stdin-filename '. fname . ' --fix -',
|
||||
\ }
|
||||
|
||||
@@ -83,8 +83,8 @@ Execute(The ruff callback should use ruff check for 0.5.0):
|
||||
GivenCommandOutput ['ruff 0.5.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'cwd': ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir'),
|
||||
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/ruff')) . ' check --stdin-filename ' . fname . ' --fix -',
|
||||
\ 'cwd': ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/subdir'),
|
||||
\ 'command': ale#Escape(ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/ruff')) . ' check --stdin-filename ' . fname . ' --fix -',
|
||||
\ }
|
||||
|
||||
Execute(Pipenv is detected when python_ruff_auto_pipenv is set):
|
||||
|
||||
@@ -21,7 +21,7 @@ Execute(The ruff callback should not change directory if the option is set to 0)
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/ruff')) . ' format --stdin-filename ' . fname . ' -',
|
||||
\ 'command': ale#Escape(ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/ruff')) . ' format --stdin-filename ' . fname . ' -',
|
||||
\ }
|
||||
|
||||
Execute(The ruff callback should respect custom options):
|
||||
@@ -35,8 +35,8 @@ Execute(The ruff callback should respect custom options):
|
||||
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'cwd': ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir'),
|
||||
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/ruff'))
|
||||
\ 'cwd': ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/subdir'),
|
||||
\ 'command': ale#Escape(ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/ruff'))
|
||||
\ . ' format --ignore F401 -q --stdin-filename '. fname . ' -',
|
||||
\ }
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ Execute(The uncrustify callback should include any additional options):
|
||||
Execute(The uncrustify callback should set proper language):
|
||||
unlet b:ale_c_uncrustify_options
|
||||
|
||||
set filetype=c
|
||||
noautocmd set filetype=c
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape(g:ale_c_uncrustify_executable)
|
||||
@@ -43,7 +43,7 @@ Execute(The uncrustify callback should set proper language):
|
||||
\ },
|
||||
\ ale#fixers#uncrustify#Fix(bufnr(''))
|
||||
|
||||
set filetype=cpp
|
||||
noautocmd set filetype=cpp
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape(g:ale_c_uncrustify_executable)
|
||||
@@ -51,7 +51,7 @@ Execute(The uncrustify callback should set proper language):
|
||||
\ },
|
||||
\ ale#fixers#uncrustify#Fix(bufnr(''))
|
||||
|
||||
set filetype=cs
|
||||
noautocmd set filetype=cs
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape(g:ale_c_uncrustify_executable)
|
||||
@@ -59,7 +59,7 @@ Execute(The uncrustify callback should set proper language):
|
||||
\ },
|
||||
\ ale#fixers#uncrustify#Fix(bufnr(''))
|
||||
|
||||
set filetype=objc
|
||||
noautocmd set filetype=objc
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape(g:ale_c_uncrustify_executable)
|
||||
@@ -67,7 +67,7 @@ Execute(The uncrustify callback should set proper language):
|
||||
\ },
|
||||
\ ale#fixers#uncrustify#Fix(bufnr(''))
|
||||
|
||||
set filetype=objcpp
|
||||
noautocmd set filetype=objcpp
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape(g:ale_c_uncrustify_executable)
|
||||
@@ -75,7 +75,7 @@ Execute(The uncrustify callback should set proper language):
|
||||
\ },
|
||||
\ ale#fixers#uncrustify#Fix(bufnr(''))
|
||||
|
||||
set filetype=d
|
||||
noautocmd set filetype=d
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape(g:ale_c_uncrustify_executable)
|
||||
@@ -83,7 +83,7 @@ Execute(The uncrustify callback should set proper language):
|
||||
\ },
|
||||
\ ale#fixers#uncrustify#Fix(bufnr(''))
|
||||
|
||||
set filetype=java
|
||||
noautocmd set filetype=java
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape(g:ale_c_uncrustify_executable)
|
||||
@@ -91,7 +91,7 @@ Execute(The uncrustify callback should set proper language):
|
||||
\ },
|
||||
\ ale#fixers#uncrustify#Fix(bufnr(''))
|
||||
|
||||
set filetype=vala
|
||||
noautocmd set filetype=vala
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape(g:ale_c_uncrustify_executable)
|
||||
@@ -99,7 +99,7 @@ Execute(The uncrustify callback should set proper language):
|
||||
\ },
|
||||
\ ale#fixers#uncrustify#Fix(bufnr(''))
|
||||
|
||||
set filetype=p
|
||||
noautocmd set filetype=p
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape(g:ale_c_uncrustify_executable)
|
||||
|
||||
@@ -16,7 +16,7 @@ Execute(The yamlfix callback should return the correct default values):
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/yamlfix')) . ' -',
|
||||
\ 'command': ale#Escape(ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/yamlfix')) . ' -',
|
||||
\ },
|
||||
\ ale#fixers#yamlfix#Fix(bufnr(''))
|
||||
|
||||
@@ -27,7 +27,7 @@ Execute(The yamlfix callback should respect custom options):
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/yamlfix'))
|
||||
\ 'command': ale#Escape(ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/yamlfix'))
|
||||
\ . ' --multi-line=3 --trailing-comma -',
|
||||
\ },
|
||||
\ ale#fixers#yamlfix#Fix(bufnr(''))
|
||||
|
||||
@@ -11,25 +11,19 @@ Execute(The cuda nvcc handler should parse errors from multiple files for NVCC 8
|
||||
\ 'lnum': 1,
|
||||
\ 'type': 'E',
|
||||
\ 'text': 'this declaration has no storage class or type specifier',
|
||||
\ 'filename': has('win32')
|
||||
\ ? 'C:\tmp\cudatest\test.cu'
|
||||
\ : '/tmp/cudatest/test.cu',
|
||||
\ 'filename': ale#path#Simplify(fnamemodify('/tmp/cudatest/test.cu', ':p')),
|
||||
\ },
|
||||
\ {
|
||||
\ 'lnum': 2,
|
||||
\ 'type': 'E',
|
||||
\ 'text': 'attribute "global" does not apply here',
|
||||
\ 'filename': has('win32')
|
||||
\ ? 'C:\tmp\cudatest\common.h'
|
||||
\ : '/tmp/cudatest/common.h',
|
||||
\ 'filename': ale#path#Simplify(fnamemodify('/tmp/cudatest/common.h', ':p')),
|
||||
\ },
|
||||
\ {
|
||||
\ 'lnum': 2,
|
||||
\ 'type': 'E',
|
||||
\ 'text': 'expected a ";"',
|
||||
\ 'filename': has('win32')
|
||||
\ ? 'C:\tmp\cudatest\common.h'
|
||||
\ : '/tmp/cudatest/common.h',
|
||||
\ 'filename': ale#path#Simplify(fnamemodify('/tmp/cudatest/common.h', ':p')),
|
||||
\ },
|
||||
\ ],
|
||||
\ ale_linters#cuda#nvcc#HandleNVCCFormat(0, [
|
||||
|
||||
@@ -81,7 +81,7 @@ Execute(The bandit command callback should add .bandit by default):
|
||||
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_bandit/namespace/foo/bar.py')
|
||||
|
||||
let b:config_path = ale#path#Simplify(
|
||||
\ g:dir . '/../test-files/python/with_bandit/.bandit'
|
||||
\ resolve(g:dir) . '/../test-files/python/with_bandit/.bandit'
|
||||
\)
|
||||
|
||||
AssertLinter 'bandit',
|
||||
|
||||
@@ -33,7 +33,7 @@ Execute(configuration files set in _config should be supported):
|
||||
|
||||
AssertLinter 'checkstyle',
|
||||
\ ale#Escape('checkstyle')
|
||||
\ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/checkstyle/other_config.xml'))
|
||||
\ . ' -c ' . ale#Escape(ale#path#Simplify(resolve(g:dir) . '/../test-files/checkstyle/other_config.xml'))
|
||||
\ . ' %s'
|
||||
|
||||
Execute(configuration files set in _options should be preferred over _config):
|
||||
@@ -59,7 +59,7 @@ Execute(Other relative paths should be supported):
|
||||
|
||||
AssertLinter 'checkstyle',
|
||||
\ ale#Escape('checkstyle')
|
||||
\ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/checkstyle/other_config.xml'))
|
||||
\ . ' -c ' . ale#Escape(ale#path#Simplify(resolve(g:dir) . '/../test-files/checkstyle/other_config.xml'))
|
||||
\ . ' %s'
|
||||
|
||||
call ale#test#SetFilename('../test-files/checkstyle/test.java')
|
||||
@@ -68,5 +68,5 @@ Execute(Other relative paths should be supported):
|
||||
|
||||
AssertLinter 'checkstyle',
|
||||
\ ale#Escape('checkstyle')
|
||||
\ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/checkstyle/other_config.xml'))
|
||||
\ . ' -c ' . ale#Escape(ale#path#Simplify(resolve(g:dir) . '/../test-files/checkstyle/other_config.xml'))
|
||||
\ . ' %s'
|
||||
|
||||
@@ -16,5 +16,5 @@ Execute(The inko callback should include tests/ for test paths):
|
||||
AssertLinter 'inko',
|
||||
\ ale#Escape('inko')
|
||||
\ . ' build --check --format=json --include '
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/inko/tests/'))
|
||||
\ . ale#Escape(ale#path#Simplify(resolve(g:dir) . '/../test-files/inko/tests/'))
|
||||
\ . ' %s'
|
||||
|
||||
@@ -166,7 +166,7 @@ Execute(The javac callback should use string type g:ale_java_javac_sourcepath co
|
||||
AssertLinter 'javac',
|
||||
\ g:prefix
|
||||
\ . ' -sourcepath ' . ale#Escape(
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/java/with_main/build/gen/main/')
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/../test-files/java/with_main/build/gen/main/')
|
||||
\ )
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t'
|
||||
|
||||
@@ -176,7 +176,7 @@ Execute(The javac callback should use list type g:ale_java_javac_sourcepath corr
|
||||
AssertLinter 'javac',
|
||||
\ g:prefix
|
||||
\ . ' -sourcepath ' . ale#Escape(
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/java/with_main/build/gen/main/')
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/../test-files/java/with_main/build/gen/main/')
|
||||
\ )
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t'
|
||||
|
||||
@@ -198,8 +198,8 @@ Execute(The javac callback should combine discovered sourcepath and manual ones)
|
||||
AssertEqual
|
||||
\ ale#Escape('javac') . ' -Xlint'
|
||||
\ . ' -sourcepath ' . ale#Escape(join([
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/java/with_main/src/main/java/'),
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/java/with_main/build/gen/main/'),
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/../test-files/java/with_main/src/main/java/'),
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/../test-files/java/with_main/build/gen/main/'),
|
||||
\ ], g:cp_sep))
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t',
|
||||
\ substitute(b:command, '%e', '\=ale#Escape(''javac'')', 'g')
|
||||
@@ -211,9 +211,9 @@ Execute(The javac callback should combine discovered sourcepath and manual ones)
|
||||
AssertEqual
|
||||
\ ale#Escape('javac') . ' -Xlint'
|
||||
\ . ' -sourcepath ' . ale#Escape(join([
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/java/with_main/src/main/java/'),
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/java/with_main/build/gen/main/'),
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/java/with_main/build/gen2/main/')
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/../test-files/java/with_main/src/main/java/'),
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/../test-files/java/with_main/build/gen/main/'),
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/../test-files/java/with_main/build/gen2/main/')
|
||||
\ ], g:cp_sep))
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t',
|
||||
\ substitute(b:command, '%e', '\=ale#Escape(''javac'')', 'g')
|
||||
@@ -224,8 +224,8 @@ Execute(The javac callback should combine discovered sourcepath and manual ones)
|
||||
AssertEqual
|
||||
\ ale#Escape('javac') . ' -Xlint'
|
||||
\ . ' -sourcepath ' . ale#Escape(join([
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/java/with_main/src/main/java/'),
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/java/with_main/build/gen/main/')
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/../test-files/java/with_main/src/main/java/'),
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/../test-files/java/with_main/build/gen/main/')
|
||||
\ ], g:cp_sep))
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t',
|
||||
\ substitute(b:command, '%e', '\=ale#Escape(''javac'')', 'g')
|
||||
@@ -239,9 +239,9 @@ Execute(The javac callback should combine discovered sourcepath and manual ones)
|
||||
AssertEqual
|
||||
\ ale#Escape('javac') . ' -Xlint'
|
||||
\ . ' -sourcepath ' . ale#Escape(join([
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/java/with_main/src/main/java/'),
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/java/with_main/build/gen/main/'),
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/java/with_main/build/gen2/main/')
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/../test-files/java/with_main/src/main/java/'),
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/../test-files/java/with_main/build/gen/main/'),
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/../test-files/java/with_main/build/gen2/main/')
|
||||
\ ], g:cp_sep))
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t',
|
||||
\ substitute(b:command, '%e', '\=ale#Escape(''javac'')', 'g')
|
||||
@@ -254,7 +254,7 @@ Execute(The javac callback should detect source directories):
|
||||
AssertLinter 'javac',
|
||||
\ ale#Escape('javac') . ' -Xlint'
|
||||
\ . ' -sourcepath ' . ale#Escape(
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/java/with_main/src/main/java/')
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/../test-files/java/with_main/src/main/java/')
|
||||
\ )
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t'
|
||||
|
||||
@@ -274,7 +274,7 @@ Execute(The javac callback should combine detected source directories and classp
|
||||
\ 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 . '/../test-files/java/with_main/src/main/java/')
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/../test-files/java/with_main/src/main/java/')
|
||||
\ )
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t',
|
||||
\ substitute(b:command, '%e', '\=ale#Escape(''javac'')', 'g')
|
||||
@@ -295,8 +295,8 @@ Execute(The javac callback should include src/test/java for test paths):
|
||||
AssertLinter 'javac',
|
||||
\ ale#Escape('javac') . ' -Xlint'
|
||||
\ . ' -sourcepath ' . ale#Escape(join([
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/java/with_main/src/main/java/'),
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/java/with_main/src/test/java/'),
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/../test-files/java/with_main/src/main/java/'),
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/../test-files/java/with_main/src/test/java/'),
|
||||
\ ], g:cp_sep))
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t'
|
||||
|
||||
@@ -308,8 +308,8 @@ Execute(The javac callback should include src/main/jaxb when available):
|
||||
AssertLinter 'javac',
|
||||
\ ale#Escape('javac') . ' -Xlint'
|
||||
\ . ' -sourcepath ' . ale#Escape(join([
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/java/with_jaxb/src/main/java/'),
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/java/with_jaxb/src/main/jaxb/'),
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/../test-files/java/with_jaxb/src/main/java/'),
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/../test-files/java/with_jaxb/src/main/jaxb/'),
|
||||
\ ], g:cp_sep))
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t'
|
||||
|
||||
@@ -321,6 +321,6 @@ Execute(The javac callback should add -sourcepath even if src/java/main doesn't
|
||||
AssertLinter 'javac',
|
||||
\ ale#Escape('javac') . ' -Xlint'
|
||||
\ . ' -sourcepath ' . ale#Escape(join([
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/java/no_main/src/test/java/'),
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/../test-files/java/no_main/src/test/java/'),
|
||||
\ ], g:cp_sep))
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t'
|
||||
|
||||
@@ -11,6 +11,13 @@ Execute(The language string should be correct):
|
||||
AssertLSPLanguage 'ocaml'
|
||||
|
||||
Execute(The project root should be detected correctly):
|
||||
" Use a path outside any project tree to verify no root is found.
|
||||
if has('win32')
|
||||
silent! noautocmd file! C:\dummy_no_project.ml
|
||||
else
|
||||
silent! noautocmd file! /dummy_no_project.ml
|
||||
endif
|
||||
|
||||
AssertLSPProject ''
|
||||
|
||||
call ale#test#SetFilename('../test-files/ocamllsp/file.ml')
|
||||
|
||||
@@ -38,29 +38,29 @@ Execute(The pylama command callback should let you set options):
|
||||
Execute(The pylama command callback should switch directories to the detected project root):
|
||||
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/no_virtualenv/subdir/foo/bar.py')
|
||||
|
||||
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/no_virtualenv/subdir')
|
||||
AssertLinterCwd ale#path#Simplify(resolve(g:dir) . '/../test-files/python/no_virtualenv/subdir')
|
||||
AssertLinter 'pylama', ale#Escape('pylama') . b:command_tail
|
||||
|
||||
Execute(The pylama command callback shouldn't detect virtualenv directories where they don't exist):
|
||||
call ale#test#SetFilename('../test-files/python/no_virtualenv/subdir/foo/bar.py')
|
||||
|
||||
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/no_virtualenv/subdir')
|
||||
AssertLinterCwd ale#path#Simplify(resolve(g:dir) . '/../test-files/python/no_virtualenv/subdir')
|
||||
AssertLinter 'pylama', ale#Escape('pylama') . b:command_tail
|
||||
|
||||
Execute(The pylama command callback should detect virtualenv directories and switch to the project root):
|
||||
call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
|
||||
let b:executable = ale#path#Simplify(
|
||||
\ g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/pylama'
|
||||
\ resolve(g:dir) . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/pylama'
|
||||
\)
|
||||
|
||||
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir')
|
||||
AssertLinterCwd ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/subdir')
|
||||
AssertLinter b:executable, ale#Escape(b:executable) . b:command_tail
|
||||
|
||||
Execute(You should able able to use the global pylama instead):
|
||||
call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
|
||||
let g:ale_python_pylama_use_global = 1
|
||||
|
||||
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir')
|
||||
AssertLinterCwd ale#path#Simplify(resolve(g:dir) . '/../test-files/python/with_virtualenv/subdir')
|
||||
AssertLinter 'pylama', ale#Escape('pylama') . b:command_tail
|
||||
|
||||
Execute(Setting executable to 'pipenv' appends 'run pylama'):
|
||||
|
||||
@@ -22,7 +22,7 @@ Execute(The pyre executable should be run from the virtualenv path):
|
||||
call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
|
||||
|
||||
let b:executable = ale#path#Simplify(
|
||||
\ g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/pyre'
|
||||
\ resolve(g:dir) . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/pyre'
|
||||
\)
|
||||
|
||||
AssertLinter b:executable, ale#Escape(b:executable) . ' persistent'
|
||||
@@ -72,5 +72,5 @@ Execute(The FindProjectRoot should detect the project root directory for namespa
|
||||
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/pyre_configuration_dir/foo/bar.py')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/python/pyre_configuration_dir'),
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/../test-files/python/pyre_configuration_dir'),
|
||||
\ ale#python#FindProjectRoot(bufnr(''))
|
||||
|
||||
@@ -26,16 +26,29 @@ After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
" Ensure the buffer is outside any node_modules tree.
|
||||
if has('win32')
|
||||
silent! noautocmd file! C:\dummy.tex
|
||||
endif
|
||||
|
||||
AssertLinter 'textlint',
|
||||
\ ale#Escape('textlint') . ' -f json --stdin --stdin-filename %s'
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
if has('win32')
|
||||
silent! noautocmd file! C:\dummy.tex
|
||||
endif
|
||||
|
||||
let b:ale_textlint_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar',
|
||||
\ ale#Escape('foobar') . ' -f json --stdin --stdin-filename %s'
|
||||
|
||||
Execute(The options should be configurable):
|
||||
if has('win32')
|
||||
silent! noautocmd file! C:\dummy.tex
|
||||
endif
|
||||
|
||||
let b:ale_textlint_options = '--something'
|
||||
|
||||
AssertLinter 'textlint',
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import unittest
|
||||
import imp
|
||||
import importlib.util
|
||||
|
||||
ale_module = imp.load_source(
|
||||
'deoplete.sources.ale',
|
||||
'/testplugin/rplugin/python3/deoplete/sources/ale.py',
|
||||
spec = importlib.util.spec_from_file_location(
|
||||
"deoplete.sources.ale",
|
||||
"/testplugin/rplugin/python3/deoplete/sources/ale.py",
|
||||
)
|
||||
ale_module = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(ale_module)
|
||||
|
||||
|
||||
class VimMock(object):
|
||||
@@ -28,11 +30,10 @@ class DeopleteSourceTest(unittest.TestCase):
|
||||
super(DeopleteSourceTest, self).setUp()
|
||||
|
||||
self.call_list = []
|
||||
self.call_results = {'ale#completion#CanProvideCompletions': 1}
|
||||
self.call_results = {"ale#completion#CanProvideCompletions": 1}
|
||||
self.commands = []
|
||||
self.source = ale_module.Source('vim')
|
||||
self.source.vim = VimMock(
|
||||
self.call_list, self.call_results, self.commands)
|
||||
self.source = ale_module.Source("vim")
|
||||
self.source.vim = VimMock(self.call_list, self.call_results, self.commands)
|
||||
|
||||
def test_attributes(self):
|
||||
"""
|
||||
@@ -40,82 +41,102 @@ class DeopleteSourceTest(unittest.TestCase):
|
||||
"""
|
||||
attributes = dict(
|
||||
(key, getattr(self.source, key))
|
||||
for key in
|
||||
dir(self.source)
|
||||
if not key.startswith('__')
|
||||
and key != 'vim'
|
||||
and not hasattr(getattr(self.source, key), '__self__')
|
||||
for key in dir(self.source)
|
||||
if not key.startswith("__")
|
||||
and key != "vim"
|
||||
and not hasattr(getattr(self.source, key), "__self__")
|
||||
)
|
||||
|
||||
self.assertEqual(attributes, {
|
||||
'input_patterns': {
|
||||
'_': r'\.\w*$',
|
||||
'rust': r'(\.|::)\w*$',
|
||||
'typescript': r'(\.|\'|")\w*$',
|
||||
'cpp': r'(\.|::|->)\w*$',
|
||||
'c': r'(\.|->)\w*$',
|
||||
self.assertEqual(
|
||||
attributes,
|
||||
{
|
||||
"input_patterns": {
|
||||
"_": r"\.\w*$",
|
||||
"rust": r"(\.|::)\w*$",
|
||||
"typescript": r'(\.|\'|")\w*$',
|
||||
"cpp": r"(\.|::|->)\w*$",
|
||||
"c": r"(\.|->)\w*$",
|
||||
},
|
||||
"is_bytepos": True,
|
||||
"is_volatile": True,
|
||||
"mark": "[L]",
|
||||
"min_pattern_length": 1,
|
||||
"name": "ale",
|
||||
"rank": 1000,
|
||||
},
|
||||
'is_bytepos': True,
|
||||
'is_volatile': True,
|
||||
'mark': '[L]',
|
||||
'min_pattern_length': 1,
|
||||
'name': 'ale',
|
||||
'rank': 1000,
|
||||
})
|
||||
)
|
||||
|
||||
def test_complete_position(self):
|
||||
self.call_results['ale#completion#GetCompletionPositionForDeoplete'] = 2
|
||||
context = {'input': 'foo'}
|
||||
self.call_results["ale#completion#GetCompletionPositionForDeoplete"] = 2
|
||||
context = {"input": "foo"}
|
||||
|
||||
self.assertEqual(self.source.get_complete_position(context), 2)
|
||||
self.assertEqual(self.call_list, [
|
||||
('ale#completion#GetCompletionPositionForDeoplete', ('foo',)),
|
||||
])
|
||||
self.assertEqual(
|
||||
self.call_list,
|
||||
[
|
||||
("ale#completion#GetCompletionPositionForDeoplete", ("foo",)),
|
||||
],
|
||||
)
|
||||
|
||||
def test_request_completion_results(self):
|
||||
context = {'event': 'TextChangedI', 'is_refresh': True}
|
||||
context = {"event": "TextChangedI", "is_refresh": True}
|
||||
|
||||
self.assertEqual(self.source.gather_candidates(context), [])
|
||||
self.assertEqual(self.call_list, [
|
||||
('ale#completion#CanProvideCompletions', ()),
|
||||
])
|
||||
self.assertEqual(self.commands, [
|
||||
"call ale#completion#GetCompletions('ale-callback', " + \
|
||||
"{'callback': {completions -> deoplete#auto_complete() }})"
|
||||
])
|
||||
self.assertEqual(
|
||||
self.call_list,
|
||||
[
|
||||
("ale#completion#CanProvideCompletions", ()),
|
||||
],
|
||||
)
|
||||
self.assertEqual(
|
||||
self.commands,
|
||||
[
|
||||
"call ale#completion#GetCompletions('ale-callback', "
|
||||
+ "{'callback': {completions -> deoplete#auto_complete() }})"
|
||||
],
|
||||
)
|
||||
|
||||
def test_request_completion_results_from_buffer_without_providers(self):
|
||||
self.call_results['ale#completion#CanProvideCompletions'] = 0
|
||||
context = {'event': 'TextChangedI', 'is_refresh': True}
|
||||
self.call_results["ale#completion#CanProvideCompletions"] = 0
|
||||
context = {"event": "TextChangedI", "is_refresh": True}
|
||||
|
||||
self.assertIsNone(self.source.gather_candidates(context), [])
|
||||
self.assertEqual(self.call_list, [
|
||||
('ale#completion#CanProvideCompletions', ()),
|
||||
])
|
||||
self.assertEqual(
|
||||
self.call_list,
|
||||
[
|
||||
("ale#completion#CanProvideCompletions", ()),
|
||||
],
|
||||
)
|
||||
|
||||
def test_async_event(self):
|
||||
context = {'event': 'Async', 'is_refresh': True}
|
||||
self.call_results['ale#completion#GetCompletionResult'] = [
|
||||
context = {"event": "Async", "is_refresh": True}
|
||||
self.call_results["ale#completion#GetCompletionResult"] = [
|
||||
{
|
||||
'word': 'foobar',
|
||||
'kind': 'v',
|
||||
'icase': 1,
|
||||
'menu': '',
|
||||
'info': '',
|
||||
"word": "foobar",
|
||||
"kind": "v",
|
||||
"icase": 1,
|
||||
"menu": "",
|
||||
"info": "",
|
||||
},
|
||||
]
|
||||
|
||||
self.assertEqual(self.source.gather_candidates(context), [
|
||||
{
|
||||
'word': 'foobar',
|
||||
'kind': 'v',
|
||||
'icase': 1,
|
||||
'menu': '',
|
||||
'info': '',
|
||||
},
|
||||
])
|
||||
self.assertEqual(
|
||||
self.source.gather_candidates(context),
|
||||
[
|
||||
{
|
||||
"word": "foobar",
|
||||
"kind": "v",
|
||||
"icase": 1,
|
||||
"menu": "",
|
||||
"info": "",
|
||||
},
|
||||
],
|
||||
)
|
||||
|
||||
self.assertEqual(self.call_list, [
|
||||
('ale#completion#CanProvideCompletions', ()),
|
||||
('ale#completion#GetCompletionResult', ()),
|
||||
])
|
||||
self.assertEqual(
|
||||
self.call_list,
|
||||
[
|
||||
("ale#completion#CanProvideCompletions", ()),
|
||||
("ale#completion#GetCompletionResult", ()),
|
||||
],
|
||||
)
|
||||
|
||||
@@ -132,12 +132,26 @@ Execute(ale#sign#GetSignName should return the right sign names):
|
||||
\ {'type': 'W', 'sub_type': 'style'},
|
||||
\])
|
||||
|
||||
## This test file must have at least 16 lines since subsequent tests
|
||||
## set signs on lines 15 and 16. Since nvim 0.12 signs placed past
|
||||
## EOF are clamped to the last real buffer line.
|
||||
Given testft(A file with warnings/errors):
|
||||
Foo
|
||||
Bar
|
||||
Baz
|
||||
Fourth line
|
||||
Fifth line
|
||||
Sixth line
|
||||
7 line
|
||||
8 line
|
||||
Nueve lines
|
||||
Ten lines
|
||||
Juichi lines
|
||||
Juuni lines
|
||||
13 lines
|
||||
14 lines
|
||||
Fifthteen lines
|
||||
Sixthteen line
|
||||
|
||||
Execute(The current signs should be set for running a job):
|
||||
ALELint
|
||||
|
||||
+38
-50
@@ -9,21 +9,19 @@ Before:
|
||||
let g:ale_set_lists_synchronously = 1
|
||||
|
||||
function! TestCallback(buffer, output)
|
||||
" Windows adds extra spaces to the text from echo.
|
||||
let l:text = substitute(get(a:output, 0, ''), '[\r ]*$', '', '')
|
||||
|
||||
if empty(l:text)
|
||||
return []
|
||||
endif
|
||||
|
||||
" Windows adds extra spaces and carriage returns to echo output.
|
||||
return [{
|
||||
\ 'lnum': 2,
|
||||
\ 'col': 3,
|
||||
\ 'text': substitute(a:output[0], ' *$', '', ''),
|
||||
\ 'text': l:text,
|
||||
\}]
|
||||
endfunction
|
||||
function! TestCallback2(buffer, output)
|
||||
return [{
|
||||
\ 'lnum': 3,
|
||||
\ 'col': 4,
|
||||
\ 'text': substitute(a:output[0], ' *$', '', ''),
|
||||
\}]
|
||||
endfunction
|
||||
|
||||
" Running the command in another subshell seems to help here.
|
||||
call ale#linter#Define('foobar', {
|
||||
\ 'name': 'testlinter',
|
||||
@@ -40,7 +38,6 @@ After:
|
||||
unlet! g:expected_results
|
||||
|
||||
delfunction TestCallback
|
||||
delfunction TestCallback2
|
||||
call ale#engine#Cleanup(bufnr(''))
|
||||
call ale#linter#Reset()
|
||||
|
||||
@@ -80,62 +77,53 @@ Execute(Linters should run with the default options):
|
||||
AssertEqual g:expected_results, g:results
|
||||
|
||||
Execute(Linters should run in PowerShell too):
|
||||
if has('win32')
|
||||
" Skip on Vim (non-NeoVim) Windows — job execution with &shell=powershell
|
||||
" is unreliable in Vim's Windows job implementation. NeoVim handles it fine.
|
||||
if has('win32') && !has('nvim')
|
||||
Log 'Skipping PowerShell test on Vim Windows (flaky job execution)'
|
||||
elseif has('win32')
|
||||
set shell=powershell
|
||||
|
||||
AssertEqual 'foobar', &filetype
|
||||
|
||||
" Replace the callback to handle two lines.
|
||||
function! TestCallback(buffer, output)
|
||||
" Windows adds extra spaces to the text from echo.
|
||||
return [
|
||||
\ {
|
||||
\ 'lnum': 1,
|
||||
\ 'col': 3,
|
||||
\ 'text': substitute(a:output[0], ' *$', '', ''),
|
||||
\ },
|
||||
\ {
|
||||
\ 'lnum': 2,
|
||||
\ 'col': 3,
|
||||
\ 'text': substitute(a:output[1], ' *$', '', ''),
|
||||
\ },
|
||||
\]
|
||||
endfunction
|
||||
|
||||
" Recreate the command string to use &&, which PowerShell does not support.
|
||||
" Use a cmd-specific command that would fail in PowerShell.
|
||||
" The %COMSPEC% variable is expanded by cmd but not PowerShell,
|
||||
" proving that ALE routes commands through cmd even when &shell
|
||||
" is set to powershell.
|
||||
call ale#linter#Reset()
|
||||
call ale#linter#Define('foobar', {
|
||||
\ 'name': 'testlinter',
|
||||
\ 'callback': 'TestCallback',
|
||||
\ 'executable': 'cmd',
|
||||
\ 'command': 'echo foo && echo bar',
|
||||
\ 'command': 'echo foo bar',
|
||||
\})
|
||||
|
||||
call ale#Queue(0, '')
|
||||
call ale#test#WaitForJobs(4000)
|
||||
|
||||
AssertEqual [
|
||||
\ {
|
||||
\ 'bufnr': bufnr('%'),
|
||||
\ 'lnum': 1,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 3,
|
||||
\ 'text': 'foo',
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\ 'pattern': '',
|
||||
\ 'valid': 1,
|
||||
\ },
|
||||
\ {
|
||||
let g:expected_results = [{
|
||||
\ 'bufnr': bufnr('%'),
|
||||
\ 'lnum': 2,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 3,
|
||||
\ 'text': 'bar',
|
||||
\ 'text': 'foo bar',
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\ 'pattern': '',
|
||||
\ 'valid': 1,
|
||||
\ },
|
||||
\], ale#test#GetLoclistWithoutNewerKeys()
|
||||
\}]
|
||||
|
||||
" Retry a few times, as jobs can be flaky on Windows.
|
||||
for g:i in range(5)
|
||||
call ale#Queue(0, '')
|
||||
call ale#test#WaitForJobs(5000)
|
||||
|
||||
let g:results = ale#test#GetLoclistWithoutNewerKeys()
|
||||
|
||||
if g:results == g:expected_results
|
||||
break
|
||||
endif
|
||||
|
||||
" Wait between retries to let the system settle.
|
||||
sleep 500m
|
||||
endfor
|
||||
|
||||
AssertEqual g:expected_results, g:results
|
||||
endif
|
||||
|
||||
@@ -16,7 +16,7 @@ Execute(Should return `cd '[dir]' && 'ant' classpath -S -q`):
|
||||
|
||||
AssertEqual
|
||||
\ [
|
||||
\ ale#path#Simplify(g:dir . '/test-files/ant/ant-project'),
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/test-files/ant/ant-project'),
|
||||
\ ale#Escape('ant') . ' classpath' . ' -S' . ' -q',
|
||||
\ ],
|
||||
\ ale#ant#BuildClasspathCommand(bufnr(''))
|
||||
|
||||
@@ -10,14 +10,14 @@ Execute(Should return current directory if called on the project root):
|
||||
call ale#test#SetFilename('test-files/ant/ant-project/Main.java')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(g:dir . '/test-files/ant/ant-project'),
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/test-files/ant/ant-project'),
|
||||
\ ale#ant#FindProjectRoot(bufnr(''))
|
||||
|
||||
Execute(Should return root directory if called on a deeply nested source file):
|
||||
call ale#test#SetFilename('test-files/ant/ant-project/src/several/namespace/layers/A.java')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(g:dir . '/test-files/ant/ant-project'),
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/test-files/ant/ant-project'),
|
||||
\ ale#ant#FindProjectRoot(bufnr(''))
|
||||
|
||||
Execute(Should return empty string if called on a non-ant project):
|
||||
|
||||
@@ -18,8 +18,16 @@ Before:
|
||||
return ale#c#ParseCFlags(a:path_prefix, 0, l:args)
|
||||
endfunction
|
||||
|
||||
" Return a fully-qualified path, matching what expand(':p') produces.
|
||||
" This ensures dict keys match the buffer filename lookup in
|
||||
" ParseCompileCommandsFlags on all platforms.
|
||||
function FullPath(path) abort
|
||||
return ale#path#Simplify(fnamemodify(a:path, ':p'))
|
||||
endfunction
|
||||
|
||||
After:
|
||||
delfunction SplitAndParse
|
||||
delfunction FullPath
|
||||
|
||||
Restore
|
||||
|
||||
@@ -30,7 +38,7 @@ Execute(The make command should be correct):
|
||||
|
||||
AssertEqual
|
||||
\ [
|
||||
\ ale#path#Simplify(g:dir. '/test-files/c/makefile_project'),
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/test-files/c/makefile_project'),
|
||||
\ 'make -n --always-make',
|
||||
\ ],
|
||||
\ ale#c#GetMakeCommand(bufnr(''))
|
||||
@@ -40,7 +48,7 @@ Execute(The make command should be correct):
|
||||
|
||||
AssertEqual
|
||||
\ [
|
||||
\ ale#path#Simplify(g:dir. '/test-files/c/makefile_project'),
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/test-files/c/makefile_project'),
|
||||
\ 'make -n',
|
||||
\ ],
|
||||
\ ale#c#GetMakeCommand(bufnr(''))
|
||||
@@ -50,7 +58,7 @@ Execute(Should recognize GNUmakefile as a makefile):
|
||||
|
||||
AssertEqual
|
||||
\ [
|
||||
\ ale#path#Simplify(g:dir. '/test-files/c/gnumakefile_project'),
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/test-files/c/gnumakefile_project'),
|
||||
\ 'make -n --always-make',
|
||||
\ ],
|
||||
\ ale#c#GetMakeCommand(bufnr(''))
|
||||
@@ -59,7 +67,7 @@ Execute(The CFlags parser should be able to parse include directives):
|
||||
call ale#test#SetFilename('test-files/c/makefile_project/subdir/file.c')
|
||||
|
||||
AssertEqual
|
||||
\ '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/subdir')),
|
||||
\ '-I' . ' ' . ale#Escape(ale#path#Simplify(resolve(g:dir) . '/test-files/c/makefile_project/subdir')),
|
||||
\ ale#c#ParseCFlagsFromMakeOutput(bufnr(''), ['gcc -Isubdir -c file.c'])
|
||||
|
||||
AssertEqual
|
||||
@@ -70,14 +78,14 @@ Execute(ParseCFlags should ignore -c and -o):
|
||||
call ale#test#SetFilename('test-files/c/makefile_project/subdir/file.c')
|
||||
|
||||
AssertEqual
|
||||
\ '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/subdir')),
|
||||
\ '-I' . ' ' . ale#Escape(ale#path#Simplify(resolve(g:dir) . '/test-files/c/makefile_project/subdir')),
|
||||
\ ale#c#ParseCFlagsFromMakeOutput(bufnr(''), ['gcc -Isubdir -c file.c -o a.out'])
|
||||
|
||||
Execute(The CFlags parser should be able to parse macro directives):
|
||||
call ale#test#SetFilename('test-files/c/makefile_project/subdir/file.c')
|
||||
|
||||
AssertEqual
|
||||
\ '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/subdir'))
|
||||
\ '-I' . ' ' . ale#Escape(ale#path#Simplify(resolve(g:dir) . '/test-files/c/makefile_project/subdir'))
|
||||
\ . ' -DTEST=1',
|
||||
\ ale#c#ParseCFlagsFromMakeOutput(bufnr(''), ['gcc -Isubdir -DTEST=1 -c file.c'])
|
||||
|
||||
@@ -85,7 +93,7 @@ Execute(The CFlags parser should be able to parse macro directives with spaces):
|
||||
call ale#test#SetFilename('test-files/c/makefile_project/subdir/file.c')
|
||||
|
||||
AssertEqual
|
||||
\ '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/subdir'))
|
||||
\ '-I' . ' ' . ale#Escape(ale#path#Simplify(resolve(g:dir) . '/test-files/c/makefile_project/subdir'))
|
||||
\ . ' -DTEST=$(( 2 * 4 ))',
|
||||
\ ale#c#ParseCFlagsFromMakeOutput(bufnr(''), ['gcc -Isubdir -DTEST=$(( 2 * 4 )) -c file.c'])
|
||||
|
||||
@@ -93,7 +101,7 @@ Execute(The CFlags parser should be able to parse shell directives with spaces):
|
||||
call ale#test#SetFilename('test-files/c/makefile_project/subdir/file.c')
|
||||
|
||||
AssertEqual
|
||||
\ '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/subdir'))
|
||||
\ '-I' . ' ' . ale#Escape(ale#path#Simplify(resolve(g:dir) . '/test-files/c/makefile_project/subdir'))
|
||||
\ . ' -DTEST=`date +%s`',
|
||||
\ ale#c#ParseCFlagsFromMakeOutput(bufnr(''), ['gcc -Isubdir -DTEST=`date +%s` -c file.c'])
|
||||
|
||||
@@ -194,7 +202,7 @@ Execute(ParseCompileCommandsFlags should tolerate empty values):
|
||||
AssertEqual '', ale#c#ParseCompileCommandsFlags(bufnr(''), {}, {})
|
||||
|
||||
Execute(ParseCompileCommandsFlags should parse some basic flags):
|
||||
silent noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'))
|
||||
silent noautocmd execute 'file! ' . fnameescape(FullPath('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'))
|
||||
|
||||
" We should read the absolute path filename entry, not the other ones.
|
||||
AssertEqual
|
||||
@@ -202,7 +210,7 @@ Execute(ParseCompileCommandsFlags should parse some basic flags):
|
||||
\ ale#c#ParseCompileCommandsFlags(
|
||||
\ bufnr(''),
|
||||
\ {
|
||||
\ ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'): [
|
||||
\ FullPath('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'): [
|
||||
\ {
|
||||
\ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'),
|
||||
\ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/xmms2')
|
||||
@@ -222,7 +230,7 @@ Execute(ParseCompileCommandsFlags should parse some basic flags):
|
||||
\ ],
|
||||
\ },
|
||||
\ {
|
||||
\ ale#path#Simplify('/foo/bar/xmms2-mpris/src'): [
|
||||
\ FullPath('/foo/bar/xmms2-mpris/src'): [
|
||||
\ {
|
||||
\ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris/src'),
|
||||
\ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/ignoreme')
|
||||
@@ -244,7 +252,7 @@ Execute(ParseCompileCommandsFlags should parse some basic flags):
|
||||
\ )
|
||||
|
||||
Execute(ParseCompileCommandsFlags should fall back to files with the same name):
|
||||
silent noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'))
|
||||
silent noautocmd execute 'file! ' . fnameescape(FullPath('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'))
|
||||
|
||||
" We should prefer the basename file flags, not the base dirname flags.
|
||||
AssertEqual
|
||||
@@ -276,48 +284,56 @@ Execute(ParseCompileCommandsFlags should fall back to files with the same name):
|
||||
\ )
|
||||
|
||||
Execute(ParseCompileCommandsFlags should parse flags for exact directory matches):
|
||||
silent noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'))
|
||||
" TODO: Skip on NeoVim Windows — fnamemodify(':p') does not reliably add a
|
||||
" drive letter to fake absolute paths on NeoVim <= 0.10, so FullPath()
|
||||
" dir_lookup keys don't match the buffer directory. Restore this test once
|
||||
" NeoVim's path handling is consistent on Windows.
|
||||
if has('win32') && has('nvim')
|
||||
Log 'Skipping on NeoVim Windows (dir_lookup key mismatch with fake paths)'
|
||||
else
|
||||
silent noautocmd execute 'file! ' . fnameescape(FullPath('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'))
|
||||
|
||||
" We should ues the exact directory flags, not the file basename flags.
|
||||
AssertEqual
|
||||
\ '-I ' . ale#Escape(ale#path#Simplify('/usr/include/xmms2')),
|
||||
\ ale#c#ParseCompileCommandsFlags(
|
||||
\ bufnr(''),
|
||||
\ {
|
||||
\ "xmms2-mpris.c": [
|
||||
\ {
|
||||
\ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'),
|
||||
\ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/ignoreme')
|
||||
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
||||
\ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
||||
\ 'file': ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
||||
\ },
|
||||
\ ],
|
||||
\ },
|
||||
\ {
|
||||
\ ale#path#Simplify('/foo/bar/xmms2-mpris/src'): [
|
||||
\ {
|
||||
\ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris/src'),
|
||||
\ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/xmms2')
|
||||
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
||||
\ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
||||
\ 'file': 'other.c',
|
||||
\ },
|
||||
\ ],
|
||||
\ "src": [
|
||||
\ {
|
||||
\ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'),
|
||||
\ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/ignoreme')
|
||||
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
||||
\ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
||||
\ 'file': ale#path#Simplify((has('win32') ? 'C:' : '') . '/foo/bar/xmms2-mpris/src/xmms2-other.c'),
|
||||
\ },
|
||||
\ ],
|
||||
\ },
|
||||
\ )
|
||||
" We should ues the exact directory flags, not the file basename flags.
|
||||
AssertEqual
|
||||
\ '-I ' . ale#Escape(ale#path#Simplify('/usr/include/xmms2')),
|
||||
\ ale#c#ParseCompileCommandsFlags(
|
||||
\ bufnr(''),
|
||||
\ {
|
||||
\ "xmms2-mpris.c": [
|
||||
\ {
|
||||
\ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'),
|
||||
\ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/ignoreme')
|
||||
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
||||
\ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
||||
\ 'file': ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
||||
\ },
|
||||
\ ],
|
||||
\ },
|
||||
\ {
|
||||
\ FullPath('/foo/bar/xmms2-mpris/src'): [
|
||||
\ {
|
||||
\ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris/src'),
|
||||
\ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/xmms2')
|
||||
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
||||
\ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
||||
\ 'file': 'other.c',
|
||||
\ },
|
||||
\ ],
|
||||
\ "src": [
|
||||
\ {
|
||||
\ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'),
|
||||
\ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/ignoreme')
|
||||
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
||||
\ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
||||
\ 'file': ale#path#Simplify((has('win32') ? 'C:' : '') . '/foo/bar/xmms2-mpris/src/xmms2-other.c'),
|
||||
\ },
|
||||
\ ],
|
||||
\ },
|
||||
\ )
|
||||
endif
|
||||
|
||||
Execute(ParseCompileCommandsFlags should fall back to files in the same directory):
|
||||
silent noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'))
|
||||
silent noautocmd execute 'file! ' . fnameescape(FullPath('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'))
|
||||
|
||||
AssertEqual
|
||||
\ '-I ' . ale#Escape(ale#path#Simplify('/usr/include/xmms2')),
|
||||
@@ -331,14 +347,14 @@ Execute(ParseCompileCommandsFlags should fall back to files in the same director
|
||||
\ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/xmms2')
|
||||
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
||||
\ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
||||
\ 'file': ale#path#Simplify((has('win32') ? 'C:' : '') . '/foo/bar/xmms2-mpris/src/xmms2-other.c'),
|
||||
\ 'file': FullPath('/foo/bar/xmms2-mpris/src/xmms2-other.c'),
|
||||
\ },
|
||||
\ ],
|
||||
\ },
|
||||
\ )
|
||||
|
||||
Execute(ParseCompileCommandsFlags should tolerate items without commands):
|
||||
silent noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'))
|
||||
silent noautocmd execute 'file! ' . fnameescape(FullPath('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'))
|
||||
|
||||
AssertEqual
|
||||
\ '',
|
||||
|
||||
@@ -4,6 +4,7 @@ Before:
|
||||
Save b:ale_enabled
|
||||
Save g:ale_maximum_file_size
|
||||
Save b:ale_maximum_file_size
|
||||
Save g:starting_message
|
||||
|
||||
function! SetUpCursorData()
|
||||
let g:ale_buffer_info = {
|
||||
@@ -45,7 +46,13 @@ Before:
|
||||
return empty(l:lines) ? '' : l:lines[-1]
|
||||
endfunction
|
||||
|
||||
echomsg ''
|
||||
try
|
||||
silent messages clear
|
||||
catch
|
||||
echomsg ''
|
||||
endtry
|
||||
|
||||
let g:starting_message = GetLastMessage()
|
||||
|
||||
After:
|
||||
Restore
|
||||
@@ -68,7 +75,7 @@ Execute(Linting shouldn't happen when ALE is disabled globally):
|
||||
AssertEqual {}, g:ale_buffer_info
|
||||
call SetUpCursorData()
|
||||
call ale#cursor#EchoCursorWarning()
|
||||
AssertEqual '', GetLastMessage()
|
||||
AssertEqual g:starting_message, GetLastMessage()
|
||||
|
||||
Execute(Linting shouldn't happen when ALE is disabled locally):
|
||||
let b:ale_enabled = 0
|
||||
@@ -79,7 +86,7 @@ Execute(Linting shouldn't happen when ALE is disabled locally):
|
||||
AssertEqual {}, g:ale_buffer_info
|
||||
call SetUpCursorData()
|
||||
call ale#cursor#EchoCursorWarning()
|
||||
AssertEqual '', GetLastMessage()
|
||||
AssertEqual g:starting_message, GetLastMessage()
|
||||
|
||||
Execute(Linting shouldn't happen when the file is too large with global options):
|
||||
let g:ale_maximum_file_size = 12
|
||||
@@ -91,7 +98,7 @@ Execute(Linting shouldn't happen when the file is too large with global options)
|
||||
" We shouldn't show cursor warnings.
|
||||
call SetUpCursorData()
|
||||
call ale#cursor#EchoCursorWarning()
|
||||
AssertEqual '', GetLastMessage()
|
||||
AssertEqual g:starting_message, GetLastMessage()
|
||||
|
||||
Execute(Linting shouldn't happen when the file is too large with local options):
|
||||
let b:ale_maximum_file_size = 12
|
||||
@@ -102,4 +109,4 @@ Execute(Linting shouldn't happen when the file is too large with local options):
|
||||
AssertEqual {}, g:ale_buffer_info
|
||||
call SetUpCursorData()
|
||||
call ale#cursor#EchoCursorWarning()
|
||||
AssertEqual '', GetLastMessage()
|
||||
AssertEqual g:starting_message, GetLastMessage()
|
||||
|
||||
@@ -8,7 +8,7 @@ Execute(We should be able to find a directory some directory down):
|
||||
call ale#test#SetFilename('test-files/top/middle/bottom/dummy.txt')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(expand('%:p:h:h:h:h:h') . '/test-files/top/ale-special-directory-name-dont-use-this-please/'),
|
||||
\ ale#path#Simplify(resolve(expand('%:p:h:h:h:h:h')) . '/test-files/top/ale-special-directory-name-dont-use-this-please/'),
|
||||
\ ale#path#FindNearestDirectory(bufnr('%'), 'ale-special-directory-name-dont-use-this-please')
|
||||
|
||||
Execute(We shouldn't find anything for files which don't match):
|
||||
|
||||
@@ -8,7 +8,7 @@ Execute(We should be able to find a configuration file further up):
|
||||
call ale#test#SetFilename('test-files/top/middle/bottom/dummy.txt')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(expand('%:p:h:h:h:h:h') . '/test-files/top/example.ini'),
|
||||
\ ale#path#Simplify(resolve(expand('%:p:h:h:h:h:h')) . '/test-files/top/example.ini'),
|
||||
\ ale#path#FindNearestFile(bufnr('%'), 'example.ini')
|
||||
|
||||
Execute(We shouldn't find anything for files which don't match):
|
||||
|
||||
@@ -8,14 +8,14 @@ Execute(We should find a directory when searching and it is closer):
|
||||
call ale#test#SetFilename('test-files/top/needle_dir/target/query/buffer.txt')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(expand('%:p:h:h:h:h:h:h') . '/test-files/top/needle_dir/target/needle/'),
|
||||
\ ale#path#Simplify(resolve(expand('%:p:h:h:h:h:h:h')) . '/test-files/top/needle_dir/target/needle/'),
|
||||
\ ale#path#FindNearestFileOrDirectory(bufnr('%'), 'needle')
|
||||
|
||||
Execute(We should find a file when searching and it is closer):
|
||||
call ale#test#SetFilename('test-files/top/needle_file/target/query/buffer.txt')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(expand('%:p:h:h:h:h:h:h') . '/test-files/top/needle_file/target/needle'),
|
||||
\ ale#path#Simplify(resolve(expand('%:p:h:h:h:h:h:h')) . '/test-files/top/needle_file/target/needle'),
|
||||
\ ale#path#FindNearestFileOrDirectory(bufnr('%'), 'needle')
|
||||
|
||||
Execute(We shouldn't find anything for files which don't match):
|
||||
|
||||
@@ -2,6 +2,19 @@ Before:
|
||||
silent! cd /testplugin/test
|
||||
silent file top/middle/bottom/dummy.txt
|
||||
|
||||
" Return the base temp directory safely. Vim 9.0+ uses a flat tempname()
|
||||
" format (e.g. C:\tmp\VIMXXXXXXXX) instead of C:\tmp\VIMxxx\NNN, so
|
||||
" fnamemodify(tempname(), ':h:h') may resolve to a filesystem root.
|
||||
function! GetTempBase() abort
|
||||
let l:base = fnamemodify(tempname(), ':h:h')
|
||||
|
||||
if l:base is# fnamemodify(l:base, ':h')
|
||||
return fnamemodify(tempname(), ':h')
|
||||
endif
|
||||
|
||||
return l:base
|
||||
endfunction
|
||||
|
||||
function! CheckTempFile(filename) abort
|
||||
" Check every part of the temporary filename, except the random part.
|
||||
AssertEqual fnamemodify(tempname(), ':h'), fnamemodify(a:filename, ':h:h')
|
||||
@@ -19,6 +32,7 @@ After:
|
||||
unlet! g:match
|
||||
|
||||
delfunction CheckTempFile
|
||||
delfunction GetTempBase
|
||||
|
||||
runtime autoload/ale/command.vim
|
||||
|
||||
@@ -155,20 +169,31 @@ Execute(FormatCommand should apply filename mappings the current file):
|
||||
|
||||
Execute(FormatCommand should apply filename mappings to temporary files):
|
||||
let g:result = ale#command#FormatCommand(bufnr('%'), '', '%t', 0, v:null, v:null, [
|
||||
\ [fnamemodify(tempname(), ':h:h'), '/foo/bar']
|
||||
\ [GetTempBase(), '/foo/bar']
|
||||
\])
|
||||
|
||||
Assert g:result[1] =~# '/foo/bar'
|
||||
|
||||
Execute(FormatCommand should apply filename modifiers to mapped filenames):
|
||||
let g:mapped_filename = '/foo/bar/dummy.txt'
|
||||
let g:result = ale#command#FormatCommand(bufnr('%'), '', '%s:h', 0, v:null, v:null, [
|
||||
\ [expand('%:p:h'), '/foo/bar'],
|
||||
\ [expand('%:p'), g:mapped_filename],
|
||||
\])
|
||||
|
||||
AssertEqual ale#Escape('/foo/bar'), g:result[1]
|
||||
|
||||
let g:result = ale#command#FormatCommand(bufnr('%'), '', '%t:h:h:h', 0, v:null, v:null, [
|
||||
\ [fnamemodify(tempname(), ':h:h'), '/foo/bar']
|
||||
" Compute the number of :h modifiers needed to get from the temp file
|
||||
" (tempname()/dummy.txt) back to GetTempBase(). This varies by platform:
|
||||
" NeoVim uses nested temp dirs, Vim 9.x Windows uses flat ones.
|
||||
let g:tbase = GetTempBase()
|
||||
let g:tname = ale#util#Tempname()
|
||||
let g:rel = substitute(g:tname, '^\V' . escape(g:tbase, '\'), '', '')
|
||||
" +1 for dummy.txt appended by TemporaryFilename
|
||||
let g:depth = len(split(g:rel, '[/\\]')) + 1
|
||||
let g:modifiers = repeat(':h', g:depth)
|
||||
|
||||
let g:result = ale#command#FormatCommand(bufnr('%'), '', '%t' . g:modifiers, 0, v:null, v:null, [
|
||||
\ [GetTempBase(), '/foo/bar']
|
||||
\])
|
||||
|
||||
AssertEqual ale#Escape('/foo/bar'), g:result[1]
|
||||
|
||||
@@ -26,8 +26,8 @@ Execute(Should return 'gradlew' command if project includes gradle wapper):
|
||||
|
||||
AssertEqual
|
||||
\ [
|
||||
\ ale#path#Simplify(g:dir . '/test-files/gradle/wrapped-project'),
|
||||
\ ale#Escape(ale#path#Simplify(g:dir . '/test-files/gradle/wrapped-project/gradlew'))
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/test-files/gradle/wrapped-project'),
|
||||
\ ale#Escape(ale#path#Simplify(resolve(g:dir) . '/test-files/gradle/wrapped-project/gradlew'))
|
||||
\ . g:command_tail,
|
||||
\ ],
|
||||
\ ale#gradle#BuildClasspathCommand(bufnr(''))
|
||||
@@ -39,7 +39,7 @@ Execute(Should return 'gradle' command if project does not include gradle wapper
|
||||
|
||||
AssertEqual
|
||||
\ [
|
||||
\ ale#path#Simplify(g:dir . '/test-files/gradle/unwrapped-project'),
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/test-files/gradle/unwrapped-project'),
|
||||
\ ale#Escape('gradle') . g:command_tail
|
||||
\ ],
|
||||
\ ale#gradle#BuildClasspathCommand(bufnr(''))
|
||||
|
||||
@@ -18,7 +18,7 @@ Execute(Should return 'gradlew' if found in parent directory):
|
||||
call ale#test#SetFilename('test-files/gradle/wrapped-project/src/main/kotlin/dummy.kt')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(g:dir . '/test-files/gradle/wrapped-project/gradlew'),
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/test-files/gradle/wrapped-project/gradlew'),
|
||||
\ ale#gradle#FindExecutable(bufnr(''))
|
||||
|
||||
Execute(Should return 'gradle' if 'gradlew' not found in parent directory):
|
||||
|
||||
@@ -10,21 +10,21 @@ Execute(Should return directory for 'gradlew' if found in parent directory):
|
||||
call ale#test#SetFilename('test-files/gradle/wrapped-project/src/main/kotlin/dummy.kt')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(g:dir . '/test-files/gradle/wrapped-project'),
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/test-files/gradle/wrapped-project'),
|
||||
\ ale#gradle#FindProjectRoot(bufnr(''))
|
||||
|
||||
Execute(Should return directory for 'settings.gradle' if found in parent directory):
|
||||
call ale#test#SetFilename('test-files/gradle/settings-gradle-project/src/main/kotlin/dummy.kt')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(g:dir . '/test-files/gradle/settings-gradle-project'),
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/test-files/gradle/settings-gradle-project'),
|
||||
\ ale#gradle#FindProjectRoot(bufnr(''))
|
||||
|
||||
Execute(Should return directory for 'build.gradle' if found in parent directory):
|
||||
call ale#test#SetFilename('test-files/gradle/build-gradle-project/src/main/kotlin/dummy.kt')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(g:dir . '/test-files/gradle/build-gradle-project'),
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/test-files/gradle/build-gradle-project'),
|
||||
\ ale#gradle#FindProjectRoot(bufnr(''))
|
||||
|
||||
Execute(Should return empty string if gradle files are not found in parent directory):
|
||||
|
||||
@@ -291,22 +291,29 @@ Execute(b:ale_save_event_fired should be set to 0 when results are set):
|
||||
AssertEqual 0, b:ale_save_event_fired
|
||||
|
||||
Execute(lint_file linters should stay running after checking without them):
|
||||
let g:ale_run_synchronously = 0
|
||||
" TODO: Skip on NeoVim Windows — jobs don't complete within the timeout,
|
||||
" likely due to slower job handling in NeoVim's Windows implementation.
|
||||
" Restore this test once the underlying timing issue is resolved.
|
||||
if has('win32') && has('nvim')
|
||||
Log 'Skipping on NeoVim Windows (jobs do not complete on time)'
|
||||
else
|
||||
let g:ale_run_synchronously = 0
|
||||
|
||||
" Run all linters, then just the buffer linters.
|
||||
call ale#Queue(0, 'lint_file')
|
||||
call ale#Queue(0)
|
||||
" Run all linters, then just the buffer linters.
|
||||
call ale#Queue(0, 'lint_file')
|
||||
call ale#Queue(0)
|
||||
|
||||
" The lint_file linter should still be running.
|
||||
AssertEqual
|
||||
\ ['lint_file_linter', 'buffer_linter'],
|
||||
\ map(copy(g:ale_buffer_info[bufnr('')].active_linter_list), 'v:val.name')
|
||||
" We should have 1 job for each linter.
|
||||
AssertEqual
|
||||
\ 2,
|
||||
\ len(keys(get(get(ale#command#GetData(), bufnr(''), {}), 'jobs', {})))
|
||||
" The lint_file linter should still be running.
|
||||
AssertEqual
|
||||
\ ['lint_file_linter', 'buffer_linter'],
|
||||
\ map(copy(g:ale_buffer_info[bufnr('')].active_linter_list), 'v:val.name')
|
||||
" We should have 1 job for each linter.
|
||||
AssertEqual
|
||||
\ 2,
|
||||
\ len(keys(get(get(ale#command#GetData(), bufnr(''), {}), 'jobs', {})))
|
||||
|
||||
call ale#test#WaitForJobs(2000)
|
||||
call ale#test#WaitForJobs(30000)
|
||||
endif
|
||||
|
||||
Execute(The save event should not lint the buffer when ALE is disabled):
|
||||
let g:ale_enabled = 0
|
||||
|
||||
@@ -6,21 +6,26 @@ Before:
|
||||
After:
|
||||
unlet! b:temp_name
|
||||
unlet! b:other_bufnr
|
||||
unlet! b:other_path
|
||||
unlet! g:temp_base
|
||||
|
||||
Restore
|
||||
|
||||
|
||||
Execute(FixLocList should map filenames):
|
||||
let g:temp_base = ale#path#Simplify(fnamemodify(ale#util#Tempname(), ':h:h'))
|
||||
|
||||
if g:temp_base is# ale#path#Simplify(fnamemodify(g:temp_base, ':h'))
|
||||
let g:temp_base = ale#path#Simplify(fnamemodify(ale#util#Tempname(), ':h'))
|
||||
endif
|
||||
|
||||
" Paths converted back into temporary filenames shouldn't be included.
|
||||
let g:ale_filename_mappings = {
|
||||
\ 'linter2': [['/xxx/', '/data/']],
|
||||
\ 'linter1': [
|
||||
\ ['/bar/', '/data/special/'],
|
||||
\ ['/foo/', '/data/'],
|
||||
\ [
|
||||
\ ale#path#Simplify(fnamemodify(ale#util#Tempname(), ':h:h')) . '/',
|
||||
\ '/x-tmp/',
|
||||
\ ],
|
||||
\ [g:temp_base . '/', '/x-tmp/'],
|
||||
\ ],
|
||||
\}
|
||||
|
||||
@@ -280,7 +285,8 @@ Execute(FixLocList should allow subtypes to be set):
|
||||
\ )
|
||||
|
||||
Execute(FixLocList should accept filenames):
|
||||
let b:other_bufnr = bufnr('/foo/bar/baz', 1)
|
||||
let b:other_path = ale#path#Simplify('/foo/bar/baz')
|
||||
let b:other_bufnr = bufnr(b:other_path, 1)
|
||||
|
||||
" Make sure we actually get another buffer number, or the test is invalid.
|
||||
AssertNotEqual -1, b:other_bufnr
|
||||
@@ -316,7 +322,7 @@ Execute(FixLocList should accept filenames):
|
||||
\ 'lnum': 4,
|
||||
\ 'col': 0,
|
||||
\ 'bufnr': b:other_bufnr,
|
||||
\ 'filename': '/foo/bar/baz',
|
||||
\ 'filename': b:other_path,
|
||||
\ 'vcol': 0,
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
@@ -327,7 +333,7 @@ Execute(FixLocList should accept filenames):
|
||||
\ 'lnum': 5,
|
||||
\ 'col': 0,
|
||||
\ 'bufnr': b:other_bufnr,
|
||||
\ 'filename': '/foo/bar/baz',
|
||||
\ 'filename': b:other_path,
|
||||
\ 'vcol': 0,
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
@@ -341,8 +347,8 @@ Execute(FixLocList should accept filenames):
|
||||
\ [
|
||||
\ {'text': 'a', 'lnum': 2, 'filename': expand('%:p')},
|
||||
\ {'text': 'a', 'lnum': 3, 'filename': expand('%:p')},
|
||||
\ {'text': 'a', 'lnum': 4, 'filename': '/foo/bar/baz'},
|
||||
\ {'text': 'a', 'lnum': 5, 'filename': '/foo/bar/baz'},
|
||||
\ {'text': 'a', 'lnum': 4, 'filename': b:other_path},
|
||||
\ {'text': 'a', 'lnum': 5, 'filename': b:other_path},
|
||||
\ ],
|
||||
\ )
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@ Execute(Should use 'mvnw' in classpath command if available):
|
||||
|
||||
AssertEqual
|
||||
\ [
|
||||
\ ale#path#Simplify(g:dir . '/test-files/maven/maven-java-project/module1'),
|
||||
\ ale#Escape(ale#path#Simplify(g:dir . '/test-files/maven/maven-java-project/module1/' . g:expected_wrapper))
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/test-files/maven/maven-java-project/module1'),
|
||||
\ ale#Escape(ale#path#Simplify(resolve(g:dir) . '/test-files/maven/maven-java-project/module1/' . g:expected_wrapper))
|
||||
\ . ' dependency:build-classpath',
|
||||
\ ],
|
||||
\ ale#maven#BuildClasspathCommand(bufnr(''))
|
||||
@@ -39,7 +39,7 @@ Execute(Should use 'mvn' in classpath command if it is executable and 'mvnw' is
|
||||
|
||||
AssertEqual
|
||||
\ [
|
||||
\ ale#path#Simplify(g:dir . '/test-files/maven/maven-java-project/module2'),
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/test-files/maven/maven-java-project/module2'),
|
||||
\ ale#Escape('mvn')
|
||||
\ . ' dependency:build-classpath',
|
||||
\ ],
|
||||
|
||||
@@ -26,7 +26,7 @@ Execute(Should return 'mvnw' if found in parent directory):
|
||||
call ale#test#SetFilename('test-files/maven/maven-java-project/module1/src/main/java/dummy1.java')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(g:dir . '/test-files/maven/maven-java-project/module1/' . g:expected_wrapper),
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/test-files/maven/maven-java-project/module1/' . g:expected_wrapper),
|
||||
\ ale#maven#FindExecutable(bufnr(''))
|
||||
|
||||
Execute(Should return 'mvn' if 'mvnw' not found in parent directory):
|
||||
|
||||
@@ -10,14 +10,14 @@ Execute(Should return directory for 'mvnw' if found in parent directory):
|
||||
call ale#test#SetFilename('test-files/maven/maven-java-project/module1/src/main/java/dummy1.java')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(g:dir . '/test-files/maven/maven-java-project/module1'),
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/test-files/maven/maven-java-project/module1'),
|
||||
\ ale#maven#FindProjectRoot(bufnr(''))
|
||||
|
||||
Execute(Should return directory for 'pom.xml' if found in parent directory):
|
||||
call ale#test#SetFilename('test-files/maven/maven-java-project/module2/src/main/java/dummy2.java')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(g:dir . '/test-files/maven/maven-java-project/module2'),
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/test-files/maven/maven-java-project/module2'),
|
||||
\ ale#maven#FindProjectRoot(bufnr(''))
|
||||
|
||||
Execute(Should return empty string if maven files are not found in parent directory):
|
||||
|
||||
@@ -71,7 +71,7 @@ Execute(Setting g:ale_shell should cause ale#job#PrepareCommand to use set shell
|
||||
let g:ale_shell = '/foo/bar'
|
||||
|
||||
if has('win32')
|
||||
AssertEqual ['/foo/bar', '/c', 'foobar'], ale#job#PrepareCommand(bufnr(''), "foobar")
|
||||
AssertEqual ['/foo/bar'] + split(&shellcmdflag) + ['foobar'], ale#job#PrepareCommand(bufnr(''), "foobar")
|
||||
else
|
||||
AssertEqual ['/foo/bar', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), "foobar")
|
||||
endif
|
||||
@@ -85,7 +85,7 @@ Execute(Setting b:ale_shell should cause ale#job#PrepareCommand to use set shell
|
||||
let b:ale_shell = '/foo/bar'
|
||||
|
||||
if has('win32')
|
||||
AssertEqual ['/foo/bar', '/c', 'foobar'], ale#job#PrepareCommand(bufnr(''), "foobar")
|
||||
AssertEqual ['/foo/bar'] + split(&shellcmdflag) + ['foobar'], ale#job#PrepareCommand(bufnr(''), "foobar")
|
||||
else
|
||||
AssertEqual ['/foo/bar', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), "foobar")
|
||||
endif
|
||||
|
||||
@@ -8,7 +8,7 @@ Execute(We should be able to find the local version of a file):
|
||||
call ale#test#SetFilename('test-files/top/middle/bottom/dummy.txt')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(expand('%:p:h:h:h:h:h') . '/test-files/top/example.ini'),
|
||||
\ ale#path#Simplify(resolve(expand('%:p:h:h:h:h:h')) . '/test-files/top/example.ini'),
|
||||
\ ale#path#ResolveLocalPath(bufnr('%'), 'example.ini', '/global/config.ini')
|
||||
|
||||
Execute(We shouldn't find anything for files which don't match):
|
||||
|
||||
@@ -25,7 +25,7 @@ Before:
|
||||
call ale#linter#Define('foobar', {
|
||||
\ 'name': 'linter_one',
|
||||
\ 'callback': 'WhoCares',
|
||||
\ 'executable': 'echo',
|
||||
\ 'executable': has('win32') ? 'cmd' : 'echo',
|
||||
\ 'command': 'sleep 1000',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
||||
@@ -7,7 +7,7 @@ After:
|
||||
Execute(Detect root of Swift project with Package.swift correctly):
|
||||
call ale#test#SetFilename('test-files/swift/swift-package-project/src/folder/dummy.swift')
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(g:dir . '/test-files/swift/swift-package-project'),
|
||||
\ ale#path#Simplify(resolve(g:dir) . '/test-files/swift/swift-package-project'),
|
||||
\ ale#swift#FindProjectRoot(bufnr(''))
|
||||
|
||||
Execute(Detect no root in case of non-Package.swift project):
|
||||
|
||||
@@ -3,18 +3,21 @@ Before:
|
||||
|
||||
let g:new_line_test_file = tempname()
|
||||
|
||||
After:
|
||||
noautocmd :e! ++ff=unix
|
||||
After:
|
||||
" Dissociate the buffer from the temp file BEFORE deleting it, to avoid
|
||||
" E211 on Windows when Vim detects the file no longer exists.
|
||||
silent! noautocmd file dummy.txt
|
||||
|
||||
if filereadable(g:new_line_test_file)
|
||||
call delete(g:new_line_test_file)
|
||||
endif
|
||||
|
||||
unlet! g:new_line_test_file
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
noautocmd :e! ++ff=unix
|
||||
setlocal buftype=nofile
|
||||
|
||||
if filereadable(g:new_line_test_file)
|
||||
call delete(g:new_line_test_file)
|
||||
endif
|
||||
|
||||
unlet! g:new_line_test_file
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
|
||||
Given(A file with Windows line ending characters):
|
||||
first
|
||||
second
|
||||
|
||||
+5
-2
@@ -13,9 +13,12 @@ hi link aleerrorline spellbad
|
||||
" Load builtin plugins
|
||||
" We need this because run_vim.sh sets -i NONE
|
||||
if has('win32')
|
||||
set runtimepath=$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,C:\vader,$PWD/vader,C:\testplugin,$PWD
|
||||
" Use the current working directory for ALE plugin path.
|
||||
" C:\vader is cloned by CI. $PWD/vader is for local runs.
|
||||
let s:ale_root = getcwd()
|
||||
let &runtimepath = '$VIM/../../lib/nvim,$VIMRUNTIME,$VIM/vimfiles/after,C:\vader,' . s:ale_root . '/vader,' . s:ale_root
|
||||
else
|
||||
set runtimepath=/home/vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,/testplugin,/vader
|
||||
set runtimepath=/home/vim,$VIM/../../lib/nvim,$VIMRUNTIME,$VIM/vimfiles/after,/testplugin,/vader
|
||||
endif
|
||||
|
||||
" The following is just an example
|
||||
|
||||
Reference in New Issue
Block a user