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
This commit is contained in:
Jan Edmund Lazo 2020-07-12 19:04:35 -04:00
parent bf88228180
commit e16f2cbd12
No known key found for this signature in database
GPG Key ID: 64915E6E9F735B15
4 changed files with 23 additions and 18 deletions

View File

@ -799,10 +799,14 @@ bool tv_list_equal(list_T *const l1, list_T *const l2, const bool ic,
if (l1 == l2) {
return true;
}
if (l1 == NULL || l2 == NULL) {
if (tv_list_len(l1) != tv_list_len(l2)) {
return false;
}
if (tv_list_len(l1) != tv_list_len(l2)) {
if (tv_list_len(l1) == 0) {
// empty and NULL list are considered equal
return true;
}
if (l1 == NULL || l2 == NULL) {
return false;
}

View File

@ -47,10 +47,8 @@ describe('NULL', function()
-- Subjectable behaviour
-- FIXME Should return 1
null_expr_test('is equal to empty list', 'L == []', 0, 0)
-- FIXME Should return 1
null_expr_test('is equal to empty list (reverse order)', '[] == L', 0, 0)
null_expr_test('is equal to empty list', 'L == []', 0, 1)
null_expr_test('is equal to empty list (reverse order)', '[] == L', 0, 1)
-- Correct behaviour
null_expr_test('can be indexed with error message for empty list', 'L[0]',

View File

@ -38,6 +38,9 @@ describe('assert function:', function()
call assert_equal(4, n)
let l = [1, 2, 3]
call assert_equal([1, 2, 3], l)
call assert_equal(v:_null_list, v:_null_list)
call assert_equal(v:_null_list, [])
call assert_equal([], v:_null_list)
fu Func()
endfu
let F1 = function('Func')

View File

@ -1234,13 +1234,13 @@ describe('typval.c', function()
local l = list()
local l2 = list()
-- NULL lists are not equal to empty lists
eq(false, lib.tv_list_equal(l, nil, true, false))
eq(false, lib.tv_list_equal(nil, l, false, false))
eq(false, lib.tv_list_equal(nil, l, false, true))
eq(false, lib.tv_list_equal(l, nil, true, true))
-- NULL lists are equal to empty lists
eq(true, lib.tv_list_equal(l, nil, true, false))
eq(true, lib.tv_list_equal(nil, l, false, false))
eq(true, lib.tv_list_equal(nil, l, false, true))
eq(true, lib.tv_list_equal(l, nil, true, true))
-- Yet NULL lists are equal themselves
-- NULL lists are equal themselves
eq(true, lib.tv_list_equal(nil, nil, true, false))
eq(true, lib.tv_list_equal(nil, nil, false, false))
eq(true, lib.tv_list_equal(nil, nil, false, true))
@ -2648,13 +2648,13 @@ describe('typval.c', function()
local l2 = lua2typvalt(empty_list)
local nl = lua2typvalt(null_list)
-- NULL lists are not equal to empty lists
eq(false, lib.tv_equal(l, nl, true, false))
eq(false, lib.tv_equal(nl, l, false, false))
eq(false, lib.tv_equal(nl, l, false, true))
eq(false, lib.tv_equal(l, nl, true, true))
-- NULL lists are equal to empty lists
eq(true, lib.tv_equal(l, nl, true, false))
eq(true, lib.tv_equal(nl, l, false, false))
eq(true, lib.tv_equal(nl, l, false, true))
eq(true, lib.tv_equal(l, nl, true, true))
-- Yet NULL lists are equal themselves
-- NULL lists are equal themselves
eq(true, lib.tv_equal(nl, nl, true, false))
eq(true, lib.tv_equal(nl, nl, false, false))
eq(true, lib.tv_equal(nl, nl, false, true))