aboutsummaryrefslogtreecommitdiff
path: root/test/functional/vimscript
Commit message (Collapse)AuthorAge
* fix(powershell): wrong length allocation for ":%w !" #20530Enan Ajmain2023-01-12
| | | | | | | | | | | | | | | | | | | Problem: The calculation of `len` in `make_filter_cmd` for powershell falls short by one character for the following ex command: :%w !sort This command satisfies these conditions: - `itmp` is not null - `otmp` is null __NOTE__ that other shells circumvent this bug only because of `len` allocation for six extra characters: a pair of curly braces and four spaces: https://github.com/neovim/neovim/blob/cfdb4cbada8c65aa57e69776bcc0f7b8b298317a/src/nvim/ex_cmds.c#L1551-L1554 If allocation for these six characters are removed, then bash also faces the same bug. Solution: Add allocation for 6 extra bytes. 1 would do, but let's keep powershell in sync with other shells as much as possible.
* feat(lua): exit 1 on Lua "-l" script errorJustin M. Keyes2023-01-05
|
* 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
|
* feat: ":write ++p" creates parent dirs #20835Victor Blanchard2022-11-06
| | | | | | | | | | | - `:write ++p foo/bar/baz.txt` should create parent directories `foo/bar/` if they do not exist - Note: `:foo ++…` is usually for options. No existing options have a single-char abbreviation (presumably by design), so it's safe to special-case `++p` here. - Same for `writefile(…, 'foo/bar/baz.txt', 'p')` - `BufWriteCmd` can see the ++p flag via `v:cmdarg`. closes #19884
* vim-patch:8.2.1106: crash when trying to use s: variable in typed commandzeertzjq2022-11-05
| | | | | | | | Problem: Crash when trying to use s: variable in typed command. Solution: Don't use the script index when not set. (Ken Takata, closes vim/vim#6366) https://github.com/vim/vim/commit/8e6cbb72324b6fb25d1a9abd6cc4d102d0e5f14e
* vim-patch:8.2.0615: regexp benchmark stest is old style (#20940)zeertzjq2022-11-05
| | | | | | | | | | Problem: Regexp benchmark stest is old style. Solution: Make it a new style test. Fix using a NULL list. Add more tests. (Yegappan Lakshmanan, closes vim/vim#5963) https://github.com/vim/vim/commit/ad48e6c1590842ab6d48e6caba3e9250734dae27 N/A patches: vim-patch:9.0.0829: wrong counts in macro comment
* vim-patch:8.2.2653: build failurezeertzjq2022-10-27
| | | | | | | | | | | Problem: Build failure. Solution: Add missing changes. https://github.com/vim/vim/commit/3a0f092ac0dbdd4ce71f9c4abe020e89f13df36c Omit E1176: only applicable to Vim9 script. Co-authored-by: Bram Moolenaar <Bram@vim.org>
* test: add a test for a crash fixed by patch 8.2.0908zeertzjq2022-10-24
|
* test: add test for :function followed by <lambda>zeertzjq2022-10-04
|
* fix: :! pwsh redirection for `command not found`Enan Ajmain2022-09-30
| | | | | | | | | Problem: If the shell command passed to the filtered bang command isn't found, the error isn't redirected to the temp.out file when shell is set to powershell. Solution: Use anonymous function with Invoke-Command operator (&).
* fix: make_filter_cmd for :! powershellEnan Ajmain2022-09-30
| | | | | | | | | | | | | | | Problem: `Start-Process` requires the command to be split into the shell command and its arguments. Previously it was done by parsing, which didn't handle cases such as - commands with escaped space in their filepath - quoted commands with space in their filepath Solution: Use - `pwsh -Command` instead of `Start-Process` - `Get-Content` instead of `-RedirectStandardInput` - `Out-File` instead of `-RedirectStandardOutput`
* docs: fix typos (#20394)dundargoc2022-09-30
| | | | | Co-authored-by: Raphael <glephunter@gmail.com> Co-authored-by: smjonas <jonas.strittmatter@gmx.de> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* docs: fix typos (#20150)dundargoc2022-09-26
| | | | | | | Co-authored-by: Miguel Carneiro <mcarneiromorenas@gmail.com> Co-authored-by: Gregory Anders <greg@gpanders.com> Co-authored-by: Raphael <glephunter@gmail.com> Co-authored-by: C.D. MacEachern <craig.daniel.maceachern@gmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* fix(mapset): remove existing abbreviation of same lhs (#20320)zeertzjq2022-09-24
|
* feat(ui): use msg_grid based implementation for cmdheight=0bfredl2022-09-15
|
* vim-patch:8.2.2646: Vim9: error for not using string doesn't mention argumentzeertzjq2022-09-12
| | | | | | Problem: Vim9: error for not using string doesn't mention argument. Solution: Add argument number. https://github.com/vim/vim/commit/f28f2ac425600b88da0bdcc12a82cd620f575681
* feat(mapset): support restoring Lua callback (#20024)zeertzjq2022-09-01
| | | | | | | vim-patch:9.0.0341: mapset() does not restore <Nop> mapping properly Problem: mapset() does not restore <Nop> mapping properly. Solution: Use an empty string for <Nop>. (closes vim/vim#11022) https://github.com/vim/vim/commit/92a3d20682d46359bb50a452b4f831659e799155
* 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.
* vim-patch:8.2.0522: several errors are not tested for (#19901)zeertzjq2022-08-23
| | | | | | | | | | | | | | Problem: Several errors are not tested for. Solution: Add tests. (Yegappan Lakshmanan, closes vim/vim#5892) https://github.com/vim/vim/commit/ee4e0c1e9a81cb5d96e0060203a9033c2f28588e Omit Test_range() change: reverted in patch 8.2.0615. Cherry-pick Test_z_no_space_before_xxx() from patch 8.2.0195. Cherry-pick Test_reverse_sort_uniq() change from patch 8.2.0183. Make uniq() error behavior consistent with sort(). Cherry-pick Test_set_ttytype() change from patch 8.1.1826. Cherry-pick quickfix checks from patch 8.1.2373 to test_preview.vim. Test_viminfo_error() is applicable. Cherry-pick E1058 from patch 8.2.0149 and port Test_deep_nest() to Lua.
* vim-patch:8.1.0832: confirm() is not tested (#19896)zeertzjq2022-08-23
| | | | | Problem: confirm() is not tested. Solution: Add a test. (Dominique Pelle, closes vim/vim#3868) https://github.com/vim/vim/commit/2e0500921891e4fec57e97d3c0021aa2d2b4d7ae
* vim-patch:partial:8.1.0822: peeking and flushing output slows down executionzeertzjq2022-08-15
| | | | | | | | | | | | | | | | | Problem: Peeking and flushing output slows down execution. Solution: Do not update the mode message when global_busy is set. Do not flush when only peeking for a character. (Ken Takata) https://github.com/vim/vim/commit/cb574f415486adff645ce384979bfecf27f5be8c Omit inchar() change: it breaks too many tests. N/A patches for version.c: vim-patch:8.2.5170: tiny issues Problem: Tiny issues. Solution: Tiny improvements. https://github.com/vim/vim/commit/944cc9ceba8868acd238264d4a3894803c566b37
* vim-patch:7.4.1168 (#19645)zeertzjq2022-08-13
| | | | | | Problem: This doesn't give the right result: eval(string(v:true)). (Nikolay Pavlov) Solution: Make the string "v:true" instead of "true". https://github.com/vim/vim/commit/f48aa160fdd7b8caa7678e1a2139244dd2bdc547
* test(let_spec): increase expect_exit() timeoutzeertzjq2022-08-05
| | | Test ":unlet self-referencing node in a List graph #6070" feeds many characters into typeahead, so a timeout of only 100 milliseconds sometimes fails. Change that timeout to 1000 milliseconds.
* feat(mapset): support restoring "replace_keycodes" and "desc"zeertzjq2022-08-01
|
* vim-patch:8.2.0815: maparg() does not provide enough information for mapset()zeertzjq2022-08-01
| | | | | | | | | | | | Problem: maparg() does not provide enough information for mapset(). Solution: Add "lhsraw" and "lhsrawalt" items. Drop "simplified" https://github.com/vim/vim/commit/9c65253fe702ea010afec11aa971acd542c35de2 vim-patch:9.0.0127: unused variable Problem: Unused variable. Solution: Remove the variable. (closes vim/vim#10829) https://github.com/vim/vim/commit/e95f22f63a1871b91e5508088e5ae4905ce28cd7
* vim-patch:9.0.0090: no error when assigning bool to a string option (#19539)zeertzjq2022-07-27
| | | | | Problem: No error when assigning bool to a string option with setwinvar(). Solution: Give an error (closes vim/vim#10766) https://github.com/vim/vim/commit/28f84e17b068daca2635692d279930dcb7a150d0
* test: deal with RPC call causing Nvim to exit laterzeertzjq2022-07-19
|
* fix(powershell): filter ":!" commands with args #19268Enan Ajmain2022-07-18
| | | | | | | | | | Problem: Since 0b9664f5240be4d9e9d6882fcd398970fd3a9532 powershell filtered :[range]! commands with args causes error: "Start-Process: A positional parameter cannot be found that accepts argument ..." Solution: Pass args to Start-Process via `-ArgumentList`. closes #19250
* fix(windows):exepath, stdpath return wrong slashes #19111Enan Ajmain2022-07-17
| | | | | | exepath and stdpath should respect shellslash and return path with proper file separator. Closes #13787
* fix(ex_cmds): correct flags for :const (#19387)zeertzjq2022-07-16
|
* feat(eval)!: input() support any type for "cancelreturn" in a dict (#19357)zeertzjq2022-07-14
|
* vim-patch:8.2.0614: get ml_get error when deleting a line in 'completefunc' ↵zeertzjq2022-07-07
| | | | | | | | | | | | | (#19244) Problem: Get ml_get error when deleting a line in 'completefunc'. (Yegappan Lakshmanan) Solution: Lock the text while evaluating 'completefunc'. https://github.com/vim/vim/commit/ff06f283e3e4b3ec43012dd3b83f8454c98f6639 Fix a mistake in the porting of patch 8.1.0098. Cherry-pick Test_run_excmd_with_text_locked() from patch 8.2.0270. Cherry-pick test_gf.vim changes from patch 8.2.0369. Cherry-pick message change from later patches.
* 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
* test: use "python3" to avoid skipped test #19106Justin M. Keyes2022-06-26
| | | | | | | | Problem: The "calls executable in $PATH" is skipped on some CI jobs because "python" is not found. Solution: Use "python3" instead.
* refactor(tests): introduce testprg()Justin M. Keyes2022-06-25
| | | | | | Also: - Add a describe('shell :!') section to system_spec. - Make the test for #16271 work on systems without powershell.
* fix: make_filter_cmd for :! powershell #15913Enan Ajmain2022-06-25
| | | | | | | | | | | | | Problem: Nvim fails to create tempfile "…/nvim6UJx04/7" when 'shell' is set to pwsh (PowerShell Core). This breaks filtered shell commands ":{range}!". With shell set to cmd, it works. Solution: PowerShell doesn't use "<" for stdin redirection. Instead, use "-RedirectStandardInput". Closes #15913
* fix(float): make `screen*()` functions respect floating windowsEvgeni Chasnovski2022-06-23
| | | | Resolves #19013.
* feat(server): instance "name", store pipes in stdpath(state)Justin M. Keyes2022-06-15
| | | | | | | | | | | | | | | | | | Problem: - Unix sockets are created in random /tmp dirs. - /tmp is messy, unclear when OSes actually clear it. - The generated paths are very ugly. This adds friction to reasoning about which paths belong to which Nvim instances. - No way to provide a human-friendly way to identify Nvim instances in logs or server addresses. Solution: - Store unix sockets in stdpath('state') - Allow --listen "name" and serverstart("name") to given a name (which is appended to a generated path). TODO: - is stdpath(state) the right place?
* 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
* fix(tests): fix some screen.lua warningsbfredl2022-05-21
|
* feat(server): set $NVIM, unset $NVIM_LISTEN_ADDRESS #11009Justin M. Keyes2022-05-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PROBLEM ------------------------------------------------------------------------ $NVIM_LISTEN_ADDRESS has conflicting purposes as both a parameter ("the current process should listen on this address") and a descriptor ("the current process is a child of this address"). This contradiction means the presence of NVIM_LISTEN_ADDRESS is ambiguous, so child Nvim always tries to listen on its _parent's_ socket. This is the cause of lots of "Failed to start server" spam in our test/CI logs: WARN 2022-04-30… server_start:154: Failed to start server: address already in use: \\.\pipe\nvim-4480-0 WARN 2022-04-30… server_start:154: Failed to start server: address already in use: \\.\pipe\nvim-2168-0 SOLUTION ------------------------------------------------------------------------ 1. Set $NVIM to the parent v:servername, *only* in child processes. - Now the correct way to detect a "parent" Nvim is to check for $NVIM. 2. Do NOT set $NVIM_LISTEN_ADDRESS in child processes. 3. On startup if $NVIM_LISTEN_ADDRESS exists, unset it immediately after server init. 4. Open a channel to parent automatically, expose it as v:parent. Fixes #3118 Fixes #6764 Fixes #9336 Ref https://github.com/neovim/neovim/pull/8247#issuecomment-380275696 Ref #8696
* fix(input): only disable mapped CTRL-C interrupts when getting input (#18310)zeertzjq2022-04-30
|
* fix: has() should preserve v:shell_error #18280Andrey Mishchenko2022-04-26
| | | fixes #18278
* test: correct order of arguments to eq() and neq()zeertzjq2022-04-26
|
* fix(ci): workaround bug in msgpackparse() on windows caused by api level bumpbfredl2022-04-25
|
* docs: typo fixes (#17859)dundargoc2022-04-15
| | | | | | | | | | Co-authored-by: Elias Alves Moura <eliamoura.alves@gmail.com> Co-authored-by: venkatesh <shariharanvenkatesh@gmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Vikas Raj <24727447+numToStr@users.noreply.github.com> Co-authored-by: Steve Vermeulen <sfvermeulen@gmail.com> Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com> Co-authored-by: rwxd <rwxd@pm.me> Co-authored-by: casswedson <58050969+casswedson@users.noreply.github.com>
* fix(event-loop): duplicate display updating logic in vgetorpeek() (#17913)zeertzjq2022-03-30
|
* feat(test): use nvim_exec in helpers.source() #16064Justin M. Keyes2022-03-27
| | | | | | | | helpers.source() was a hack to work around the lack of anonymous :source. Its "create tempfile" behavior is not a required part of most tests that use it. Some tests still need the old "create tempfile" behavior either because they test SID behavior, or because of missing nvim_exec features: #16071
* fix(event-loop): call vpeekc() directly first to check for characterzeertzjq2022-02-03
| | | | Expand mappings first by calling `vpeekc()` directly.