From abe38f7d26d68d7032ea391c039c56c8b87675a5 Mon Sep 17 00:00:00 2001 From: glacambre Date: Sun, 26 Nov 2017 13:29:32 +0100 Subject: window.c: do BufEnter in correct window after closing help #7431 closes #7429 Problem: after a help window was closed, a window was selected and its autocommands triggered. After that, restore_snapshot was called and the focused window changed, confusing the user. Solution: Add function get_snapshot_focus() that returns the window that holds the cursor in a snapshot. Use this function in win_close to make sure the right window is selected before any autocommand is triggered. --- test/functional/autocmd/bufenter_spec.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test') diff --git a/test/functional/autocmd/bufenter_spec.lua b/test/functional/autocmd/bufenter_spec.lua index fef9838050..e14ddb3316 100644 --- a/test/functional/autocmd/bufenter_spec.lua +++ b/test/functional/autocmd/bufenter_spec.lua @@ -31,4 +31,17 @@ describe('autocmd BufEnter', function() eq(1, eval("exists('g:dir_bufenter')")) -- Did BufEnter for the directory. eq(2, eval("bufnr('%')")) -- Switched to the dir buffer. end) + + it('triggered by ":split normal|:help|:bw"', function() + command("split normal") + command("wincmd j") + command("helptags runtime/doc") + command("help") + command("wincmd L") + command("autocmd BufEnter normal let g:bufentered = 1") + command("bw") + eq(1, eval('bufnr("%")')) -- The cursor is back to the bottom window + eq(0, eval("exists('g:bufentered')")) -- The autocmd hasn't been triggered + end) + end) -- cgit From ad9c2d3cb97bbc4ba83ce7d23c9df23f9d3d11db Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 14 Nov 2017 10:47:49 +0100 Subject: doc closes #7622 --- test/README.md | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/README.md b/test/README.md index 1cb814d85b..58aa6a06aa 100644 --- a/test/README.md +++ b/test/README.md @@ -168,16 +168,13 @@ minutes](http://learnxinyminutes.com/docs/lua/). Do not silently skip the test with `if-else`. If a functional test depends on some external factor (e.g. the existence of `md5sum` on `$PATH`), *and* you can't mock or fake the dependency, then skip the test via `pending()` if the - external factor is missing. This ensures that the *total* test-count (success - + fail + error + pending) is the same in all environments. + external factor is missing. This ensures that the *total* test-count + (success + fail + error + pending) is the same in all environments. - *Note:* `pending()` is ignored if it is missing an argument _unless_ it is - [contained in an `it()` - block](https://github.com/neovim/neovim/blob/d21690a66e7eb5ebef18046c7a79ef898966d786/test/functional/ex_cmds/grep_spec.lua#L11). - Provide empty function argument if the `pending()` call is outside of - `it()` + [contained in an `it()` block](https://github.com/neovim/neovim/blob/d21690a66e7eb5ebef18046c7a79ef898966d786/test/functional/ex_cmds/grep_spec.lua#L11). + Provide empty function argument if the `pending()` call is outside of `it()` ([example](https://github.com/neovim/neovim/commit/5c1dc0fbe7388528875aff9d7b5055ad718014de#diff-bf80b24c724b0004e8418102f68b0679R18)). -- Use `make testlint` for using the shipped luacheck program ([supported by - syntastic](https://github.com/scrooloose/syntastic/blob/d6b96c079be137c83009827b543a83aa113cc011/doc/syntastic-checkers.txt#L3546)) +- Use `make testlint` for using the shipped luacheck program ([supported by syntastic](https://github.com/scrooloose/syntastic/blob/d6b96c079be137c83009827b543a83aa113cc011/doc/syntastic-checkers.txt#L3546)) to lint all tests. ### Where tests go -- cgit