aboutsummaryrefslogtreecommitdiff
path: root/test/functional/plugin/man_spec.lua
Commit message (Collapse)AuthorAge
* refactor(man.lua): various changesLewis Russell2024-12-18
| | | | | | | | | | | | | | | | | | | - 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
* fix(Man): completion on MacLewis Russell2024-12-16
| | | | | | | | 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
* fix(tests): needing two calls to setup a screen is cringebfredl2024-11-14
| | | | | | | | | | 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.
* test: support upvalues in exec_luaLewis Russell2024-09-21
|
* test: tmpname(create:boolean) #30242Justin M. Keyes2024-09-03
| | | | | | | | | 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.
* fix(man): avoid setting v:errmsg (#30052)zeertzjq2024-08-15
|
* fix(man): filter OSC 8 hyperlink markup #29171Lennard Hofmann2024-06-07
| | | | | 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
* fix(man.vim): q quits after jump to different tag in MANPAGER modified (#28495)Brian Cao2024-04-26
|
* test: improve test conventionsdundargoc2024-04-23
| | | | | | | | | 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.
* refactor(test): inject after_each differentlyLewis Russell2024-04-10
|
* test: improve test conventionsdundargoc2024-04-08
| | | | Work on https://github.com/neovim/neovim/issues/27004.
* fix(test): typingLewis Russell2024-03-25
|
* test: rename (meths, funcs) -> (api, fn)Lewis Russell2024-01-12
|
* test: do not inject vim module into global helpersLewis Russell2024-01-12
|
* refactor: format test/*Justin M. Keyes2024-01-03
|
* test: avoid repeated screen lines in expected stateszeertzjq2023-12-09
| | | | | | 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
* test(plugin/man_spec): use pesc() on actual_file in pattern (#25199)zeertzjq2023-09-17
|
* test: add more tests for :Man section extractionzeertzjq2023-05-08
|
* fix(man.lua): tests, namingJustin M. Keyes2023-03-07
|
* feat(man.lua): support spaces in manpage namesEriks Muhins2023-03-07
| | | | | | | | | | 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.
* fix(man): use italics for `<bs>_` (#22086)Lewis Russell2023-02-01
| | | | | | | | | | | | 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
* test: simplify platform detection (#21020)dundargoc2022-11-22
| | | | | 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")`.
* test: introduce skip() #21010dundargoc2022-11-13
| | | | | | | 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())`.
* ci: add cirrus to isCI function to skip tests (#20526)dundargoc2022-10-17
| | | | The environment variable CIRRUS_CI is manually passed to RunTests.cmake as it doesn't get passed when using cmake script mode.
* fix(man): handle absolute paths as `:Man` targets (#20624)Mahmoud Al-Qudsi2022-10-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* feat(Man): port to Lua (#19912)Lewis Russell2022-09-02
| | | Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* fix(exceptions): restore `did_throw` (#20000)Sean Dewar2022-08-30
| | | | | | | | | | | | | | | | | | `!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.
* fix(man.vim): q in "$MANPAGER mode" does not quit #18443Arsham Shirvani2022-05-13
| | | | | | | | | | | | | | | | | 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>
* tests/ui: remove unnecessary screen:detach()Björn Linse2019-10-13
| | | | | | | | | | | | | 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.
* tests/ui: cleanup illegitimate usages of "attr_ignore"Björn Linse2019-10-13
| | | | | "attr_ignore" is an anti-pattern, with snapshot_util() just include all the highlights already.
* test/man_spec: remove plugin_helpers.reset()Justin M. Keyes2019-08-05
| | | | | | | | | 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>
* man.vim: Handle ANSI escape sequences with ":" #10267Kovas Palunas2019-06-30
| | | | closes #10267
* test: man_spec: Fix use of nested [[ quotingJames McCoy2018-02-02
| | | | | | 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.
* Merge #7623 'man.vim: highlight bold, underlined text'Justin M. Keyes2018-01-09
|
* Address PR commentsGabriel Holodak2017-12-27
|
* Add functional tests for man highlightingGabriel Holodak2017-12-27