Update generated nvim config
This commit is contained in:
@ -0,0 +1,9 @@
|
||||
.PHONY: test
|
||||
|
||||
MYVIM ?= nvim --clean --headless
|
||||
|
||||
INMAKE := 1
|
||||
export INMAKE
|
||||
|
||||
test:
|
||||
@$(MYVIM) -u test.vim
|
||||
@ -0,0 +1,54 @@
|
||||
@string{ test= "something" }
|
||||
@string{ name1 = "Mr. Foo" }
|
||||
@string{anch-ie = {Angew.~Chem. Int.~Ed.}}
|
||||
|
||||
@comment{
|
||||
blahrg
|
||||
}
|
||||
|
||||
@preamble{silly things
|
||||
}
|
||||
|
||||
@SomeType{key1,
|
||||
title = "Some title, with a comma in it",
|
||||
year = {2017},
|
||||
author = "Author1 and Author2",
|
||||
other = {Something else}
|
||||
}
|
||||
|
||||
@misc{key2,
|
||||
title = {A new title},
|
||||
author = name1 # " and Mr. Bar",
|
||||
year = "1960",
|
||||
}
|
||||
|
||||
@misc{key3,
|
||||
tag1 = {{Bib}\TeX},
|
||||
tag2 = "{Bib}\TeX",
|
||||
tag3 = "{Bib}" # "\TeX",
|
||||
publisher = "nob" # "ody",
|
||||
year = 2005,
|
||||
}
|
||||
|
||||
@misc{key4,
|
||||
|
||||
}
|
||||
|
||||
@misc{key5,
|
||||
author = {text here } # test,
|
||||
title = "title: " # anch-ie
|
||||
}
|
||||
|
||||
@errorintags{key6,
|
||||
title = {some title}
|
||||
author = "should not work",
|
||||
}
|
||||
|
||||
@article{knuth,
|
||||
title = "Other title",
|
||||
year = {1938},
|
||||
author = "Donald Knuth",
|
||||
key = {Knuth},
|
||||
}
|
||||
|
||||
@article{knuth-single-line, title = "Other title", year = {1938}, author = "Donald Knuth", }
|
||||
@ -0,0 +1,56 @@
|
||||
set nocompatible
|
||||
let &rtp = '../..,' . &rtp
|
||||
|
||||
function! TestBackend(bibfile, backend) abort
|
||||
let g:vimtex_parser_bib_backend = a:backend
|
||||
return vimtex#parser#bib(a:bibfile)
|
||||
endfunction
|
||||
|
||||
let s:backends = ['bibtex', 'vim']
|
||||
if has('nvim')
|
||||
call add(s:backends, 'lua')
|
||||
endif
|
||||
|
||||
for s:backend in s:backends
|
||||
let s:parsed = TestBackend('test.bib', s:backend)
|
||||
call assert_equal(8, len(s:parsed),
|
||||
\ "Failed for backend: " . s:backend)
|
||||
|
||||
for s:entry in s:parsed
|
||||
if s:entry.key == 'key5'
|
||||
call assert_match(
|
||||
\ 'text.here something',
|
||||
\ get(s:entry, 'author', ''),
|
||||
\ "Failed for backend: " . s:backend)
|
||||
call assert_match(
|
||||
\ '^title: Angew',
|
||||
\ get(s:entry, 'title', ''),
|
||||
\ "Failed for backend: " . s:backend)
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
|
||||
" Check that Vim and Lua parser give the same result
|
||||
if has('nvim')
|
||||
let s:parsed_lua = TestBackend('test.bib', 'lua')
|
||||
let s:parsed_vim = TestBackend('test.bib', 'vim')
|
||||
call assert_equal(len(s:parsed_lua), len(s:parsed_vim))
|
||||
for s:i in range(len(s:parsed_lua))
|
||||
call assert_equal(s:parsed_lua[s:i], s:parsed_vim[s:i])
|
||||
endfor
|
||||
endif
|
||||
|
||||
let s:bib = vimtex#kpsewhich#find('biblatex-examples.bib')
|
||||
if !empty(s:bib) && filereadable(s:bib)
|
||||
for s:backend in s:backends
|
||||
let s:parsed = TestBackend(s:bib, s:backend)
|
||||
call assert_equal(92, len(s:parsed),
|
||||
\ "Failed for backend: " . s:backend)
|
||||
endfor
|
||||
endif
|
||||
|
||||
call vimtex#log#set_silent()
|
||||
let s:parsed = TestBackend('test.bib', 'badparser')
|
||||
call assert_equal(0, len(s:parsed))
|
||||
|
||||
call vimtex#test#finished()
|
||||
Reference in New Issue
Block a user