ale/autoload/ale/test.vim

24 lines
728 B
VimL

" Author: w0rp <devw0rp@gmail.com>
" Description: Functions for making testing ALE easier.
"
" This file should not typically be loaded during the normal execution of ALE.
" Change the filename for the current buffer using a relative path to
" the script without running autocmd commands.
"
" If a g:dir variable is set, it will be used as the path to the directory
" containing the test file.
function! ale#test#SetFilename(path) abort
let l:dir = get(g:, 'dir', '')
if empty(l:dir)
let l:dir = getcwd()
endif
let l:full_path = ale#path#IsAbsolute(a:path)
\ ? a:path
\ : l:dir . '/' . a:path
silent noautocmd execute 'file ' . fnameescape(ale#path#Simplify(l:full_path))
endfunction