Commit Graph

380 Commits

Author SHA1 Message Date
Rainer Borene
0f97f52ded legacy tests: migrate test98 2015-03-11 00:22:22 -04:00
Rainer Borene
9c40721ea4 legacy tests: migrate test103 2015-03-11 00:22:22 -04:00
Rainer Borene
05fcce3896 legacy tests: migrate test_qf_title 2015-03-11 00:00:22 -04:00
Rainer Borene
b18cd63260 legacy tests: migrate test100 2015-03-11 00:00:22 -04:00
Björn Linse
a7aeda8c7a tests/ui: Also test character at cursor 2015-03-09 08:01:49 -03:00
John Szakmeister
638452da2a Merge pull request #2082 from jszakmeister/fixes-for-busted-and-luajit
tests: prevent busted from reloading the ffi module and others
2015-03-09 05:47:48 -04:00
Gustaf Lindstedt
2d65ccf06c test: migrate legacy test 77 #2046
Migrate legacy test 77 which tests mf_hash_grow() to lua/busted.
2015-03-08 23:27:54 -04:00
Björn Linse
5be040ffe4 jobsend: Don't append extra newline after last item
This allows sending binary data that is not newline terminated
2015-03-03 20:18:24 +01:00
John Szakmeister
d8ef23849a tests: prevent busted from reloading the ffi module and others
It turns out that Busted started cleaning the environment in 2.0rc5 as a
result of Olivine-Labs/busted#62.  This, in turn, caused the ffi module
to be reloaded for each spec file, and LuaJIT doesn't appreciate it.
The net effect is an assertion error in LuaJIT.

By using the --helper feature of Busted, we can pre-load some modules
ahead of Busted and prevent it from reloading them--making LuaJIT happy
again.
2015-03-01 15:25:39 -05:00
John Szakmeister
ea35062589 Merge pull request #2075 from jszakmeister/dont-hardcode-tty-test-path
tests: don't hardcode the path to tty-test
2015-03-01 15:24:00 -05:00
John Szakmeister
235909044a tests: require luassert in the helpers
This is necessary for newer versions of Busted, otherwise assert will be
nil and the tests will die.

Note: this does not mean the tests now work with the latest Busted.
There are still several issues preventing that from happening.
2015-03-01 09:00:27 -05:00
John Szakmeister
c1e8d12aa3 tests: don't hardcode the path to tty-test
This fixes the build for those who drive the build directly using
CMake.
2015-02-28 10:46:56 -05:00
Numkil
bbc9eff9ae test: mark job/pty test as pending #2058
- closes #2057
- see https://github.com/neovim/neovim/issues/2057 for discussion
2015-02-26 19:23:37 -05:00
Thiago de Arruda
d7e560e5b3 job: Allow spawning jobs connected to pseudo terminals 2015-02-23 21:43:33 -03:00
Thiago de Arruda
d28011ee1c eval: Fix buffering of data in job autocommands
Job autocommands will no longer buffer data chunks that don't end in newlines
characters.
2015-02-23 21:43:33 -03:00
Thiago de Arruda
3baba1e7bc refactor: Remove term modules and termcap options
- Removed term.c, term.h and term_defs.h
- Tests for T_* values were removed. screen.c was simplified as a
  consequence(the best strategy for drawing is implemented in the UI layer)
- Redraw functions now call ui.c functions directly. Updates are flushed with
  `ui_flush()`
- Removed all termcap options(they now return empty strings for compatibility)
- &term/&ttybuiltin options return a constant value(nvim)
- &t_Co is still available, but it mirrors t_colors directly
- Remove cursor tracking from screen.c and the `screen_start` function. Now the
  UI is expected to maintain cursor state across any call, and reset it when
  resized.
