Specifically, functions that are run in the context of the test runner
are put in module `test/testutil.lua` while the functions that are run
in the context of the test session are put in
`test/functional/testnvim.lua`.
Closes https://github.com/neovim/neovim/issues/27004.
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")`.
Problem: Cannot use expand() to get the script name.
Solution: Support expand('<script>'). (closesvim/vim#10121)
6013d0045d
Use `.sn_name` instead of `->sn_name` as v8.2.0154 hasn't been ported.
Cherry-pick builtin.txt expand() doc from latest Vim.
For anonymous scripts, defer the creation of script items until an attempt to access a script-local
variable is made. This dramatically reduces the number of script items created when using lots of
vim.cmd and nvim_exec especially.
This will mean <SID> usage fails until a script-local variable access is first made.
Based on #13143 (and #11507) with changes:
- Omit script_type_E. Use sn_name == NULL to determine anon items.
- Keep SID_STR. Used by anon :source for .lua files (no item).
- Show SID in get_scriptname output (:verbose set).
- Factor item creation into new_script_item.
- Leave sc_seq = 0 (anon scripts don't re-use the same item when re-sourced).
- Add tests for anon :source.
Co-authored-by: Vikram Pal <vikrampal659@gmail.com>
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
It's possible for weirdness to happen if curbuf is modified while
sourcing from it via :source (with no arguments). For example:
- Deleting lines from or wiping curbuf can cause internal error E315 to
be thrown from ml_get.
- Changing the curbuf to another buffer while sourcing can cause lines
from the new curbuf to then be sourced instead.
Problem:
Anonymous :source (no args) and nvim_exec() don't support Vimscript line continuations.
Solution:
Factor out the concat logic into concat_continued_line() and a
CONCAT_CONTINUED_LINES macro for simple concatenations where lines are
fetched individually.
Closes#14807
It's happening because do_source is only expected to return FAIL when it
was unable to open file . But `nlua_exec_file` returns fail for parsing
and execution error too . Those errors are emitted through `nlua_error`.
So now return value of nlua_exec_file is ignored like do_cmdline. It now
only returns fail when it was unable to open file that check is done
before calling nlua_exec_file or do_cmdline. Errors in nlua_exec_file
are still directly emitted through nlua_error like before.