diff --git a/test/test-getfile/Makefile b/test/test-getfile/Makefile new file mode 100644 index 0000000000..0891f11987 --- /dev/null +++ b/test/test-getfile/Makefile @@ -0,0 +1,14 @@ +MYVIM ?= nvim --clean --headless + +INMAKE := 1 +export INMAKE + +TESTS := $(wildcard test*.vim) +TESTS := $(TESTS:.vim=) + +.PHONY: default $(TESTS) + +default: $(TESTS) + +$(TESTS): + @$(MYVIM) -u $@.vim diff --git a/test/test-getfile/test_auxdir.vim b/test/test-getfile/test_auxdir.vim new file mode 100644 index 0000000000..fbc3c77ad8 --- /dev/null +++ b/test/test-getfile/test_auxdir.vim @@ -0,0 +1,46 @@ +set nocompatible +let &rtp = '../..,' . &rtp +filetype plugin on + +nnoremap q :qall! + +function! Test(file, expected) abort + silent edit test_auxdir/test.tex + let l:file = vimtex#paths#shorten_relative( + \ b:vimtex.compiler.get_file(a:file)) + call assert_equal(a:expected, l:file) + bwipeout +endfunction + +call Test('pdf', 'test.pdf') + +let g:vimtex_compiler_latexmk = {'out_dir': 'out'} +call Test('pdf', 'out/test.pdf') +call Test('aux', 'out/test.aux') +call Test('fls', 'out/test.fls') +call Test('log', 'out/test.log') +call Test('blg', 'out/test.blg') + +let g:vimtex_compiler_latexmk = {'aux_dir': 'aux'} +call Test('pdf', 'test.pdf') +call Test('fls', 'test.fls') +call Test('aux', 'aux/test.aux') +call Test('log', 'aux/test.log') +call Test('blg', 'aux/test.blg') + +let g:vimtex_compiler_latexmk = { + \ 'out_dir': 'out', + \ 'aux_dir': 'aux' + \} +call Test('pdf', 'out/test.pdf') +call Test('fls', 'out/test.fls') +call Test('aux', 'aux/test.aux') +call Test('log', 'aux/test.log') +call Test('blg', 'aux/test.blg') + +call vimtex#log#set_silent() +let $VIMTEX_OUTPUT_DIRECTORY = 'out' +call Test('aux', 'out/test.aux') +call Test('log', 'out/test.log') + +call vimtex#test#finished() diff --git a/test/test-getfile/test_auxdir/aux/test.aux b/test/test-getfile/test_auxdir/aux/test.aux new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/test-getfile/test_auxdir/aux/test.blg b/test/test-getfile/test_auxdir/aux/test.blg new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/test-getfile/test_auxdir/aux/test.log b/test/test-getfile/test_auxdir/aux/test.log new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/test-getfile/test_auxdir/out/test.aux b/test/test-getfile/test_auxdir/out/test.aux new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/test-getfile/test_auxdir/out/test.blg b/test/test-getfile/test_auxdir/out/test.blg new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/test-getfile/test_auxdir/out/test.fls b/test/test-getfile/test_auxdir/out/test.fls new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/test-getfile/test_auxdir/out/test.log b/test/test-getfile/test_auxdir/out/test.log new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/test-getfile/test_auxdir/out/test.pdf b/test/test-getfile/test_auxdir/out/test.pdf new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/test-getfile/test_auxdir/out/test.synctex.gz b/test/test-getfile/test_auxdir/out/test.synctex.gz new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/test-getfile/test_auxdir/test.fls b/test/test-getfile/test_auxdir/test.fls new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/test-getfile/test_auxdir/test.pdf b/test/test-getfile/test_auxdir/test.pdf new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/test-getfile/test_auxdir/test.tex b/test/test-getfile/test_auxdir/test.tex new file mode 100644 index 0000000000..527545ebc3 --- /dev/null +++ b/test/test-getfile/test_auxdir/test.tex @@ -0,0 +1,6 @@ +\documentclass{minimal} +\begin{document} + +Dummy file + +\end{document}