This commit adds an on_print callback to stdioopen's dictionary
argument which lets the caller specify a function called each time
neovim will try to output something to stdout (e.g. on "echo" or
"echoerr" in --headless mode).
When the user is in ex mode, a call to mode(1) is documented to return
"cv". However, it does not currently do so, because the check which
checks for ex mode is nested inside a conditional which is never reached
in ex mode. Vim uses an explicit check for exmode_active, so let's do
the same thing here. Add some tests for this case both with a TTY and
in silent mode.
Fixes#15147 and fixes#15497. Also sketch "subdir" caching. Currently
this only caches whether an rtp entry has a "lua/" subdir but we could
consider cache other subdirs potentially or even "lua/mybigplugin/"
possibly.
Note: the async_leftpad test doesn't actually fail on master, at least
not deterministically (even when disabling the fast_breakcheck
throttling). It's still useful as a regression test for further changes
and included as such.
site packages must be sourced before user config
NOTE: we only consider dirs exactly matching "after" to be an AFTER dir.
vim8 considers all dirs like "foo/bar_after", "Xafter" etc, as an
"after" dir in SOME codepaths not not in ALL codepaths.
It was not possible to run the tests under the gdbserver because we were
not closing the old session before starting a new one. This caused the
server to not to be able to bind to the given address and crashing the
tests.
This commit closes the session before starting a new one.
Signed-off-by: Shreyansh Chouhan <chouhan.shreyansh2702@gmail.com>
Problem
- `redir_exec` is obsolete, but it keeps getting used in new tests
because people copy existing tests.
- Disadvantages of `redir_exec`:
- Captures extra junk before the actual error/message that we _want_ to test.
- Does not fail on error, unlike e.g. `command()`.
Solution
- Use new functions like `nvim_exec` and `pcall_err`.
The order should be:
XDG_CONFIG_HOME/nvim
XDG_DATA_HOME/nvim/site/pack/foo/start/bar/
XDG_CONFIG_HOME/nvim/after
XDG_DATA_HOME/nvim/site/pack/foo/start/bar/after
Otherwise the users site packages will be loaded from ~/.local/share/nvim/site
which can cause unexpected error messages and other kinds of mayhem
Simpler alternative: use "--noplugin". Shouldn't be done because:
(1) these tests should test the ordinary startup code path as close as possible
(2) tests that test the loading of site packages will be added here very soon
v8.1.0736 made some changes for making some emsgs more specific.
Includes the change for Test_lambda_fails() in test_lambda.vim.
Adjust relevant functionaltests to expect the new emsgs.
This patch has been fully ported in my Blob port PR, but it hasn't been
merged yet, so just use what we need from it for now.
Required for v8.1.1821.
Quoting the existing docs:
Packages are loaded. These are plugins, as above [&runtimepath], but
found in the "start" directory of each entry in 'packpath'. Every
plugin directory found is added in 'runtimepath' and then the plugins
are sourced.
Also tj didn't think I could do it.
The test of "replace environment" in the test module of
`test/functional/core/job_spec.lua` failed in case the bashrc file of
the user running the test has special actions in it (such actions were
printing to the screen from inside this file, or changing the bash mode
to be vi).
In order to fix this problem, the test now sets the shell to be
`/bin/sh` before running the command. Setting the shell to be `/bin/sh`
causes the running shell to run without the configuration of the user,
and so the test passes even in case of special .bashrc.
This change was done only for platforms other than Windows since it is
not relevant in windows.
The fix was applied to the specific test, even though it is possible
that related issues will arise in other tests. It seems like a big
overhead to make the fix work on all the possible tests, and it does not
worth this cost.
* fixed hang issue with --headless and -r option specified
Calling the do_more_prompt function in headless mode will freeze neovim because it is eventally in the input-accepting state (the same as waiting for --more--).
* fixed "Press ENTER or type command to continue" to be suppressed
If in headless mode, we need to exit at this point. If we continue, we will enter the normal mode and the message "Press ENTER or type command to continue" will be displayed and we will be in the input waiting state.
* fixed functional ex_cmds tests
* Revert "fixed "Press ENTER or type command to continue" to be suppressed"
This reverts commit a02dc40e3b.
* Revert "fixed functional ex_cmds tests"
This reverts commit 3bdb8da20a.
* fixed conditional again
* added test for fixed hang issue with --headless (#11386)