Commit Graph

197 Commits

Author SHA1 Message Date
Björn Linse
e5c4c4bca2 test/ui: add redraw debug util 2015-04-03 09:05:04 -03:00
Thiago de Arruda
6abde99ff2 test: Remove indeterminism from jobwait tests
- Use on_exit instead of on_stdout since there's no guarantee that the OS will
  send the data in time(It fails randomly in slow environments such as
  travis/valgrind)
- Increase the timeout gap for the "jobwait with timeout" test
2015-04-02 11:33:48 -03:00
Thiago de Arruda
b8b9e5ebad eval: Implement jobclose() vimscript function 2015-03-29 20:35:44 -03:00
Thiago de Arruda
028f6d7d3f eval: Implement jobwait() vimscript function 2015-03-29 20:35:44 -03:00
Thiago de Arruda
6e7757ad51 eval: Refactor vimscript job control API
- Remove JobActivity autocmd and v:job_data variable
- Simplify `jobstart` to receive:
  - An argument vector
  - An optional dictionary which may contain any of the current `jobstart`
    options plus `on_stdout`, `on_stderr` and `on_exit` callbacks.
- Refactor and add more job tests
- Update documentation
2015-03-29 20:35:44 -03:00
Thiago de Arruda
9d02e5b984 test: Add missing before_each call to sign_spec.lua
Without this the test will inherit the previous test environment, causing random
failures.

Close #2243
2015-03-28 12:04:14 -03:00
Thiago de Arruda
2aa2513b8e test: Add terminal tests
- Modify tty-test to allow easier control over the terminal
- Add a new directory with various terminal tests/specifications
- Remove a pending job/pty test.
- Flush stdout in Screen:snapshot_util() (avoid waiting for the test to finish)
- Replace libuv sigwinch watcher by a sigaction handler. libuv randomly fails to
  deliver signals on OSX. Might be related to the problem fixed by
  @bbcddc55ee1e5605657592644be0102ed3a5f104 (under the hoods, libuv uses a pipe
  to deliver signals to the main thread, which might be blocking in some
  situations)
2015-03-25 18:57:36 -03:00
David Bürgin
d2d99454e6 tests: Migrate legacy test 94 #2218 2015-03-25 16:33:24 -04:00
Thiago de Arruda
1ee7ca7bc0 test: Improve functional test debuggability and efficiency
- Read TEST_TAG/TEST_FILTER env vars from cmake/RunTests.cmake. Setting these
  environment variables will pass --tags/--filter to busted, which can used to
  filter which tests are executed.
- Remove calls to nvim msgpack-rpc API outside tests. This removes the
  requirement of having a static `clear` call in test/functional/helpers.lua
- Use the new busted command-line option "--lazy" to ensure the setup/teardown
  hooks are only executed when a suite runs at least one test.

Now its possible to run/debug a single test like this:

```sh
TEST_FILTER='some test string' make test
```

Which will only run tests containing "some test string" in the title.
Another option is:

```sh
TEST_TAG=some-tag make test
```

After putting #some-tag into the test title. This also improves debugging
experience because there will be no unnecessary gdbserver instances whe GDB=1 is
passed.
2015-03-24 12:46:15 -03:00
Thiago de Arruda
47e90ea1c5 test: Extract code to spawn nvim into the "spawn" helper function
This is can be used for spawning nvim outside a test context. Also refactor
screen.lua to use this function when loading the color map(It is better because
the GDB/VALGRIND environment variables are ignored)
2015-03-24 12:46:15 -03:00
Thiago de Arruda
d6369707c2 test: Fix tty-test program
The "tty ready" string must only be printed when the process is ready to receive
signals, and this only happens when the event loop has started.
2015-03-24 10:56:53 -03:00
Perry Hung
26e6bca769 vim-patch:7.4.503 #2178
Problem:    Cannot append a list of lines to a file.
Solution:   Add the append option to writefile(). (Yasuhiro Matsumoto)