- Remove unused code
2015-02-21 05:08:21 -03:00
Thiago de Arruda
f9d327c88b test: Add extra screen expectation to prevent race condition
This is to ensure ctrl+c is only pressed after the command has started executing
in the viml_system_spec.lua system() interrupt test.
2015-02-20 20:41:03 -03:00
Thiago de Arruda
a21d952bdd test: Remove temporary files created by 072_undo_file_spec.lua 2015-02-20 20:40:02 -03:00
Thiago de Arruda
aed19a7c5f test: Remove -g flag from pynvim call in Screen.debug
The flag is no longer valid(pynvim always starts a GUI)
2015-02-20 20:38:42 -03:00
Fabian Brosda
20054df06e legacy test: migrate test 72 2015-02-20 13:26:59 -03:00
Thiago de Arruda
e7c945ab59 input: Escape utf8 sequences that contain CSI/K_SPECIAL 2015-02-18 13:16:30 -03:00
Felipe Morales
3ffc5d81c3 Add TabClosed event
TabClosed is triggered when a tab page closes.
2015-02-16 23:24:31 -05:00
Felipe Morales
66d94869a0 Add TabNewEntered
TabNewEntered is triggered after vim has entered a buffer in new tab.
2015-02-16 23:24:30 -05:00
Felipe Morales
817be96be5 Add TabNew event
TabNew triggers when entering a new tab page, but not when entering an
already created one.
2015-02-16 23:24:30 -05:00
Thiago de Arruda
40b7990553 test: Fix 051_highlight_spec.lua
- The syntax `gui=` is invalid when setting properties of highlight group.
- Wait for the initial "-- More --" prompt before continuing. Required to avoid
  a race condition
2015-02-16 23:17:39 -03:00
Thiago de Arruda
d8f3458ec7 syntax: Refactor to store all term and gui attributes independently
Now the attrentry_T structure will store all attributes in separate fields for
cterm and rgb UIs.
2015-02-16 23:17:39 -03:00
Thiago de Arruda
98dca8a827 test: Increase default_screen_timeout when running on travis
Some screen tests such as system/ctrl+c(viml_system_spec.lua) can take some time
to respond(default kill timeout is 2 seconds for an interrupted job) and fail
when running under a slow environment such as travis.
2015-02-16 23:17:38 -03:00
Thiago de Arruda
291e15c60a test: Remove unnecessary tests from viml_system_spec.lua
The `system` function is never executed with these tests because the ctrl+c is
queued with the input string that calls it(The `process_interrupts` function
will destroy all previous input when a ctrl+c is found).
2015-02-16 23:17:38 -03:00
Thiago de Arruda
e974b00283 test: Fix race condition in window_spec.lua
Without waiting for the 'gg' command to be processed, its possible that the
following assertion will fail.
2015-02-16 23:17:38 -03:00
Thiago de Arruda
e6208df73e test: Add synchronization helper for functional tests
The `wait` function will only return after all input has been processed by nvim.
It is useful to time assertions correctly.
2015-02-16 23:17:38 -03:00
Björn Linse
f4f0f646c3 api: always return empty string as api type String 2015-02-16 20:13:54 -05:00
Björn Linse
f56d1dc838 test: NULL-initialized vimscript strings should eval to empty strings 2015-02-16 20:13:53 -05:00
Justin M. Keyes
1b055c54a0 FEAT_SIGNS: restore :signs wildmenu, and add test. 2015-02-15 02:49:59 -05:00
Felipe Morales
6e992876ea shadow previously set signs #1893 2015-02-13 14:56:43 -05:00
John Szakmeister
f1f1f711c7 Merge pull request #1965 from jszakmeister/fix-fs-spec-test-for-freebsd
Fix an fs_spec test under FreeBSD and a symlinked home directory.
2015-02-11 19:45:26 -05:00
John Szakmeister
dd12238329 Merge pull request #1958 from jszakmeister/fix-unittest-header-parsing-on-freebsd
unittests: define _Thread_local to be nothing
2015-02-11 04:04:54 -05:00
Thiago de Arruda
4c92a0baca deps: Add Luajit compilation flags to improve debugging 2015-02-10 09:57:24 -03:00
John Szakmeister
3562f686b0 Get rid of a bashism in the fs_spec test. #1964
FreeBSD doesn't use bash by default, causing the group id to be print
out in the middle of the test.
2015-02-09 12:44:22 -05:00
John Szakmeister
41d8c8980b Fix an fs_spec test under FreeBSD and a symlinked home directory.
It turns out the FreeBSD 10 VM has a symlink for the home directory to
/usr/home.  Unfortunately, this breaks the test as arg[0] may not have
the symlink resolved, but the path returned from the exe() call will.
As a result, the comparison fails, even though the result is correct.

