aboutsummaryrefslogtreecommitdiff
path: root/test/unit
Commit message (Collapse)AuthorAge
* test(unit/strings_spec): use correct type for binary valuesJames McCoy2025-01-29
| | | | | When 9.0.1856 was ported, the numbers being formatted as binary were cast to "unsigned int" rather than uvarnumber_T, as is done upstream.
* test(unit/strings_spec): provide context for vim_snprintf testsJames McCoy2025-01-28
| | | | | | | | | | | | | | | | | | | | | | | | | | Since these assertions all use a common function to perform the test assertions, it's difficult to figure out which test failed: ERROR test/unit/testutil.lua @ 785: vim_snprintf() positional arguments test/unit/testutil.lua:757: test/unit/testutil.lua:741: (string) ' test/unit/strings_spec.lua:143: Expected objects to be the same. Passed in: (number) 6400 Expected: (number) 6' exit code: 256 Adding context to the assertion makes it clearer what the problem is: ERROR test/unit/testutil.lua @ 785: vim_snprintf() positional arguments test/unit/testutil.lua:757: test/unit/testutil.lua:741: (string) ' test/unit/strings_spec.lua:149: snprintf(buf, 0, "%1$0.*2$b", cdata<unsigned int>: 0xf78d0f38, cdata<int>: 0xf78dc4e0) = 001100 Expected objects to be the same. Passed in: (number) 6400 Expected: (number) 6' exit code: 256
* feat(terminal): forward X1 and X2 mouse eventszeertzjq2025-01-21
| | | | | Ref: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Other-buttons
* test: use esc sequences in vterm unit testsGregory Anders2025-01-16
|
* feat(terminal): add support for kitty keyboard protocolGregory Anders2025-01-16
| | | | | | This commit adds basic support for the kitty keyboard protocol to Neovim's builtin terminal. For now only the first mode ("Disambiguate escape codes") is supported.
* feat(terminal): support theme update notifications (DEC mode 2031) (#31999)Gregory Anders2025-01-14
|
* fix(options): better handling of empty valuesLewis Russell2025-01-13
| | | | | | | | | | | | | | | Problem: Whether an option is allowed to be empty isn't well defined and isn't properly checked. Solution: - For non-list string options, explicitly check the option value if it is empty. - Annotate non-list string options that can accept an empty value. - Adjust command completion to ignore the empty value. - Render values in Lua meta files
* refactor: delete duplicate utf8-functionalitydundargoc2025-01-13
| | | | | | | | | | | | Also remove British National Replacement Character Set. We keep the DEC Special Graphics and ASCII despite it not being unicode as some old software such as calcurse still rely on this functionality. References: - https://github.com/neovim/neovim/pull/31934#discussion_r1911046426 - https://en.wikipedia.org/wiki/DEC_Special_Graphics - https://vt100.net/docs/vt220-rm/chapter2.html#S2.4.3
* docs: miscdundargoc2025-01-11
| | | | | | | | | | | | | | | Co-authored-by: Axel <axelhjq@gmail.com> Co-authored-by: Colin Kennedy <colinvfx@gmail.com> Co-authored-by: Daiki Noda <sys9kdr@users.noreply.github.com> Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com> Co-authored-by: Jean-Jacq du Plessis <1030058+jj-du-plessis@users.noreply.github.com> Co-authored-by: Juan Giordana <juangiordana@gmail.com> Co-authored-by: Lincoln Wallace <locnnil0@gmail.com> Co-authored-by: Matti Hellström <hellstrom@scm.com> Co-authored-by: Steven Locorotondo <steven.locorotondo@justeattakeaway.com> Co-authored-by: Yochem van Rosmalen <git@yochem.nl> Co-authored-by: glepnir <glephunter@gmail.com> Co-authored-by: ifish <fishioon@live.com>
* refactor: adopt vtermdundargoc2025-01-07
| | | | | | We have changed too much to consider it a mere bundled dependency (such as unicode handling in e3bfcf2fd4a4ebf00b104b082cfe83c8144a842d), and can consider it our own at this point.
* feat(terminal): support grapheme clusters, including emojibfredl2025-01-02
|
* test: format C test files and fix clang-tidy warningsdundargoc2024-12-21
| | | | | | | It's probably not worth adding the C test files to regular formatting as they're pretty much never touched, but ensuring the files are formatted according to our standards and getting rid of warnings is a cheap one-time fix.
* test(vterm): move test functions into vterm_test fixtureJames McCoy2024-12-02
| | | | | | | In order to run unittests with a release build, we need the test functions to be accessible when NDEBUG is defined. Moving the functions into the test fixture ensures they are available and only available for use by the unit tests.
* docs: misc (#30914)dundargoc2024-11-09
| | | | | | | Co-authored-by: Ernie Rael <errael@raelity.com> Co-authored-by: Famiu Haque <famiuhaque@proton.me> Co-authored-by: Jade <spacey-sooty@proton.me> Co-authored-by: glepnir <glephunter@gmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* test: port libvterm unit test to neovim test suitedundargoc2024-10-22
| | | | | | | These were imported from the v0.3.3 git tag https://github.com/neovim/libvterm/tree/v0.3.3 and not the latest commit. This is for compatibility reasons as the libvterm code was imported from v0.3.3.
* docs: misc (#30177)dundargoc2024-09-29
| | | | | Co-authored-by: Christian Clason <c.clason@uni-graz.at> Co-authored-by: Riley Bruins <ribru17@hotmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* refactor(multibyte): neo-casefolding without allocationbfredl2024-09-29
| | | | fixes #30400
* fix(mbyte): check for utf8proc_map() failure (#30531)zeertzjq2024-09-26
|
* refactor(api)!: rename Dictionary => DictJustin M. Keyes2024-09-23
| | | | | | | | | | | | | | In the api_info() output: :new|put =map(filter(api_info().functions, '!has_key(v:val,''deprecated_since'')'), 'v:val') ... {'return_type': 'ArrayOf(Integer, 2)', 'name': 'nvim_win_get_position', 'method': v:true, 'parameters': [['Window', 'window']], 'since': 1} The `ArrayOf(Integer, 2)` return type didn't break clients when we added it, which is evidence that clients don't use the `return_type` field, thus renaming Dictionary => Dict in api_info() is not (in practice) a breaking change.
* test: add termkey unit testsdundargoc2024-09-11
| | | | | | | | | | | Skipped importing the following unit tests from libtermkey as they'd require introducing a lot of unused code or require more effort to port than is probably worth: - 05read - 12strpkey - 20canon - 40ti-override
* fix(multibyte): handle backspace of wide clusters in replace modebfredl2024-09-06
| | | | | Make utf_head_off more robust against invalid sequences and embedded NUL chars
* feat(mbyte): support extended grapheme clusters including more emojibfredl2024-08-30
| | | | | | | | | Use the grapheme break algorithm from utf8proc to support grapheme clusters from recent unicode versions. Handle variant selector VS16 turning some codepoints into double-width emoji. This means we need to use ptr2cells rather than char2cells when possible.
* refactor(shada): rework msgpack decoding without msgpack-cbfredl2024-08-05
| | | | | | | This also makes shada reading slightly faster due to avoiding some copying and allocation. Use keysets to drive decoding of msgpack maps for shada entries.
* refactor(declarations): also generate prototypes for functions in headersbfredl2024-07-13
| | | | | | | | | | | Before this change, "static inline" functions in headers needed to have their function attributes specified in a completely different way. The prototype had to be duplicated, and REAL_FATTR_ had to be used instead of the public FUNC_ATTR_ names. TODO: need a check that a "header.h.inline.generated.h" file is not forgotten when the first "static inline" function with attributes is added to a header (they would just be silently missing).
* vim-patch:9.1.0569: fnamemodify() treats ".." and "../" differently (#29673)zeertzjq2024-07-12
| | | | | | | | | Problem: fnamemodify() treats ".." and "../" differently. Solution: Expand ".." properly like how "/.." is treated in 8.2.3388. (zeertzjq) closes: vim/vim#15218 https://github.com/vim/vim/commit/1ee7420460768df67ea4bc73467f2d4f8b1555bd
* vim-patch:9.1.0524: the recursive parameter in the *_equal functions can be ↵zeertzjq2024-07-05
| | | | | | | | | | | | | | | 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 https://github.com/vim/vim/commit/7ccd1a2e858dbb2ac7fb09971dfcbfad62baa677 Co-authored-by: Yinzuo Jiang <jiangyinzuo@foxmail.com>
* refactor(io): make rstream use a linear bufferbfredl2024-06-08
| | | | | | | | | If you like it you shouldn't put a ring on it. This is what _every_ consumer of RStream used anyway, either by calling rbuffer_reset, or rbuffer_consumed_compact (same as rbuffer_reset without needing a scratch buffer), or by consuming everything in each stream_read_cb call directly.
* test(unit): skip flaky 'typval.c dict extend() works' testdundargoc2024-05-25
|
* vim-patch:9.1.0426: too many strlen() calls in search.czeertzjq2024-05-22
| | | | | | | | | | | | | Problem: too many strlen() calls in search.c Solution: refactor code and remove more strlen() calls, use explicit variable to remember strlen (John Marriott) closes: vim/vim#14796 https://github.com/vim/vim/commit/8c85a2a49acf80e4f53ec51e6ff2a5f3830eeddb Co-authored-by: John Marriott <basilisk@internode.on.net>
* fix(path): avoid chdir() when resolving path (#28799)zeertzjq2024-05-17
| | | | | | | | | | | | | | | | | | | | | | Use uv_fs_realpath() instead. It seems that uv_fs_realpath() has some problems on non-Linux platforms: - macOS and other BSDs: this function will fail with UV_ELOOP if more than 32 symlinks are found while resolving the given path. This limit is hardcoded and cannot be sidestepped. - Windows: while this function works in the common case, there are a number of corner cases where it doesn't: - Paths in ramdisk volumes created by tools which sidestep the Volume Manager (such as ImDisk) cannot be resolved. - Inconsistent casing when using drive letters. - Resolved path bypasses subst'd drives. Ref: https://docs.libuv.org/en/v1.x/fs.html#c.uv_fs_realpath I don't know if the old implementation that uses uv_chdir() and uv_cwd() also suffers from the same problems. - For the ELOOP case, chdir() seems to have the same limitations. - On Windows, Vim doesn't use anything like chdir() either. It uses _wfullpath(), while libuv uses GetFinalPathNameByHandleW().
* refactor(lua): "module" => "M" #28426Justin M. Keyes2024-04-20
| | | | Most of the codebase uses the `M` convention for Lua module. Update the last remaining cases.
* ci: enable unittests on macos-14Joey Gouly2024-04-14
| | | | | | | | | | | | | | | | | | | | | Add more filters so that LuaJIT can parse headers on macOS 14. The system headers use a style of enum introduced in C++11 (and allowed as an extension in C by clang) of the form: enum Name : Type { The system headers also use bitfields in the mach_vm_range_recipe* types: struct Foo { int bar : 32; } Neither of these constructs can be parsed by LuaJIT, so filter the lines out. Neither of these declarations are used by neovim's unittests. There is a (now closed) issue about bitfields for LuaJIT: https://github.com/LuaJIT/LuaJIT/issues/951 Fixes #26145.
* fix(path): check return value of append_path() (#28309)Joey Gouly2024-04-13
| | | | | | | | | | | | | | | | | | | | | | | If the filename passed to vim_FullName() is a relative directory, and does not exist, it is appended to the current working directory. Since the return value of append_path() was ignored, and if the buffer length was too small to fit getcwd() + dirname(filename), it would still try to append the basename(filename). This was manifesting as a failure in test/unit/path_spec.lua in: itp('fails and uses filename if given filename contains non-existing directory', .. This failure occurs when running the tests from directory with a short path such as: /work/src/nv test/unit/path_spec.lua:420: Expected objects to be the same. Passed in: (string) '/work/src/nv/test.file' Expected: (string) 'non_existing_dir/test.file' This return value for the second call to append_path() to append basename(filename) was checked, and this is where it would fail for normal / longer getcwd()s.
* fix(test): fix strings_spec.lua for AArch64Joey Gouly2024-04-12
| | | | | | | | | | | LuaJIT does not handle -0.0 correctly in 'dual number mode' (which is the default, and only supported mode for LuaJIT arm64). If LuaJIT is forced to use 'dual number mode' on X64 (where the default is single), this test will fail in the same manner. Fix this by using tonumber("-0.0") instead of a -0.0 literal. See: https://github.com/LuaJIT/LuaJIT/issues/858
* refactor(test): inject after_each differentlyLewis Russell2024-04-10
|
* test: improve test conventionsdundargoc2024-04-08
| | | | Work on https://github.com/neovim/neovim/issues/27004.
* test: skip flaky testsdundargoc2024-03-29
|
* test: skip flaky testsdundargoc2024-03-28
|
* docs: fix typos (#27868)dundargoc2024-03-28
| | | | | | | | | Co-authored-by: ite-usagi <77563904+ite-usagi@users.noreply.github.com> Co-authored-by: v-sim <56476039+v-sim@users.noreply.github.com> Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Quico Augustijn <quico.public@gmail.com> Co-authored-by: nhld <nahnera@gmail.com> Co-authored-by: francisco souza <108725+fsouza@users.noreply.github.com>
* test: correct order of arguments to eq() (#27816)zeertzjq2024-03-11
|
* refactor(metadata): generate all metadata in luabfredl2024-02-28
| | | | | | | | Then we can just load metadata in C as a single msgpack blob. Which also can be used directly as binarly data, instead of first unpacking all the functions and ui_events metadata to immediately pack it again, which was a bit of a silly walk (and one extra usecase of `msgpack_rpc_from_object` which will get yak shaved in the next PR)
* Merge pull request #27599 from bfredl/nofileallocbfredl2024-02-26
|\ | | | | refactor(fileio): remove API shell layer encouraging unnecessary allocations
| * refactor(fileio): remove API shell layer encouraging unnecessary allocationsbfredl2024-02-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Functions like file_open_new() and file_open_fd_new() which just is a wrapper around the real functions but with an extra xmalloc/xfree around is an anti-pattern. If the caller really needs to allocate a FileDescriptor as a heap object, it can do that directly. FileDescriptor by itself is pretty much a pointer, or rather two: the OS fd index and a pointer to a buffer. So most of the time an extra pointer layer is just wasteful. In the case of scriptin[curscript] in getchar.c, curscript used to mean in practice: N+1 open scripts when curscript>0 zero or one open scripts when curscript==0 Which means scriptin[0] had to be compared to NULL to disambiguate the curscript=0 case. Instead, use curscript==-1 to mean that are no script, then all pointer comparisons dissappear and we can just use an array of structs without extra pointers.
* | fix(mbyte): fix bugs in utf_cp_*_off() functionsVanaIgr2024-02-26
|/ | | | | | Problems: - Illegal bytes after valid UTF-8 char cause utf_cp_*_off() to fail. - When stream isn't NUL-terminated, utf_cp_*_off() may go over the end. Solution: Don't go over end of the char of end of the string.
* refactor(eval): use arena when converting typvals to Objectbfredl2024-02-15
| | | | | | | | | | | | Note: this contains two _temporary_ changes which can be reverted once the Arena vs no-Arena distinction in API wrappers has been removed. Both nlua_push_Object and object_to_vim_take_luaref() has been changed to take the object argument as a pointer. This is not going to be necessary once these are only used with arena (or not at all) allocated Objects. The object_to_vim() variant which leaves luaref untouched might need to stay for a little longer.
* refactor(indent): refactor computing of a string's indent size (#27252)VanaIgr2024-02-12
| | | | | | | | | | | | | | | | | | The `get_indent_str_vtab()` function currently calls `tabstop_padding()` every time a tab is encountered (unless tabstops aren't used). `tabstop_padding()` either does a division by 'tabstop' If 'vartabstop' is not set, or iterates through the 'vartabstop' list to find current tab width. Since the virtual column only increases, we can keep track of where the next tabstop would be, and update this information once it was reached. `get_indent_str_vtab()` also depends on 'listchars' "tab" value from the current window, even though it may be called for a line from the same buffer in a different window. In most cases, it is called with tabstops enabled (last argument was `false`), so I split the function into one that uses tabstops and the other that doesn't. I removed `get_indent_str()` since I couldn't find any calls to it.
* refactor(api): refactor more api functions to use arena returnbfredl2024-02-08
| | | | | | | | | | | | | | | Currently having two separate memory strategies for API return values is a bit unnecessary, and mostly a consequence of converting the hot spot cases which needed it first. But there is really no downside to using arena everywhere (which implies also directly using strings which are allocated earlier or even statically, without copy). There only restriction is we need to know the size of arrays in advance, but this info can often be passed on from some earlier stage if it is missing. This collects some "small" cases. The more complex stuff will get a PR each.
* fix(extmark): fix crash when stepping out from internal nodebfredl2024-01-23
|
* perf(extmarks): add metadata for efficient filtering of special decorationsbfredl2024-01-22
| | | | | | | | | | | | | | | | | | This expands on the global "don't pay for what you don't use" rules for these special extmark decorations: - inline virtual text, which needs to be processed in plines.c when we calculate the size of text on screen - virtual lines, which are needed when calculating "filler" lines - signs, with text and/or highlights, both of which needs to be processed for the entire line already at the beginning of a line. This adds a count to each node of the marktree, for how many special marks of each kind can be found in the subtree for this node. This makes it possible to quickly skip over these extra checks, when working in regions of the buffer not containing these kind of marks, instead of before where this could just be skipped if the entire _buffer_ didn't contain such marks.
* test: move format_{string,luav} to a separate moduleLewis Russell2024-01-17
|