Commit Graph

76 Commits

Author SHA1 Message Date
zeertzjq
3a1e17e3a1 test: add tests for executing commands with backwards range 2023-05-05 19:07:56 +08:00
zeertzjq
bdaaf2e8e1 vim-patch:9.0.0250: slightly inconsistent error messages
Problem:    Slightly inconsistent error messages.
Solution:   Make it "Using a Float". (closes vim/vim#10959)

dde77a7c4d

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-05-05 09:20:30 +08:00
zeertzjq
88cfb49bee vim-patch:8.2.4890: inconsistent capitalization in error messages
Problem:    Inconsistent capitalization in error messages.
Solution:   Make capitalization consistent. (Doug Kearns)

cf030578b2

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-05-05 09:20:30 +08:00
zeertzjq
75119fcc86 vim-patch:8.2.3135: Vim9: builtin function arguments not checked at compile time
Problem:    Vim9: builtin function arguments not checked at compile time.
Solution:   Add more type checks. (Yegappan Lakshmanan, closes vim/vim#8539)

5b73992d8f

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-05-05 09:19:05 +08:00
zeertzjq
d321deb4a9
test: fix dependencies between test cases (#23343)
Discovered using --shuffle argument of busted.
2023-04-27 15:51:44 +08:00
zeertzjq
ac9f8669a8
vim-patch:9.0.0875: using freed memory when executing delfunc at more prompt (#23314)
Problem:    Using freed memory when executing delfunc at the more prompt.
Solution:   Check function list not changed in another place. (closes vim/vim#11437)

398a26f7fc

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-25 23:19:00 +08:00
zeertzjq
1355861b92
fix(typval): don't treat v:null as truthy (#23281) 2023-04-23 17:44:08 +08:00
kylo252
aab95ec67e
test: avoid name collisions with Xtest directory (#23019) 2023-04-11 17:18:54 +08:00
zeertzjq
0e4086b741
fix(eval): prevent double-free in garbage collection (#22990) 2023-04-10 18:06:59 +08:00
dundargoc
743860de40
test: replace lfs with luv and vim.fs
test: replace lfs with luv

luv already pretty much does everything lfs does, so this duplication
of dependencies isn't needed.
2023-04-04 21:59:06 +02:00
Enan Ajmain
ecc4d0e435
fix(shell): on Windows :make does not echo #22728
Problem:
On Windows, :make does not display the output of the program it runs.
The cause is the default 'shellpipe'.  On Linux, nvim uses `tee` to redirect the
output to both stdout and the error file.  In Windows, for both cmd.exe and
powershell, the output is only redirected to the error file.

Solution:
- On Windows, change the 'shellpipe' default to "2>&1| tee".
    - Nvim includes `tee` in its Windows package.
- Document recommended defaults for powershell.

Fixes #12910
2023-03-19 14:25:12 -07:00
Justin M. Keyes
ce597235a2 feat(ui): restore has('gui_running')
Problem:
has('gui_running') is still common in the wild and our answer has
changed over time, causing frustration.
95a6ccbe9f

Solution:
Use stdin_tty/stdout_tty to decide if a UI is (not) a GUI.
2023-02-27 19:50:59 +01:00
zeertzjq
05faa8f30a
test: make expect_unchanged() less confusing (#22255)
Problem:
The sleep before collecting the initial screen state is confusing and
may lead to unexpected success if it comes after a blocking RPC call.

Solution:
Remove that sleep and add an "intermediate" argument.
2023-02-15 07:26:55 +08:00
Anton Kriese
3544082f46
test: exepath() returns correct path with cmd.exe, powershell #21928
test(exepath): test if exepath returns correct path with multiple
Windows shells

This test covers the changes from #21175 where exepath() is set to
prefer file extensions in powershell.exe aswell as in cmd.exe.

In both shells, the file with a valid extension should be returned
instead of the extensionless file.
2023-01-26 03:06:29 -08:00
zeertzjq
3b75485043
revert: "shada/context: fully remove jumplist duplicates #10898" (#21874)
This reverts commit 8b8ecf44f2.
It is causing performance problems on exit.
Fix #21082.
2023-01-23 19:32:27 +08:00
Justin M. Keyes
665a7dafaf refactor(tests): lift retry() into assert_log() 2023-01-17 00:19:30 +01:00
Justin M. Keyes
6ec7bcb618 test: avoid noise in NVIM_LOG_FILE
Problem:
Tests that _intentionally_ fail certain conditions cause noise in
$NVIM_LOG_FILE:

    $NVIM_LOG_FILE: /home/runner/work/neovim/neovim/build/.nvimlog
    (last 100 lines)
    WRN 2023-01-16T18:26:27.673 T599.7799.0 unsubscribe:519: RPC: ch 1: tried to unsubscribe unknown event 'doesnotexist'
    WRN 2023-01-16T18:29:00.557 ?.11151    server_start:163: Failed to start server: no such file or directory: /X/X/X/...
    WRN 2023-01-16T18:33:07.269 127.0.0.1:12345 server_start:163: Failed to start server: address already in use: 127.0.0.1
    ...
    -- Output to stderr:
    module 'vim.shared' not found:
    	no field package.preload['vim.shared']
    	no file './vim/shared.lua'
    	no file '/home/runner/nvim-deps/usr/share/lua/5.1/vim/shared.lua'
    	no file '/home/runner/nvim-deps/usr/share/lua/5.1/vim/shared/init.lua'
    	no file '/home/runner/nvim-deps/usr/lib/lua/5.1/vim/shared.lua'
    	no file '/home/runner/nvim-deps/usr/lib/lua/5.1/vim/shared/init.lua'
    	no file './vim/shared.so'
    	...
    E970: Failed to initialize builtin lua modules

Solution:
- Log to a private $NVIM_LOG_FILE in tests that intentionally fail and
  cause ERR log messages.
- Assert that the expected messages are actually logged.
2023-01-16 23:56:56 +01:00
zeertzjq
61d5bd561a refactor: remove E5500, adjust tests
Now with try_end() including more exception info, E5500 looks like
redundant information.
Adjust tests for more exception information.
2023-01-16 18:03:08 +08:00
Enan Ajmain
2f1fd15554
fix(powershell): wrong length allocation for ":%w !" #20530
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:
  cfdb4cbada/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.
2023-01-12 09:25:29 -08:00
Justin M. Keyes
adef308a59 feat(lua): exit 1 on Lua "-l" script error 2023-01-05 17:10:02 +01:00
dundargoc
5eb5f49488
test: simplify platform detection (#21020)
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-22 08:13:30 +08:00
Lewis Russell
e8cc489acc
feat(test): add Lua forms for API methods (#20152) 2022-11-14 10:01:35 +00:00
Victor Blanchard
d337814906
feat: ":write ++p" creates parent dirs #20835
- `: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
2022-11-06 19:31:50 -08:00
zeertzjq
01ccfb40e3 vim-patch:8.2.1106: crash when trying to use s: variable in typed command
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)

8e6cbb7232
2022-11-05 21:38:36 +08:00
zeertzjq
a86295cd5c
vim-patch:8.2.0615: regexp benchmark stest is old style (#20940)
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)

ad48e6c159

N/A patches:
vim-patch:9.0.0829: wrong counts in macro comment
2022-11-05 12:26:17 +08:00
zeertzjq
25cf4f2fc7 vim-patch:8.2.2653: build failure
Problem:    Build failure.
Solution:   Add missing changes.

3a0f092ac0

Omit E1176: only applicable to Vim9 script.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2022-10-27 13:07:51 +08:00
zeertzjq
0ed1429fcb test: add a test for a crash fixed by patch 8.2.0908 2022-10-24 16:29:28 +08:00
zeertzjq
71497c164d test: add test for :function followed by <lambda> 2022-10-04 07:31:48 +08:00
Enan Ajmain
f2482b3b53 fix: :! pwsh redirection for command not found
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 (&).
2022-09-30 21:08:45 +06:00
Enan Ajmain
b4d42bb905 fix: make_filter_cmd for :! powershell
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`
2022-09-30 21:07:45 +06:00
dundargoc
df646572c5
docs: fix typos (#20394)
Co-authored-by: Raphael <glephunter@gmail.com>
Co-authored-by: smjonas <jonas.strittmatter@gmx.de>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2022-09-30 09:53:52 +02:00
dundargoc
c815aadfcc
docs: fix typos (#20150)
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>
2022-09-26 17:43:23 +08:00
zeertzjq
291a649632
fix(mapset): remove existing abbreviation of same lhs (#20320) 2022-09-24 21:07:18 +08:00
bfredl
708bd68651 feat(ui): use msg_grid based implementation for cmdheight=0 2022-09-15 12:13:43 +02:00
zeertzjq
38059b4f31 vim-patch:8.2.2646: Vim9: error for not using string doesn't mention argument
Problem:    Vim9: error for not using string doesn't mention argument.
Solution:   Add argument number.
f28f2ac425
2022-09-12 14:56:42 +08:00
zeertzjq
0c6b39894f
feat(mapset): support restoring Lua callback (#20024)
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)
92a3d20682
2022-09-01 06:19:49 +08:00
Sean Dewar
813476bf72
fix(exceptions): restore did_throw (#20000)
`!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-08-30 23:13:52 +01:00
zeertzjq
d5328ea408
vim-patch:8.2.0522: several errors are not tested for (#19901)
Problem:    Several errors are not tested for.
Solution:   Add tests. (Yegappan Lakshmanan, closes vim/vim#5892)
ee4e0c1e9a

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.
2022-08-23 10:38:53 +08:00
zeertzjq
2fd25fb909
vim-patch:8.1.0832: confirm() is not tested (#19896)
Problem:    confirm() is not tested.
Solution:   Add a test. (Dominique Pelle, closes vim/vim#3868)
2e05009218
2022-08-23 07:20:23 +08:00
zeertzjq
95b8e2c55f vim-patch:partial:8.1.0822: peeking and flushing output slows down execution
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)
cb574f4154

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.
944cc9ceba
2022-08-15 17:58:35 +08:00
zeertzjq
02a4974418
vim-patch:7.4.1168 (#19645)
Problem:    This doesn't give the right result: eval(string(v:true)). (Nikolay
            Pavlov)
Solution:   Make the string "v:true" instead of "true".
f48aa160fd
2022-08-13 21:31:00 +08:00
zeertzjq
a78606ec53
test(let_spec): increase expect_exit() timeout
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.
2022-08-05 08:32:54 +08:00
zeertzjq
d954e8da62 feat(mapset): support restoring "replace_keycodes" and "desc" 2022-08-01 21:54:18 +08:00
zeertzjq
6963c2bdcd vim-patch:8.2.0815: maparg() does not provide enough information for mapset()
Problem:    maparg() does not provide enough information for mapset().
Solution:   Add "lhsraw" and "lhsrawalt" items.  Drop "simplified"
9c65253fe7

vim-patch:9.0.0127: unused variable

Problem:    Unused variable.
Solution:   Remove the variable. (closes vim/vim#10829)
e95f22f63a
2022-08-01 21:54:18 +08:00
zeertzjq
f57432af4d
vim-patch:9.0.0090: no error when assigning bool to a string option (#19539)
Problem:    No error when assigning bool to a string option with setwinvar().
Solution:   Give an error (closes vim/vim#10766)
28f84e17b0
2022-07-27 20:59:43 +08:00
zeertzjq
72dfd57e5f test: deal with RPC call causing Nvim to exit later 2022-07-19 19:41:07 +08:00
Enan Ajmain
3340728c72
fix(powershell): filter ":!" commands with args #19268
Problem:
Since 0b9664f524 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
2022-07-18 13:26:09 -07:00
Enan Ajmain
1b462705d0
fix(windows):exepath, stdpath return wrong slashes #19111
exepath and stdpath should respect shellslash and return path with
proper file separator.
Closes #13787
2022-07-17 17:00:08 -07:00
zeertzjq
711a6a9157
fix(ex_cmds): correct flags for :const (#19387) 2022-07-16 14:54:31 +08:00
zeertzjq
b93cb481a2
feat(eval)!: input() support any type for "cancelreturn" in a dict (#19357) 2022-07-14 14:47:25 +08:00