neovim/test/functional
Rob Pilling 5f60861f5a fnamemodify: fix handling of :r after :e #11165
- Test fnamemodify()
- Test handling of `expand("%:e:e:r")`.
- Fix :e:e:r on filenames with insufficiently many extensions

During `fnamemodify()`, ensuring that we don't go before the filename's
tail is insufficient in cases where we've already handled a ":e"
modifier, for example:

```
"path/to/this.file.ext" :e:e:r:r
         ^    ^-------- *fnamep
         +------------- tail
```

This means for a ":r", we'll go before `*fnamep`, and outside the bounds
of the filename. This is both incorrect and causes neovim to exit with
an allocation error.

We exit because we attempt to calculate `s - *fnamep` (line 23948).
Since `s` is before `*fnamep`, we caluclate a negative length, which
ends up being interpreted as an amount to allocate, causing neovim to
exit with ENOMEM (`memory.c:xmalloc`).

We must instead ensure we don't go before `*fnamep` nor `tail`.
The check for `tail` is still relevant, for example:

```
"path/to/this.file.ext" :r:r:r
 ^       ^------------- tail
 +--------------------- *fnamep
```
Here we don't want to go before `tail`.

close #11165
2019-10-10 22:33:42 -07:00
..
api server_requests_spec: fix assertion, pass Lua paths via args (#10875) 2019-09-16 19:16:39 +02:00
autocmd autocmds: TermEnter, TermLeave #8550 2019-09-14 15:54:19 -07:00
cmdline cmdline: CTRL-R: Omit trailing <CR>. 2017-02-18 23:24:35 +01:00
core test: fix failure on Windows (allow ".exe") 2019-09-13 16:31:21 -07:00
eval fnamemodify: fix handling of :r after :e #11165 2019-10-10 22:33:42 -07:00
ex_cmds getdigits: introduce strict, def parameters 2019-09-13 19:29:25 -07:00
fixtures fix api_level_6.mpack 2019-09-15 17:28:42 -07:00
insert normal: Don't exit CTRL-O mode after processing K_EVENT 2019-06-04 13:59:43 +02:00
legacy vim-patch:8.1.0460: assert_fails() message argument #11051 2019-09-21 14:03:46 -07:00
lua tree-sitter: improve and cleanup tests 2019-09-28 17:46:25 +02:00
normal test: Eliminate expect_err 2019-09-06 17:19:07 -07:00
options findoption_len: treat viminfo/viminfofile as aliases 2019-08-26 09:39:00 +02:00
plugin test/shada_spec: avoid exit_event race #10951 2019-09-05 09:48:34 -07:00
provider provider: has("python3_dynamic") et al. #10980 2019-09-09 10:54:07 -07:00
shada shada: initialize jumplist before search pattern (#10964) 2019-09-07 18:02:29 -07:00
terminal tests: tui_spec: improve/merge OptionSet/deferred 2019-10-04 08:39:16 +02:00
ui test: "!:&" works with powershell #11201 2019-10-10 21:30:20 -07:00
viml tests: adjust to latest Vim patches 2019-05-05 14:05:25 +02:00
example_spec.lua vim-patch:8.1.{0849,1001}: 'cursorline' highlight #9757 2019-03-19 12:24:41 +01:00
helpers.lua test: "!:&" works with powershell #11201 2019-10-10 21:30:20 -07:00
preload.lua test/functional/preload.lua: _set_fmode for Windows 2019-09-25 05:47:15 +02:00