Commit Graph

259 Commits

Author SHA1 Message Date
ZyX
ed4948a933 unittests: Test tv_copy() 2017-03-29 10:08:46 +03:00
ZyX
f0bbd1e825 unittests: Add tests for tv_clear() 2017-03-29 10:08:46 +03:00
ZyX
e43de6bb3e unittests: Add test for tv_dict_set_keys_readonly 2017-03-29 10:08:45 +03:00
ZyX
368a61c525 unittests: Add tv_dict_copy tests 2017-03-29 10:08:45 +03:00
ZyX
8b9a1fbf7a unittests: Add tests for tv_dict_extend 2017-03-29 10:08:45 +03:00
ZyX
4987850cac unittests: Add tv_dict_clear tests 2017-03-29 10:08:45 +03:00
ZyX
270a3889af unittests: Add tv_dict_add* unit tests
Also fixes incorrect location of `tv_dict_add` function and three bugs in other 
functions:

1. `tv_dict_add_list` may free list it does not own (vim/vim#1555).
2. `tv_dict_add_dict` may free dictionary it does not own (vim/vim#1555).
3. `tv_dict_add_dict` ignores `key_len` argument.
2017-03-29 10:08:45 +03:00
ZyX
bc87d23c28 unittests: Add tests for dictionary indexing 2017-03-29 10:08:45 +03:00
ZyX
5ce6243241 unittests: Enable tv_list_join tests back
Unable to reproduce the problem on Mac OS X Sierra VPS, need to check whether it 
is reproducible on travis.
2017-03-29 10:08:45 +03:00
ZyX
52e226ff74 unittests: Disable tv_list_join test on Mac OS only 2017-03-29 10:08:45 +03:00
ZyX
38dd81c136 eval/typval: Fix SEGV in test_alot.vim test 2017-03-29 10:08:45 +03:00
ZyX
6c622ed08b unittests: Add tv_dict_item_{add,remove} tests 2017-03-29 10:08:45 +03:00
ZyX
ffaf7c7521 unittests: Add tv_dict_item_{alloc,free} tests 2017-03-29 10:08:45 +03:00
ZyX
4c3be98db9 unittests: Add tv_dict_watcher_{add,remove} tests 2017-03-29 10:08:45 +03:00
ZyX
140174669e unittests: Run tv_list_join tests in case it stopped failing 2017-03-29 10:08:45 +03:00
ZyX
4bcee96347 *: Fix some Windows-specific warnings
Also fixed an error in path_fnamecmp().
2017-03-29 10:08:42 +03:00
ZyX
56e51033ab unittests: Add tests for tv_list_idx_of_item 2017-03-29 10:08:06 +03:00
ZyX
e5edf07ec4 unittests: Add tests for tv_list_find*() functions
Additional modifications:

- More `const` qualifiers in tested functions.
- `tv_list_find_str()` second argument is more in-line with other
  `tv_list_find*()` functions.
2017-03-29 10:08:06 +03:00
ZyX
b3672ae2fc eval/typval: Add tv_list_equal() tests, compare NULL lists equal 2017-03-29 10:08:06 +03:00
ZyX
4f9e784427 unittests: Test tv_list_join() 2017-03-29 10:08:06 +03:00
ZyX
cf45c7bb05 unittests: Fix tests crash
Tests crash at some point without
- `after_each(collectgarbage)` right before “typval.c list copy() copies list
  correctly and converts items” test.
- Commenting out that test.
- Adding `collectgarbage()` after the test (what actually this commit does).

Adding `collectgarbage()` to top-level `after_each` block right after
`restore_allocators` makes running this file crash even if it is run alone.
2017-03-29 10:08:06 +03:00
ZyX
7ceebacb3f eval/typval,tests: Fix extending list with itself, add tests
Adds unit test for tv_list_extend and regression test for extend() VimL
function.
2017-03-29 10:08:06 +03:00
ZyX
56e4c2f67e unittests: Test tv_list_concat() 2017-03-29 10:08:06 +03:00
ZyX
9898f36aa3 unittests: Test tv_list_copy
Also found some bugs:

1. var_item_copy() always fails to copy v:_null_list and v:_null_dict. Fixing
   this should mean fixing `deepcopy(v:_null_list)` which should’ve been, but
   was not listed in #4615. This also fixes `deepcopy(v:_null_dict)`.
2. var_item_copy() crashes when trying to copy NULL string with `conv != NULL`.
3. `conv` argument is ignored when copying list unless `deep` is true, but it
   was not reflected in documentation.
4. `tv_dict_item_alloc_len()` allocated more memory then needed.
5. typvalt2lua was not able to handle self-referencing containers.
2017-03-29 10:08:06 +03:00
ZyX
9b8beaff02 unittests: Add tests for tv_list_insert*()/…append*() functions 2017-03-29 10:08:06 +03:00
ZyX
be360d8841 unittests: Add tests for tv_list_insert() 2017-03-29 10:08:06 +03:00
ZyX
d2639e1e1d unittests: Add tests for list watchers and list alloc/free/unref 2017-03-29 10:08:06 +03:00
ZyX
a394167177 unittests: Test tv_list_item_\* functions
To check that memory is free()d correctly.
2017-03-29 10:08:06 +03:00
ZyX
2ad4fba46d eval: Move copy_tv to eval/typval 2017-03-29 10:08:06 +03:00
ZyX
5df35297f8 eval: Remove eval_expr() completely 2017-03-29 10:08:05 +03:00
ZyX
e18a578308 *: Move some dictionary functions to typval.h and use char*
Also fixes buffer reusage in setmatches() and complete().
2017-03-29 10:07:42 +03:00
ZyX
fb146e80aa eval: Split eval.c into smaller files 2017-03-29 10:05:06 +03:00
Justin M. Keyes
e20e9645b2 build: Rename NEOVIM_* to NVIM_* 2017-03-27 14:27:20 +02:00
John Szakmeister
3c8d974f73 unittests: avoid using pattern matching on file names
The directory name could contain special characters that trips up the
matching used by find.  Instead, let's just make sure that the filename
starts with the directory name.
2017-03-16 06:58:15 -04:00
ZyX
48e7a83447 unittests: Fix linter error 2017-03-12 04:20:31 +03:00
ZyX
d559fe6e93 unittests: Allow running ffi.cdef in the main process 2017-03-12 03:14:34 +03:00
ZyX
a7f64ba517 unittests: Move filtering cdefs to main process 2017-03-12 03:02:14 +03:00
ZyX
bf68907778 unittests: Use more adequate names for some functions 2017-03-12 02:54:23 +03:00
ZyX
8ef6cfa6ac unittests: Fix linter errors 2017-03-11 23:48:16 +03:00
ZyX
a54be846cf unittests: Update test/unit/message_spec.lua 2017-03-11 23:26:33 +03:00
ZyX
ec730daee9 unittests: Do not use which, add data to paths.lua.in instead 2017-03-11 23:23:50 +03:00
ZyX
ce12bda712 unittests: Always close all pipes 2017-03-11 23:23:49 +03:00
ZyX
e2a578f40d unittests: Do not import libnvim or headers in main process
Slows down unit tests much, but gets rid of as much preserved state as possible.
2017-03-11 23:23:49 +03:00
ZyX
9400466282 unittests: Check core dumps in after_each, like in functests 2017-03-11 23:23:49 +03:00
ZyX
12b062b2c8 unittests: Run all unit tests in their own processes
Used

    sed -r -i -e '/ helpers =/ s/$/\nlocal itp = helpers.gen_itp(it)/; s/^(\s*)it\(/\1itp(/' test/unit/**/*_spec.lua

to alter all tests. Locally they all run fine now.

Reasoning:

1. General: state from one test should not affect other tests.
2. Local: travis build is failing with something which may be an output of
   garbage collector. This should prevent state of the garbage collector from
   interferring as well.
2017-03-11 23:23:30 +03:00
ZyX
5898b42d82 unittests: Do not run failing test at all 2017-03-11 23:23:30 +03:00
ZyX
29ed5b3a39 unittests: Fix lint errors 2017-03-11 23:23:30 +03:00
ZyX
b442574862 unittests: Allow failing test to fail 2017-03-11 23:23:30 +03:00
ZyX
ff5dca6630 unittests: Log syscalls if requested 2017-03-11 23:23:30 +03:00
ZyX
1edb3ccc36 unittests: Use own bindings to libc syscall wrappers 2017-03-11 23:23:30 +03:00