diff options
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/buffer_spec.lua | 10 | ||||
-rw-r--r-- | test/unit/eval/typval_spec.lua | 8 | ||||
-rw-r--r-- | test/unit/message_spec.lua | 2 | ||||
-rw-r--r-- | test/unit/os/fs_spec.lua | 6 | ||||
-rw-r--r-- | test/unit/path_spec.lua | 16 | ||||
-rw-r--r-- | test/unit/search_spec.lua | 2 | ||||
-rw-r--r-- | test/unit/tui_spec.lua | 2 |
7 files changed, 29 insertions, 17 deletions
diff --git a/test/unit/buffer_spec.lua b/test/unit/buffer_spec.lua index 5dccc2f5a2..a54ea8c656 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() @@ -233,10 +233,12 @@ describe('buffer functions', function() output_buffer, buffer_byte_size, to_cstr(pat), - false, + NULL, + 0, fillchar, maximum_cell_count, NULL, + NULL, NULL) end 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({}) 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) 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 eb23a3cff1..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. @@ -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' 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 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]) |