https://code.google.com/p/vim/source/detail?r=v7-4-503

-Ported old legacy test over to
    test/functional/legacy/writefile_spec.lua
-Tests for mapping and signs from the original patch were removed since
    they have nothing to do this with feature

Tested with: make oldtest, make test on OS X.

Signed-off-by: Perry Hung <iperry@gmail.com>
2015-03-20 17:54:28 -04:00
Björn Linse
cf88f33eec tests/ui: cleanup ignores in screen_basic_spec 2015-03-19 23:09:56 +01:00
Björn Linse
a040aa95c1 tests/legacy: convert test 63 (:match and matchadd() ) 2015-03-19 23:09:56 +01:00
Björn Linse
93d01bf12e tests/ui: test hlsearch and incsearch 2015-03-19 23:09:56 +01:00
Thiago de Arruda
8b7b71f474 ui: Refactor so that busy state won't be the default
Even though assuming nvim is busy most times is simpler, it has a problem: A lot
of unnecessary busy_start/busy_stop notifications are sent to the UI. That's
because in the majority of scenarios almost no time is spent between
`event_poll` calls.

This restores the normal behavior which is to call busy_start only when nvim is
going to perform some task that can take a significant amount of time. Also
improve the usage of buffering in the TUI when changing the cursor state.
2015-03-18 14:16:23 -03:00
Gustaf Lindstedt
6511c24af8 legacy tests: migrate test19 2015-03-16 10:54:49 -04:00
Gustaf Lindstedt
311f09e20f legacy tests: migrate test89 2015-03-16 10:54:36 -04:00
Thiago de Arruda
5199456471 test: Only display cursor marker in screen tests if nvim is not busy 2015-03-16 08:29:57 -03:00
Thiago de Arruda
c546875daf ui: Replace cursor_{on,off} by busy_{stop,start}
Switching cursor off is only necessary in two occasions:

- When redrawing to avoid terminal flickering
- When the editor is busy

The first can now be handled by the TUI, so most calls to ui_cursor_off can be
removed from the core.

So, before this commit it was only necessary to switch the cursor off to notify
the user that nvim was running some long operation. Now the cursor_{on,off}
functions have been replaced by busy_{stop,start} which can be handled in a
UI-specific way(turning the cursor off or showing a busy indicator, for
example).

To make things even more simpler, nvim is always busy except when waiting for
user input or other asynchronous events: It automatically switches to a non-busy
state when the event loop is about to be entered for more than 100 milliseconds.

`ui_busy_start` can be called when its not desired to change the busy state in
the event loop (As its now done by functions that perform blocking shell
invocations).
2015-03-15 10:30:59 -03:00
Justin M. Keyes
3de0f5654b tests: fix 005_bufleave_delete_buffer_spec.lua
- After _spec suffix was added so busted could find the test, it failed.
- The original legacy test wrote to a "test.out", but the new test uses
  register @A.
- Original test did not contain 1d and new test shouldn't either.

ref c152cdd0f3
2015-03-11 01:47:38 -04:00
Justin M. Keyes
f8f07891e7 tests: add missing "_spec" suffix 2015-03-11 00:56:53 -04:00
Rainer Borene
c9fefe2a74 legacy tests: migrate test84 2015-03-11 00:22:23 -04:00
Rainer Borene
126b169f99 legacy tests: migrate test91 2015-03-11 00:22:23 -04:00
Rainer Borene
1e4a5f878f legacy tests: migrate test90 2015-03-11 00:22:23 -04:00
Rainer Borene
a1aacb2a32 legacy tests: migrate test95 2015-03-11 00:22:23 -04:00
Rainer Borene
2cfecf5420 legacy tests: migrate test15 2015-03-11 00:22:23 -04:00
Rainer Borene
0099f6148c legacy tests: migrate test_listlbr_utf8 2015-03-11 00:22:23 -04:00
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