Fix some escaping and make some tests set filenames consistently

This commit is contained in:
w0rp
2017-06-21 22:33:34 +01:00
parent ab534c2995
commit dab6f39eb0
7 changed files with 71 additions and 32 deletions

19
autoload/ale/test.vim Normal file
View File

@@ -0,0 +1,19 @@
" 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
silent noautocmd execute 'file ' . fnameescape(simplify(l:dir . '/' . a:path))
endfunction