mirror of
https://github.com/neovim/neovim
synced 2025-07-16 01:01:49 +00:00
tests: use runtime from build for doc/tags with :help (#10479)
This is better practice in general, and allows to remove the "helptags ALL" hacks. Ref: https://github.com/neovim/neovim/issues/8824 Ref: https://github.com/neovim/neovim/commit/f1b67c3453c * Makefile: fix dependencies with regard to helptags - use the file as the main target to avoid unnecessary triggering - use "make oldtest" on Travis to ensure it gets built
This commit is contained in:
@ -541,6 +541,7 @@ add_subdirectory(test/includes)
|
|||||||
add_subdirectory(config)
|
add_subdirectory(config)
|
||||||
add_subdirectory(test/functional/fixtures) # compile test programs
|
add_subdirectory(test/functional/fixtures) # compile test programs
|
||||||
add_subdirectory(runtime)
|
add_subdirectory(runtime)
|
||||||
|
get_directory_property(GENERATED_HELP_TAGS DIRECTORY runtime DEFINITION GENERATED_HELP_TAGS)
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
install_helper(
|
install_helper(
|
||||||
FILES ${DEPS_PREFIX}/share/nvim-qt/runtime/plugin/nvim_gui_shim.vim
|
FILES ${DEPS_PREFIX}/share/nvim-qt/runtime/plugin/nvim_gui_shim.vim
|
||||||
@ -562,7 +563,7 @@ if(BUSTED_PRG)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(UNITTEST_PREREQS nvim-test unittest-headers)
|
set(UNITTEST_PREREQS nvim-test unittest-headers)
|
||||||
set(FUNCTIONALTEST_PREREQS nvim printargs-test shell-test)
|
set(FUNCTIONALTEST_PREREQS nvim printargs-test shell-test ${GENERATED_HELP_TAGS})
|
||||||
if(NOT WIN32)
|
if(NOT WIN32)
|
||||||
list(APPEND FUNCTIONALTEST_PREREQS tty-test)
|
list(APPEND FUNCTIONALTEST_PREREQS tty-test)
|
||||||
endif()
|
endif()
|
||||||
|
6
Makefile
6
Makefile
@ -114,7 +114,7 @@ build/.ran-third-party-cmake::
|
|||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
# TODO: cmake 3.2+ add_custom_target() has a USES_TERMINAL flag.
|
# TODO: cmake 3.2+ add_custom_target() has a USES_TERMINAL flag.
|
||||||
oldtest: | nvim helptags
|
oldtest: | nvim build/runtime/doc/tags
|
||||||
+$(SINGLE_MAKE) -C src/nvim/testdir clean
|
+$(SINGLE_MAKE) -C src/nvim/testdir clean
|
||||||
ifeq ($(strip $(TEST_FILE)),)
|
ifeq ($(strip $(TEST_FILE)),)
|
||||||
+$(SINGLE_MAKE) -C src/nvim/testdir NVIM_PRG="$(realpath build/bin/nvim)" $(MAKEOVERRIDES)
|
+$(SINGLE_MAKE) -C src/nvim/testdir NVIM_PRG="$(realpath build/bin/nvim)" $(MAKEOVERRIDES)
|
||||||
@ -122,11 +122,11 @@ else
|
|||||||
+$(SINGLE_MAKE) -C src/nvim/testdir NVIM_PRG="$(realpath build/bin/nvim)" NEW_TESTS=$(TEST_FILE) SCRIPTS= $(MAKEOVERRIDES)
|
+$(SINGLE_MAKE) -C src/nvim/testdir NVIM_PRG="$(realpath build/bin/nvim)" NEW_TESTS=$(TEST_FILE) SCRIPTS= $(MAKEOVERRIDES)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
helptags: | nvim
|
build/runtime/doc/tags helptags: | nvim
|
||||||
+$(BUILD_CMD) -C build runtime/doc/tags
|
+$(BUILD_CMD) -C build runtime/doc/tags
|
||||||
|
|
||||||
# Builds help HTML _and_ checks for invalid help tags.
|
# Builds help HTML _and_ checks for invalid help tags.
|
||||||
helphtml: | nvim helptags
|
helphtml: | nvim build/runtime/doc/tags
|
||||||
+$(BUILD_CMD) -C build doc_html
|
+$(BUILD_CMD) -C build doc_html
|
||||||
|
|
||||||
functionaltest: | nvim
|
functionaltest: | nvim
|
||||||
|
@ -113,7 +113,7 @@ run_functionaltests() {(
|
|||||||
run_oldtests() {(
|
run_oldtests() {(
|
||||||
enter_suite oldtests
|
enter_suite oldtests
|
||||||
ulimit -c unlimited || true
|
ulimit -c unlimited || true
|
||||||
if ! make -C "${TRAVIS_BUILD_DIR}/src/nvim/testdir"; then
|
if ! make oldtest; then
|
||||||
reset
|
reset
|
||||||
fail 'oldtests' F 'Legacy tests failed'
|
fail 'oldtests' F 'Legacy tests failed'
|
||||||
fi
|
fi
|
||||||
|
@ -74,6 +74,9 @@ set nomore
|
|||||||
" Output all messages in English.
|
" Output all messages in English.
|
||||||
lang mess C
|
lang mess C
|
||||||
|
|
||||||
|
" Nvim: append runtime from build dir, which contains the generated doc/tags.
|
||||||
|
let &runtimepath .= ','.expand($BUILD_DIR).'/runtime/'
|
||||||
|
|
||||||
" Always use forward slashes.
|
" Always use forward slashes.
|
||||||
set shellslash
|
set shellslash
|
||||||
|
|
||||||
|
@ -300,7 +300,6 @@ func Test_augroup_warning()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_BufReadCmdHelp()
|
func Test_BufReadCmdHelp()
|
||||||
helptags ALL
|
|
||||||
" This used to cause access to free memory
|
" This used to cause access to free memory
|
||||||
au BufReadCmd * e +h
|
au BufReadCmd * e +h
|
||||||
help
|
help
|
||||||
@ -382,7 +381,6 @@ func Test_three_windows()
|
|||||||
|
|
||||||
only
|
only
|
||||||
|
|
||||||
helptags ALL
|
|
||||||
help
|
help
|
||||||
wincmd w
|
wincmd w
|
||||||
1quit
|
1quit
|
||||||
|
@ -242,7 +242,6 @@ func Test_getcompletion()
|
|||||||
let l = getcompletion('break', 'compiler')
|
let l = getcompletion('break', 'compiler')
|
||||||
call assert_equal([], l)
|
call assert_equal([], l)
|
||||||
|
|
||||||
helptags ALL
|
|
||||||
let l = getcompletion('last', 'help')
|
let l = getcompletion('last', 'help')
|
||||||
call assert_true(index(l, ':tablast') >= 0)
|
call assert_true(index(l, ':tablast') >= 0)
|
||||||
let l = getcompletion('giveup', 'help')
|
let l = getcompletion('giveup', 'help')
|
||||||
|
@ -89,8 +89,11 @@ func Test_tagfiles()
|
|||||||
|
|
||||||
help
|
help
|
||||||
let tf = tagfiles()
|
let tf = tagfiles()
|
||||||
|
" Nvim: expectation(s) based on tags in build dir (added to &rtp).
|
||||||
|
" Filter out the (non-existing) '../../../runtime/doc/tags'.
|
||||||
|
call filter(tf, 'filereadable(v:val)')
|
||||||
call assert_equal(1, len(tf))
|
call assert_equal(1, len(tf))
|
||||||
call assert_equal(fnamemodify(expand('$VIMRUNTIME/doc/tags'), ':p:gs?\\?/?'),
|
call assert_equal(fnamemodify(expand('$BUILD_DIR/runtime/doc/tags'), ':p:gs?\\?/?'),
|
||||||
\ fnamemodify(tf[0], ':p:gs?\\?/?'))
|
\ fnamemodify(tf[0], ':p:gs?\\?/?'))
|
||||||
helpclose
|
helpclose
|
||||||
call assert_equal(['Xtags1', 'Xtags2'], tagfiles())
|
call assert_equal(['Xtags1', 'Xtags2'], tagfiles())
|
||||||
|
@ -33,9 +33,9 @@ describe('autocmd BufEnter', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('triggered by ":split normal|:help|:bw"', function()
|
it('triggered by ":split normal|:help|:bw"', function()
|
||||||
|
helpers.add_builddir_to_rtp()
|
||||||
command("split normal")
|
command("split normal")
|
||||||
command("wincmd j")
|
command("wincmd j")
|
||||||
command("helptags runtime/doc")
|
|
||||||
command("help")
|
command("help")
|
||||||
command("wincmd L")
|
command("wincmd L")
|
||||||
command("autocmd BufEnter normal let g:bufentered = 1")
|
command("autocmd BufEnter normal let g:bufentered = 1")
|
||||||
|
@ -8,6 +8,7 @@ describe('autocmd FileType', function()
|
|||||||
before_each(clear)
|
before_each(clear)
|
||||||
|
|
||||||
it("is triggered by :help only once", function()
|
it("is triggered by :help only once", function()
|
||||||
|
helpers.add_builddir_to_rtp()
|
||||||
command("let g:foo = 0")
|
command("let g:foo = 0")
|
||||||
command("autocmd FileType help let g:foo = g:foo + 1")
|
command("autocmd FileType help let g:foo = g:foo + 1")
|
||||||
command("help help")
|
command("help help")
|
||||||
|
@ -9,6 +9,7 @@ describe(':help', function()
|
|||||||
before_each(clear)
|
before_each(clear)
|
||||||
|
|
||||||
it('window closed makes cursor return to a valid win/buf #9773', function()
|
it('window closed makes cursor return to a valid win/buf #9773', function()
|
||||||
|
helpers.add_builddir_to_rtp()
|
||||||
command('help help')
|
command('help help')
|
||||||
eq(1001, funcs.win_getid())
|
eq(1001, funcs.win_getid())
|
||||||
command('quit')
|
command('quit')
|
||||||
|
@ -800,6 +800,11 @@ function module.parse_context(ctx)
|
|||||||
end, parsed)
|
end, parsed)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function module.add_builddir_to_rtp()
|
||||||
|
-- Add runtime from build dir for doc/tags (used with :help).
|
||||||
|
module.command(string.format([[set rtp+=%s/runtime]], module.test_build_dir))
|
||||||
|
end
|
||||||
|
|
||||||
module = global_helpers.tbl_extend('error', module, global_helpers)
|
module = global_helpers.tbl_extend('error', module, global_helpers)
|
||||||
|
|
||||||
return function(after_each)
|
return function(after_each)
|
||||||
|
@ -97,6 +97,7 @@ describe('python3 provider', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('RPC call to expand("<afile>") during BufDelete #5245 #5617', function()
|
it('RPC call to expand("<afile>") during BufDelete #5245 #5617', function()
|
||||||
|
helpers.add_builddir_to_rtp()
|
||||||
source([=[
|
source([=[
|
||||||
python3 << EOF
|
python3 << EOF
|
||||||
import vim
|
import vim
|
||||||
|
@ -101,6 +101,7 @@ end)
|
|||||||
|
|
||||||
describe('ruby provider', function()
|
describe('ruby provider', function()
|
||||||
it('RPC call to expand("<afile>") during BufDelete #5245 #5617', function()
|
it('RPC call to expand("<afile>") during BufDelete #5245 #5617', function()
|
||||||
|
helpers.add_builddir_to_rtp()
|
||||||
command([=[autocmd BufDelete * ruby VIM::evaluate('expand("<afile>")')]=])
|
command([=[autocmd BufDelete * ruby VIM::evaluate('expand("<afile>")')]=])
|
||||||
feed_command('help help')
|
feed_command('help help')
|
||||||
eq(2, eval('1+1')) -- Still alive?
|
eq(2, eval('1+1')) -- Still alive?
|
||||||
|
Reference in New Issue
Block a user