Commit Graph

59 Commits

Author SHA1 Message Date
Rainer Borene
7fc5d6fc8e legacy tests: migrate test66 2014-11-20 21:06:37 -03:00
Rainer Borene
963a146e8b legacy tests: migrate test25 2014-11-20 21:06:37 -03:00
Rainer Borene
8ca8a0da08 legacy tests: migrate test104 2014-11-20 21:06:37 -03:00
Rainer Borene
e0332e7f7c legacy tests: implement :source helper method. 2014-11-20 21:06:37 -03:00
Rainer Borene
c152cdd0f3 legacy tests: migrate test5 2014-11-20 21:06:37 -03:00
Thiago de Arruda
f291f41525 test: Add tests for the python provider
These tests were adapted from the python-client repository
2014-11-18 14:58:31 -03:00
Thiago de Arruda
ca1d8673be test: Add tests for the rpc#define#* functions 2014-11-18 14:58:31 -03:00
Thiago de Arruda
3e8ef31ada shell: Use job_write_cb for closing stdin
Commit @45525853d352 removed usage of the `job_write_cb` for closing stdin due
to a memory error, but that doesn't work anymore because `job_close_in` closes
stdin immediately, possibly trimming input data before it is fully written.

Since most memory issues with jobs have been fixed, re-add the `job_write_cb`
call to ensure stdin is only closed when it should. Also add tests for scenarios
where using the callback makes a difference.
2014-11-10 18:47:46 -03:00
Thiago de Arruda
ab826d88f6 eval: Return an empty list from systemlist() when there's no output
This is the behavior on vim's `systemlist()`.
2014-11-10 18:47:03 -03:00
Thiago de Arruda
63a98fca55 test: Fix nondeterminism in tests with notifications
Tests which spin the event loop and stop it in a notification handler have a
chance of re-entering the event loop due to the `vim_eval` call in the
`request()` helper(assuming the request call is what triggered the
notification). Since this will cause an error to be thrown by the lua client,
don't send the extra `vim_eval` request when the loop has been stopped.
2014-11-10 18:46:09 -03:00
Scott Prager
ea3296ad85 job_spec: Fix bad test. 2014-11-07 13:34:56 -03:00
Scott Prager
fd36dc208e job: Let vimL jobsend() accept a list.
Use save_tv_as_string(), same as vimL system(). This also makes
jobsend() more liberal in what it can accept. For example,
`jobsend(j, 123)` is now valid.

Closes #1176
2014-11-07 13:34:56 -03:00
Scott Prager
e90973e035 job: Make v:job_data[2] a list.
Factor out string_to_list() from f_system()'s implementation
and use that to set job_data. This has the technical advantage of
preserving NULs, and may be more convenient for users.

Required for #1176.
2014-11-07 13:34:56 -03:00
Thiago de Arruda
d3f81424e5 job: Only force-close stdout/stderr when the job exits
stdout/stderr should only be closed after the job truly exits, or else we can
lose data sent by it.
2014-11-07 09:12:42 -03:00
Thiago de Arruda
88a49148b3 test: Pass --show-possibly-lost=no to valgrind in helpers.lua
This command-line flag will suppress all warnings about interior pointers,
which are used in hashtab.c.
2014-11-07 01:40:18 -03:00
Thiago de Arruda
168a46fd31 test: Improve test environment setup and error handling/reporting
During test setup, we used to call a vimscript function(BeforeEachTest) that
attempted to restore Nvim to it's initial state as much as possible in order to
provide a clean environment for running new tests. This approach has proven to
be unreliable, as some tests leave state that can affect other tests, eventually
causing failures that are difficult to debug.

This commit changes the 'clear' function so it will restart Nvim every time it
is called, which is a slower, but more reliable solution that will simplify
spotting bugs in the future.

Some other improvements/fixes were also performed:

- Whenever an error is detected in a handler passed to "run()", the event loop
  will be stopped and the error will be propagated to the main thread.
- Errors and the "cleanup()" function will always send a quit command to the
  current Nvim instance. This should prevent memory starvation when running
  tests under valgrind(where each Nvim instance can consume a lot of memory).
- Fixed a wrong assertion in server_requests_spec.lua. Previously the failure
  was undetected in a notification handler.
- Fixed some tests to expect fully clean registers. The deleted cleanup function
  used to put an empty string in every register, but that resulted in a extra
  line being added.
2014-11-07 00:55:58 -03:00
Thiago de Arruda
d83868fe90 channel: Delay notifications to avoid client race conditions
It is currently possible for a client to send a response that doesn't match the
current server->client request(at the top of the stack). This commit fixes that
by delaying notifications to until the first `channel_send_call` invocation
returns.

