Commit Graph

52 Commits

Author SHA1 Message Date
Jun T
edbc97225d test: shada_spec: resolve symlink
If the build directory path has symlinks in it, 'make functionaltest'
fails at shada_spec.lua:177 because readme_fname has symlink but
nvim resolves the symlink when writing it into the shada file.
2016-02-12 00:03:39 +09:00
ZyX
efaf76e623 functests: Update tests 2016-01-07 00:54:57 +03:00
ZyX
ea67bf808b shada: Continue dumping when variables failed to dump
Closes #3721
2015-12-18 19:29:49 +03:00
Justin M. Keyes
b9139e009f Merge pull request #3724 from ZyX-I/fix-3635
shada: Do not save unlisted and quickfix buffers
2015-11-27 18:06:52 -05:00
Felipe Morales
80cf03602e Merge pull request #3581 from ZyX-I/fix-shada
Store last search direction when writing ShaDa files
2015-11-23 23:03:29 +01:00
ZyX
b98cea909f shada: Also store last search direction
Note: it looks like viminfo files do not store search direction intentionally.
After reading viminfo file search direction was considered to be “forward”.

Note 2: all files created on earlier Neovim version will automatically receive
“forward” direction.

Fixes #3580
2015-11-23 17:08:01 +03:00
Marco Hinz
4a69e55f39 test/functional: clean up according to luacheck (part 1) 2015-11-23 13:57:21 +01:00
ZyX
ec8e60a055 shada: Do not save unlisted and quickfix buffers
Fixes #3635
2015-11-23 15:12:08 +03: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
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
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