Update generated nvim config
This commit is contained in:
@ -0,0 +1,37 @@
|
||||
MYVIM ?= nvim --clean --headless
|
||||
|
||||
INMAKE := 1
|
||||
export INMAKE
|
||||
|
||||
TESTS := $(wildcard test*.vim)
|
||||
TESTS := $(filter-out test-backend,$(TESTS:.vim=))
|
||||
|
||||
.PHONY: test $(TESTS)
|
||||
|
||||
test: test-backend $(TESTS) prepare-test-clean
|
||||
|
||||
$(TESTS):
|
||||
@$(MYVIM) -u $@.vim
|
||||
|
||||
test-backend: latexrun
|
||||
@PATH=$$PATH:. chronic $(MYVIM) -u $@.vim
|
||||
@rm -f minimal.*
|
||||
@rm -f pdflatex*.fls
|
||||
@rm -f .latexrun.db.lock
|
||||
@rm -rf out
|
||||
|
||||
test-clean: prepare-test-clean
|
||||
|
||||
prepare-test-clean:
|
||||
@touch test-clean.log
|
||||
@touch test-clean.aux
|
||||
@touch test-clean.pdf
|
||||
@touch generated-extra_files.out
|
||||
@mkdir -p _minted-test-clean
|
||||
@touch _minted-test-clean/stuffhere
|
||||
|
||||
latexrun:
|
||||
@wget \
|
||||
https://raw.githubusercontent.com/aclements/latexrun/master/latexrun \
|
||||
>/dev/null 2>&1
|
||||
@chmod u+x latexrun
|
||||
@ -0,0 +1,108 @@
|
||||
set nocompatible
|
||||
let &rtp = '../..,' . &rtp
|
||||
filetype plugin on
|
||||
|
||||
set nomore
|
||||
|
||||
let g:vimtex_view_automatic = 0
|
||||
let g:vimtex_log_verbose = 0
|
||||
|
||||
function! RunTests(comp, list_opts)
|
||||
if !executable(a:comp)
|
||||
echo 'Warning! "' . a:comp . '" was not executable!'
|
||||
echo "Compiler tests could not run!\n\n"
|
||||
cquit
|
||||
endif
|
||||
|
||||
let g:vimtex_compiler_method = a:comp
|
||||
|
||||
for l:opts in a:list_opts
|
||||
let g:vimtex_compiler_{a:comp} = l:opts
|
||||
|
||||
" Ensure there is no latexmk process before we start the test
|
||||
if a:comp ==# 'latexmk'
|
||||
call system('pkill -f latexmk')
|
||||
endif
|
||||
|
||||
echo 'Testing compiler "' . a:comp . '"'
|
||||
if !empty(l:opts)
|
||||
echon ' with options:'
|
||||
for [l:key, l:val] in items(l:opts)
|
||||
echo '* ' . l:key . ' =' l:val . "\n"
|
||||
endfor
|
||||
endif
|
||||
|
||||
for l:file in glob('minimal.*', 1, 1)
|
||||
call delete(l:file)
|
||||
endfor
|
||||
call writefile([
|
||||
\ '\documentclass{minimal}',
|
||||
\ '\begin{document}',
|
||||
\ 'Hello World!',
|
||||
\ '\end{document}',
|
||||
\], 'minimal.tex')
|
||||
|
||||
silent edit minimal.tex
|
||||
|
||||
" Check if the compiler was loaded
|
||||
if !has_key(b:vimtex, 'compiler')
|
||||
echo "Compiler failed to load!\n"
|
||||
cquit
|
||||
endif
|
||||
|
||||
silent call vimtex#compiler#compile()
|
||||
sleep 650m
|
||||
|
||||
" Check if continuous mode is active
|
||||
if get(b:vimtex.compiler, 'continuous')
|
||||
if !b:vimtex.compiler.get_pid()
|
||||
echo "Could not get PID for compiler\n"
|
||||
cquit
|
||||
endif
|
||||
|
||||
silent call vimtex#compiler#stop()
|
||||
else
|
||||
sleep 450m
|
||||
endif
|
||||
|
||||
" Check that the PDF has been built
|
||||
if empty(b:vimtex.compiler.get_file('pdf'))
|
||||
echo "PDF was not built properly\n"
|
||||
cquit
|
||||
endif
|
||||
|
||||
silent call vimtex#compiler#clean(1)
|
||||
sleep 650m
|
||||
|
||||
if !empty(b:vimtex.compiler.get_file('pdf'))
|
||||
\ || !empty(b:vimtex.compiler.get_file('aux'))
|
||||
echo "VimtexClean failed!\n"
|
||||
cquit
|
||||
endif
|
||||
|
||||
if !empty(get(l:opts, 'out_dir', ''))
|
||||
call delete(l:opts.out_dir, 'rf')
|
||||
endif
|
||||
|
||||
echo "\n"
|
||||
bwipeout
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
for [s:comp, s:opts] in items({
|
||||
\ 'latexmk' : [
|
||||
\ {},
|
||||
\ {'out_dir' : 'out'},
|
||||
\ {'callback' : 0},
|
||||
\ {'callback' : 0, 'continuous' : 0},
|
||||
\ {'continuous' : 0},
|
||||
\ ],
|
||||
\ 'latexrun' : [
|
||||
\ {},
|
||||
\ {'out_dir' : 'out'},
|
||||
\ ],
|
||||
\})
|
||||
call RunTests(s:comp, s:opts)
|
||||
endfor
|
||||
|
||||
quitall!
|
||||
@ -0,0 +1,4 @@
|
||||
\documentclass{minimal}
|
||||
\begin{document}
|
||||
Hello World! \failed
|
||||
\end{document}
|
||||
@ -0,0 +1,33 @@
|
||||
set nocompatible
|
||||
let &rtp = '../..,' . &rtp
|
||||
filetype plugin on
|
||||
|
||||
let g:status = 0
|
||||
nnoremap q :qall!<cr>
|
||||
|
||||
let g:vimtex_compiler_latexmk = {'out_dir': 'build'}
|
||||
|
||||
call vimtex#log#set_silent()
|
||||
|
||||
augroup test_builddir
|
||||
autocmd!
|
||||
autocmd User VimtexEventCompileSuccess let g:status = 1
|
||||
autocmd User VimtexEventCompileFailed let g:status = 2
|
||||
augroup END
|
||||
|
||||
silent edit test-builddir.tex
|
||||
|
||||
if empty($INMAKE) | finish | endif
|
||||
|
||||
silent VimtexCompileSS
|
||||
|
||||
let s:n = 0
|
||||
while g:status < 1 && s:n < 100
|
||||
sleep 20m
|
||||
let s:n += 1
|
||||
endwhile
|
||||
|
||||
call assert_equal(2, g:status)
|
||||
|
||||
silent VimtexClean!
|
||||
call vimtex#test#finished()
|
||||
@ -0,0 +1,28 @@
|
||||
set nocompatible
|
||||
let &rtp = '../..,' . &rtp
|
||||
filetype plugin on
|
||||
|
||||
nnoremap q :qall!<cr>
|
||||
|
||||
let g:vimtex_compiler_method = 'arara'
|
||||
let g:vimtex_compiler_clean_paths = [
|
||||
\ '_minted*',
|
||||
\ 'generated*files*',
|
||||
\]
|
||||
|
||||
" call vimtex#log#set_silent()
|
||||
|
||||
silent edit test-clean.tex
|
||||
|
||||
if empty($INMAKE) | finish | endif
|
||||
|
||||
silent VimtexClean!
|
||||
|
||||
call assert_false(filereadable('test-clean.log'))
|
||||
call assert_false(filereadable('test-clean.aux'))
|
||||
call assert_false(filereadable('test-clean.pdf'))
|
||||
call assert_false(filereadable('generated-extra_files.out'))
|
||||
call assert_false(isdirectory('_minted-test-clean'))
|
||||
call assert_false(filereadable('_minted-test-clean/stuffhere'))
|
||||
|
||||
call vimtex#test#finished()
|
||||
Reference in New Issue
Block a user