From 73207cae611a1efb8cd17139e8228772daeb9866 Mon Sep 17 00:00:00 2001 From: Dundar Göc Date: Fri, 26 Aug 2022 23:11:25 +0200 Subject: refactor: replace char_u with char Work on https://github.com/neovim/neovim/issues/459 --- test/unit/message_spec.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/unit') diff --git a/test/unit/message_spec.lua b/test/unit/message_spec.lua index 7e92b5c857..549eff6e03 100644 --- a/test/unit/message_spec.lua +++ b/test/unit/message_spec.lua @@ -22,7 +22,7 @@ describe('trunc_string', function() local function test_copy(s, expected, room) room = room and room or 20 local buf = cimp.xmalloc(ffi.sizeof('char_u') * buflen) - local str = cimp.vim_strsave(to_cstr(s)) + local str = cimp.xstrdup(to_cstr(s)) cimp.trunc_string(str, buf, room, buflen) eq(expected, ffi.string(buf)) cimp.xfree(buf) -- cgit From 46a54dd6a03f51ba08142abe0aa5710705917987 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 26 Oct 2022 20:10:41 +0800 Subject: 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) https://github.com/vim/vim/commit/ffdf8adfa8108d4765fdc68abbd2fe49a4292b25 Co-authored-by: Bram Moolenaar --- test/unit/eval/typval_spec.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test/unit') diff --git a/test/unit/eval/typval_spec.lua b/test/unit/eval/typval_spec.lua index 6387f89fe4..34dbf592a5 100644 --- a/test/unit/eval/typval_spec.lua +++ b/test/unit/eval/typval_spec.lua @@ -2253,8 +2253,8 @@ describe('typval.c', function() local d1 = dict() alloc_log:check({a.dict(d1)}) eq(1, d1.dv_refcount) - eq(false, tv_dict_equal(nil, d1)) - eq(false, tv_dict_equal(d1, nil)) + eq(true, tv_dict_equal(nil, d1)) + eq(true, tv_dict_equal(d1, nil)) eq(true, tv_dict_equal(d1, d1)) eq(1, d1.dv_refcount) alloc_log:check({}) @@ -2721,8 +2721,8 @@ describe('typval.c', function() local d1 = lua2typvalt({}) alloc_log:check({a.dict(d1.vval.v_dict)}) eq(1, d1.vval.v_dict.dv_refcount) - eq(false, tv_equal(nd, d1)) - eq(false, tv_equal(d1, nd)) + eq(true, tv_equal(nd, d1)) + eq(true, tv_equal(d1, nd)) eq(true, tv_equal(d1, d1)) eq(1, d1.vval.v_dict.dv_refcount) alloc_log:check({}) -- cgit From f2d9c330fc56d1e589d33c82d372532e1695ce40 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 30 Oct 2022 07:10:04 +0800 Subject: fix(path): don't remove trailing slash when getting absolute path (#20853) Before Vim patch 8.2.3468 relative_directory is never used in the resulting path name, so whether it has a trailing slash didn't matter. Now path_full_dir_name() appends a non-existing relative directory to the current directory name, so the trailing slash needs to be kept. --- test/unit/path_spec.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/unit') diff --git a/test/unit/path_spec.lua b/test/unit/path_spec.lua index eb23a3cff1..3ed3a4aec9 100644 --- a/test/unit/path_spec.lua +++ b/test/unit/path_spec.lua @@ -504,6 +504,16 @@ describe('path.c', function() eq(OK, result) end) + itp('does not remove trailing slash from non-existing relative directory #20847', function() + local expected = lfs.currentdir() .. '/non_existing_dir/' + local filename = 'non_existing_dir/' + local buflen = get_buf_len(expected, filename) + local do_expand = 1 + local buf, result = vim_FullName(filename, buflen, do_expand) + eq(expected, ffi.string(buf)) + eq(OK, result) + end) + itp('expands "./" to the current directory #7117', function() local expected = lfs.currentdir() .. '/unit-test-directory/test.file' local filename = './unit-test-directory/test.file' -- cgit From 8147d3df284a075f89746f9d5e948b5220c45f0b Mon Sep 17 00:00:00 2001 From: luukvbaal <31730729+luukvbaal@users.noreply.github.com> Date: Tue, 8 Nov 2022 00:21:22 +0100 Subject: vim-patch:9.0.0844: handling 'statusline' errors is spread out (#20992) Problem: Handling 'statusline' errors is spread out. Solution: Pass the option name to the lower levels so the option can be reset there when an error is encountered. (Luuk van Baal, closes vim/vim#11467) https://github.com/vim/vim/commit/7b224fdf4a29f115567d4fc8629c1cef92d8444a --- test/unit/buffer_spec.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test/unit') diff --git a/test/unit/buffer_spec.lua b/test/unit/buffer_spec.lua index 5dccc2f5a2..2611e7ca7c 100644 --- a/test/unit/buffer_spec.lua +++ b/test/unit/buffer_spec.lua @@ -233,7 +233,8 @@ describe('buffer functions', function() output_buffer, buffer_byte_size, to_cstr(pat), - false, + NULL, + 0, fillchar, maximum_cell_count, NULL, -- cgit From b2d984558bfa66439c784eed66b35868c771e085 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 22 Dec 2022 22:17:01 +0800 Subject: test(unit): use file:close() properly (#21505) --- test/unit/buffer_spec.lua | 6 +++--- test/unit/os/fs_spec.lua | 6 +++--- test/unit/path_spec.lua | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'test/unit') diff --git a/test/unit/buffer_spec.lua b/test/unit/buffer_spec.lua index 2611e7ca7c..4f8a27de09 100644 --- a/test/unit/buffer_spec.lua +++ b/test/unit/buffer_spec.lua @@ -28,9 +28,9 @@ describe('buffer functions', function() setup(function() -- create the files - io.open(path1, 'w').close() - io.open(path2, 'w').close() - io.open(path3, 'w').close() + io.open(path1, 'w'):close() + io.open(path2, 'w'):close() + io.open(path3, 'w'):close() end) teardown(function() diff --git a/test/unit/os/fs_spec.lua b/test/unit/os/fs_spec.lua index 0bb33772cd..c718244ea4 100644 --- a/test/unit/os/fs_spec.lua +++ b/test/unit/os/fs_spec.lua @@ -72,9 +72,9 @@ describe('fs.c', function() before_each(function() lfs.mkdir('unit-test-directory'); - io.open('unit-test-directory/test.file', 'w').close() + io.open('unit-test-directory/test.file', 'w'):close() - io.open('unit-test-directory/test_2.file', 'w').close() + io.open('unit-test-directory/test_2.file', 'w'):close() lfs.link('test.file', 'unit-test-directory/test_link.file', true) lfs.link('non_existing_file.file', 'unit-test-directory/test_broken_link.file', true) @@ -472,7 +472,7 @@ describe('fs.c', function() describe('os_remove', function() before_each(function() - io.open('unit-test-directory/test_remove.file', 'w').close() + io.open('unit-test-directory/test_remove.file', 'w'):close() end) after_each(function() diff --git a/test/unit/path_spec.lua b/test/unit/path_spec.lua index 3ed3a4aec9..1fc4e2496e 100644 --- a/test/unit/path_spec.lua +++ b/test/unit/path_spec.lua @@ -82,8 +82,8 @@ describe('path.c', function() local f2 = 'f2.o' before_each(function() -- create the three files that will be used in this spec - io.open(f1, 'w').close() - io.open(f2, 'w').close() + io.open(f1, 'w'):close() + io.open(f2, 'w'):close() end) after_each(function() @@ -355,7 +355,7 @@ end) describe('path.c', function() setup(function() lfs.mkdir('unit-test-directory'); - io.open('unit-test-directory/test.file', 'w').close() + io.open('unit-test-directory/test.file', 'w'):close() -- Since the tests are executed, they are called by an executable. We use -- that executable for several asserts. -- cgit From 3b9bd7bd439a31f393746e01e25291dd0543630d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 24 Dec 2022 07:55:03 +0800 Subject: vim-patch:9.0.1092: search error message doesn't show used pattern (#21518) Problem: Search error message doesn't show used pattern. Solution: Pass the actually used pattern to where the error message is given. (Rob Pilling, closes vim/vim#11742) https://github.com/vim/vim/commit/e86190e7c1297da29d0fc2415fdeca5ecae8d2ba Co-authored-by: Rob Pilling --- test/unit/search_spec.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/unit') diff --git a/test/unit/search_spec.lua b/test/unit/search_spec.lua index ce37ebfc3a..be905bf5f0 100644 --- a/test/unit/search_spec.lua +++ b/test/unit/search_spec.lua @@ -37,7 +37,7 @@ end) describe('search_regcomp', function() local search_regcomp = function(pat, pat_save, pat_use, options ) local regmatch = ffi.new("regmmatch_T") - local fail = search.search_regcomp(to_cstr(pat), pat_save, pat_use, options, regmatch) + local fail = search.search_regcomp(to_cstr(pat), nil, pat_save, pat_use, options, regmatch) return fail, regmatch end -- cgit From 43e8ec92de9e0850e7d202cb7ff9051bc408447e Mon Sep 17 00:00:00 2001 From: bfredl Date: Mon, 2 May 2022 21:10:01 +0200 Subject: fix(tui): more work in the TUI --- test/unit/tui_spec.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/unit') diff --git a/test/unit/tui_spec.lua b/test/unit/tui_spec.lua index 36ce4a1493..15b019edd1 100644 --- a/test/unit/tui_spec.lua +++ b/test/unit/tui_spec.lua @@ -33,7 +33,7 @@ itp('handle_background_color', function() term_input.waiting_for_bg_response = 1 eq(kComplete, handle_background_color(term_input)) eq(0, term_input.waiting_for_bg_response) - eq(1, multiqueue.multiqueue_size(events)) + eq(0, multiqueue.multiqueue_size(events)) local event = multiqueue.multiqueue_get(events) local bg_event = ffi.cast("Event*", event.argv[1]) -- cgit From 364b131f42509326c912c9b0fef5dfc94ed23b41 Mon Sep 17 00:00:00 2001 From: luukvbaal <31730729+luukvbaal@users.noreply.github.com> Date: Mon, 9 Jan 2023 18:12:06 +0100 Subject: feat(ui): add 'statuscolumn' option Problem: Unable to customize the column next to a window ('gutter'). Solution: Add 'statuscolumn' option that follows the 'statusline' syntax, allowing to customize the status column. Also supporting the %@ click execute function label. Adds new items @C and @s which will print the fold and sign columns. Line numbers and signs can be clicked, highlighted, aligned, transformed, margined etc. --- test/unit/buffer_spec.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'test/unit') diff --git a/test/unit/buffer_spec.lua b/test/unit/buffer_spec.lua index 4f8a27de09..a54ea8c656 100644 --- a/test/unit/buffer_spec.lua +++ b/test/unit/buffer_spec.lua @@ -238,6 +238,7 @@ describe('buffer functions', function() fillchar, maximum_cell_count, NULL, + NULL, NULL) end -- cgit