summaryrefslogtreecommitdiffstatshomepage
path: root/test/functional/plugin/man_spec.lua
AgeCommit message (Collapse)AuthorFiles
2026-04-22ci: drop cirrus #39321Justin M. Keyes1
Problem: cirrus will shutdown soon, and we are running out of minutes anyway, which causes ci failures. Solution: Drop cirrus config.
2026-03-10fix(lua): extra CR (\r) in `nvim -l` output #38048Commrade Goad1
Problem: `nvim -l` prints an extra `\r` to stdout: :=vim.system({'cmd', '/c', "echo print(1) | nvim -l -"}, {}):wait() { code = 0, signal = 0, stderr = "1\r\r\n", stdout = "" } Solution: Check `headless_mode` in `msg_use_crlf`. Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2026-03-10fix(man.lua): :Man ignores section of gzipped manpage #38235MP4301
Problem: Under certain circumstances (e.g. gzipped manpages with mandoc), :Man will not find the correct page because it does not process multiple extensions correctly. For example, with a file named strcpy.3p.gz, it will only check the .gz part to try to check the section. This leads to some pages being inaccessible because it will return the page from the wrong section. Solution: Loop and try multiple extensions to try to find one which matches the name of the section. Also refactor the man.get_path function so that it can be tested.
2025-05-04feat(messages): cleanup Lua error messagesJustin M. Keyes1
"Error" in error messages is redundant. Just provide the context, don't say "Error ...".
2025-04-15fix(man.lua): E95 when piping to :Man #33068João Bettencourt1
Problem: When piping raw manpage content into `:Man!`, buf name is set to 'man://.. ref', but the check only matches the prefix. Allows duplicate buffers to be created, triggering E95. Solution: Match full buf name instead of only 'man://' prefix. If the buffer already exists, generate a unique name with 'man://' .. 'ref' .. '?new=' format. Refs: #30132
2025-03-14test: do not dedent() in feed() (#32884)zeertzjq1
Most callers of feed() do not expect feed() to dedent. Now use a literal space in tests where it looks better.
2024-12-18refactor(man.lua): various changesLewis Russell1
- Replace all uses of vim.regex with simpler Lua patterns. - Replace all uses of vim.fn.substitute with string.gsub. - Rework error handling so expected errors are passed back via a return. - These get routed up an passed to `vim.notify()` - Any other errors will cause a stack trace. - Reworked the module initialization of `localfile_arg` - Updated all type annotations. - Refactored CLI completion by introduction a parse_cmdline() function. - Simplified `show_toc()` - Refactor highlighting - Inline some functions - Fix completion on MacOS 13 and earlier. - Prefer `manpath -q` over `man -w` - Make completion more efficient by avoiding vim.fn.sort and vim.fn.uniq - Reimplement using a single loop
2024-12-16fix(Man): completion on MacLewis Russell1
Problem: `man -w` does not work on recent versions of MacOs. Solution: Make it so an empty result is interpreted as an error unless silent=true
2024-11-14fix(tests): needing two calls to setup a screen is cringebfredl1
Before calling "attach" a screen object is just a dummy container for (row, col) values whose purpose is to be sent as part of the "attach" function call anyway. Just create the screen in an attached state directly. Keep the complete (row, col, options) config together. It is still completely valid to later detach and re-attach as needed, including to another session.
2024-09-21test: support upvalues in exec_luaLewis Russell1
2024-09-03test: tmpname(create:boolean) #30242Justin M. Keyes1
Problem: 137f98cf6428 added the `create` parameter to `tmpname()` but didn't fully implement it. Solution: - Update impl for the `os.tmpname()` codepath. - Inspect all usages of `tmpname()`, update various tests.
2024-08-15fix(man): avoid setting v:errmsg (#30052)zeertzjq1
2024-06-07fix(man): filter OSC 8 hyperlink markup #29171Lennard Hofmann1
Problem: `man cmake` shows "8;;https://cmake.orghttps://cmake.org8;;" Solution: Remove noise so that it shows as "https://cmake.org". See also: https://en.wikipedia.org/wiki/ANSI_escape_code#OSC
2024-04-26fix(man.vim): q quits after jump to different tag in MANPAGER modified (#28495)Brian Cao1
2024-04-23test: improve test conventionsdundargoc1
Specifically, functions that are run in the context of the test runner are put in module `test/testutil.lua` while the functions that are run in the context of the test session are put in `test/functional/testnvim.lua`. Closes https://github.com/neovim/neovim/issues/27004.
2024-04-10refactor(test): inject after_each differentlyLewis Russell1
2024-04-08test: improve test conventionsdundargoc1
Work on https://github.com/neovim/neovim/issues/27004.
2024-03-25fix(test): typingLewis Russell1
2024-01-12test: rename (meths, funcs) -> (api, fn)Lewis Russell1
2024-01-12test: do not inject vim module into global helpersLewis Russell1
2024-01-03refactor: format test/*Justin M. Keyes1
2023-12-09test: avoid repeated screen lines in expected stateszeertzjq1
This is the command invoked repeatedly to make the changes: :%s/^\(.*\)|\%(\*\(\d\+\)\)\?$\n\1|\%(\*\(\d\+\)\)\?$/\=submatch(1)..'|*'..(max([str2nr(submatch(2)),1])+max([str2nr(submatch(3)),1]))/g
2023-09-17test(plugin/man_spec): use pesc() on actual_file in pattern (#25199)zeertzjq1
2023-05-08test: add more tests for :Man section extractionzeertzjq1
2023-03-07fix(man.lua): tests, namingJustin M. Keyes1
2023-03-07feat(man.lua): support spaces in manpage namesEriks Muhins1
Problem: :Man command errors if given more than two arguments. Thus, it is impossible to open man pages that contain spaces in their names. Solution: Adjust :Man so that it tries variants with spaces and underscores, and uses the first found.
2023-02-01fix(man): use italics for `<bs>_` (#22086)Lewis Russell1
fix(man): use italics for <bs>_ Even though underline is strictly what this should be. <bs>_ was used by nroff to indicate italics which wasn't possible on old typewriters so underline was used. Modern terminals now support italics so lets use that now. See: - https://unix.stackexchange.com/questions/274658/purpose-of-ascii-text-with-overstriking-file-format/274795#274795 - https://cmd.inp.nsk.su/old/cmd2/manuals/unix/UNIX_Unleashed/ch08.htm
2022-11-22test: simplify platform detection (#21020)dundargoc1
Extend the capabilities of is_os to detect more platforms such as freebsd and openbsd. Also remove `iswin()` helper function as it can be replaced by `is_os("win")`.
2022-11-13test: introduce skip() #21010dundargoc1
This is essentially a convenience wrapper around the `pending()` function, similar to `skip_fragile()` but more general-purpose. Also remove `pending_win32` function as it can be replaced by `skip(iswin())`.
2022-10-17ci: add cirrus to isCI function to skip tests (#20526)dundargoc1
The environment variable CIRRUS_CI is manually passed to RunTests.cmake as it doesn't get passed when using cmake script mode.
2022-10-17fix(man): handle absolute paths as `:Man` targets (#20624)Mahmoud Al-Qudsi1
* fix(man): handle absolute paths as :Man targets Previously, attempting to provide `:Man` with an absolute path as the name would cause neovim to return the following error: ``` Error detected while processing command line: /usr/local/share/nvim/runtime/lua/man.lua:690: /usr/local/share/nvim/runtime/lua/man.lua:683: Vim:E426: tag not found: nil(nil) Press ENTER or type command to continue ``` ..because it would try to validate the existence of a man page for the provided name by executing `man -w /some/path` which (on at least some Linux machines [0]) returns `/some/path` instead of the path to the nroff files that would be formatted to satisfy the man(1) lookup. While man pages are not normally named after absolute paths, users shouldn't be blamed for trying. Given such a name/path, neovim would **not** complain that the path didn't have a corresponding man file but would error out when trying to call the tag function for the null-propagated name-and-section `nil(nil)`. (The same underlying error existed before this function was ported to lua, but did not exhibit the lua-specific `nil(nil)` name; instead a tag lookup for `()` would fail and error out.) With this patch, we detect the case where `man -w ...` returns the same value as the provided name to not only prevent invoking the tag function for a non-existent/malformed name+sect but also to properly report the non-existence of a man page for the provided lookup (the absolute path). While man(1) can be used to directly read an nroff-formatted document via `man /path/to/nroff.doc`, `:Man /path/to/nroff.doc` never supported this behavior so no functionality is lost in case the provided path _was_ an nroff file. [0]: `man -w /absolute/path` returning `/absolute/path` observed on an Ubuntu 18.04 installation. * test: add regression test for #20624 Add a functional test to `man_spec.lua` to check for a regression for #20624 by first obtaining an absolute path to a random file and materializing it to disk, then attempting to query `:Man` for an entry by that same name/path. The test passes if nvim correctly reports that there is no man page correspending to the provided name/path and fails if any other error (or no error) is shown.
2022-09-02feat(Man): port to Lua (#19912)Lewis Russell1
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2022-08-30fix(exceptions): restore `did_throw` (#20000)Sean Dewar1
`!did_throw` doesn't exactly imply `!current_exception`, as `did_throw = false` is sometimes used to defer exception handling for later (without forgetting the exception). E.g: uncaught exception handling in `do_cmdline()` may be deferred to a different call (e.g: when `try_level > 0`). In #7881, `current_exception = NULL` in `do_cmdline()` is used as an analogue of `did_throw = false`, but also causes the pending exception to be lost, which also leaks as `discard_exception()` wasn't used. It may be possible to fix this by saving/restoring `current_exception`, but handling all of `did_throw`'s edge cases seems messier. Maybe not worth diverging over. This fix also uncovers a `man_spec.lua` bug on Windows: exceptions are thrown due to Windows missing `man`, but they're lost; skip these tests if `man` isn't executable.
2022-05-13fix(man.vim): q in "$MANPAGER mode" does not quit #18443Arsham Shirvani1
Problem: q in "$MANPAGER mode" does not quit Nvim. This is because ftplugin/man.vim creates its own mapping: nnoremap <silent> <buffer> <nowait> q :lclose<CR><C-W>c which overrides the one set by the autoload file when using :Man! ("$MANPAGER mode") Solution: Set b:pager during "$MANPAGER mode" so that ftplugin/man.vim can set the mapping correctly. Fixes #18281 Ref #17791 Helped-by: Gregory Anders <8965202+gpanders@users.noreply.github.com>
2019-10-13tests/ui: remove unnecessary screen:detach()Björn Linse1
It is perfectly fine and expected to detach from the screen just by the UI disconnecting from nvim or exiting nvim. Just keep detach() in screen_basic_spec, to get some coverage of the detach method itself. This avoids hang on failure in many situations (though one could argue that detach() should be "fast", or at least "as fast as resize", which works in press-return already). Never use detach() just to change the size of the screen, try_resize() method exists for that specifically.
2019-10-13tests/ui: cleanup illegitimate usages of "attr_ignore"Björn Linse1
"attr_ignore" is an anti-pattern, with snapshot_util() just include all the highlights already.
2019-08-05test/man_spec: remove plugin_helpers.reset()Justin M. Keyes1
The call to plugin_helpers.reset() is redundant with the clear() call above it. Probably just a copy-paste mistake. Avoids exit_event race #8813. Helped-by: Björn Linse <bjorn.linse@gmail.com>
2019-06-30man.vim: Handle ANSI escape sequences with ":" #10267Kovas Palunas1
closes #10267
2018-02-02test: man_spec: Fix use of nested [[ quotingJames McCoy1
Lua (not LuaJIT) complains about the "^[[" strings inside the expect, since it sees them as nested quotes. Change the quoting to [=[ ]=] to avoid the issue.
2018-01-09Merge #7623 'man.vim: highlight bold, underlined text'Justin M. Keyes1
2017-12-27Address PR commentsGabriel Holodak1
2017-12-27Add functional tests for man highlightingGabriel Holodak1