Commit Graph

95 Commits

Author SHA1 Message Date
dundargoc
736c36c02f
test: introduce skip() #21010
This is essentially a convenience wrapper around the `pending()`
function, similar to `skip_fragile()` but more general-purpose.

Also remove `pending_win32` function as it can be replaced by
`skip(iswin())`.
2022-11-13 05:52:19 -08:00
zeertzjq
71e70d0c99
vim-patch:9.0.0537: the do_set() function is much too long (#20274)
Problem:    The do_set() function is much too long.
Solution:   Move setting of a string option to a separate function.
4740394f23

Cherry-pick some tests from Vim patch 8.2.0540.
2022-09-22 09:43:37 +08:00
Justin M. Keyes
f05a2891d3 build: rename build-related dirs
Problem:
Dirs "config", "packaging", and "third-party" are all closely related
but this is not obvious from the layout. This adds friction for new
contributors.

Solution:
- rename config/ to cmake.config/
- rename test/config/ to test/cmakeconfig/ because it is used in Lua
  tests: require('test.cmakeconfig.paths').
- rename packaging/ to cmake.packaging/
- rename third-party/ to cmake.deps/ (parallel with .deps/)
2022-06-28 04:02:29 -07:00
bfredl
e3281d992e fix(tests): check for EOF on exit of nvim properly 2022-06-13 10:15:44 +02:00
Justin M. Keyes
2afbce7651
refactor(tests): remove redir_exec #15718
Problem
- `redir_exec` is obsolete, but it keeps getting used in new tests
  because people copy existing tests.
- Disadvantages of `redir_exec`:
  - Captures extra junk before the actual error/message that we _want_ to test.
  - Does not fail on error, unlike e.g. `command()`.

Solution
- Use new functions like `nvim_exec` and `pcall_err`.
2021-09-19 02:29:37 -07:00
Sean Dewar
ef729fb15b
feat(shada): restore Blob globals properly
As Strings and Blobs are encoded as msgpack BINs, the current ShaDa
implementation will restore global Blob variables as Strings (or msgpack
special dicts if they contain NULs).

Encode an additional element with Blob globals to differentiate them
from Strings so that we can restore them with the correct type.

Adjust variables_spec.lua's autotest() to also check for proper type.
2021-09-15 21:19:30 +01:00
Justin M. Keyes
6751d6254b
refactor(tests): use assert_alive() #15546 2021-09-01 09:42:53 -07:00
erw7
a4fe8bdc97
shada: fix failed assertion on exit (#12692)
If set the number of history saves is 0, assertions fail when inserting an entry on exit.
Dont insert an entry when the number of saves is 0 fixes the issue.

fixes #11497
2020-07-31 16:08:34 +02:00
erw7
f1cbd39f7b vim-patch:8.2.0920: writing viminfo fails with a circular reference
Problem:    Writing viminfo fails with a circular reference.
Solution:   Use copyID to detect the cycle. (closes vim/vim#6217)
5b157fe2ed
2020-06-09 23:54:07 +09:00
erw7
9fc3949841 shada: fix write E5004 error on exit
Fix the problem of failing to write shada when the global variable contains
Funcref or Partial.
2020-06-08 23:15:10 +09:00
Abdelhakeem Osama
6692c0958f shada: initialize jumplist before search pattern (#10964)
Since 8b8ecf4, the shada module loads files in the jumplist to properly
clear duplicates. This can trigger some autocommands, which in turn
saves and restores search and substitute patterns, freeing the previous
strings in "spats" which are held in "wms" as well (heap-use-after-free).
To avoid this, initialize the jumplist in "wms" before search patterns.
2019-09-07 18:02:29 -07:00
Justin M. Keyes
4bb728dfa0
test: Minimize shada/helpers.lua #10728 2019-08-09 10:23:57 +02:00
Abdelhakeem Osama
35362495c9 jumplist: avoid extra tail entry #9805
fixes #9775
2019-04-02 00:50:28 +02:00
Björn Linse
4da5cb38d3 startup: always wait for UI with --embed, unless --headless also is supplied 2018-09-22 10:18:28 +02:00
ZyX
5d9bb16d66 functests: Use proper path in eq() 2018-04-02 11:14:11 +03:00
ZyX
dd1b493f75 shada: Fix some memory leaks and completely ignore numbered mark names
Problems:
- In two places in shada_read_when_writing() memory just was not freed. Both 
  places were verified to cause test failures.
- Numbered marks got assigned incorrect (off-by-one compared to position in the 
  array) numbers in replace_numbered_mark.
- It was possible to have non-continuously populated array of numbered marks 
  which messed up code for merging them.

(Note about tests: marks with additional data are always compared different when 
merging, that caused some confusion regarding why test did not work the way 
I expected.)
2018-04-01 21:29:47 +03:00
ZyX
1ac1f520f0 functests: Add test for merging with file with only numeric mark
Known to cause memory leak, but not an expected crash.
2018-04-01 20:04:35 +03:00
ZyX
17ea0f2214 functests: Fix existing functional tests 2018-03-27 01:33:59 +03:00
Justin M. Keyes
b616ef9b22 tests: stderr output contains cp noise
closes #7811
2018-01-05 18:18:26 +01:00
ZyX
6b45dbca04 mark: Make sure that jumplist item will not have zero lnum
Fixes #7169
2017-12-24 00:32:43 +03:00
Ignas Anikevicius
e9dba214ea test/shada: fixup for Windows backslashes #7287 2017-10-02 00:48:43 +02:00
ZyX
91b9ad7d82 shada: Make sure that code does not attempt to read too long items
Fixes #6957
2017-07-04 15:41:59 +03:00
AdnoC
5908f562df test: Fix and add cases for unnamed register
Also:

Add ru to shada tests with all keys

Add test for unset unnamed and register 0
2017-05-31 13:31:05 -04:00
AdnoC
beca4dc16c eval/shada: Add testing for unnamed register with setreg and startup 2017-05-31 13:19:08 -04:00
James McCoy
2dc27a8a78 shada: Remember whether "0 or "1 was the unnamed register
Ref #4645
2017-05-24 14:17:19 -04:00
ZyX
cdb1aa3e47 eval: Fix len argument to xstrlcat 2017-03-29 10:08:45 +03:00
Rui Abreu Ferreira
ae1ba2b2fb test: Windows: Re-enable shada functional tests
One of the tests remains disabled until we figure out the expected
behaviour of mkdir() on Windows when `prot` is passed.
2017-01-08 03:23:15 +01:00
ZyX
81ef9f55ae shada: Save current cursor position before saving jumps 2017-01-04 16:34:06 +03:00
James McCoy
7eb91c781b shada: Respect the optional buffer count for shada-%
Closes #5759
2016-12-12 14:35:09 -05:00
Justin M. Keyes
44e6ee930f build: Target luacheck HEAD.
https://github.com/mpeterv/luacheck/pull/81#issuecomment-261099606

> If you really want to use bleeding-edge version you should get the
> rockspec from master branch, not a fixed commit ...
> The correct way to install from a specific commit is cloning that
> commit and running "luarocks make" from project directory. The reason
> is that running "install" or "build" on an scm rockspec fetches
> sources from master but uses build description from the rockspec
> itself, which may be outdated.
2016-11-17 00:55:39 +01:00
James McCoy
c0fd830be4
Bump all nvim-specific error codes above E5000
In order to not conflict with new error codes that Vim adds, all Neovim
error codes should be above 5000.  The three existing sub-5000 error
codes (E926, E951, and E952) are now E50003, E5004, and E5005
respectively.

E953 was removed in 6167ce6df2, so just
remove it from the help.
2016-11-15 23:16:08 -05:00
Björn Linse
b3ece5c81c encoding: update tests
Change shada reencoding tests to check for
correct handling of UTF-8 and binary strings.

Delete enc=latin1 json tests.
2016-11-05 14:49:24 +01:00
James McCoy
93f3896300
test: Fix shada/marks_spec.lua failure
The 'dump and read back mark " from a closed tab' test needs to actually
create a second tab.  Since it wasn't doing so, the 'q!' command caused
nvim to exit and the subsequent 'qall' command fails.
2016-10-28 22:32:14 -04:00
Grzegorz Milka
9ca90fdb9f vim-patch:7.4.2212
Problem:    Mark " is not set when closing a window in another tab. (Guraga)
Solution:   Check all tabs for the window to be valid. (based on patch by
            Hirohito Higashi, closes vim/vim#974)

e59215c7dc
2016-10-22 23:43:14 +02:00
ZyX
6127eaef05 shada: Fix non-writeable ShaDa directory handling
Before this change,

    nvim -i /etc/shada

segfaults on exit if the file does not exist and user does not have
permissions to create the file at /etc/shada.

Closes #5296
Reported in #5277
https://github.com/neovim/neovim/issues/5277#issuecomment-243937255
2016-09-04 21:45:48 -04:00
Björn Linse
1c22cab2fd api: consistently use nvim_ prefix and update documentation 2016-08-31 21:57:06 +02:00
Rui Abreu Ferreira
9ce81f7b2b functionaltest: Create lua helper for os.tmpname()
In Windows Lua's os.tmpname() returns relative paths starting with \s,
prepend them with $TEMP to generate a valid path.

In OS X os.tmpname() returns paths in '/tmp' but they should be in
'/private/tmp'. We cannot use os_name() for platform detection because
some tests use tempname() before nvim is spawned, instead use one of the
following:

1. Set SYSTEM_NAME environment variable before calling the tests, it
   is set from CMAKE_SYSTEM_NAME(i.e. uname -s or 'Windows')
2. Call uname -s
3. Assume windows
2016-08-31 11:32:28 +01:00
Rui Abreu Ferreira
39c628d031 Mark some functional tests as pending in Windows 2016-08-26 08:21:41 +01:00
ZyX
ff470bb853 functests: Check logs in lua code
It is otherwise impossible to determine which test failed sanitizer/valgrind
check. test/functional/helpers.lua module return was changed so that tests which
do not provide after_each function to get new check will automatically fail.
2016-06-10 21:50:49 +03:00
Björn Linse
ce17d03180 eval: let getreg() return valid list for an undefined register
vim-patch:7.4.1755
this prevents a crash when the list is used in setreg() later
2016-04-21 18:11:06 +02:00
ZyX
d4106f6df3 shada: Make sure that NIL and EXT values can also be parsed back
Note: currently they are both *dumped*, but parsing them produces an error. This
is inappropriate: variables should either be skipped with error message when
dumping or should be read back properly.

It also appears that I did not have test for “has wrong variable value type”
error, so nothing got removed from errors_spec.
2016-04-18 02:46:34 +03:00
Thiago de Arruda
c18d5917e3 Update lua client to 0.0.1-24
The new version of the lua client uses libmpack as a backend, and some test
scripts had to be updated to reflect that.
2016-04-13 09:21:32 -03:00
Thiago de Arruda
704f3dd855 Synchronize shada reset helper with other functional tests 2016-04-11 23:07:52 -03:00
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