Commit Graph

6414 Commits

Author SHA1 Message Date
Thiago de Arruda
df37aa6115 eval: Implement dictionary change notifications 2015-11-09 09:43:30 -03:00
John Szakmeister
9499432d7f Merge pull request #3616 from jszakmeister/sort-results-shada-test
Sort oldfiles in the marks_spec tests to avoid random ordering errors.
2015-11-06 06:47:58 -05:00
John Szakmeister
a6c45d15fd Sort oldfiles in the marks_spec tests to avoid random ordering errors.
According to @ZyX-I in #3594, ordering is not important so let's use
@tarruda's fix by sorting the results.
2015-11-06 06:02:41 -05:00
ZyX
96dc38b3c8 undo: Remove incorrect NONNULL_ALL attribute
Fixes #3605
2015-11-05 23:34:48 +03:00
John Szakmeister
690df9333a Ensure a session is running before attempting to do Python detection. 2015-11-04 05:01:22 -05:00
ZyX
ae0576a472 runtime: Add shada.vim syntax file 2015-11-01 21:27:28 +03:00
ZyX
9037a180de runtime: Add [ft]plugin/shada.vim files that automatically open .shada 2015-11-01 21:27:28 +03:00
ZyX
8d9063bb2a runtime: Add autoload/shada.vim helper file
Contains most of the logic
2015-11-01 21:27:28 +03:00
ZyX
136c560023 functests: Do not run some tests if there is no -NaN 2015-11-01 21:27:27 +03:00
ZyX
00a638179d runtime: Add autoload/msgpack.vim helper file 2015-11-01 21:27:27 +03:00
Thiago de Arruda
7e8b431d3f tui: Fix abort when stdout and stderr are not tty.
The abort came from using libuv tty handle on non-tty fd. Use uv_pipe_t in these
cases. Also add simple test for this case.
2015-10-29 08:13:45 -03:00
Thiago de Arruda
e5165bae11 input: Remove CURSORHOLD key
Refactor input.c, normal.c and edit.c to use the K_EVENT special key to trigger
the CURSORHOLD event. In normal and edit mode, K_EVENT is treated as
K_CURSORHOLD, which enables better handling of arbitrary actions in those
states(eg: In normal mode the previous operator counts will be restored).

Also fix a test in vim_spec.lua. The test had a wrong assumption: cmdheight is
only used to determine when the press enter screen will be shown, not to limit
how many lines or control pagination.
2015-10-26 10:52:01 -03:00
Thiago de Arruda
e596234fc2 test: Add more TUI tests and increase timeout 2015-10-26 10:52:01 -03:00
Justin M. Keyes
0f9dea2a0e vim-patch:7.4.849
Problem:    Moving the cursor in Insert mode starts new undo sequence.
Solution:   Add CTRL-G U to keep the undo sequence for the following
            cursor movement command. (Christian Brabandt)

8b5f65a527

Closes #3492
2015-10-26 02:23:59 -04:00
Justin M. Keyes
1ca5646bb5 Merge pull request #3470 from ZyX-I/pr-3198
XDG base directory specification support
2015-10-25 22:38:23 -04:00
ZyX
e5537a935f functests: Fix tests 2015-10-23 15:56:51 +03:00
ZyX
6b17d35ff1 functests: Use . for various folder defaults in tests 2015-10-23 15:56:51 +03:00
ZyX
ec1ca54d59 functests: Do not forget about -i argument
Target: make all tests run with chmod -x ~/.config/nvim ~/.local/share/nvim.
2015-10-23 15:56:51 +03:00
ZyX
b7732cceca functests: Fix 078_swapfile_recover test 2015-10-23 14:54:11 +03:00
ZyX
ea2fe52552 functests: Add test to check expected behaviour (failing) 2015-10-23 14:47:59 +03:00
ZyX
3a4a941885 shada: Fix memory leak and double free when setting both &vi and &sd 2015-10-08 22:01:12 +03:00
ZyX
1162962d8b functests: Refactor tests:
- Remove unused variables.
- Do not use helpers.nvim_feed in most cases.
- Do not use helpers.nvim and helpers.nvim_eval at all.
- Add helpers.funcs and helpers.\*meths special tables. Indexing such table 
  creates functions which call helpers.call or helpers.nvim (and similar) with 
  first argument equal to table index.
2015-10-08 22:01:12 +03:00
ZyX
2dd8e05f9f shada: Fix jump/change list merging code
Errors happens under following conditions:

