aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/help_spec.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2022-09-25 02:20:47 +0200
committerJustin M. Keyes <justinkz@gmail.com>2022-09-28 18:34:20 +0200
commit16336c486ecb5a60e85a870904316308c7d7fc3f (patch)
tree887ccb63a5184b32dd45bf27261701e23c2fdeeb /test/functional/lua/help_spec.lua
parent7b4c49888a97c21f346b8337330fbc8e196b9cf8 (diff)
downloadrneovim-16336c486ecb5a60e85a870904316308c7d7fc3f.tar.gz
rneovim-16336c486ecb5a60e85a870904316308c7d7fc3f.tar.bz2
rneovim-16336c486ecb5a60e85a870904316308c7d7fc3f.zip
feat(gen_help_html.lua): adapt to new parser
- adapt to parser changes from https://github.com/vigoux/tree-sitter-vimdoc/pull/16 - numerous other generator improvements
Diffstat (limited to 'test/functional/lua/help_spec.lua')
-rw-r--r--test/functional/lua/help_spec.lua31
1 files changed, 13 insertions, 18 deletions
diff --git a/test/functional/lua/help_spec.lua b/test/functional/lua/help_spec.lua
index 266f261ab9..2ddabc15ae 100644
--- a/test/functional/lua/help_spec.lua
+++ b/test/functional/lua/help_spec.lua
@@ -12,29 +12,26 @@ describe(':help docs', function()
before_each(clear)
it('validate', function()
-- If this test fails, try these steps (in order):
- -- 1. Try to fix/cleanup the :help docs, especially Nvim-owned :help docs.
- -- 2. Try to fix the parser: https://github.com/vigoux/tree-sitter-vimdoc
+ -- 1. Fix/cleanup the :help docs.
+ -- 2. Fix the parser: https://github.com/neovim/tree-sitter-vimdoc
-- 3. File a parser bug, and adjust the tolerance of this test in the meantime.
local rv = exec_lua([[return require('scripts.gen_help_html').validate('./build/runtime/doc')]])
+ -- Check that we actually found helpfiles.
+ ok(rv.helpfiles > 100, '>100 :help files', rv.helpfiles)
-- Check that parse errors did not increase wildly.
- -- TODO: yes, there are currently 24k+ parser errors.
- -- WIP: https://github.com/vigoux/tree-sitter-vimdoc/pull/16
- ok(rv.err_count < 24000, '<24000', rv.err_count)
- -- TODO: should be eq(0, …)
- ok(exec_lua('return vim.tbl_count(...)', rv.invalid_tags) < 538, '<538',
- exec_lua('return vim.inspect(...)', rv.invalid_tags))
+ -- TODO: Fix all parse errors in :help files.
+ ok(rv.err_count < 1300, '<1300 parse errors', rv.err_count)
+ eq({}, rv.invalid_links, exec_lua([[return 'found invalid :help tag links:\n'..vim.inspect(...)]], rv.invalid_links))
end)
it('gen_help_html.lua generates HTML', function()
- -- Test:
- -- 1. Check that parse errors did not increase wildly. Because we explicitly test only a few
- -- :help files, we can be more precise about the tolerances here.
- -- 2. exercise gen_help_html.lua, check that it actually works.
- -- 3. check that its tree-sitter-vimdoc dependency is working.
+ -- 1. Test that gen_help_html.lua actually works.
+ -- 2. Test that parse errors did not increase wildly. Because we explicitly test only a few
+ -- :help files, we can be precise about the tolerances here.
local tmpdir = exec_lua('return vim.fs.dirname(vim.fn.tempname())')
- -- Because gen() is slow (1 min), this test is limited to a few files.
+ -- Because gen() is slow (~30s), this test is limited to a few files.
local rv = exec_lua([[
local to_dir = ...
return require('scripts.gen_help_html').gen(
@@ -46,9 +43,7 @@ describe(':help docs', function()
tmpdir
)
eq(4, #rv.helpfiles)
- ok(rv.err_count < 700, '<700', rv.err_count)
- -- TODO: should be eq(0, …)
- ok(exec_lua('return vim.tbl_count(...)', rv.invalid_tags) <= 32, '<=32',
- exec_lua('return vim.inspect(...)', rv.invalid_tags))
+ ok(rv.err_count < 16, '<16 parse errors', rv.err_count)
+ eq({}, rv.invalid_links, exec_lua([[return 'found invalid :help tag links:\n'..vim.inspect(...)]], rv.invalid_links))
end)
end)