aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-07-12 19:04:35 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-07-19 11:40:34 -0400
commite16f2cbd123b5a7bd75b5810ec7641a93c99c009 (patch)
tree770fc24f1189e1c37e4d73b83e2b61372242f27c
parentbf882281800fe155536de487418d8052812446e5 (diff)
downloadrneovim-e16f2cbd123b5a7bd75b5810ec7641a93c99c009.tar.gz
rneovim-e16f2cbd123b5a7bd75b5810ec7641a93c99c009.tar.bz2
rneovim-e16f2cbd123b5a7bd75b5810ec7641a93c99c009.zip
vim-patch:8.2.0539: comparing two NULL list fails
Problem: Comparing two NULL list fails. Solution: Change the order of comparing two lists. https://github.com/vim/vim/commit/7b293c730b07d1586688e622b8d9cbbb4a52379b 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. https://github.com/vim/vim/commit/c85156bb897085d7f5a8e4e180287f87bf19b948 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) https://github.com/vim/vim/commit/6d3a7213f58da834b0fc869d05f87e86010c66cf vim-patch:8.2.1196: build failure with normal features Problem: Build failure with normal features. Solution: Add #ifdef. https://github.com/vim/vim/commit/83e7450053399942e1c9efa802c568b51d948541 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. https://github.com/vim/vim/commit/a4b442614c5ca4ebf32acf5cf0b7b718496f1c94
-rw-r--r--src/nvim/eval/typval.c8
-rw-r--r--test/functional/eval/null_spec.lua6
-rw-r--r--test/functional/legacy/assert_spec.lua3
-rw-r--r--test/unit/eval/typval_spec.lua24
4 files changed, 23 insertions, 18 deletions
diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c
index 89ca2db59b..2394eb8099 100644
--- a/src/nvim/eval/typval.c
+++ b/src/nvim/eval/typval.c
@@ -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;
}
diff --git a/test/functional/eval/null_spec.lua b/test/functional/eval/null_spec.lua
index afe999e1fa..db0a706319 100644
--- a/test/functional/eval/null_spec.lua
+++ b/test/functional/eval/null_spec.lua
@@ -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]',
diff --git a/test/functional/legacy/assert_spec.lua b/test/functional/legacy/assert_spec.lua
index dd7810bf51..d48b8882af 100644
--- a/test/functional/legacy/assert_spec.lua
+++ b/test/functional/legacy/assert_spec.lua
@@ -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')
diff --git a/test/unit/eval/typval_spec.lua b/test/unit/eval/typval_spec.lua
index 06465071c5..7c03005529 100644
--- a/test/unit/eval/typval_spec.lua
+++ b/test/unit/eval/typval_spec.lua
@@ -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))