1. Jump/change list is full.
2. New jump/change list item should go between some of the old ones.
2015-10-08 22:01:11 +03:00
ZyX
b8e7915596 shada: Make sure that shada-r option correctly ignores case 2015-10-08 22:01:10 +03:00
ZyX
0966e92cf4 shada: When using shada-r normalize option path 2015-10-08 22:01:10 +03:00
ZyX
7085ea07d8 functests: Move exc_exec to test.functional.helpers 2015-10-08 22:01:10 +03:00
ZyX
56a2549ff8 functests: Do not disable pattern tests
Problem that led to this skip was fixed in [#3309][1].

[1]: 0a116c828d
2015-10-08 22:01:07 +03:00
ZyX
d283e758ea shada: Fix out-of-bounds array access
It leads to a memory leak as well. May overwrite wms->jumps_size.
2015-10-08 22:01:07 +03:00
ZyX
29a3e972de shada: Fix v:hlsearch save/restore and do not write empty patterns 2015-10-08 22:01:05 +03:00
ZyX
915a298223 shada,functests: Fix v:hlsearch saving/restoring handling 2015-10-08 22:01:04 +03:00
ZyX
48ba2f0109 documentation/functests: Replace NeoVim with Neovim 2015-10-08 22:00:49 +03:00
ZyX
be45e75026 shada: Refuse to write ShaDa file when ShaDa was disabled 2015-10-08 22:00:46 +03:00
ZyX
b249529676 functests: Make one recover_spec test also use gdb or valgrind 2015-10-08 22:00:45 +03:00
ZyX
804e074096 eval,functests: Reference all additional_* items created by ShaDa 2015-10-08 22:00:45 +03:00
ZyX
369081d1c4 shada: Fix crash in hmll_insert
This problem made test64 to crash. Description of the bug: when removing entry
from history when removed entry is not the last one it puts one element to
free_entries list, but ignores free entries starting from last_free_element.

Possible solutions:
1. First working: simply populate free_entries list with entries which are still
   free, starting from last_free_element.
2. Better (wastes less CPU): after free_entries list size goes to zero (which is
   the initial value) continue using last_free_element.
3. Even better (less memory): note that element from the list is *only* removed
   before adding another one. So replace free_entries array with one item.

Also renamed last_free_element to last_free_entry: in any case most of the lines
which mention it were altered.
2015-10-08 22:00:43 +03:00
ZyX
0960e16908 functests: Disable some tests when running with address sanitizer
Ref #1350
2015-10-08 22:00:43 +03:00
ZyX
17c69258a7 shada: Use same merging code for jumps and changes 2015-10-08 22:00:39 +03:00
ZyX
74d5084139 shada,functests: Add tests for merging ShaDa data 2015-10-08 22:00:38 +03:00
ZyX
4dc3bc8fc1 shada,functests: Make sure that v:oldfiles list is reset on :rshada! 2015-10-08 22:00:37 +03:00
ZyX
830c8bd23e functests: Add a number of “generic” functional tests 2015-10-08 22:00:36 +03:00
ZyX
fd4d5521a3 shada,functests: Use special sd_reader function for skipping 2015-10-08 22:00:34 +03:00
ZyX
17b5d27d85 functests: Move wshada and sdrcmd commands to helpers 2015-10-08 22:00:34 +03:00
ZyX
1542fc221e shada,functests: Improve detection of invalid ShaDa files
It appears that large portion of non-ShaDa ASCII text files may be parsed as
a ShaDa file because it is mostly recognized as a sequence of unknown entries:
all ASCII non-control characters are recognized as FIXUINT shada objects, so
text like

    #!/bin/sh

    powerline "$@" 2>&1 | tee -a powerline

(with trailing newline) will be recognized as a correct ShaDa file containing
single unknown entry with type 0x23 (dec 35, '#'), timestamp 0x21 (dec 33, '!')
and length 0x2F (dec 47, '/') without this commit. With it parsing this entry
will fail.
2015-10-08 22:00:29 +03:00
ZyX
12a31c70c1 shada,functests: Test compatibility support
For compatibility the following things are done:

1. Items with type greater then greatest type are ignored when reading and
   copied when writing.
2. Registers with unknown name are ignored when reading and blindly copied when
   writing.
3. Registers with unknown type are ignored when reading and merged as usual when
   writing.
4. Local and global marks with unknown names are ignored when reading. When
   writing global marks are blindly copied and local marks are also blindly
   copied, but only if file they are attached to fits in the `'N` limit defined
   in &shada. Unknown local mark’s timestamp is also taken into account when
   calculating which files exactly should fit into this limit.
5. History items with unknown type are ignored when reading and blindly copied
   when writing.
6. Unknown keys found in register, local marks, global marks, changes, jumps and
   search pattern entries are read to additional_data Dictionary and dumped (of
   course, unless any of these elements were not overwritten later). It
   obviously works only for values conversible to Object type.
7. Additional elements found in replacement string and history entries are read
   to additional_elements Array and dumped (same: only if they were not
   overwritten later). Again this works only for elements conversible to Object
   type.
8. Additional elements found in variable entries are simply ignored when
   reading. When writing *new* variables they will be preserved during merging,
   but that’s all. Variable values dumped from current NeoVim session never have
   additional elements.
2015-10-08 22:00:25 +03:00
ZyX
2244db67aa shada: Do not allow empty keys 2015-10-08 22:00:22 +03:00
ZyX
56174572bc shada,documentation: Extend read error handling, handle write errors
Modifications:
- If file was not written due to write error then writing stops and temporary
  file will not be renamed.
- If NeoVim detects that target file is not a ShaDa file then temporary file
  will not be renamed.
2015-10-08 22:00:16 +03:00
ZyX
e2994a3c62 shada,functests: Test how ShaDa support code reacts on errors
Some notes:
- Replaced msgpack_unpacker usage with regular xmalloc’ed buffer. Also since
  msgpack_unpack_next (as well as msgpack_unpacker_next) is not ever going to
  return MSGPACK_UNPACK_EXTRA_BYTES this condition was checked manually.
  Function that does return this status is msgpack_unpack, but it is marked as
  obsolete.
- Zero type is checked prior to main switch in shada_read_next_item because
  otherwise check would be skipped.
- Zeroing entry at the start of shada_read_next_item makes it safer.
- dedent('') does not work.
- v:oldfiles list is only replaced with bang, if it is NULL or empty.
2015-10-08 22:00:15 +03:00
ZyX
875d287d4b functests: Test that history is still accessible after :wshada 2015-10-08 22:00:10 +03:00
ZyX
1d3823a5c9 shada: Populate v:oldfiles 2015-10-08 22:00:09 +03:00
ZyX
f43a5e6926 shada: Save v:hlsearch value 2015-10-08 22:00:08 +03:00
ZyX
8663983cc4 Deprecate &viminfo and :[rw]v, add &shada and :[rw]sh 2015-10-08 22:00:07 +03:00
ZyX
9cf9c4a586 Replace references to viminfo in various places 2015-10-08 22:00:06 +03:00
ZyX
749cae8662 functests: Fix change list ShaDa test failures 2015-10-08 22:00:06 +03:00
ZyX
c8c5da875c functests: Test &encoding support 2015-10-08 22:00:03 +03:00
ZyX
d1ae27ceec shada,functests: Refactor shada items skipping 2015-10-08 21:59:56 +03:00
ZyX
cf004c0d41 functests: Test dumping and loading change list 2015-10-08 21:59:56 +03:00
ZyX
42536abd33 functests: Add tests for dumping/restoring registers 2015-10-08 21:59:55 +03:00
ZyX
8c93877e1c shada: Add support for dumping and restoring buffer list 2015-10-08 21:59:55 +03:00
ZyX
200e62efeb shada: Add support for dumping/restoring bufs changes and win jumps 2015-10-08 21:59:53 +03:00
ZyX
9ab08c8256 functests: Test loading last search/substitute pattern/replacement 2015-10-08 21:59:53 +03:00
ZyX
bc52522616 functests: Add history tests 2015-10-08 21:59:53 +03:00
ZyX
46387b9aac functests: Add tests for mark dumping/reading 2015-10-08 21:59:52 +03:00
ZyX
e143be7f3d functests: Add tests for ShaDa variables dumping/reading 2015-10-08 21:59:52 +03:00
ZyX
244dbe3a77 viminfo: First version of ShaDa file dumping
What works:

1. ShaDa file dumping: header, registers, jump list, history, search patterns,
   substitute strings, variables.
2. ShaDa file reading: registers, global marks, variables.

Most was not tested.

TODO:

1. Merging.
2. Reading history, local marks, jump and buffer lists.
3. Documentation update.
4. Converting some data from &encoding.
5. Safer variant of dumping viminfo (dump to temporary file then rename).
6. Removing old viminfo code (currently masked with `#if 0` in a ShaDa file for
   reference).
2015-10-08 21:59:51 +03:00
Björn Linse
57d3a2a52f api: represent api type String as msgpack type STR. closes #1250 2015-10-08 20:18:46 +02:00
Justin M. Keyes
5a9b2fc1ae test: menu_spec: avoid screen test.
Redraw can be flaky especially when remote commands happen during
command-mode. Assert the state directly instead of using Screen.
2015-10-04 15:11:23 -04:00
bambu
2788f7fcc8 menu: support :emenu invoked by cmenu map. 2015-10-03 03:02:05 -04:00
Thiago de Arruda
5d185c7772 test: Add basic tests for the TUI
The tests use `termopen` to spawn nvim and verify the TUI.
2015-10-01 15:22:49 -03:00
Thiago de Arruda
1143b416ab tui: Don't use 'pastetoggle' for automatic pasting
Add a new special key that can be used by UIs to toggle the 'paste' option and
use it in the TUI instead of the user's 'pastetoggle' value.

Close #2843 #2092
2015-10-01 15:22:48 -03:00
Thiago de Arruda
c1edd07990 shell: Ensure silent bang mappings won't cut output
Setting `msg_didout` after `call_shell` is enough as it will cause
`hit_return_msg()` to print on next line.

Close #3269
2015-10-01 15:22:48 -03:00
John Szakmeister
625f8ec07f Disable a broken functional test.
No one has taken a real interest in fixing this, so let's disable it for
now.  The issue crops up most on the QB OS X node, but it has
periodically occurred under other nodes too.
2015-10-01 07:01:13 -04:00
ZyX
0be94d1e5a functests: Do not use user viminfo file 2015-09-30 10:09:27 +03:00
ZyX
6da3fadd9f eval/msgpackdump(): Use copyID for protecting against recursive input
Should be faster then O(depth) iteration, but removes const qualifiers.
2015-09-30 10:09:21 +03:00
Florian Walch
54596396bc test: Check for installed Python module with Vimscript function.
Use the existing Vimscript function provider#pythonx#Detect()
to determine whether the Neovim Python module is installed and
Python 2/3 tests can be run.
2015-09-27 00:03:06 +02:00
Justin M. Keyes
b22b568266 test: K, 'keywordprg' 2015-09-23 00:06:27 -04:00
ZyX
c6102f9a9f functests: Test how msgpack\* functions behave with invalid input 2015-09-19 01:54:43 +03:00
ZyX
e881a20dfb functests: Split msgpack\* function tests into three groups:
- Tests that use both functions.
- Tests that use msgpackparse().
- Tests that use msgpackdump().
2015-09-19 01:54:43 +03:00
ZyX
10fd95a9ea functests/helpers: Add exc_exec function that checks the exception 2015-09-19 01:54:43 +03:00
Thiago de Arruda
47cbbc0b8c terminal: Run screen refresh timer in a deferred queue
Close #3332
2015-09-18 14:35:26 -03:00
Björn Linse
c8aaabc09c api: vim_err_write: add tests for multiline handling 2015-09-16 21:42:57 +02:00
Thiago de Arruda
22ea2900d0 loop: Free the parent queue last when destroying the loop
This avoids a heap-use-after-free ASAN error. Close #3334
2015-09-16 02:52:55 -03:00
Björn Linse
087f3bacaf encoding: test that &encoding cannot be changed
Helped-By: Justin M. Keyes <justinkz@gmail.com>
2015-09-08 10:56:15 +02:00
Björn Linse
ffff2c9c47 encoding: Update handling of encoding in tests
Always run tests with encoding=utf-8, regardless of user locale
Don't set &encoding after startup in tests

Helped-By: Michael Reed <m.reed@mykolab.com>
2015-09-08 10:54:31 +02:00
Felipe Morales
acdac914d5 clipboard: avoid clipboard during :global. #2809
This is equivalent to patches 7.4.396, 7.4.445 and 7.4.598.

vim-patch:7.4.396

Problem:    When 'clipboard' is "unnamed", :g/pat/d is very slow.
(Praful)
Solution:   Only set the clipboard after the last delete. (Christian
Brabandt)

1f285eb49a

vim-patch:7.4.445

Problem:    Clipboard may be cleared on startup.
Solution:   Set clip_did_set_selection to -1 during startup. (Christian
	    Brabandt)

1a19d37d90

vim-patch:7.4.598

Problem:    ":tabdo windo echo 'hi'" causes "* register not to be
changed.
	    (Salman Halim)
Solution:   Change how clip_did_set_selection is used and add
	    clipboard_needs_update and global_change_count.  (Christian
	    Brabandt)

af6a579263

Co-Author: @bfredl
2015-08-30 23:40:12 -04:00
Björn Linse
2b6d1546ec test59: Store all text as utf-8 and convert when needed 2015-08-26 10:31:26 +02:00
Björn Linse
f666b2cb12 test59: Make "syntax off" explicit, as default may change with #2675
Helped-By: Felipe Morales <hel.sheep@gmail.com>
2015-08-26 10:31:02 +02:00
Björn Linse
d4fae57a4c test59: Fixup incorrectly encoded utf-8 2015-08-26 10:30:55 +02:00
Lucas Hoffmann
a412e72a2f test59: Split tests into 1-1, etc
Helped-By: Björn Linse <bjorn.linse@gmail.com>
Fixed some output issues
2015-08-26 10:30:48 +02:00
Lucas Hoffmann
c7d58e7a56 test59: Turn the VimL test function into a lua function.
Helped-By: Björn Linse <bjorn.linse@gmail.com>
`spelldump | quit` must be in a function
2015-08-26 10:30:44 +02:00
Lucas Hoffmann
f3c67a617e test59: Write spell files from lua and use cp to get the right files in place
Use teardown to remove these temporary files
2015-08-26 10:30:44 +02:00
Lucas Hoffmann
ffe88f0d52 test59: Save source file in utf8, this will mess up a lot of characters. 2015-08-26 10:30:34 +02:00
Lucas Hoffmann
144b4954f7 test59: Turn function definition into source() call. 2015-08-26 10:30:30 +02:00
Lucas Hoffmann
e60e46596a test59: Inital clean up.
Fix some feed() calls and string delimiters
Fix trimming of buffer before final expect().
2015-08-26 10:30:25 +02:00
Lucas Hoffmann
0a495d0be8 tests: Migrate legacy test 59. 2015-08-26 10:30:22 +02:00
Felipe Morales
45121a267f defaults: set 'laststatus' to 2. #2876 2015-08-24 00:48:32 -04:00
Felipe Morales
be29de1fa2 defaults: set 'listchars' to "tab:> ,trail:-,nbsp:+". #2872
Re: https://github.com/neovim/neovim/issues/2676
2015-08-22 13:48:48 -04:00
Thiago de Arruda
105a72eabc terminal: Fix use after free
Since close_cb may free the terminal structure, save the "wipe" flag before
calling it.
2015-08-22 01:01:14 -03:00
John Szakmeister
f9778052af tests: fix the glob tests when building under a long path #3214 2015-08-21 23:58:39 -04:00
Thiago de Arruda
1beee0685d eval: Protect job callbacks from being redefined
ref: #3188
2015-08-21 13:28:49 -03:00
Robin Allen
d5b5063622 Notify attached UIs whenever menus change
This adds a redraw notification "update_menu" which is sent whenever
Vim's menus are changed by the :menu command and friends.
2015-08-21 14:23:50 +01:00
Thiago de Arruda
0d71354058 test: Make sure ENTER prompt is exited in clipboard_provider_spec
The test may hang without this.
2015-08-13 07:41:04 -03:00
Justin M. Keyes
d21690a66e test: cover :grep
References #3156
2015-08-11 12:49:50 -04:00
Justin M. Keyes
5c1dc0fbe7 test: fix pending() invocations
AFAICT busted does not report pending() invocations without the 2nd
argument.
2015-08-09 22:33:28 -04:00
Justin M. Keyes
62c53c404b test: move runtime/autoload/* to provider/
- Organize tests by logical function, not the literal impl location.
- Avoid deep nesting / hyper-hierarchy.
2015-08-09 22:33:28 -04:00
Justin M. Keyes
698482ec3e test: python: report pending() if python{2,3} is missing 2015-08-09 22:33:28 -04:00
Marco Hinz
990c0350ab vim-patch:7.4.773 #3066
Problem:  'langmap' is used in command-line mode when checking for mappings.
Solution: Do not use 'langmap' in command-line mode. (Larry Velazquez)

Original patch:
  https://code.google.com/p/vim/source/detail?r=5b1eefbf9a532f32a66fa13abbd671488aaafd5c
2015-08-09 21:12:11 -04:00
Björn Linse
d4ebbaa91a clipboard: support clipboard=unnamedplus,unnamed 2015-08-07 13:06:13 +02:00
Justin M. Keyes
5a19585865 test: cover msgpackparse() regression 2015-08-05 19:08:06 -04:00
Justin M. Keyes
9f350e615c Merge pull request #3034 from ZyX-I/msgpack-eval
msgpack viml functions for dump/restore
2015-08-03 00:24:10 -04:00
ZyX
030f360312 functests: Use eval subdirectory in place of viml 2015-08-02 22:19:58 +03:00
ZyX
7fbefd585e eval: Remove most of msgpack* functions limitations 2015-08-02 19:32:41 +03:00
ZyX
5a7135fa1c eval: Add msgpackparse and msgpackdump functions 2015-08-02 19:32:41 +03:00
Justin M. Keyes
efa059c5a4 test: call scandir_next_with_dots() more than once
Also cosmetic reduction.
2015-08-01 23:33:54 -04:00
Felipe Morales
ea551044ea Add the . and .. entries to glob()
os_scandir() and os_scandir_next() skip over those, because of the
unverlying libuv funcitons behaviour.

Fixes #2954
2015-08-01 23:16:17 -04:00
Omar Sandoval
f79025b9de tui: Use underline cursor in Replace mode
This is a port of my original contribution to Vim, added in 7.4.687
(https://github.com/vim/vim/commit/v7-4-687). The TUI code has been
heavily refactored (see esp. 25ceadab37),
so this required some translation, but the logic is the same.
2015-07-26 23:45:41 -04:00
Omar Sandoval
fa48fc667a api: Simplify UI API on mode change
Currently, there are two functions in the UI API that are called when
the mode changes: insert_mode() and normal_mode(). These can be folded
into a single mode_change() entrypoint which can do whatever it wants
based on the mode it is passed, limited to INSERT and NORMAL for now.
2015-07-26 23:38:35 -04:00
Björn Linse
7a6bf3f418 Add ui test for default title (with/without filename) #3091 2015-07-23 22:35:42 +02:00
Robin Allen
5ad619a847 menu: Fix :emenu mode detection #2992
A menu item can have separate bindings for each Vim mode.

:emenu checks to see which binding it should execute. But, it assumes
it can only be called from Normal mode, so its mode detection is based
on some guesswork. For instance, it detects if you've just used C-O
and, if so, uses the Insert mode binding.

Now that :emenu can be called from any mode (via vim_command), this
commit has it check the actual mode we're in, and simply use the
binding for that mode if we aren't in Normal mode.
2015-07-22 10:13:49 -04:00
Lucas Hoffmann
6571c84d54 tests: Migrate legacy test 80. #2989
The test is also split in several blocks and heavily modernized.  This was
done to prevent the following quoting and escaping problems during migration:
- the vim command `put =...` treats double quotes as the start of a comment so
  they have to be escaped with a backslash
- when inserting control characters on the command line they have to be
  escaped with <C-V>

The parts one and two of the test are functional identical so they are wrapped
in a local function. The only difference was which letters where used to test
the same feature.

Part six did test a flag in 'cpoptions' that has been removed in neovim.  It
has therefore been removed as well.

Reviewed-by: Michael Reed <Pyrohh@users.noreply.github.com>
2015-07-21 19:56:15 -04:00
Björn Linse
8047570b70 clipboard: add tests for error fallback and middleclick paste 2015-07-20 20:24:28 -04:00
Marco Hinz
2b2cea38a9 Test: fix functional/ex_cmds/recover_spec.lua
os.remove() wasn't removing the temporary swap directory which leads to
problems when the test is run a second time.

That's also the reason why the CI never caught this.

os.remove() got replaced by helpers.rmdir().
2015-07-20 22:19:16 +02:00
Marco Hinz
0f34b256aa Test: add new helper function: rmdir()
- lfs.rmdir() only removes empty directories

- os.remove() supercedes lfs.rmdir(); removes files and empty directories

- helpers.rmdir() first removes all files within a directory, then the
  directory itself
2015-07-20 22:19:07 +02:00
Sebastian Witte
fcb79ffc40 Implement API function to call functions #2979
Remove static modifier from func_call
Move MAX_FUNC_ARGS definnition from eval.c to eval.h
2015-07-19 17:18:31 +02:00
Lucas Hoffmann
42d38b363c tests: Split migrated test 57. 2015-07-19 04:06:45 +02:00
Lucas Hoffmann
1b2eb306f7 tests: Migrate legacy test 57. 2015-07-19 04:06:45 +02:00
Marco Hinz
9d876eb037 Test: synIDattr(): true color awareness 2015-07-18 16:55:25 +02:00
Thiago de Arruda
9e42ef4e13 test: lower sleep value in job test
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.
2015-07-16 23:10:01 -03:00
Thiago de Arruda
e85c9966b8 test: Increase determinism in screen_basic_spec tests 2015-07-16 23:08:09 -03:00
Lucas Hoffmann
d88c93acf3 tests: Style improvements and Makefile fix for migrated test 60. #2975 2015-07-16 20:31:20 -04:00
Justin M. Keyes
7b56a8230f test: buffer_spec: fix set_line invocation
- pcall result was always false because of wrong arity
- also re-arrange tests into it() blocks
2015-07-11 22:33:05 -04:00
Nick Hynes
c2f14bb89c test: api: exercise out-of-bounds line slicing 2015-07-11 18:20:35 -04:00
Lucas Hoffmann
c51d0e49a9 tests: Modernize migrated legacy test 62.
- 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>
2015-07-11 00:55:16 +02:00
Lucas Hoffmann
98c022c329 tests: Migrate legacy test 62. 2015-07-11 00:47:49 +02:00
Michael Reed
1b78ad1c4d Merge pull request #2932 from lucc/helpers/write_file
[RDY] tests: Add write_file helper function

Reviewed-by: Florian Walch <florian@fwalch.com>
Reviewed-by: Michael Reed <m.reed@mykolab.com>
2015-07-06 04:07:23 -04:00
Björn Linse
e9c9d44f65 clipboard: don't overwrite before pasting in visual mode. #2945
This occured when clipboard=unnamedplus and doing "+p in visual mode.
Fixes #2942.
2015-07-04 18:17:30 +02:00
Lucas Hoffmann
8f4e3a68a8 tests: Use new write_file() function in tests. 2015-06-30 18:06:06 +02:00
Lucas Hoffmann
652ee0348c tests: Use write_file() in source(). 2015-06-30 18:06:06 +02:00
Lucas Hoffmann
f0850775bf tests: Add helpers.write_file() to write short files. 2015-06-30 18:06:06 +02:00
Nick Hynes
105b8f1070 rplugin: allow users to register hosts #2896 2015-06-25 19:01:38 -04:00
Justin M. Keyes
f78bf64771 api: vim_set_var() should return the old value #2899
Closes #2816
2015-06-25 01:26:17 -04:00
Justin M. Keyes
20a57c497b tests: 061_undo_tree_spec: minor edits 2015-06-22 22:56:16 -04:00
Lucas Hoffmann
c411fb6cda tests: Repeat a flaky part of the migrated test 61.
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.
2015-06-22 17:05:10 +02:00
Lucas Hoffmann
1c7372361f tests: Split test 61 into several it() blocks. 2015-06-22 12:15:51 +02:00
Lucas Hoffmann
2ce3656754 tests: Fix an further simplify migrated test 61.
: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.
2015-06-22 12:08:24 +02:00
Lucas Hoffmann
981dd23f8d tests: Don't set ul in migrated test 61.
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.
2015-06-22 12:01:07 +02:00
Lucas Hoffmann
8c999a9d6c tests: Migrate legacy test 61.
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.
2015-06-22 11:58:43 +02:00
Lucas Hoffmann
7e7d78b2a6 doc: Fix some typos and trailing whitespace. #2875 2015-06-21 00:34:51 -04:00
Justin M. Keyes
9ebb5c681b defaults: enable 'hlsearch' by default. #2859
Also update the documentation regarding the option.

Re: https://github.com/neovim/neovim/issues/2676
2015-06-20 16:40:03 -04:00
Felipe Morales
8e3f67f2a0 defaults: enable 'autoindent' #2857
Re: https://github.com/neovim/neovim/issues/2676
2015-06-20 14:02:56 -04:00
Felipe Morales
41c76d9444 defaults: enable 'smarttab' by default. #2855 2015-06-20 13:45:47 -04:00
Shougo Matsushita
8b200f904f completion: Initialize v:completed_item #2839
v:completed_item should always be a dict (not empty string), even before
the first completion.
2015-06-20 11:53:13 -04:00
Lucas Hoffmann
c2065a183f tests: Modernize migrated argument_count test. 2015-06-16 01:36:17 -04:00
Lucas Hoffmann
55806fbe39 tests: Migrate legacy test argument_count. 2015-06-16 01:36:17 -04:00
Lucas Hoffmann
88b76ec146 tests: Modernize migrated legacy test argument_0count. 2015-06-16 01:23:23 -04:00
Lucas Hoffmann
a15ba262e4 tests: Migrate legacy test argument_0count. 2015-06-16 01:23:23 -04:00
Justin M. Keyes
1f0830f700 tests: wviminfo_spec.lua: rework
074_global_var_in_viminfo_spec: remove some redundant sanity checks.
2015-06-12 03:32:18 -04:00
Lucas Hoffmann
fa4b5211c6 tests: Add tests for the :wv command. 2015-06-12 00:10:58 -04:00
Lucas Hoffmann
d080375813 tests: Migrate legacy test 74.
Helped-By: David Bürgin <676c7473@gmail.com>
Helped-By: Justin M. Keyes <justinkz@gmail.com>
2015-06-12 00:10:58 -04:00
Shougo Matsushita
be66c0b357 Add complete() noinsert/noselect support #2792 2015-06-11 09:03:00 -04:00
Shougo Matsushita
e6c62c80ef Add noinsert and noselect features in completeopt #2564
Backported from vim_dev:
https://groups.google.com/forum/#!searchin/vim_dev/completeopt/vim_dev/tVsk0pdOGvs/fCzBbPkA4w0J

Use case:
https://github.com/Shougo/neocomplcache.vim/issues/426

Reviewed-by: Felipe Morales <hel.sheep@gmail.com>
Reviewed-by: Scott Prager <splinterofchaos@gmail.com>
Reviewed-by: Michael Reed <m.reed@mykolab.com>
2015-06-04 21:20:09 -04:00
Frederik Van Slycken
e54fa04b90 terminal : don't set vterm size to 0 (workaround #2732) 2015-05-31 11:53:07 -04:00
Florian Walch
122890463a tests: Use pending() instead of silently skipping test. #2737 2015-05-29 20:57:20 +03:00
Lucas Hoffmann
ee312ca9a4 tests: Migrate legacy test 65.
Helped-By: David Bürgin <676c7473@gmail.com>
2015-05-27 12:56:47 -04:00
Lucas Hoffmann
5218fc2ccb tests: Migrate legacy test 82.
Helped-By: David Bürgin <676c7473@gmail.com>
Helped-By: Shougo Matsushita <Shougo.Matsu@gmail.com>
2015-05-27 12:51:37 -04:00
David Bürgin
a3c3811436 tests: Migrate legacy test 3 #2399 2015-05-27 12:40:35 -04:00
Lucas Hoffmann
bc27c9e8d1 tests: Migrate legacy test 76. #2711 2015-05-27 12:31:09 -04:00
Lucas Hoffmann
a4c22c95e3 tests: Migrate legacy test 60. #2721
Helped-By: Justin M. Keyes <justinkz@gmail.com>
2015-05-27 12:06:13 -04:00
David Bürgin
e4c3ac1f82 tests: Convert legacy test29 2015-05-25 16:29:01 -04:00
Nelson Yeung
8ce22c6323 tests: Migrate legacy test 31 #2736 2015-05-25 15:47:12 +03:00
Shougo Matsushita
d9f97e3026 completion: Add v:completed_item feature #2563
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>
2015-05-24 17:05:12 -04:00
Felipe Morales
b90378dfb0 options: Enable &wildmenu, use "list:longest,full" for &wildmode by default #2677 2015-05-17 15:24:31 -04:00
Björn Linse
d9acfbd471 options: mark nonfunctional &termencoding option as hidden. #2631
Remove related dead code and references in the docs.

Helped-By: Michael Reed <m.reed@mykolab.com>
Helped-By: Shougo Matsushita <Shougo.Matsu@gmail.com>
2015-05-17 18:39:25 +02:00
Justin M. Keyes
64c7a36933 test: v:servername, serverstart(), serverstop() 2015-05-17 02:17:34 -04:00
David Bürgin
af4b0a76a7 vim-patch:7.4.587 #2622
Problem:    Conceal does not work properly with 'linebreak'. (cs86661)
Solution:   Save and restore boguscols. (Christian Brabandt)

https://github.com/vim/vim/commit/v7-4-587
2015-05-13 03:15:52 -04:00
Björn Linse
208013ae39 test/terminal: fix indeterminism in colorcolumn screen test
Previously, the screen test was expecting the screen state to be
identical to the previous screen test in `thelpers.screen_setup()`,
which is indeterministic. (The later screen test can accidentally
still see the previous identical state). The solution is to add a test
for a intermediate different state.
2015-05-10 20:18:46 +02:00
Clinton McKay
89d0e23624 test/ui: Add concealing tests. #2055 2015-05-09 17:21:54 +02:00
David Bürgin
9e91bb461f tests: Migrate legacy test 96 #2220 2015-05-04 23:36:08 -04:00
Scott Prager
1eb3396922 unify jobstart, termopen, and system interfaces
For any of these functions, if {cmd} is a string, execute
"&shell &shellcmdflag '{cmd}'", or simply {cmd} if it's a list.

In termopen(), if the 'name' option is not supplied, try to guess using
'{cmd}' (string) or {cmd}[0] (list).  Simplify ex_terminal to use the
string form of termopen().

termopen: get name from argument

Convert list_to_argv to tv_to_argv.

Helped-by: Björn Linse <@bfredl>
Helped-by: oni-link <knil.ino@gmail.com>
Helped-by: Thiago de Arruda <@tarruda>
2015-05-02 09:47:30 -04:00
Scott Prager
74aef89720 term: use an argument vector for termopen().
Old behaviour: termopen('cmd') would run `&shell &shcf "cmd"`, which
caused the functional tests to fail on some systems due to the process
not "owning" the terminal. Also, it is inconsistent with jobstart().

Modify termopen() so that &shell is not invoked, but maintain the old
behaviour with :terminal. Factor the common code for building the
argument vector from jobstart() and modify the functional tests to call
termopen() instead of :terminal (fixes #2354).

Also:
 * Add a 'name' option for termopen() so that `:terminal {cmd}` produces
   a buffer named "term//{cwd}/{cmd}" and termopen() users can customize
   the name.
 * Update the documentation.
 * Add functional tests for `:terminal` sinse its behaviour now differs
   from termopen(). Add "test/functional/fixtures/shell-test.c" and move
   "test/functional/job/tty-test.c" there, too.

Helped-by: Justin M. Keyes <@justinmk>
2015-05-02 09:47:29 -04:00
Michael Reed
98b3dc0571 vim-patch:7.4.659 + test
Problem:    When 'ruler' is set the preferred column is reset. (Issue 339)
Solution:   Don't set curswant when redrawing the status lines.

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

Helped-by: David Bürgin <676c7473@gmail.com>
Based on #2347 by @pvinis
2015-05-01 16:45:02 -04:00
Marco Hinz
6fb66f4416 UI test: visual selection after left click in tabline 2015-04-28 14:16:37 +02:00
Marco Hinz
6449921943 UI test: left click in tabline 2015-04-28 14:16:37 +02:00
David Bürgin
7f07646294 vim-patch:7.4.710
Problem:    It is not possible to make spaces visibible in list mode.
Solution:   Add the "space" item to 'listchars'. (David Bürgin, issue 350)

https://github.com/vim/vim/releases/tag/v7-4-710

Closes #2485.
2015-04-27 04:58:37 -04:00
David Bürgin
5a1a2ba783 vim-patch:7.4.537 #2509
Problem:    Value of v:hlsearch reflects an internal variable.
Solution:   Make the value reflect whether search highlighting is actually
            displayed. (Christian Brabandt)

https://github.com/vim/vim/releases/tag/v7-4-537
2015-04-27 02:10:57 -04:00
David Bürgin
af863d46a9 vim-patch:7.4.532 #2504
Problem:    When using 'incsearch' "2/pattern/e" highlights the first match.
Solution:   Move the code to set extra_col inside the loop for count.  (Ozaki
            Kiichi)

https://github.com/vim/vim/releases/tag/v7-4-532
2015-04-27 01:46:43 -04:00
Marco Hinz
5b94632f6e test: don't process vimrc #2511
676133aa introduced a new test for calling a nvim instance recursively.
But without '-u NONE', the vimrc (and all plugins) get loaded too, which
breaks the test for things that do stuff on VimEnter.
2015-04-25 23:50:15 -04:00
Shougo Matsushita
42de617974 Add if_python3 support
Reviewed-by: Michael Reed <m.reed@mykolab.com>, Daniel Hahler <github@thequod.de>
Helped-by: Daniel Hahler <github@thequod.de>
2015-04-21 06:20:23 +09:00
Björn Linse
26fedb133d clipboard: cleanup valid_yank_reg and use it for :redir
This fixes missing clipboard support for `:redir`

Helped-By: Michael Reed <m.reed@mykolab.com>
Helped-By: Scott Prager <splinterofchaos@gmail.com>
2015-04-17 16:12:32 +02:00
Björn Linse
edb13791bd clipboard: simplify handling of of put in visual mode.
When clipboard=unnamed and put over visual selection, reduces number of
provider calls from 6 to 2. Also add test.
2015-04-17 11:34:06 +02:00
Scott Prager
b47ea5fcde Merge pull request #2331 from splinterofchaos/serverlisten
vimL: serverlisten({addr}), list(), and stop({addr})
2015-04-14 15:45:39 -04:00
Scott Prager
9353fcf024 server: add unit tests 2015-04-14 15:31:04 -04:00
Scott Prager
920e5905d8 channel: recognized nvim-style errors 2015-04-13 10:20:42 -04:00
Scott Prager
676133aa9b msgpack: Allow notifications to execute commands.
Consider: `let vim = rpcstart('nvim', ['--embed'])`

Allows `rpcnotify(vim, ...)` to work like an asynchronous
`rpcrequest(nvim, ...)`.

Helped-by: Michael Reed <m.reed@mykolab.com>
Helped-by: Justin M. Keyes <>
2015-04-13 10:20:42 -04:00
Justin M. Keyes
b23e444b37 test regression: recover_spec.lua 2015-04-12 01:14:54 -04:00
Justin M. Keyes
04806dee4b test: helpers.lua: add temporary set_session() function
This function is needed until helpers.lua is refactored to support
multiple sessions.
2015-04-12 01:02:58 -04:00
Justin M. Keyes
2275297f4a test: migrate legacy test 78 2015-04-12 01:02:58 -04:00
Marco Hinz
0e65962a68 Remove all references to JobActivity
The JobActivity event got replaced by callback functions provided to
jobstart() or termopen().

It got removed here:

6e7757ad51
2015-04-11 18:32:18 +02:00
Thiago de Arruda
ad8d415e3a test: Remove indeterminism in job_spec.lua pty tests 2015-04-11 08:46:59 -03:00
Thiago de Arruda
ccd42e81c8 eval: Fix jobwait()
- Properly save job event deferring state for recursive calls
- Disable breakcheck while running. Breakcheck can invoke job callbacks
  in unexpected places.
2015-04-11 08:46:59 -03:00
Björn Linse
9978a01faa clipboard: fix "" register not updated when clipboard=unnamed
Helped-By: Scott Prager <splinterofchaos@gmail.com>
2015-04-11 11:11:52 +02:00
Björn Linse
941b02af4c clipboard: adjust v:register when clipboard=unnamed
Helped-By: Nicolas Hillegeer <nicolas@hillegeer.com>
Helped-By: Michael Reed <m.reed@mykolab.com>
2015-04-11 11:11:52 +02:00
Marco Hinz
cd7b910e81 Add new highlight groups TermCursor/TermCursorNC
These highlight groups replace the old mechanism of setting:

  - {g,b}:terminal_focused_cursor_highlight
  - {g,b}:terminal_unfocused_cursor_highlight
2015-04-09 16:38:32 +02:00
Michael Reed
0f6e25a9e4 messages: Update common instances of Vim to Nvim #2031 2015-04-08 23:05:39 -04:00
Scott Prager
e1bac3b840 Merge pull request #2346 from splinterofchaos/fix-terminal
[RFC] terminal: Handle loss of focus in event loop.
2015-04-08 12:27:52 -04:00
Murali Suresh
ee3af18640 legacy tests: migrate test38 #2367 2015-04-07 19:21:55 -04:00
David Bürgin
9a6a311f35 tests: Migrate legacy tests 44 and 99 #2366
Consolidates the old test44 and test99 tests into one busted spec.
2015-04-07 18:54:27 -04:00
David Bürgin
d41322fafb tests: Migrate legacy tests 92 and 93 #2261 2015-04-05 22:14:10 -04:00
Scott Prager
b8ae09b3cf term: after <C-\>, resume normal input loop
Pressing <C-\> and then a mouse click will insert the click into the
terminal as if a keyboard button had been pressed.

Keep track of whether the last input was <C-\> and only call
terminal_send_key() if the next input is a key press.
2015-04-05 13:40:21 -04:00
Scott Prager
b6296f4e84 terminal: Handle loss of focus in event loop.
While in a terminal and insert mode, if an event caused loss of focus,
nvim would stay in the terminal event loop causing an inconsistent view
of internal state and/or segfault.

Remove the "term" argument from terminal_enter() as it only makes sense
to call it with curbuf->terminal. Terminate the loop when switched to a
different buffer.

fixes #2301
2015-04-05 13:39:55 -04:00
Björn Linse
adcf268a72 clipboard: handle clipboard reading directly in get_yank_register
This makes :<c-r>* work as expected and
avoids clobbering zero register ("0) when pasting unnamed clipboard

Helped-By: Scott Prager <splinterofchaos@gmail.com>
Helped-By: Michael Reed <m.reed@mykolab.com>
2015-04-05 11:34:14 +02:00
Björn Linse
db92fcdba3 test/clipboard: more clipboard test cleanups 2015-04-05 11:34:13 +02:00
Björn Linse
7422843f5c clipboard: improve the handling of newlines in get_clipboard
This makes the interpretion consistent with the way newlines are used in
the VIMENC format, while keeping the same fallback behaviour when
regtype is unspecified. Also check both cases explicitly in the tests.
2015-04-05 11:34:13 +02:00
Björn Linse
34dba3d7cd clipboard: reallow :put 2015-04-05 11:34:13 +02:00
Björn Linse
5600b80c1f clipboard: show "* and "+ in :registers
Helped-by: Robin Allen <r@foon.uk>
Helped-by: Scott Prager <splinterofchaos@gmail.com>
2015-04-05 11:34:13 +02:00
Björn Linse
638ceea092 test/clipboard: split unrelated subtests 2015-04-05 11:34:13 +02:00
Thiago de Arruda
3a20a9847e test/ui: Fix indeterminism in screen_basic_spec 2015-04-03 09:05:04 -03:00
Björn Linse
1e7624d2a0 tests/ui: warn when the correct state was seen temporarily.
Helped-by: Thiago de Arruda <tpadilha84@gmail.com>
2015-04-03 09:05:04 -03:00
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
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
Thiago de Arruda
4c92a0baca deps: Add Luajit compilation flags to improve debugging 2015-02-10 09:57:24 -03: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
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
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
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
Thiago de Arruda
d561ba223d job: Refactor to ensure that all callbacks will be invoked
It's possible that a child process won't close it's standard streams, even after
it exits. This can be evidenced with the "xclip" program:

    :call system('xclip -i -selection clipboard', 'DATA')

Before this commit, the above command wouldn't return, even though the xclip
program had exited. That is because `xclip` wasn't closing it's stdout/stderr
streams, which would block pending_refs from ever reaching 0.

Now the job.c module was refactored to ensure all streams are closed when the
uv_process_t handle is closed.
2014-10-23 21:19:08 -03:00
Nate Sullivan
d11fd1950f legacy tests: migrate test35. #1318
Migrate vim's integration test 35 (increment/decrement commands) to
lua/busted.
2014-10-22 15:28:26 -04:00
Thiago de Arruda
f7fab4af86 test: verify that v:shell_error is set by system()/systemlist() 2014-10-22 07:15:55 -03:00
Thiago de Arruda
0c2ec77ae0 test: Use lua to perform sanity API checks
Sanity API checks made by the python-client in the api-python travis target were
converted to lua and will now live in this repository. This will simplify
performing breaking changes to the API as it won't be necessary to send parallel
PRs the python-client.
2014-10-16 14:06:54 -03:00
Thiago de Arruda
69561ea922 test: Remove run-functional-tests.py
Now that the lua client is available, python/lupa are no longer necessary to run
the functional tests. The helper functions previously defined in
run-functional-tests.py were adapted to test/functional/helpers.lua.
2014-10-16 09:21:37 -03:00
Thiago de Arruda
35d7815eb2 test: Add some specs for the viml function system()
These new specs replace src/nvim/testdir/test_system
2014-10-01 21:41:54 -03:00
Thiago de Arruda
f6a008a182 test: Add 'eval' functional helper
The eval helper transforms vimL expressions into lua tables, it's useful for
verifying function output.
2014-10-01 09:31:57 -03:00
Thiago de Arruda
549fc9548d test: Move 'test/legacy' to 'test/functional'
Busted can only discover tests from a single directory. In order to allow tests
under 'legacy' to run as a functional test, it needed to be moved to
'test/functional'.
2014-10-01 09:05:28 -03:00
Thiago de Arruda
42d5b526b9 test: Replace vroom by lua/busted for functional tests
The 'lupa' python package provides a simple way to seamless integrate lua and
python code.

This commit replaces vroom by a python script that exposes the 'neovim' package
to a lua state, and invokes busted to run functional tests. This is a temporary
solution that will enable writing functional tests using lua/bused while a lua
client library is not available.

The reason for dropping vroom is flexibility: Lua/busted has a nice DSL-style
syntax while also providing the customization power of a full programming
language. Another reason is to use a single framework for unit/functional tests.

Two other changes were performed in this commit:

- Instead of "gcc-unittest/gcc-ia32", the travis builds for gcc are now
  identified by "gcc/gcc-32". They will run unit/functional tests for both 64
  and 32 bits.
- Old integration tests(in src/nvim/testdir) are now ran by the 'oldtest' target
2014-09-30 17:37:16 -03:00