Commit Graph

82 Commits

Author SHA1 Message Date
zeertzjq
2a883d9c59
vim-patch:9.1.0524: the recursive parameter in the *_equal functions can be removed (#29572)
Problem:  the recursive parameter in the *_equal functions can be removed
Solution: Remove the recursive parameter in dict_equal(), list_equal()
          object_equal and tv_equal(). Use a comparison of the static
          var recursive_cnt == 0 to determine whether or not tv_equal()
          has been called recursively (Yinzuo Jiang).

closes: vim/vim#15070

7ccd1a2e85

Co-authored-by: Yinzuo Jiang <jiangyinzuo@foxmail.com>
2024-07-05 15:20:02 +08:00
dundargoc
52389e7243 test(unit): skip flaky 'typval.c dict extend() works' test 2024-05-25 15:15:36 +02:00
Lewis Russell
81fc27124b refactor(test): inject after_each differently 2024-04-10 15:53:50 +01:00
dundargoc
7035125b2b test: improve test conventions
Work on https://github.com/neovim/neovim/issues/27004.
2024-04-08 22:51:00 +02:00
dundargoc
5a5d26b4ab test: skip flaky tests 2024-03-29 14:27:13 +01:00
dundargoc
cff8c15977 test: skip flaky tests 2024-03-28 18:18:57 +01:00
Lewis Russell
d33e1da9b7 test: do not inject vim module into global helpers 2024-01-12 12:04:18 +00:00
Justin M. Keyes
c3836e40a2
build: enable lintlua for test/unit/ dir #26396
Problem:
Not all Lua code is checked by stylua. Automating code-style is an
important mechanism for reducing time spent on accidental
(non-essential) complexity.

Solution:
- Enable lintlua for `test/unit/` directory.
- TODO: only `test/functional/` remains unchecked.

previous: 45fe4d11ad
previous: 517f0cc634
2023-12-04 14:32:39 -08:00
dundargoc
79b6ff28ad refactor: fix headers with IWYU 2023-11-28 22:23:56 +01:00
zeertzjq
842a47d6a4
vim-patch:9.0.1704: Cannot use positional arguments for printf() (#24719)
Problem: Cannot use positional arguments for printf()
Solution: Support positional arguments in string formatting

closes: vim/vim#12140

0c6181fec4

Co-authored-by: Christ van Willegen <cvwillegen@gmail.com>
2023-08-15 19:16:19 +08:00
Sean Dewar
41ee7bc7db test(unit/eval/typval_spec): adjust for Float to String conversion
Adjust relevant Lua tests. Refactor testing logic for tv_get_string_*
functions into test_string_fn().

Note that vim_snprintf(), which is used for stringifying floats, always
calls xfree(tofree), even if tofree is NULL, so we need to expect that
in the alloc log.
2023-06-12 14:08:27 +08:00
Sean Dewar
1ffd20a26e test(unit/eval/typval_spec): don't dereference NULL last_msg_hist
If last_msg_hist is NULL, check_emsg will cause the running test process
to SIGSEGV from trying to access the msg member.
2023-06-12 13:27:16 +08:00
zeertzjq
bdaaf2e8e1 vim-patch:9.0.0250: slightly inconsistent error messages
Problem:    Slightly inconsistent error messages.
Solution:   Make it "Using a Float". (closes vim/vim#10959)

dde77a7c4d

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-05-05 09:20:30 +08:00
zeertzjq
88cfb49bee vim-patch:8.2.4890: inconsistent capitalization in error messages
Problem:    Inconsistent capitalization in error messages.
Solution:   Make capitalization consistent. (Doug Kearns)

cf030578b2

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-05-05 09:20:30 +08:00
zeertzjq
75119fcc86 vim-patch:8.2.3135: Vim9: builtin function arguments not checked at compile time
Problem:    Vim9: builtin function arguments not checked at compile time.
Solution:   Add more type checks. (Yegappan Lakshmanan, closes vim/vim#8539)

5b73992d8f

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-05-05 09:19:05 +08:00
bfredl
6d267ad30c fix(api): make nvim_get_hl return 'cterm' attrs properly 2023-03-23 13:42:00 +01:00
bfredl
42999a8d64 fix(test): fix issues detected by running unittests in ASAN/UBSAN 2023-01-31 18:28:29 +01:00
zeertzjq
f8669e8a18
vim-patch:8.2.1698: cannot lock a variable in legacy Vim script like in Vim9 (#21883)
Problem:    Cannot lock a variable in legacy Vim script like in Vim9.
Solution:   Make ":lockvar 0" work.

a187c43cfe

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-01-19 08:03:13 +08:00
bfredl
6bfbb4db1d fix(unittests): fix TUI broken test previously ignored 2023-01-18 14:56:55 +01:00
zeertzjq
46a54dd6a0 vim-patch:8.2.1852: map() returing zero for NULL list is unexpected
Problem:    map() returing zero for NULL list is unexpected.
Solution:   Return the empty list. (closes vim/vim#7133)

ffdf8adfa8

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2022-10-26 20:53:39 +08:00
zeertzjq
02a4974418
vim-patch:7.4.1168 (#19645)
Problem:    This doesn't give the right result: eval(string(v:true)). (Nikolay
            Pavlov)
Solution:   Make the string "v:true" instead of "true".
f48aa160fd
2022-08-13 21:31:00 +08:00
Sean Dewar
9e38c4a79f
vim-patch:8.2.1473: items in a list given to :const can still be modified
Problem:    Items in a list given to :const can still be modified.
Solution:   Work like ":lockvar! name" but don't lock referenced items.
            Make locking a blob work.
021bda5671
2021-09-16 00:13:41 +01:00
Jan Edmund Lazo
20dc3f1989
vim-patch:8.1.0897: can modify a:000 when using a reference (#14902)
Problem:    Can modify a:000 when using a reference.
Solution:   Make check for locked variable stricter. (Ozaki Kiichi,
            closes vim/vim#3930)
05c00c038b
2021-06-26 10:19:09 -04:00
Jan Edmund Lazo
e16f2cbd12
vim-patch:8.2.0539: comparing two NULL list fails
Problem:    Comparing two NULL list fails.
Solution:   Change the order of comparing two lists.
7b293c730b

N/A patches for version.c:

vim-patch:8.2.1187: terminal2 test sometimes hangs in the GUI on Travis

Problem:    Terminal2 test sometimes hangs in the GUI on Travis.
Solution:   Disable Test_zz2_terminal_guioptions_bang() for now.
c85156bb89

vim-patch:8.2.1188: memory leak with invalid json input

Problem:    Memory leak with invalid json input.
Solution:   Free all keys at the end. (Dominique Pellé, closes vim/vim#6443,
            closes vim/vim#6442)
6d3a7213f5

vim-patch:8.2.1196: build failure with normal features

Problem:    Build failure with normal features.
Solution:   Add #ifdef.
83e7450053

vim-patch:8.2.1198: terminal2 test sometimes hangs in the GUI on Travis

Problem:    Terminal2 test sometimes hangs in the GUI on Travis.
Solution:   Move test function to terminal3 to see if the problem moves too.
a4b442614c
2020-07-19 11:40:34 -04:00
Billy Su
1805fb469a vim-patch:8.2.0111: VAR_SPECIAL is also used for booleans
Problem:    VAR_SPECIAL is also used for booleans.
Solution:   Add VAR_BOOL for better type checking.
9b4a15d5db
2020-06-06 23:24:58 +08:00
Yatao Li
ed6230434b gen_api_dispatch.lua: allow msgpack int for Float args; test: add ui_pum_set_bounds and tv_dict_add_float tests 2020-04-28 01:53:43 +08:00
Hirokazu Hata
e2ed8053bf
lua: move test helper function, map and filter, to vim.shared module 2020-02-18 17:43:10 +09:00
Justin M. Keyes
fd04877eb0 test: remove use of require('test.helpers')
The test.functional.helpers and test.unit.helpers modules now include
all of the public functions from test.helpers, so there is no need to
separately require('test.helpers').
2019-05-18 15:48:13 +02:00
ZyX
9ea1752d60 *: Provide list length when allocating lists 2018-01-14 01:33:16 +03:00
ZyX
bc52ec6110 *: Fix linter errors 2017-12-24 23:09:26 +03:00
ZyX
7997147245 eval: Replace some tv_list_item_remove() calls
There is nothing wrong with them, just it is generally better to remove
a range then to remove items individually.
2017-12-24 17:52:24 +03:00
ZyX
67fa9e5237 eval: Rename tv_list_remove_items() to tv_list_drop_items()
tv_list_remove_items() may cause confusion with tv_list_item_remove()
2017-12-24 16:38:30 +03:00
ZyX
ac55558c97 eval/typval: Make tv_list_item_remove return pointer to the next item 2017-12-24 14:09:36 +03:00
ZyX
608c3d7baf eval/typval: Remove tv_list_item_free() as it is unused 2017-12-24 14:09:36 +03:00
ZyX
0c533a488f *: Remove most calls to tv_list_item_alloc
Still left calls in eval/typval.c and test/unit/eval/helpers.lua. Latter is the 
only reason why function did not receive `static` modifier.
2017-12-24 14:09:35 +03:00
ZyX
35898cff5d unittests: Fix allocation ordering for tv_dict_add_str() 2017-07-02 20:24:39 +03:00
ZyX
df040e55fb eval/typval: Add tv_dict_add_allocated_str() function 2017-07-02 19:01:09 +03:00
ZyX
f4d5d5250a eval: Refactor get_user_input to support dictionary 2017-05-10 15:52:48 +03:00
ZyX
b54e5c220f unittests: Add a test for TV_CSTRING
Not using enum{} because SIZE_MAX exceeds integer and I do not really like how
enum definition is described in C99:

1. Even though all values must fit into the chosen type (6.7.2.2, p 4) the type
   to choose is still implementation-defined.
2. 6.4.4.3 explicitly states that “an identifier declared as an enumeration
   constant has type `int`”. So it looks like “no matter what type was chosen
   for enumeration, constants will be integers”. Yet the following simple
   program:

        #include <stdint.h>
        #include <stdio.h>
        #include <stddef.h>

        enum { X=SIZE_MAX };

        int main(int argc, char **argv)
        {
          printf("x:%zu m:%zu t:%zu v:%zu",
                 sizeof(X), sizeof(SIZE_MAX), sizeof(size_t), (size_t)X);
        }

    yields one of the following using different compilers:

    - clang/gcc/pathcc: `x:8 m:8 t:8 v:18446744073709551615`
    - pcc/tcc: `x:4 m:8 t:8 v:1844674407370955161`

    If I remove the cast of X to size_t then pcc/tcc both yield `x:4 m:8 t:8
    v:4294967295`, other compilers’ output does not change.

    All compilers were called with `$compiler -std=c99 -xc -` (feeding program
    from echo), except for `tcc` which has missing `-std=c99`. `pcc` seems to
    ignore the argument though: it is perfectly fine with `-std=c1000`.
2017-04-14 23:58:47 +03:00
ZyX
8990490b50 unittests: Move allocating vimconv_T to a function 2017-04-09 03:36:18 +03:00
ZyX
233e71419e unittests: Do not GC typval_T which is owned by a di 2017-04-09 03:36:18 +03:00
ZyX
44cd4e63f5 unittests: Use Neovim memory allocation for vimconv_T
Not sure whether this is going to fix things though, but core dump does not 
contain Neovim functions in stack in this case.
2017-04-09 03:36:17 +03:00
ZyX
94c1af7c41 unittests: Do not gc what is already freed 2017-04-09 03:36:17 +03:00
ZyX
654dd15bb8 unittests: Fix testlint failure 2017-04-07 00:46:52 +03:00
ZyX
271df03fa4 unittests: Force GC, fix GC failures in typval_spec 2017-04-06 07:29:15 +03:00
ZyX
114eaa15f0 eval/typval,api/buffer: Fix review comments 2017-03-29 10:08:46 +03:00
ZyX
58e34e8d99 eval/typval: Allow NULL dict as tv_dict_get_callback() argument
Also removes NULL key input: tv_dict_find() does not allow this.
2017-03-29 10:08:46 +03:00
ZyX
8daf756fb6 unittests: Fix linter errors 2017-03-29 10:08:46 +03:00
ZyX
7826ee1c03 unittests: Add tv_get_string* tests 2017-03-29 10:08:46 +03:00
ZyX
e08b27ba4a unittests: Add tv_get number tests 2017-03-29 10:08:46 +03:00