Commit Graph

100 Commits

Author SHA1 Message Date
Sean Dewar
c366c944c2
vim-patch:8.1.2136: using freed memory with autocmd from fuzzer
Problem:    using freed memory with autocmd from fuzzer. (Dhiraj Mishra,
            Dominique Pelle)
Solution:   Avoid using "wp" after autocommands. (closes vim/vim#5041)
ec66c41d84

Nvim doesn't use Vim's terminal implementation.
Despite this, Nvim has its own *exclusive* way of crashing here.

Requires 'winwidth' > winwidth() and 'nowinfixwidth' to crash; adjust
the test ('nowfw' is the default, but ensure its disabled anyway).
2021-11-24 03:55:02 +00:00
zeertzjq
dba3590a0e
vim-patch:8.2.3591: no event is triggered when closing a window (#16306)
Problem:    No event is triggered when closing a window.
Solution:   Add the WinClosed event. (Naohiro Ono, closes vim/vim#9110)
23beefed73

Nvim has already implemented this feature, so this only changes tests
and docs.
2021-11-17 21:11:09 -05:00
zeertzjq
8a2489d0a4 test: partially port Vim patches 8.1.2278 and 8.2.1432 2021-10-17 22:04:53 +08:00
zeertzjq
e91dee5c21 vim-patch:8.1.0602: DirChanged is also triggered when directory didn't change
Problem:    DirChanged is also triggered when the directory didn't change.
            (Daniel Hahler)
Solution:   Compare the current with the new directory. (closes vim/vim#3697)
2caad3fbbd
2021-10-17 22:04:53 +08:00
zeertzjq
eed89d5e0c vim-patch:8.0.1463: test fails without 'autochdir' option
Problem:    Test fails without 'autochdir' option.
Solution:   Skip test if 'autochdir' is not supported.
ec48a9c589
2021-10-17 22:04:53 +08:00
zeertzjq
920473d2f2 vim-patch:8.0.1459: cannot handle change of directory
Problem:    Cannot handle change of directory.
Solution:   Add the DirChanged autocommand event. (Andy Massimino,
            closes vim/vim#888)  Avoid changing directory for 'autochdir' too often.
b7407d3fc9

Only add "auto" pattern. "window" and "global" are already implemented.
Skip `Test_dirchanged_auto` using `CheckFunction test_autochdir`.
Part of PR #15952. More information can be found there.

N/A patches for version.c:

vim-patch:8.0.1460: missing file in patch

Problem:    Missing file in patch.
Solution:   Add changes to missing file.
b5cb65ba2b

vim-patch:8.0.1461: missing another file in patch

Problem:    Missing another file in patch.
Solution:   Add changes to missing file.
15833239a4
2021-10-17 22:04:53 +08:00
Gregory Anders
d8ab8cccd0 test: update tests to work with 'hidden' 2021-08-18 12:17:12 -06:00
Matthieu Coudron
5a111c1b02
feat(defaults): map Y to y$ #13268
rationale:
- consistent with D and Y
- long recommended by Vim's own ":help Y"

close #13268
close #416
ref #6289
2021-08-15 21:24:59 -07:00
Jan Edmund Lazo
cd4b649136
vim-patch:8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Problem:    BufUnload is not triggered for the quickfix dummy buffer.
Solution:   Do trigger BufUnload. (Pontus Leitzler,closes vim/vim#7518, closes vim/vim#7517)
            Fix white space around "=".
1cfb9bb5c0
2021-06-23 23:16:20 -04:00
Jan Edmund Lazo
c9195a1273
vim-patch:8.2.2473: crash when leaving command line window triggers autocommand
Problem:    Crash when leaving command line window triggers autocommand.
            (houyunsong)
Solution:   Make sure not to close the current window or buffer.
8c6951fa28

N/A patches for version.c:

vim-patch:8.2.2414: using freed memory when closing the cmdline window

Problem:    Using freed memory when closing the cmdline window.
Solution:   Check the window is still valid.
b7e2670b6a
2021-05-13 20:47:26 -04:00
Jan Edmund Lazo
3f9fa730ce
vim-patch:8.2.2419: autocmd test was failing on MS-Windows with GUI
Problem:    Autocmd test was failing on MS-Windows with GUI.
Solution:   Remove stray feedkeys().
d697ddea14
2021-05-13 20:47:26 -04:00
Jan Edmund Lazo
1ca89a60d8
vim-patch:8.2.2359: strange test failure with MS-Windows
Problem:    Strange test failure with MS-Windows.
Solution:   Skip the system() call for now.
e2924328c1
2021-05-13 20:47:26 -04:00
Jan Edmund Lazo
f98433d82a
vim-patch:8.2.2354: crash with a weird combination of autocommands
Problem:    Crash with a weird combination of autocommands.
Solution:   Increment b_nwindows when needed. (closes vim/vim#7674)
797e63b9f2
2021-05-13 20:47:26 -04:00
Jan Edmund Lazo
f54a938271
vim-patch:8.2.1059: crash when using :tabonly in an autocommand
Problem:    Crash when using :tabonly in an autocommand. (Yegappan Lakshmanan)
Solution:   Do not allow the autocommand window to be closed.
cf8441704d

E813 error message does not mention 'popup' window
because Neovim floating window are regular windows, unlike Vim popups.

https://github.com/neovim/neovim/pull/14532#discussion_r631731829
2021-05-13 20:46:00 -04:00
Jan Edmund Lazo
94b10d25da
vim-patch:8.2.2046: some test failures don't give a clear error
Problem:    Some test failures don't give a clear error.
Solution:   Use assert_match() and assert_fails() instead of assert_true().
            (Ken Takata, closes vim/vim#7368)
5dc4e2f883
2021-04-15 18:06:35 -04:00
Jan Edmund Lazo
ecd2729658
test/old: use CheckFunction, enable more tests
Some skipped tests have custom error messages.
Use ":CheckFunction" command for standard error message
on missing function.
2021-03-27 01:12:44 -04:00
Jan Edmund Lazo
b951d1ff1d
vim-patch:8.2.0402: setting local instead of global flag
Problem:    Setting local instead of global flag.
Solution:   Prepend "g:" to "test_is_flaky".
30d53e2c11
2021-03-23 22:42:52 -04:00
Jan Edmund Lazo
f6585cae50
vim-patch:8.2.0400: not all tests using a terminal are in the list of flaky tests
Problem:    Not all tests using a terminal are in the list of flaky tests.
Solution:   Introduce the test_is_flaky flag.
3cdcb090a6

Cherry-pick g:test_is_flaky from patch v8.2.0557.
Ensure that test_is_flaky variable is set from the global scope..

N/A patches for version.c:

vim-patch:8.2.2647: terminal test sometimes hangs

Problem:    Terminal test sometimes hangs.
Solution:   Wait for the shell to display a prompt.
f4a2ed0714

vim-patch:8.2.2648: terminal resize test sometimes hangs

Problem:    Terminal resize test sometimes hangs.
Solution:   Wait for the shell to display a prompt and other output.
c54f347d63

fixup! vim-patch:8.2.0400: not all tests using a terminal are in the list of flaky tests
2021-03-23 22:41:22 -04:00
Jan Edmund Lazo
519848f64e
vim-patch:8.2.2596: :doautocmd may confuse scripts listening to WinEnter
Problem:    :doautocmd may confuse scripts listening to WinEnter.
Solution:   Do the current buffer last. (closes vim/vim#7958)
41cd80335c
2021-03-14 11:54:36 -04:00
Jan Edmund Lazo
da3f9778af
vim-patch:8.2.2464: using freed memory if window closed in autocommand
Problem:    Using freed memory if window closed in autocommand. (houyunsong)
Solution:   Check the window still exists.
8ab375706e
2021-02-03 18:46:53 -05:00
Jan Edmund Lazo
c77b679ecd
vim-patch:8.2.2420: too many problems with using all autocommand events
Problem:    Too many problems with using all autocommand events.
Solution:   Disallow defining an autocommand for all events.
9a046fd08b

Delete Test_wipe_cbuffer().
Commit dc5f4a3cc2 should have removed it.
2021-01-28 23:43:15 -05:00
Jan Edmund Lazo
562877c135
vim-patch:8.2.2355: stray test failure on Appveyor
Problem:    Stray test failure on Appveyor.
Solution:   Finish insert command.
97c6943e11
2021-01-17 12:42:27 -05:00
Jan Edmund Lazo
b3ddc23507
test/old: partial port of patch 8.1.0711
Patch 8.1.0711 is too difficult to merge in 1 commit.
2020-11-30 01:18:33 -05:00
Jan Edmund Lazo
8d7fa8962b
vim-patch:8.2.0996: using "aucmdwin" in win_gettype() is not ideal
Problem:    Using "aucmdwin" in win_gettype() is not ideal.
Solution:   Rename to "autocmd".
40a019f157
2020-11-25 02:46:20 -05:00
Jan Edmund Lazo
9b2efe6b7d
vim-patch:8.2.0991: cannot get window type for autocmd and preview window
Problem:    Cannot get window type for autocmd and preview window.
Solution:   Add types to win_gettype(). (Yegappan Lakshmanan, closes vim/vim#6277)
0fe937fd86

Cherry-pick test_preview.vim,test_window_cmd.vim changes
from patch v8.2.0522.
2020-11-25 02:45:00 -05:00
Jan Edmund Lazo
b0d3f47e90
vim-patch:8.2.0303: TermChanged test fails in the GUI
Problem:    TermChanged test fails in the GUI.
Solution:   Skip the test when running the GUI.
d28e0b3652
2020-11-24 22:52:06 -05:00
Jan Edmund Lazo
eae90b37c3
vim-patch:8.2.0302: setting 'term' may cause error in TermChanged autocommand
Problem:    Setting 'term' may cause error in TermChanged autocommand.
Solution:   Use aucmd_prepbuf() to switch to the buffer where the autocommand
            is to be executed. (closes vim/vim#5682)
0c81d1b112
2020-11-24 22:29:41 -05:00
Jan Edmund Lazo
3a573a9e2f
vim-patch:8.1.2290: autocommand test fails
Problem:    Autocommand test fails.
Solution:   Remove 'closeoff' from 'diffopt'.
a9aa86ff95
2020-11-24 22:17:52 -05:00
Jan Edmund Lazo
d69a8a3fc4
vim-patch:8.2.0952: no simple way to interrupt Vim
Problem:    No simple way to interrupt Vim.
Solution:   Add the SigUSR1 autocommand, triggered by SIGUSR1. (Jacob Hayes,
            closes vim/vim#1718)
be5ee8686a
2020-10-22 18:24:08 -04:00
Jan Edmund Lazo
ba16475549
vim-patch:8.1.2108: cannot close the cmdline window from CmdWinEnter
Problem:    Cannot close the cmdline window from CmdWinEnter. (George Brown)
Solution:   Reset cmdwin_result earlier. (Christian Brabandt, closes vim/vim#4980)
23324a0b35
2020-09-15 23:00:35 -04:00
Jan Edmund Lazo
9b361e9ea1
vim-patch:8.2.1369: MS-Windows: autocommand test sometimes fails
Problem:    MS-Windows: autocommand test sometimes fails.
Solution:   Do not rely on the cat command.
14ddd226da
2020-08-14 18:20:28 -04:00
Jan Edmund Lazo
e681a317fe
vim-patch:8.2.0964: TextYankPost does not provide info about Visual selection
Problem:    TextYankPost does not provide info about Visual selection.
Solution:   Add the 'visual' key in v:event. (closes vim/vim#6249)
37d1673ce0
2020-06-18 18:01:43 -04:00
Christian Clason
8a1276005a
Add v:event.visual during TextYankPost (#12382)
* propagate visual selection to textyankpost event

* adapt tests

* add docs

* also adapt oldtest
2020-06-03 10:51:25 -04:00
Jan Edmund Lazo
87334c00e0
vim-patch:8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Problem:    Cannot use :write when using a plugin with BufWriteCmd.
Solution:   Reset BF_NOTEDITED after BufWriteCmd. (closes vim/vim#5807)
0fff44152d
2020-04-13 12:00:33 -04:00
Jan Edmund Lazo
5fe88337f0
vim-patch:8.2.0406: FileReadCmd event not well tested
Problem:    FileReadCmd event not well tested.
Solution:   Add a test.
e32848780c
2020-04-13 12:00:32 -04:00
Jan Edmund Lazo
3a3fb08602
vim-patch:8.1.0851: feedkeys() with "L" does not work properly
Problem:    feedkeys() with "L" does not work properly.
Solution:   Do not set typebuf_was_filled when using "L". (Ozaki Kiichi,
            closes vim/vim#3885)
8d4ce56a19
2020-01-05 10:35:49 -05:00
Jurica Bradaric
c84b39150f vim-patch:8.1.1362: code and data in tests can be hard to read
Problem:    Code and data in tests can be hard to read.
Solution:   Use the new heredoc style. (Yegappan Lakshmanan, closes vim/vim#4400)
c79745a82f
2019-10-07 14:14:13 +02:00
Jan Edmund Lazo
3878b0822e
vim-patch:8.0.1771: in tests, when WaitFor() fails it doesn't say why
Problem:    In tests, when WaitFor() fails it doesn't say why. (James McCoy)
Solution:   Add WaitForAssert(), which produces an assert error when it fails.
50182fa84e
2019-09-21 08:43:07 -04:00
Jan Edmund Lazo
5f23a3dbcf vim-patch:8.0.1653: screen dump is made too soon (#10911)
Problem:    Screen dump is made too soon.
Solution:   Wait until the ruler is displayed. (Ozaki Kiichi, closes vim/vim#2755)
1834d37396
2019-09-02 06:24:34 +02:00
Daniel Hahler
6cc76194b2
tests: use runtime from build for doc/tags with :help (#10479)
This is better practice in general, and allows to remove the "helptags
ALL" hacks.

Ref: https://github.com/neovim/neovim/issues/8824
Ref: https://github.com/neovim/neovim/commit/f1b67c3453c

* Makefile: fix dependencies with regard to helptags

- use the file as the main target to avoid unnecessary triggering
- use "make oldtest" on Travis to ensure it gets built
2019-08-28 22:47:54 +02:00
Justin M. Keyes
71378a4030 free_buffer: rework b:changedtick handling #9163
- Re-enable Test_BufLeave_Wipe. 66f5e5c7d7

This is my (probably-wrong) application of Zyx's suggestion in #9163:

> free_buffer_stuff() already removes changedtick. It is better to
> make `free_options` a flag variable and avoid calling
> buf_init_changedtick() based on some flag there: current workflow
> looks weird as it first removes `b:changedtick`, then re-adds it
> by calling buf_init_changedtick(), then remove again.

> Also based on my understanding it looks logical to not remove
> `b:changedtick`, but to *replace* it with something allocated if
> needed based on examining reference count before calling
> `unref_var_dict`. Because now you have key disappearing from
> dictionary for no good reason.

Patch-By: Nikolai Aleksandrovich Pavlov <kp-pav@yandex.ru>
2019-08-12 02:17:49 +02:00
Jan Edmund Lazo
01ddb39699 vim-patch:8.1.1311: test: abort autocmd with exception #10692
Problem:    Aborting an autocmd with an exception is not tested.
Solution:   Add a test.  Also shows how to abort a command by throwing an
            exception.
23b5139234
2019-08-05 01:54:17 +02:00
Daniel Hahler
c6602df015 vim-patch:8.1.1546: in some tests 'tags' is set but not restored
Problem:    In some tests 'tags' is set but not restored. (Daniel Hahler)
Solution:   Restore 'tags'. (closes vim/vim#4535)
0331faf712
2019-06-16 19:51:12 +02:00
Daniel Hahler
192460e6b6 vim-patch:8.1.0813: FileChangedShell not sufficiently tested
Problem:    FileChangedShell not sufficiently tested.
Solution:   Add a more comprehensive test case.
0566e891f7
2019-06-08 13:59:19 +02:00
Jan Edmund Lazo
a33010d1e1 vim-patch:8.1.1325: cannot build with +eval but without +channel and +timers
Problem:    Cannot build with +eval but without +channel and +timers. (John
            Marriott)
Solution:   Adjust #ifdef for get_callback().
97b0075b0d
2019-05-18 12:21:06 -04:00
Justin M. Keyes
8330cc22af
vim-patch:8.1.1205: BufReadPre may move the cursor #9980
Problem:    A BufReadPre autocommand may cause the cursor to move.
Solution:   Restore the cursor position after executing the autocommand,
            unless the autocommand moved it. (Christian Brabandt,
            closes vim/vim#4302, closes vim/vim#4294)
a68e595909
2019-05-08 18:01:21 +02:00
Jan Edmund Lazo
9c6476d81e vim-patch:8.1.0613: when executing an insecure function the secure flag is stuck
Problem:    When executing an insecure function the secure flag is stuck.
            (Gabriel Barta)
Solution:   Restore "secure" instead of decrementing it. (closes vim/vim#3705)
48f377a476
2019-05-05 11:38:21 -04:00
Justin M. Keyes
16cc3cf9eb test/old: remove test.out files
Do this for new-style tests too, because they run after the old-style
tests which don't clean up their temp files.

Reverts ebd251c
2019-04-27 11:07:26 +02:00
Jan Edmund Lazo
ebd251cdf0 oldtests: pass Test_ReadWrite_Autocmds() 2019-04-26 23:40:29 -04:00
Jan Edmund Lazo
18fddad48b vim-patch:8.1.1203: some autocmd tests are old style
Problem:    Some autocmd tests are old style.
Solution:   Turn the tests into new style. (Yegappan Lakshmanan, closes vim/vim#4295)
69ea587289
2019-04-26 07:05:55 -04:00