Let's fix this by running the absolute path through exe() too, and then
comparing the results.
2015-02-09 06:49:11 -05:00
John Szakmeister
bc6ef4bf80 unittests: define _Thread_local to be nothing
This helps the LuaJIT ffi module to parse the header correctly.
Otherwise, the whole suite of tests fail.
2015-02-09 05:37:24 -05:00
Thiago de Arruda
11fa4f42fd test: Remove nondeterminism in systemlist interrupt tests
The systemlist test currently calls the `echo` command which can potentially
complete before being interrupted, causing random test failures.

Use `yes | xargs` instead. A `yes` invocation that is not piped through `xargs`
can produce a huge amount of lines in a very short time, leading memory
starvation when the result is being converted into a list. `xargs` ensures only
one line of output will be produced while allowing interrupt to be tested.
2015-02-06 15:24:08 -03:00
Björn Linse
f468fb70cb api/vim: allow guis and tests to retrieve the entire color table 2015-02-02 14:56:58 -03:00
Björn Linse
ae2b747e64 test/ui: update documentation for screen tests 2015-02-02 14:56:58 -03:00
Björn Linse
b78265e9b7 test/ui: enable strict mode by default (and in existing tests) 2015-02-02 14:56:58 -03:00
Björn Linse
97ac9f5c1d test/ui: more informative "unexpected highlight" errors 2015-02-02 14:56:58 -03:00
Florian Walch
2eda611cbc Travis: Fail fast, disable JIT for functional tests.
Disable JIT to find cause for random `PANIC: unprotected error in call to Lua API` on Travis (OS X).
2015-02-02 17:23:03 +01:00
Thiago de Arruda
bdba32ffd9 test: Mark unreliable test as pending in job_spec.lua
`job_send` is non-blocking and can potentially fail due to the following
`job_stop` call.  Since we can't reliably verify that the "exit" event is only
sent after the "stdout" event, mark the test as pending and fix after we can
get a notification about `job_send` status.
2015-01-29 11:52:56 -03:00
John Szakmeister
9023f62707 Fix the ctrl + left click test.
The test was hoping to not find a tags file, but didn't actively guard
against it.  In my case, I had a tags file present which was causing
different output to be generated.  To fix this, let's set the tags
option to look for an unlikely filename.
2015-01-28 17:48:36 -05:00
Björn Linse
da85859567 clipboard: more register tests for delete 2015-01-27 19:43:25 -05:00
Thiago de Arruda
8a363360dc test: Migrate legacy test 107
This test depends on terminal size to work correctly. After migration this
requirement is removed.
2015-01-23 20:46:27 -03:00
Thiago de Arruda
cbc23d93b9 test: Make default screen timeout depend on the VALGRIND env var
While running under valgrind, the screen can take significantly longer to
update(especially on travis) so a higher timeout can be required. Also reduce
the timeout when not running on valgrind.
2015-01-23 19:00:45 -03:00
Thiago de Arruda
41225fe4f6 test: Fix hanging test suite after failures
When a test that fails leaves nvim in a 'Press Enter...' state, the whole suite
will hang because the `qa!` command executed before the next test won't be
processed until '<enter>' is sent.

Now the lua client can send a signal with when `Session:exit()` is called, so
the `qa!` request is no longer necessary.

Also:

- Set noswapfile at startup to prevent tests from leaving .s* swap files(should
  also improve test environment determinism)
