- Add event loop abstraction module under src/nvim/event. The
src/nvim/event/loop module replaces src/nvim/os/event
- Remove direct dependency on libuv signal/timer API and use the new abstraction
instead.
- Replace all references to uv_default_loop() by &loop.uv, a new global variable
that wraps libuv main event loop but allows the event loop functions to be
reused in other contexts.
Since sleep is a grandchild of nvim, it is not killed after the test ends.
Using a low sleep value allows it to exit automatically after a small interval.
- use eval() and eq() in many places instead of writing to the buffer
- remove has('autocmd') checks and use corresponding code unconditionally as
neovim always has the autocmd feature
- split the test into several it() blocks
Helped-By: Scott Prager <splinterofchaos@gmail.com>
Helped-By: Michael Reed <m.reed@mykolab.com>
Extract the RBuffer class from rstream.c and reimplement it as a ring buffer,
a more efficient version that doesn't need to relocate memory.
The old rbuffer_read/rbuffer_write interfaces are kept for simple
reading/writing, and the RBUFFER_UNTIL_{FULL,EMPTY} macros are introduced to
hide wrapping logic when more control is required(such as passing the buffer
pointer to a library function that writes directly to the pointer)
Also add a basic infrastructure for writing helper C files that are only
compiled in the unit test library, and use this to write unit tests for RBuffer
which contains some macros that can't be accessed directly by luajit.
Helped-by: oni-link <knil.ino@gmail.com>
Reviewed-by: oni-link <knil.ino@gmail.com>
Reviewed-by: Scott Prager <splinterofchaos@gmail.com>
Reviewed-by: Justin M. Keyes <justinkz@gmail.com>
Reviewed-by: Michael Reed <m.reed@mykolab.com>
This is the part of the test that relies on wall clock time and sometimes
fails if the system is under load. The test is repeated up to three times
before a failure is reported to the user.
:undojoin can only be used inside scripts and command chains. So it has to be
tested inside an explicit `source()` call.
Also add a new test case for the different behavior when sourceing normal mode
commands from a script or inserting them interactively.
The legacy test uses `set ul=100` to break the changes into blocks that can be
undone separately. This is needed because the legacy test is sourced from a
file and changes would be grouped into on undo block by default. The lua test
suite does not have this restriction.
Also add a new test case to test this effect of using `set ul=100` in a
sourced script.
This test is real time based as it also tests the `:earlier` and `:later`
commands with time arguments (using `:sleep`). This can sometimes case the
test to fail on systems that are under heavy load or where the time interval
between creating the expected buffer state and the `:earlier` or `:later`
command that tries to jump to it changes.
To be system independent we use nvim's `:sleep` command and `wait()` for it in
the test suit.
The legacy vim test writes to test.out a lot with `:.w >>test.out`. This
does currently not work in the lua test suite so the test is modernized to use
busted's assertions instead of the output file.
This test was treated special in the legacy Makefile but after the conversion
the related code can be removed.
Reviewed-by: Michael Reed <m.reed@mykolab.com>
Reviewed-by: Luke Andrew <luke.github@la.id.au>
Reviewed-by: Justin M. Keyes <justinkz@gmail.com>
Reviewed-by: Florian Walch <florian@fwalch.com>