Commit Graph

501 Commits

Author SHA1 Message Date
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
Russ Adams
7be75a0291 test: os_system: spec for non-zero exit. #3419 2015-10-04 22:57:21 -04: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
Thiago de Arruda
c708061a5a os/path: Fix path_get_absolute_path for top-level paths
Close #2833
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