aboutsummaryrefslogtreecommitdiff
path: root/test/helpers.lua
Commit message (Collapse)AuthorAge
* fix(rpc): "grid_line" event parsing crashes (#25581)LW2023-11-04
| | | | | | | | | | | | | | | refactor: use a more idiomatic loop to iterate over the cells There are two cases in which the following assertion would fail: ```c assert(g->icell < g->ncells); ``` 1. If `g->ncells = 0`. Update this to be legal. 2. If an EOF is reached while parsing `wrap`. In this case, the unpacker attempts to resume from `cells`, which is a bug. Create a new state for parsing `wrap`. Reference: https://neovim.io/doc/user/ui.html#ui-event-grid_line
* feat(treesitter): improve query error messageAmaan Qureshi2023-08-31
|
* fix(test): remove test/compat.luaLewis Russell2023-08-13
|
* feat(treesitter)!: incremental injection parsingLewis Russell2023-08-12
| | | | | | | | | | | | | | | | | | | | | Problem: Treesitter highlighting is slow for large files with lots of injections. Solution: Only parse injections we are going to render during a redraw cycle. --- - `LanguageTree:parse()` will no longer parse injections by default and now requires an explicit range argument to be passed. - `TSHighlighter` now parses injections incrementally during on_win callbacks for the line range being rendered. - Plugins which require certain injections to be parsed must run `parser:parse({ start_row, end_row })` before using the tree.
* refactor(unit): add type annotationsLewis Russell2023-04-14
|
* test: remove penlight usagedundargoc2023-04-14
|
* test: replace lfs with luv and vim.fsdundargoc2023-04-04
| | | | | | test: replace lfs with luv luv already pretty much does everything lfs does, so this duplication of dependencies isn't needed.
* test: Windows not detected in msys shells #22671Enan Ajmain2023-03-15
| | | | | | | | | | | | | Problem: The functional tests have `is_os(s)` to determine if the current os is. E.g. `is_os("win")` returns true if the current os is Windows. This is done by checking if the sysname as detected by luv contains the substring 'windows'. In MSYS shells, the sysname is looks like MINGWXX_NT, where XX is either 32 or 64. So if you're using busted or luv that you built separately, not the nvim-bundled versions, then `is_os(s)` won't work. Solution: Treat sysname containing "mingw" as Windows.
* ci: skip core dump checkdundargoc2023-03-05
| | | | | The core dump check interferes with CI as it interprets any file with "core" in it to be a core dump, which is incorrect.
* feat(ui): restore has('gui_running')Justin M. Keyes2023-02-27
| | | | | | | | | | Problem: has('gui_running') is still common in the wild and our answer has changed over time, causing frustration. https://github.com/vimpostor/vim-tpipeline/commit/95a6ccbe9f33bc42dd4cee45731d8bc3fbcd92d1 Solution: Use stdin_tty/stdout_tty to decide if a UI is (not) a GUI.
* refactor(tests): move lua-client into core and use it for functionaltestsbfredl2023-02-10
| | | | | | | | Eliminates lua-client and non-static libluv as test time dependencies Note: the API for a public lua-client is not yet finished. The interface needs to be adjusted to work in the embedded loop of a nvim instance (to use it to talk between instances)
* refactor(tests): lift retry() into assert_log()Justin M. Keyes2023-01-17
|
* test: use luv.os_uname for fast platform detection (#21157)kylo2522022-12-02
|
* 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")`.
* feat(test): add Lua forms for API methods (#20152)Lewis Russell2022-11-14
|
* 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.
* feat(lua): move compat module from runtime to test (#20257)Lewis Russell2022-09-20
|
* ci: move BSD jobs from sourcehut to Cirrus CI #19616dundargoc2022-09-08
| | | | | | | | | | | | | | | | | | | dispatch.sr.ht is being deprecated, meaning that using sourcehut CI won't be possible (see https://github.com/neovim/neovim/issues/19609). Since Github Actions doesn't provide any BSD runners an external service is required and Cirrus CI seems like a good replacement for sourcehut. Initially experimented with using FreeBSD and OpenBSD virtual machines in GitHub Actions, but Cirrus has been a much better fit with better performance, logs and overall experience. Failing tests are automatically skipped on FreeBSD regardless if it's on CI or not. Ideally these tests should only be skipped in CI with the help of `isCI` helper function. Unfortunately, the tests don't recognize the environment variable CIRRUS_CI even if it's set manually. This workaround is good enough for the time being, but we might want to only skip tests when using the CI (or even better, fix the failing tests). Closes: https://github.com/neovim/neovim/issues/19609
* feat: stdpath('run'), /tmp/nvim.user/ #18993Justin M. Keyes2022-06-30
| | | | | | | | | | | | | | | | Problem: - Since c57f6b28d71d #8519, sockets are created in ~/.local/… but XDG spec says: "XDG_RUNTIME_DIR: Must be on the local filesystem", which implies that XDG_STATE_DIR is potentially non-local. - Not easy to inspect Nvim-created temp files (for debugging etc). Solution: - Store sockets in stdpath('run') ($XDG_RUNTIME_DIR). - Establish "/tmp/nvim.user/" as the tempdir root shared by all Nvims. - Make ok() actually useful. - Introduce assert_nolog(). closes #3517 closes #17093
* build: rename build-related dirsJustin M. Keyes2022-06-28
| | | | | | | | | | | | | | Problem: Dirs "config", "packaging", and "third-party" are all closely related but this is not obvious from the layout. This adds friction for new contributors. Solution: - rename config/ to cmake.config/ - rename test/config/ to test/cmakeconfig/ because it is used in Lua tests: require('test.cmakeconfig.paths'). - rename packaging/ to cmake.packaging/ - rename third-party/ to cmake.deps/ (parallel with .deps/)
* fix(tests): remove misleading $TEST_PATH segment #19050Justin M. Keyes2022-06-23
| | | | | | | | | | | | | | | Problem: RunTests.cmake adds $TEST_PATH to $TMPDIR with the implication that it gives more isolation. But this is misleading because $TEST_PATH is only defined once. Full test runs use the same $TMPDIR for all tests. This was likely added with the intention of invoking RunTests.cmake once-per-testfile from a wrapper than does the isolation/orchestration. But even so, Nvim's vim_maketempdir() / vim_mktempdir() _already_ creates a unique tempdir per session. Solution: Don't append $TEST_PATH to $TMPDIR. Avoids confusion and makes the path shorter.
* test(report): formatting, drop dumplog()Justin M. Keyes2022-06-15
| | | | | Don't need to dumplog() on each failed test because we now have test-ids that associate log messages with tests.
* feat(logging): include test-id in log messagesJustin M. Keyes2022-06-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: 1. Log messages (especially in CI) are hard to correlate with tests. 2. Since b353a5c05f02 #11886, dumplog() prints the logs next to test failures. This is noisy and gets in the way of the test results. Solution: 1. Associate an incrementing id with each test and include it in log messages. - FUTURE: add v:name so Nvim instances can be formally "named"? 2. Mention "child" in log messages if the current Nvim is a child (based on the presence of $NVIM). BEFORE: DBG … 12345 UI: event DBG … 12345 log_server_msg:722: RPC ->ch 1: … DBG … 12345 UI: flush DBG … 12345 inbuf_poll:444: blocking... events_enabled=1 events_pending=0 DBG … 23454 UI: stop INF … 23454 os_exit:594: Nvim exit: 0 AFTER: DBG … T57 UI: event DBG … T57 log_server_msg:722: RPC ->ch 1: … DBG … T57 UI: flush DBG … T57 inbuf_poll:444: blocking... events_enabled=1 events_pending=0 DBG … T57/child UI: stop INF … T57/child os_exit:594: Nvim exit: 0
* test: correct emmylua annotationsDundar Göc2022-02-20
| | | | This will fix the warnings sumneko language server outputs.
* test: remove checks to see if current CI job is travis or appveyorDundar Göc2022-02-17
|
* ci: only show last 100 lines of log on errorDundar Göc2022-02-03
|
* test(helpers): optimize read_file_listglacambre2021-12-08
| | | | | | | | | | | | | | | | | | | | | | | Read_file_list is used to read back data from the nvim log file as the testsuite executes. However, the nvim log file can get really big (each full run of the testsuite appends roughly 150MB of data to this file). Reading each line of this file can thus be extremely slow, and so are the repeated table.insert/table.removes that are done for each line. A solution to this issue is tto only read the end of the file. This results in a sizeable improvement in testsuite run times in some cases, e.g. on my computer: Without this commit: real 20m0.431s user 17m11.163s sys 1m59.422s With this commit: real 4m25.356s user 1m41.673s sys 1m31.253s
* feat(lua): enable stack traces in error output (#16228)Gregory Anders2021-11-06
|
* refactor(tests): remove redir_exec #15718Justin M. Keyes2021-09-19
| | | | | | | | | | | Problem - `redir_exec` is obsolete, but it keeps getting used in new tests because people copy existing tests. - Disadvantages of `redir_exec`: - Captures extra junk before the actual error/message that we _want_ to test. - Does not fail on error, unlike e.g. `command()`. Solution - Use new functions like `nvim_exec` and `pcall_err`.
* fix(test/dumplog): tostring(rv) before formatting as stringSean Dewar2021-09-16
| | | | | | | | | | For example, implicitly converting a table to a string works in LuaJIT, but needs to be done explicitly with tostring() in Lua 5.1. This can cause issues when testing a non-JIT build if eq(), for example, fails with a table argument. E.g: eq({}, {1}) will not print the details of the assertion failure, but will instead print a less helpful "string expected, got table" error.
* docs: make Lua docstrings consistent #15255Gregory Anders2021-08-22
| | | | | | | | | | | | The official developer documentation in in :h dev-lua-doc specifies to use "--@" for special/magic tokens. However, this format is not consistent with EmmyLua notation (used by some Lua language servers) nor with the C version of the magic docstring tokens which use three comment characters. Further, the code base is currently split between usage of "--@", "---@", and "--- @". In an effort to remain consistent, change all Lua magic tokens to use "---@" and update the developer documentation accordingly.
* fix(test): Detect more core filenamesJames McCoy2021-04-08
|
* test: Add GitHub actions support to helpers.isCIJames McCoy2020-11-22
|
* lua: make vim.inspect available early so it can be used for path debuggingBjörn Linse2020-11-05
|
* test/vim.validate(): assert normalized stacktraceJustin M. Keyes2020-10-05
| | | | | | | - The previous commit lost information in the tests. Instead, add some more "normalization" substitutions in pcall_err(), so that the general shape of the stacktrace is included in the asserted text. - Eliminate contains(), it is redundant with matches()
* vim.validate(): include stacktrace in messageTJ DeVries2020-10-05
|
* lua/check_cores(): check uname instead of TRAVIS_OS_NAMEJustin M. Keyes2020-09-12
|
* fix(bytetrack): send correct events when opening linesThomas Vigouroux2020-09-11
| | | | | | | | | | | | a bit of test cleanup ärrår feeel SPLIT fix: sned correct updates on <CR>
* test/helpers: Run $SYMBOLIZER to decode sanitizer logs, if it is setJames McCoy2020-09-06
|
* lua: move test helper function, map and filter, to vim.shared moduleHirokazu Hata2020-02-18
|
* test: always dump logs on failure #11886Justin M. Keyes2020-02-16
| | | | | Whenever `eq()`, `ok()`, etc. fails, include log tail in the failure message. This helps to correlate log messages with a particular test failure.
* test/LSP: assert contents of log fileJustin M. Keyes2020-02-16
|
* test/LSP: dump logs on errorJustin M. Keyes2020-02-16
| | | | | | This will help debug CI flakey failures. TODO: helpers.assert_log() -- Explicitly check contents of the logfile.
* Lua: vim.env, vim.{g,v,w,bo,wo} #11442Ashkan Kiani2019-11-24
| | | | | | | | - Add vim variable meta accessors: vim.env, vim.{g,v,w,bo,wo} - Redo gen_char_blob to generate multiple blobs instead of just one so that multiple Lua modules can be inlined. - Reorder vim.lua inclusion so that it can use previously defined C functions and utility functions like vim.shared and vim.inspect things. - Inline shared.lua into nvim, but also keep it available in runtime.
* test/pcall_err(): truncate full paths, omit linenrJustin M. Keyes2019-10-26
| | | | ref #11271
* build/doc/CI: remove/update quickbuild references #11258Justin M. Keyes2019-10-19
|
* build: add support for building for FreeBSD under Sourcehut [skip ci]John Szakmeister2019-09-25
|
* test: Eliminate expect_errJustin M. Keyes2019-09-06
| | | | Eliminate `expect_err` in favor of `pcall_err` + `eq` or `matches`.
* test: Rename meth_pcall to pcall_errJustin M. Keyes2019-09-06
| | | | | | | - Rename `meth_pcall`. - Make `pcall_err` raise an error if the function does not fail. - Add `vim.pesc()` to treat a string as literal where a Lua pattern is expected.
* test: is_os() #10933Justin M. Keyes2019-09-04
| | | | | - Move os_name() up to "global helpers". - Rename it to is_os(). - Make it depend on uname() instead of a running Nvim instance.