- Use `assert(false, msg) instead of `error(msg)` to report screen assertion
  failures.
2015-01-23 18:58:19 -03:00
Björn Linse
a9048896b3 tests/ui: strict mode 2015-01-23 07:47:48 -03:00
Björn Linse
5c837f613e tests/ui: snapshot util 2015-01-23 07:47:48 -03:00
Thiago de Arruda
3f0983e400 test: Set some options to reduce nondeterminism in functional tests
- shortmess+=I: Remove intro screen
- background=light: Disregard COLORFGBG environment variable
2015-01-22 08:54:42 -03:00
Thiago de Arruda
5b65ac2ca7 test: Make it possible to run functional tests with plain lua
Replace the hexadecimal escape sequences, which are only supported by luajit
2015-01-22 08:54:42 -03:00
Thiago de Arruda
f08fe552f4 test: Fix screen.lua eol_clear method. 2015-01-22 08:54:37 -03:00
Pavel Platto
1d5222985c vim-patch:7.4.492
Problem:    In Insert mode, after inserting a newline that inserts a comment
	    leader, CTRL-O moves to the right. (ZyX) Issue 57.
Solution:   Correct the condition for moving the cursor back to the NUL.
	    (Christian Brabandt)

  https://code.google.com/p/vim/source/detail?r=v7-4-492
2015-01-19 23:39:01 +02:00
Justin M. Keyes
c7f4e55362 Merge pull request #1798 from oni-link/fix.job.wait
job.c: Prevent early return from job_wait().
2015-01-18 13:23:17 -05:00
oni-link
d7d1b11332 Tests for system()/systemlist() when interrupted with CTRL-C. 2015-01-17 16:34:58 +01:00
Nicolas Hillegeer
522a15f1c0 test: fix formatc.lua oddity on OSX/gcc
The primitive C canonicalizer we use to strip out duplicate header
declarations and keep luajit's ffi happy, didn't work properly in this case.

What happened is this (in /usr/include/ctype.h):

__DARWIN_CTYPE_TOP_inline int
isspecial(int _c)
{
        return (__istype(_c, _CTYPE_T));
}

Gets preprocessed to something like:

__inline int
isspecial(int _c)
{
        return (__istype(_c, _CTYPE_T));
}

On OSX/gcc. The formatter wasn't recognizing this entire function as
something to put on a single line because it naively just checks for
"static" or "inline" for that, but not "__inline".

This error doesn't occur on OSX/clang. Without looking further into it, I
guess that __DARWIN_CTYPE_TOP_inline gets defined to inline on clang, but
__inline on gcc, for some reason.

This helps issue #1572 along.
2015-01-16 21:45:00 +01:00
Nicolas Hillegeer
dd25b2e5ae test/os/fs: fix call to lfs.attributes
The second argument to lfs.attributes() serves only to select a specific
part of the normally returned table. It's not a file open flag (e.g.: as for
fopen() in C). Also made the (n)eq checks a bit more idiomatic.

Fixes #1831
2015-01-16 21:44:25 +01:00
Thiago de Arruda
dc18fa256f test: Add more functional test to cover new code
- emulate gui_running and terminal colors
- scrolling/clearing regions
- mouse wheel scrolling
- setting icon/title
- :stop/:suspend
- screen resize
2015-01-15 09:01:25 -03:00
Thiago de Arruda
8596776bf6 ui: Implement set_{title,icon} 2015-01-14 08:31:20 -03:00
Thiago de Arruda
ea771ac559 test: Add Screen.debug for inspecting screens of hanging tests 2015-01-13 21:21:20 -03:00
Thiago de Arruda
29bc6dfabd ui: Add 'rgb' parameter to ui_attach
When set to false, nvim will send cterm color numbers with `highlight_set`.
2015-01-13 11:54:52 -03:00
Thiago de Arruda
3e83e44792 input: Ignore invalid "<" key sequences
Ignoring invalid key sequences simplifies input handling in UIs. The only
downside is having to use "<lt>" everytime a "<" is needed on functional tests.
2015-01-13 11:54:51 -03:00
Thiago de Arruda
17b211d288 test: Remove unnecessary command from highlight_spec 2015-01-13 11:54:51 -03:00
Thiago de Arruda
926503c84e ui: Fix ui resizing and change some method names 2015-01-13 11:54:28 -03:00
Thiago de Arruda
fc8f768690 ui: Add update_fg/update_bg methods
It is necessary to notify the UI when the default background/foreground colors
change in order to render correctly.
2015-01-13 11:53:27 -03:00
Thiago de Arruda
1ccbd94bee test: Fix clear/eol_clear in screen.lua
These functions need to operate on the current the scroll region.
2015-01-13 11:53:27 -03:00
Justin M. Keyes
d7e18b5c95 Revert "[WIP] "abstract_ui" fixes and improvements" 2015-01-12 10:14:52 -05:00
Thiago de Arruda
d992213678 ui: Reimplement :suspend command for remote UIs.
- Remove suspend method from the UI protocol
- Handle `:suspend` by disconnecting the last channel that sent a request to
  nvim.
2015-01-12 09:47:41 -03:00
Thiago de Arruda
74c247f75b ui: Add 'rgb' parameter to ui_attach
When set to false, nvim will send cterm color numbers with `highlight_set`.
2015-01-12 09:47:41 -03:00
Thiago de Arruda
0219c87534 input: Ignore invalid "<" key sequences
Ignoring invalid key sequences simplifies input handling in UIs. The only
downside is having to use "<lt>" everytime a "<" is needed on functional tests.
2015-01-12 09:47:40 -03:00
Thiago de Arruda
d50d79831e test: Remove unnecessary command from highlight_spec 2015-01-12 09:47:40 -03:00
Thiago de Arruda
213c3c3e53 ui: Fix ui resizing and change some method names 2015-01-12 09:47:34 -03:00
Thiago de Arruda
4f5f246a95 ui: Add update_fg/update_bg methods
It is necessary to notify the UI when the default background/foreground colors
change in order to render correctly.
2015-01-10 21:41:31 -03:00
Thiago de Arruda
209b5ed6ba test: Fix eol_clear in screen.lua
It should only clear to the end of the current scroll region(this is the
behavior expected by nvim)
2015-01-10 21:41:31 -03:00
Justin M. Keyes
a31bcfb98a Merge pull request #1742 from fwalch/vim-7.4.552
vim-patch:7.4.552
2014-12-30 00:10:26 -05:00
Justin M. Keyes
13d950f6ed Merge pull request #1738 from fwalch/vim-7.4.549
vim-patch:7.4.549
2014-12-30 00:03:44 -05:00
Justin M. Keyes
ec615012a7 vim-patch:6a598be test for 7.4.487
https://code.google.com/p/vim/source/detail?r=6a598be6d4e8
2014-12-29 23:48:23 -05:00
Florian Walch
183b4b60b6 vim-patch:750a698
Add new files for 7.4.549.

https://code.google.com/p/vim/source/detail?r=750a6986aa86a2bb3346631a353913b899d86748
2014-12-27 13:16:54 +01:00
Florian Walch
e27460b60c vim-patch:7.4.552
Problem:    Langmap applies to Insert mode expression mappings.
Solution:   Check for Insert mode. (Daniel Hahler)

https://code.google.com/p/vim/source/detail?r=v7-4-552
2014-12-26 16:54:24 +01:00
Florian Walch
e06159e6ae vim-patch:7.4.488
Problem:    test_mapping fails for some people.
Solution:   Set the 'encoding' option. (Ken Takata)

https://code.google.com/p/vim/source/detail?r=v7-4-488
2014-12-23 21:23:49 +01:00
Florian Walch
6aecbbebfd vim-patch:7.4.483
Problem:    A 0x80 byte is not handled correctly in abbreviations.
Solution:   Unescape special characters. Add a test. (Christian Brabandt)

https://code.google.com/p/vim/source/detail?r=v7-4-483
2014-12-23 21:23:32 +01:00
Julian Mehne
84dda11ec3 Remove superfluous settings from legacy tests. 2014-12-18 00:50:17 +01:00
Thiago de Arruda
40977e78a2 input: Recognize mouse events for abstract_ui 2014-12-10 07:51:06 -03:00
Michael Reed
365cf90efb docs: Remove EBCDIC remnants 2014-12-09 19:25:07 -05:00
Thiago de Arruda
1192fbd08a test: Add screen test facility
- Add screen.lua which implements a remote screen to verify screen state by
  tests under functional/ui
- Add some basic screen/highlight tests
2014-12-09 08:36:16 -03:00
Björn Linse
6ddbe6d9be clipboard: fix let @+ = ... and add test 2014-12-08 22:05:05 +01:00
Björn Linse
d9639d3a9b clipboard: add functional test 2014-12-08 22:05:05 +01:00
Justin M. Keyes
01fc0efdca Merge pull request #1341 from splinterofchaos/api-nul
Api: Improve Nul handling
2014-12-06 20:19:08 -05:00
Scott Prager
cea5092f40 api: Add tests for when not to handle NULs. 2014-12-06 17:29:39 -05:00
Scott Prager
460843b4cd api: Handle NULs and newlines in buffer_*_line. 2014-12-06 17:29:38 -05:00
Julian Mehne
42891ea9d9 Make migrated test33 more similar to old legacy test.
Remove `expandtab` and add a missing trailing space from the legacy test.
2014-12-06 13:43:14 +01:00
Thiago de Arruda
a31b06c44d deps: Update lua client 2014-12-05 14:23:37 -03:00
Björn Linse
b3151af69c systemlist: test empty lines in beginning and middle of output 2014-12-02 16:53:16 +01:00
Björn Linse
1464b0eda2 systemlist: add keepempty option to preserve final newline 2014-12-02 16:50:52 +01:00
Scott Prager
275f6e3a6b mch_early_init() -> early_init().
Move general initialization functions to early_init, which simplifies
test/unit/helpers.lua, which requires all these functions.
2014-11-28 14:27:58 -05:00
Rui Abreu Ferreira
84eb118f62 Functional tests for feedkeys CSI escaping
- tests for vim_feedkeys and replace_termcodes
2014-11-27 08:33:53 -03:00
John Szakmeister
78618d742b Avoid printing an error response when detecting xclip.
While we're at, using the slightly more portable `command -v` technique
to detect the executable.  Also, there's no need to use `io.popen()` if
we aren't going to record the path.  Instead, let's use the simpler
`os.execute()` to detect the presence of xclip.
2014-11-26 17:31:51 -05:00
Justin M. Keyes
c83dfa20bd Merge pull request #1543 from jszakmeister/fix-broken-functional-tests
Fix broken functional test.
2014-11-25 17:06:53 -05:00
Thiago de Arruda
99809903bb deps: Update bundled lua client version
The new version fixes defunct processes which causes random test failures on
some systems(#1519)
2014-11-25 14:47:54 -03:00
John Szakmeister
db914e8b61 Fix broken functional test.
In Lua, all math is floating point.  We need to coerce the result of a
division into a integer with the `{get,set}_height` and
`{get,set}_width` window_spec functional tests.
2014-11-25 06:11:43 -05:00
Thiago de Arruda
aa22612112 test: Add gdbserver support on helpers.lua
The $GDB env var can be set to run tests under gdbserver. If $VALGRIND is also
set, it will add the --vgdb=yes command-line option to valgrind instead of
starting gdbserver.
2014-11-23 08:56:43 -03:00
Eliseo Martínez
1f2c197ebe Fix functional-test-105 failure in OSX.
See https://github.com/neovim/neovim/issues/1519 for failure report.

Cause    : In OSX, /tmp is a symbolic link to /private/tmp, which causes
           expected and got results different because of implicit
           resolution.
Solution : Resolve path before setting expected value.
2014-11-21 22:08:16 +01:00
Thiago de Arruda
230c935e73 test: Fix problems in job_spec.lua
Nvim wasn't exiting cleanly in some job tests due to errors.

This can't be noticed until the next commit, which will perform a refactoring to
selectively process K_EVENT, so the `qa!` command executed at the end of each
test blocks forever if there are errors which require the user to press ENTER(in
that state Nvim no longer will process events).
2014-11-21 15:39:04 -03:00
Thiago de Arruda
179c51319d test: Refactor functional helpers to use vim_input
The vim_input function accepts raw terminal input and so is better to emulate
real user, especially because it is not deferred as vim_feedkeys.

Using this function required a number of changes:

- expect() was refactored to use curbuf_contents()
- The vim_eval function in request() was moved to curbuf_contents(). For most
  cases this is enough(we only care for synchronizing api calls with user input
  when verifying buffer contents).
- <C-@>(NUL) is preprocessed before being passed to replace_termcodes.
- Legacy test 4 had a bug that only became visible when using vim_input, it is
  fixed now.
- An extra blank line deletion was required for test 101

The last two items show that vim_feedkeys because it is not 100% equivalent to
receiving terminal input.
2014-11-21 15:39:04 -03:00
Thiago de Arruda
6b17082d3c runtime: Refer to plugins running outside Nvim as "remote plugins"
- Rename autoload/rpc to autoload/remote
- External plugins are now remote plugins
- External plugins directory is "rplugin"
2014-11-21 10:11:42 -03:00
Rainer Borene
df5a17fb51 legacy tests: migrate test105 2014-11-20 21:06:37 -03:00
Rainer Borene
da3ade6a59 legacy tests: migrate test26 2014-11-20 21:06:37 -03:00
Rainer Borene
021d9bdcc0 legacy tests: migrate test101 2014-11-20 21:06:37 -03:00
Rainer Borene
50876c2f70 legacy tests: migrate test75 2014-11-20 21:06:37 -03:00
Rainer Borene
a93d370c75 legacy tests: migrate test51 2014-11-20 21:06:37 -03:00
Rainer Borene
c9159586b8 legacy tests: migrate test43 2014-11-20 21:06:37 -03:00
Rainer Borene
bbd95c0514 legacy tests: migrate test33 2014-11-20 21:06:37 -03:00
Rainer Borene
8c872a945e legacy tests: migrate test67 2014-11-20 21:06:37 -03:00
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