Also remove the "call stack" size check, vim will already break if the call
stack goes too deep.
2014-11-06 04:22:06 -03:00
Thiago de Arruda
117d3db6d7 test: Simplify/fix options_spec.lua
The options_spec.lua suite has one purpose: Check if the :options commands will
throw any exception(:options is implemented by $VIMRUNTIME/optwin.vim). For this
it is best to use the `vim_command` API function since it will automatically
catch exceptions and forward them via msgpack-rpc.

Also, the option window seems to affect other tests, so call `restart` in the
teardown hook.
2014-11-06 04:21:57 -03:00
Rainer Borene
a695c87863 legacy tests: migrate test21 2014-11-04 12:57:33 -03:00
Rainer Borene
2d8d4285e4 legacy tests: migrate test7 2014-11-04 12:57:33 -03:00
Rainer Borene
ef08a2c0df legacy tests: migrate test6 2014-11-04 12:57:33 -03:00
Rainer Borene
38bef424a2 legacy tests: migrate test28 2014-11-04 12:57:33 -03:00
Rainer Borene
ca0a55c2a9 legacy tests: migrate test20 2014-11-04 12:57:33 -03:00
Rainer Borene
afe9aa758e legacy tests: migrate test97 2014-11-04 12:57:33 -03:00
Rainer Borene
5ea94e14f0 legacy tests: migrate test46 2014-11-04 12:57:33 -03:00
Rainer Borene
ac52d84f16 legacy tests: migrate test27 2014-11-04 12:57:33 -03:00
Rainer Borene
34cc2b1e33 legacy tests: migrate test54 2014-11-04 12:57:33 -03:00
Rainer Borene
fd503f1432 legacy tests: migrate test41 2014-11-04 12:57:33 -03:00
Rainer Borene
f85051b67e legacy tests: migrate test23 2014-11-04 12:57:33 -03:00
Rainer Borene
ffd5c43e84 legacy tests: migrate test56 2014-11-04 12:57:33 -03:00
Rainer Borene
4873171fc6 legacy tests: migrate test_autoformat_join 2014-11-04 12:57:33 -03:00
Rainer Borene
b67ad4f67f legacy tests: migrate test_changelist 2014-11-04 12:57:33 -03:00
Rainer Borene
4ca353d3bd legacy tests: migrate test81 2014-11-04 12:57:33 -03:00
Rainer Borene
79cd4a98ec legacy tests: migrate test_utf8 2014-11-04 12:57:33 -03:00
Rainer Borene
683b75d052 legacy tests: migrate test_insertcount 2014-11-04 12:57:33 -03:00
Rainer Borene
5b7d9bbd08 legacy tests: migrate test_options 2014-11-04 12:57:32 -03:00
Rainer Borene
b33c92439b legacy tests: migrate test18 2014-11-04 12:57:32 -03:00
Rainer Borene
481c449c72 legacy tests: migrate test106 2014-11-04 12:57:32 -03:00
Rainer Borene
6c90902c7a legacy tests: migrate test22 2014-11-04 12:57:32 -03:00
Rainer Borene
b780e946d5 legacy tests: migrate test9 2014-11-04 12:57:32 -03:00
Rainer Borene
d4f92e521c legacy tests: migrate test102 2014-11-04 12:57:32 -03:00
Rainer Borene
dbc7a8d987 legacy tests: migrate test4 2014-11-04 12:57:32 -03:00
Rainer Borene
649aeceb38 legacy tests: improvements to functional helpers.lua
- Clean vim registers and functions before each test
- Add eval workaround to the request helper method
- Export dedent method
2014-11-04 12:57:32 -03:00
Björn Linse
d6da424758 test/api: add test for set_cursor always updating the screen 2014-11-01 12:05:36 +01:00
Justin M. Keyes
49d5ed5591 fix #1027: :wundo segfault in new, non-empty buffer 2014-10-26 20:03:02 +00:00
Kartik K. Agaram
250298884b fix 'sign unplace id'
Since the introduction of the FOR_ALL_BUFFERS macro, 'sign unplace id'
without a buffer was only removing the sign from the first buffer rather
than all buffers, as described in the documentation.

  :help sign-unplace

--

modeline discussion: https://github.com/akkartik/neovim/commit/7863c247db#commitcomment-8342590
2014-10-28 23:12:41 -04:00
Scott Prager
7203796c54 test/job: Implement some basic jobs tests. 2014-10-28 14:09:28 -03:00
Scott Prager
860b6f6f05 test/shell: Add failure tests for system(). 2014-10-28 14:09:28 -03:00
Thiago de Arruda
53ce5493fa test: Small fixes and improvements to functional helpers.lua
- Move the cleanup function definition into `restart()` so restart can be
  selectively used as a hook
- Improve error handling: Before this, errors while running the event loop would
  cause busted to get stuck. Now the error is properly raised by stopping the
  event loop first.
2014-10-28 09:11:40 -03:00
Thiago de Arruda
d696fa51f8 test: verify that msgpacks-rpc exceptions are working 2014-10-23 21:46:09 -03:00