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.
This commit is contained in:
ZyX
2016-09-17 22:06:11 +03:00
parent 9b8beaff02
commit 9898f36aa3
3 changed files with 190 additions and 5 deletions

View File

@@ -424,6 +424,7 @@ void tv_list_append_number(list_T *const l, const varnumber_T n)
/// Make a copy of list
///
/// @param[in] conv If non-NULL, then all internal strings will be converted.
/// Only used when `deep` is true.
/// @param[in] orig Original list to copy.
/// @param[in] deep If false, then shallow copy will be done.
/// @param[in] copyID See var_item_copy().