File: test_builddir.vim

package info (click to toggle)
vim-vimtex 2.16-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 8,660 kB
  • sloc: makefile: 367; python: 103
file content (36 lines) | stat: -rw-r--r-- 913 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
set nocompatible
let &rtp = '../..,' . &rtp
filetype plugin on

nnoremap q :qall!<cr>

call vimtex#log#set_silent()

function! TestBuildDir(expected) abort
  silent edit test.tex
  " let l:out_dir = vimtex#paths#shorten_relative(
  "       \ fnamemodify(b:vimtex.compiler.get_file('pdf'), ':h'))
  call assert_equal(a:expected, b:vimtex.compiler.out_dir)
  bwipeout
endfunction

call TestBuildDir('')

let g:vimtex_compiler_latexmk = {'out_dir': 'out'}
call TestBuildDir('out')

let $VIMTEX_OUTPUT_DIRECTORY = 'out'
call TestBuildDir('out')
call assert_true(empty(vimtex#log#get()))

let $VIMTEX_OUTPUT_DIRECTORY = 'build'
call TestBuildDir('build')
let s:warning = get(map(vimtex#log#get(), {_, x -> x.msg[0]}), 0, 'NONE')
call assert_equal(
      \ 'Setting VIMTEX_OUTPUT_DIRECTORY overrides out_dir!',
      \ s:warning)

let $VIMTEX_OUTPUT_DIRECTORY = ''
call TestBuildDir('out')

call vimtex#test#finished()